Floralin
DocsColours and the shader

Colours and the shader

Every plant carries its colours as references into a palette of up to 24 named colours: leaf, bark, petal, and so on. Change a colour and the plant follows, highlights and shadows included.

Which way to recolour

A whole species
Edit the species' material: every prefab and live plant of it follows.
A ready look
Pick one of the species' named palettes.
One plant
Set a live plant's Palette to Custom and edit its colours by name.

A species' material

Each species has its own material in Materials/<Category>/, whose inspector lists the palette by name. Edit a colour there and every model of the species follows, at every LOD. A pack update brings the material back to the pack's colours: to keep yours, use a copy of the material or a Custom palette.

Palettes

A named palette (autumn, white, dried…) is another material of the species. The pack includes a prefab of each, <Model>_<Palette>, which only swaps the material, so it adds no meshes. On a live plant, pick it from the Palette field; in the Plant Browser, click a picture to see the form's palettes.

Your own colours

Set a live plant's Palette to Custom: the inspector lists the species' colours by name, starting from the palette you left. Plants with the same custom colours share one material. Bake to prefab keeps the colours in a material asset of the baked plant's own.

The shader

Floralin/VertexColor works in URP and the Built-in pipeline and is plain HLSL you can read or edit. It is lit by the main light and ambient light and casts shadows. Its settings:

  • Use palette colours: off shows the colours baked into the meshes instead.
  • Tint, Receive shadows.
  • Light wrap softens the falloff past the light; Translucency lets sun through faces turned away from it, for thin leaves and petals.

The meshes are flat-shaded with their colours in the vertices: no textures, no UV seams. Any shader that reads vertex colours shows the colours baked into the meshes.

Lightmaps

The palette references live in the meshes' first UV channel. If you bake lightmaps, enable Generate Lightmap UVs on the models first.

The demo scenes' shaders

The runtime also holds Floralin/Sky, a gradient sky, and Floralin/Water, both used by the demo scenes and free to use in yours. The water needs the camera depth texture: in URP keep the renderer's Depth Texture Mode at After Opaques, its default.