This page provides a quick starting point for the proper use of UVW mapping and VRayEnmesh modifiers when having randomization textures.
Overview
The layout of VRayEnmesh depends entirely on the mapping of the geometry. Stretched UV coordinates of the base geometry on which the VRayEnmeshMod modifier is applied can cause unwanted artifacts and repetitions when heaving randomization textures like VRayUVWRandomizer and VRayMultiSubTex.
In this guide, we explore the proper workflow for using VRayEnmeshMod in conjunction with randomization textures and UVW Map or UnwrapUVW modifiers.
To download scene files: Download Scene Files
Want to follow along but don’t have a license?: Download Free Trial
Base geometry with an exact size
Base geometry with an exact size, multiple of the Mesh object size
In this example, the base geometry is a rectangular prism without any mapping applied after the modeling process (shown in gray material). The size of the prism is L=100 cm, W=50 cm, H=30 cm and the size of the Mesh object crop box is X=10 cm, Y=10 cm, and Z=3 cm.
The Use mesh UVW mapping option is used as the Tile Mesh object has proper mapping.
After applying a VRayEnmeshMod, adding the Tile as Mesh object, and applying the Tile material to the base object, the result is a stretched pattern similar to the underlying mapping due to the UVs being stretched.
Stretched VRayEnmesh tiles and textures
After applying a UVW Map modifier in Box mapping mode and using the Fit button, the size is L=50 cm, W=100 cm, H=30 cm; and after equalizing the mapping dimensions to L=100 cm, W=100 cm, H=100 cm, the Mesh object will appear correctly. The VRayEnmeshMod surface parameters are Tiling U = 10 and Tiling V = 10, which means there are exactly 10 tiles on the longest side of the base mesh as the Mesh object has a crop box size of X=10, Y=10 and Z=3 cm. Also, we need to snap the UVW Map modifier Gizmo to the front edge of the base geometry, so the tiles appear whole and not sliced on the base geometry edges.
When moving the UVW Map modifier gizmo, the UVW Randomizer and the VRayMultisubTex coverage may need to be adjusted and offset back. To make the whole object covered, we should use the Offset U and Offset V parameters in the VRayEnmeshMod. In this particular case Offset U = 1 and Offset V = 1 will fix the UVWRandomizer and VRayMultisubTex displacement.
The textures in the UVW Randomizer and VRayMultiSubTex examples are set as shown in the following screenshots:
Base geometry with arbitrary size
In the first image, the base geometry is a rectangular prism without any mapping applied after the modeling process (shown in gray material). The size of the prism is L=56.24 cm, W=83.54 cm, H=10.1 cm.
Also, we use a slightly inward offset prism for the grout (shown in white material).
For the mesh object in the VRayEnmeshMod, we use a simple single tile with a crop box size of X=3.2, Y=3.2, Z=0.45.
The Use mesh UVW mapping option is used as the Tile Mesh object has proper mapping.
After applying a VRayEnmeshMod, adding the Tile as Mesh object, and applying the Tile material to the base object, the result is a stretched pattern similar to the underlying mapping.
Stretched VRayEnmesh tiles and textures
To fix the stretching, add a UVW Map modifier and set the mapping parameters correctly:
1. Select the UVW Mapping modifier and click Fit. This changes the Length value by using the largest dimension of the geometry for which we apply the enmesh.
2. Copy either the Length or the Width value, depending on which is bigger.
3. Paste the Length value into the Width and Height fields, or paste the Width value into the Length and Height fields, depending on what action you have taken in step 2. This approach helps to avoid stretching the UVs of the applied texture.
4. Go to the VRayEnmeshMod and adjust the Tiling U and Tiling V values in order to refine the needed scaling.
If the tiles need to be aligned with the edges of the base geometry, select the UVW Map modifier Gizmo and snap it to the desired edge:
Here is how the UV mapping alignment and the scattered Tile with different Tiling U and Tiling V values look:
Let’s explore different randomization options for the Tile texture.
For rotation and scale, we can use а VRayUVWRandomizer plugged into the Diffuse channel, and if available, into other channels like Reflection, Glossiness, Bump, etc. The Randomize mode should be By instance ID.
Also if we want to randomize the Hue, Saturation, and Gamma of the Diffuse texture, we can use a VRayMultiSubTex with its Get ID From option set to Random and By instance ID Randomize mode enabled. Both textures can be used simultaneously to randomize the rotation and color of the material textures.
Keep in mind that once we moved the UVW Map modifier gizmo, the UVWRandomizer and the VRayMultisubTex randomization did not cover the whole object. To fix this, set the Offset V parameter in the VRayEnmeshMod to 8 to offset the coverage back onto the object.
Base geometry with exact size, using complex Mesh object with multiple Material IDs
Base geometry with exact size, multiple of the Mesh object size, using complex Mesh object with multiple Material IDs
In this example, we use the same base geometry as in the previous one, but for the Mesh object we use a tile patch composed of nine sub-tiles with different IDs (from 1 to 9) and a Crop box size of X=10, Y=10 and Z=3 cm, as shown in the image.
The tiling of the Enmesh surface is Tiling U = 20 and Tiling V = 20. For the material of the Base geometry, we use a simple V-Ray material with VRayColor for the diffuse, combined with a VRayMultiSubTex for the color randomizations /Hue =5, Saturation=3, Gamma=8/, so we explore the different options in the VRayMultiSubTex.
Organic base geometry, using complex Mesh object with multiple Material IDs
When using VRayEnmeshMod on organic models, the UVW Map modifier does not produce correct mapping. Curved surfaces need unwrapping and straightened UVs for correct Mesh object and texture projection.
In the following examples, we explore how different mapping options affect the VRayEnmesh and the textures connected to its material. The scene consists of a curved Cloth object over a sphere as Base geometry and a cloth pattern with four IDs - from 1 to 4 for every row of the mesh.
As we can see, with the default mapping options there is always some kind of distortion due to the complexity of the curved geometry of the cloth. For such objects, the only way to distribute undistorted VRayEnmesh and textures is to unwrap the mesh and straighten it as much as possible. The result of the unwrapped cloth geometry UV space and the rendered VRayEnmesh are seen in the rendered image.
VRayEnmesh, Unwrapped