This article explains the settings and values of the Corona Mapping Randomizer shader in Cinema 4D.


Overview


Textured objects often show obvious repetitions, which instantly gives away that the scene is computer-generated. You can use the Corona Mapping Randomizer shader to quickly randomize textures on multiple objects or object parts, making the image appear more realistic.

The Corona Mapping Randomizer shader allows you to apply random offset, rotation, and scaling to texture maps and shaders assigned to one or multiple objects. It works similar to the Corona Multi Shader. For example, you can randomize a wood texture applied to a set of planks so that each plank has a different look in the final render. You can also apply a blending effect to the randomized texture tiles, which makes them appear even more natural.

To enable the randomization, plug any texture (be it a texture map or a shader) into the Corona Mapping Randomizer shader input slot and then plug its output into any material property. You can then adjust the texture transformations and other options to the desired values. You can use the Corona Mapping Randomizer shader with any material property, including the bump channel, RGB normal maps, and displacement.



Shader Properties


Level – Defines the intensity of the entire shader parameters.

Color – Sets a solid color to use as the source.

Texture – Sets either a texture map or a procedural shader to use as the source.

Mix mode – Defines how the texture map or shader combines with the Color parameter.

Mix value – Defines the percentage of the texture that is mixed with the Color parameter. It works like opacity for the shader's texture.



UVW Randomization


Randomize by – Selects between different randomization modes.

Primitives – Randomizes the texture map or shader by different primitives which are triangles, hair strands, etc.
Sub-primitive – Randomizes by different sub-primitives, which are displacement micro triangles or hair segments.
Material name – Randomizes the texture map or shader by different assigned materials. The materials must have different names.
Objects – Randomizes the texture map or shader per each object. You can even use this mode with Cloner objects.
Material tag index – Randomizes the texture map or shader based on the object's material tag position. Polygon selection tags can be used in combination with this mode for each material tag assigned.
Material ID – Randomizes the texture map or shader based on the Material's ID. The Material ID can be located and set in the Advanced properties for each material.
Object buffer ID – Randomizes the texture map or shader based on the object's buffer ID. The buffer ID can be located and set in the Corona Compositing tag of each object.
Mesh Element – This mode randomizes the texture map or shader by different connected mesh elements, which are groups of polygons connected by edges.
Polygon – Randomizes the texture map or shader by different polygons, which are groups of triangles (e.g. quads).
Decal – Randomizes the texture map or shader by different distinct decal objects. This randomizes only the decal layer, not the object it is projected onto. Note that this tracks decals by their names, so the result changes if a decal is renamed.
Tile ID – Randomized by different tiles if Corona Tile Map is used.
Multiple properties – Allows using different randomization modes at the same time.

The Sub-primitive, Polygon, and Multiple properties randomization modes are available starting with Chaos Corona 8. The Decal randomization mode is available starting with Chaos Corona 9.

Seed – This value makes random permutations of the UVW randomization results.


Offset

U From – Sets the initial position of the shader texture in the U coordinate.

U To – Sets the end position of the shader texture in the U coordinate. The shader can randomly use any value between the U From and U To parameters.

U Step – Determines the offset increment for each texture variation in the U coordinate. It works like the Quantize Move Step tool in Cinema 4D.

V From – Sets the initial position of the shader texture in the V coordinate.

V To – Sets the end position of the shader texture in the V coordinate. The shader can randomly use any value between the V From and V To parameters.

V Step – Determines the offset increment for each texture variation in the V coordinate. It works like the Quantize Move Step tool in Cinema 4D.


Rotation

W From – Sets the initial rotation of the shader texture in the W coordinate.

W To – Sets the end rotation of the shader texture in the W coordinate. The shader can randomly use any value between the W From and W To parameters.

W Step – Determines the offset increment for each texture variation in the W coordinate. It works like the Quantize Rotate Step tool in Cinema 4D.


Scale

U From – Sets the initial scale of the shader texture in the U coordinate.

U To – Sets the end scale of the shader texture in the U coordinate. The shader can randomly use any value between the U From and U To parameters.

U Step –Determines the offset increment for each texture variation in the U coordinate. It works like the Quantize Scale Step tool in Cinema 4D.

V From – Sets the initial scale of the shader texture in the U coordinate.

V To – Sets the end scale of the shader texture in the V coordinate. The shader can randomly use any value between the V From and V To parameters.

V Step – Determines the offset increment for each texture variation in the V coordinate. It works like the Quantize Scale Step tool in Cinema 4D.

V scale same as U – When enabled, the V and U axis use the same values for scale, rotation and offset. If this checkbox is not active, it allows you to set different scale values for each axes.


Tiling


Randomize each tile – When enabled, tiles the texture on each surface it is applied to, and is randomized using the Offset, Rotation, and Scale values.

High quality blending – This option is enabled by default and results in a better quality of the random tile blending, at some performance cost. The specific performance impact depends on the material's complexity. In case of visible rendering slowdown, it is advised to disable this option.

Number of tiles – This parameter sets the number of tiles to be randomized when the Randomize each tile checkbox is enabled.

Blending – This parameter controls how the individual tiles of the randomized texture are blended with each other. Higher values blend the tiles further together and make the texture appear slightly more blurry and uniform. Lower blending values reduce the areas where the tiles are blended together and make the texture sharper.





Example: Randomization Modes


Primitives

Mapping is randomized per each mesh primitive (triangle)


Objects

Mapping is randomized per each instance (object).

Click here to the material setup

Click on the image to view it in full size


Click here to the material setup

Click on the image to view it in full size




Material ID

Mapping is randomized based on the object's material ID. In this example, every tile has a different, randomly assigned material ID. Material ID must be manually assigned for each material in their respective Advanced properties section.


Object buffer ID

Mapping is randomized based on the object's buffer ID. In this example, each cube object has a different buffer ID assigned. Corona Compositing tag is required to define the object's buffer ID.

Click here to the material setup

Click on the image to view it in full size


Click here to the material setup

Click on the image to view it in full size




Mesh Element

Mapping is randomized per each mesh element. In this example, each tile is a separate mesh element (geometry has been split).


Polygon

Mapping is randomized per mesh face. In this example, each tile is a single polygon.

Click here to the material setup

Click on the image to view it in full size


Click here to the material setup

Click on the image to view it in full size





Tile ID

Mapping Randomizer is randomized based on the Tile ID. In this example, each Tile has the same wood texture.





Click here to see the material setup...



Click on the image to view it in full size






Example: Texturing a Simple Stairs Object


Without the Mapping Randomizer shader, the textures are repeated on each of the steps in a very obvious way.


The first step to fixing this is plugging the diffuse texture into the Corona Mapping Randomizer shader and setting its U and V offset values to 0 - 1. This enables the randomization of the texture's maximum offset in both axes by its full width and height.







The remaining issue is that the textures are aligned in the wrong direction, since the Mapping Randomizer shader relies on UVW mapping, as the name implies. To fix that, we can use any preferred method of rotating the textures - for example, using the Rotate tool when the Texture mode is enabled in C4D.




Click here to the material setup

Click on the image to view it in full size




Example: Randomizing a Brick Wall


We can start with a few objects with a brick wall texture without any randomization whatsoever.


In this case, we want to randomize the U and V positions per object, but we also want to have them tiled on every single object in a random way. This can be done with the Mapping Randomizer.





Note that in addition to U and V offset variation, we also enabled the Randomize each tile option and set Number of tiles to 4. This tiles the texture on each surface it is applied to, and the tiling is then randomized using the Offset, Rotation, and Scale values.


The remaining issue here is that while the randomization works well, the bricks are not aligned in straight horizontal rows anymore because of the full V offset randomization.


We can fix that by enabling the Step option. The Step value decides the interval, at which the texture is moved. Leaving it at 0 results in unrestricted, random movement. Setting it to 1 means that we only allow the offset to be 1, 2, 3, and so on, resulting in no visible randomization whatsoever. Setting the value to 0.5 allows offsetting the texture by half its height. In this case, a single segment of our brick wall texture consists of 7 rows of bricks. To calculate the desired Step value, we need to divide 1 by the number of rows or columns. In case of our brick wall 1 / 7 = 0.143, so let's use this value.






As you can see in the image, the bricks are still randomized, but at the same time they are now arranged in horizontal rows, thanks to the 0.143 Step value.


The last thing left to do is to add displacement to the brick material. That is also possible with the Mapping Randomizer shader. Clone the Mapping Randomizer shader, so that the diffuse texture and displacement texture randomization is the same, plug the grayscale displacement map into it, and plug the result into the material's displacement slot.





Example: Using the Mapping Randomizer with the Multi Shader



The Corona Mapping Randomizer can be combined with a Corona Multi Shader to create materials that are random in terms of both their coloring (or texturing) and their UVW mapping. 


In this case, we are using the Mapping Randomizer to randomize the wood texture per floorboard, and every floorboard also has a different color thanks to the Corona Multi Shader, both of which are then mixed together using the Corona Mixture shader.







Example: Using the Mapping Randomizer with Triplanar Mapping


In the previous examples, we used the Corona Mapping Randomizer with some sort of defined UVW mapping. In cases where objects have no UVW mapping channel, or ones that are hard to properly unwrap, such as complex organic forms, an ideal solution is to combine the UVW Randomizer with the Corona Triplanar shader.


Here we can see a duck model covered with a checkerboard texture map using the Corona Mapping Randomizer. Since the Mapping Randomizer relies on UVW mapping, in case of incorrect mapping, we can see artifacts such as texture stretching and seams.


To fix that, we can connect the Corona Mapping Randomizer shader to a Corona Triplanar shader and connect the result to the desired slot, in this case the diffuse color. This lets us take advantage of the superpowers of both the Mapping Randomizer and the Triplanar shaders. Thanks to the Mapping Randomizer, the texture is randomized in terms of Offset, Scaling, and Rotation, and it is using random tiling. Thanks to the Corona Triplanar shader, there is no stretching or seams, and the texture is uniformly distributed over the object's surface.

It is vital that the Corona Mapping Randomizer shader is connected to the Corona Triplanar shader, and not the other way around, as the Triplanar shader overrides all mapping data coming after it!



Click here to the material setup

Click on the image to view it in full-size




Example: Randomizing Procedural Shaders



In all previous examples, we were using texture maps. Corona Mapping Randomizer can, however, randomize procedural shaders as well, allowing for further creativity.

In this example, a procedural noise shader is stretched in one direction and the U / X to Scale Tiling is set to 10. The shader is randomly distributed on the object's surface using the Mapping Randomizer, with the Randomize each tile option enabled. It is then connected to a Triplanar shader. This applies the texture in a similar way as when using regular UVW mapping, which makes it easier to control. However, in this case, we do not have to worry about it that much because we are using the Corona Triplanar shader anyway.





Click here to the material setup

Click on the image to view it in full-size






Example: Blending


The Blending parameter controls how the individual tiles are blended together. Higher values further blend the tiles together and make the texture appear more blurry and uniform. Lower blending values make the texture sharper. Usually, the best value can determined by trial and error.



Blending = 0

Blending = 0.25 (default value)

Blending = 1



Click here to the material setup

Click on the image to view it in full size






Example: High Quality Blending


The High quality blending option is enabled by default and results in a better quality of the random tile blending at some performance cost. The specific performance impact depends on the material's complexity. In case of visible rendering slowdown, it is advised to disable this option.



HQ Blending off
HQ Blending on





Example: W Rotation and Step


The Step value decides the allowed interval for the random texture Offset. The same can be done with Rotation and Scaling. This example visualizes how the W Rotation Step affects texture randomization.



W Rotation Step = 0

Step 0 - no interval, full, unrestricted rotation randomization allowed

W Rotation Step = 45

Step 45 - rotation randomization is restricted to 0, 45, 90, 135, 180, 225, 270, 315, 360 degrees resulting in the pattern following only horizontal, vertical, or diagonal directions

W Rotation Step = 90

Step 90 - rotation randomization is restricted to 0, 90, 180, 270, 360 degrees resulting in the pattern following only vertical and horizontal directions



Click here to see where to find the Step options

Click on the image to view it in full size