Corona Uvw Randomizer Map
Textured objects often show obvious repetitions, which instantly give away that the scene is computer-generated.
You can use the UVW Randomizer to quickly randomize textures on multiple objects or object parts, making the image appear more natural.
The CoronaUvwRandomizer map allows you to apply random offset / rotation / scale to textures and procedural maps assigned to different objects or even to a single object. The way it works is similar to CoronaMultiMap. For example, you can randomize a wood texture applied to a set of planks so that each has a different look in your final render.
Starting with Corona Renderer 6, the Uvw Randomizer map can also generate the effect of randomized tiling, which prevents the artificial texture repetitions often found in computer-generated images, which is an easy way to make Corona renders even more realistic.
Note: the effect of the UVW Randomizer map will not be visible in the material's viewport preview.
How to use it?
To enable UVW randomization, simply plug any texture (be it a bitmap or a procedural map) into the CoronaUvwRandomizer's input slot and then plug its output into any material property. Then adjust the transformations and other options to the desired values (see below for more information).
You can use the UVW Randomizer with any material property, including grayscale bump maps, RGB normal maps, and displacement.
CoronaUvwRandomizer has several modes of operation:
- Primitive - UVW mapping will be randomized per each mesh primitive (triangle):
- Material - different UVW mapping will be applied to different materials where the Uvw Randomizer map is assigned:
Note: in this example, different materials are applied to different cube objects:
- Instance - UVW mapping will be randomized per each instance (object):
- Material ID - UVW mapping will be randomized based on the object's material ID:
Note: in this example, every floorboard has a different, randomly assigned, material ID:
- Material GBuffer ID - UVW mapping will be randomized based on the material's GBuffer ID:
Note: in this example, each cube has a different material assigned, and each of those materials has a different Material GBuffer ID assigned (see the material setup screenshot below):
- Object GBuffer ID - UVW mapping will be randomized based on the object's GBuffer ID:
Note: in this example, each cube object has a different GBuffer ID assigned (select object > right-click > object properties > GBuffer ID):
- Mesh Element - UVW mapping will be randomized per each mesh element:
Note: in this example, each floorboard is a separate mesh element:
Further examples and parameters
1. Texturing a simple stairs object.
Without the Uvw Randomizer map, the textures are repeated on each of the steps in a very obvious way:
We can easily fix that: the first step is plugging the diffuse texture into the Corona Uvw Randomizer map and setting U and V offset values to 0 - 1. This will enable randomizing 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 Uvw Randomizer map relies on UVW mapping (as the name implies), to fix that, we can use any preferred method of rotating the textures - for example, the UVW Xform modifier or changing the rotation directly in the Bitmap texture's properties. In this case, a UVW Xform modifier was applied to rotate the texture by 90 degrees:
The end result with the same wood texture randomized in U and V offset applied to each step.
2. Randomizing a brick wall
We will start with a few objects with brick wall texture with no 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 easily done with the Uvw 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 will tile the texture on each surface it is applied to, and the tiling will be randomized using the offset, rotation, and scale values.
The remaining issue here is that while the randomization works excellent, 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 next to the V Offset. The "Step" value decides about 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 will allow offsetting the texture by half its height, and so on. In this case, a single segment of our brick wall texture consists of 7 rows of bricks. To calculate the desired "Step" value, you 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:
You can see in the above image that the bricks are still randomized, but they are always arranged in horizontal rows thanks to the 0.143 "Step" value.
The last thing to do in our brick material would be adding displacement to it since that is also possible with the Uvw Randomizer map. Simply clone the Uvw Randomizer map, 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:
3. Using the UVW Randomizer with the Multimap
Corona Uvw Randomizer can be combined with Corona Multimap to create materials that are random in terms of coloring (or texturing) and UVW mapping.
In this case, the UVW Randomizer is used to randomize the wood texture per floorboard, and every floorboard also has a different color thanks to the Corona Multimap mixed using the Corona Mix node:
4. Using the UVW Randomizer with Triplanar mapping
In the previous examples, we always used the Corona Uvw Randomizer with some sort of defined UVW mapping (e.g. the object was created with its own mapping, or we used the UVW Map modifier or similar). In case of objects with no UVW mapping, or ones which are hard to properly unwrap (such as complex organic forms), an ideal solution is to combine the UVW Randomizer with the Corona Triplanar map.
Here we can see a sculpture painted with a checker patterned bitmap using Corona Uvw Randomizer. Since the UVW Randomizer relies on UVW mapping, in case of incorrect UVW mapping (like in this case), we can see artifacts such as texture stretching and seams:
To fix that, we can connect the Corona Uvw Randomizer map to a Corona Triplanar map (no the other way around!) and connect the result to the desired slot (in this case diffuse color):
This allows us to take advantage of the superpowers of both the UVW Randomizer and the Triplanar map. Thanks to the UVW Randomizer, the texture is randomized in terms of offset, scaling, and rotation, and it is using random tiling. Thanks to the Corona Triplanar map, there is no stretching or seams, and the texture is uniformly distributed over the object's surface.
5. Randomizing procedural textures
In all previous examples, we were using bitmap textures. Corona Uvw Randomizer can, however, randomize procedural textures as well, allowing for further creativity:
In the above example, a procedural noise map is stretched in one direction ("U Tiling" set to 0) and then randomly distributed on the object's surface using the UVW Randomizer and Triplanar map. Note that to get more predictable results, it is best to set the procedural map's mapping ("Source") to "Explicit Map Channel". This will apply 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 map anyway).
6. Corona Uvw Randomizer and Real-World Scale
The UVW Randomizer can be used with the Real-World Scale option without any problems. Simply plug a texture using the Real-World Scale option into it, and also make sure that the object has the Real-World Scale checkbox enabled in its settings or in the UVW mapping modifier applied to it, just as you would normally do without the UVW randomization:
Randomized texture, Real-World Scale set to 1 cm:
Randomized texture, Real-World Scale set to 5 cm:
Randomized texture, Real-World Scale set to 10 cm:
The Blending parameter found in the Corona Uvw Randomizer controls how the individual tiles of the randomized texture are blended with each other. Higher blending will further blend the tiles together and will make the texture appear slightly more blurry and uniform. Lower blending will reduce the areas where the tiles are blended together and will make the texture sharper. Usually, the best value has to be determined by trial and error.
Blending 0.25 (default value):
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:
High quality blending on:
High quality blending off:
8. W Rotation and Step value
As we learned before, the "Step" value can be used to decide about 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:
Step 0 - no interval, full, unrestricted rotation randomization allowed:
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:
Step 90 - rotation randomization is restricted to 0, 90, 180, 270, 360 degrees resulting in the pattern following only vertical and horizontal directions: