In addition to the below content, see also: Corona Multi Shader at Chaos Docs
The Corona Multi shader can be used to create a single material, which will show randomized textures (or solid colors), on each object (formally known as Instance), face, material ID, or based on other modes. The random items are distributed among all the objects using this map. The colors or textures can be blended together using the “Mix amount” parameter.
1. Distribution Modes
Following distribution modes are available:
- Primitives - each of the items will be distributed on each mesh primitive (triangle):
- Material name - the items will be applied to different materials the Multi shader is assigned to:
- Object - each of the items will be distributed on each of the instances (objects):
- Material tag index - each of the items will be distributed based on the object’s material ID. In this case, the central logo uses a material with a different material ID than the rest.
- Material ID - each of the items will be distributed based on the material’s Buffer ID. This can be set via the advanced tab in each material.
- Object Buffer ID - each of the items will be distributed based on the object’s Buffer ID. In this case, the three logos in the middle are using different Buffer IDs than the rest.
- Mesh Element - items will be distributed randomly on all mesh elements (in case the mesh consists of multiple elements).
- Polygon - items will be distributed randomly on all mesh faces:
(only available in Corona 8 and newer) - Decal - items will be distributed randomly per decal object.
(Only available in Corona 8 and newer)
2. How to use it?
The Corona Multi shader can be used in any material slot (diffuse, reflection level, bump, ...). Any type of map, or a solid color, can be used as an item in the Corona Multi shader.
Example usages of the Multi shader include:
Color variation of tree leaves
Corona Multi shader was used to produce a subtle variation of green between each tree:
Identical colors can be used as both items in the Multi shader. The variation is achieved by increasing the random hue and gamma values:
More distinct variation between the colors can be used to achieve an "autumn" look:
Material setup:
Additionally, the frequency of each color version can be controlled using the "Frequency" value:
Result of the above material setup. The red trees are much more frequent than other variants:
A single texture for the leaves with an increased value in the "Hue Random" settings will distribute a slightly different color across each tree:
Result of the above material setup:
A "Winter" version of the scene can also be achieved by randomizing the opacity of tree leaves. This way, some of the trees will appear leaf-less:
Material setup:
Texture variation of pebbles
Material setup:
Different textures on floor tiles
Material setup - "Batch load textures..." option can be used to quickly load multiple textures as the Multi shader items:
Polygon distribution mode in Corona Multi shader can be used to create variations of texture or color in each polygon of any 3D model:
(only available in Corona 8 and newer)
Material setup:
Using Corona Multi shader with Corona Decal to randomize textures per Decal object
We can apply a single material to multiple Corona Decal objects and easily randomize the decal textures using the Multi shader's "Decal" randomization mode:
Material setup:
Note that the Corona Multi shader can be as well used with one item only.
You can then use hue and gamma values to randomize the colors.
Material setup: