UE4 – Triplanar projection mapping setup

Software:
Unreal Engine 4.25

Triplanar Projection Mapping can be an effective texture mapping solution for cases where the model doesn’t have naturally flowing continuous UV coordinates, or there is a need to have the texture projected independently of UV channels, with minimally visible stretching and other mapping artifacts.
Classic use cases for Triplanar Projection Mapping are terrains and organic materials. provided that the image being used is a seamless texture, no seams will be visible because this projection type isn’t affected by UV coordinates.
Triplanar Projection Mapping can also be used in world space to create a continuous texture between separate meshes, allowing the meshes to be indestructibly transformed and edited.

How does Triplanar Projection Mapping work?
Triplanar Projection Mapping is a linear blend between 3 orthogonal 2D planar texture projections, typically each aligned to a natural world or object axis.
The more the surface faces an axis, the higher the weight of this axis projection in the final blend.

UE4 local (object) space Triplanar Projection Mapping material setup:
* It’s usually more efficient to create this setup as a Material Function

  1. Local shading coordinates are multiplied by by a “density” parameter to allow convenient scaling of the projected.
  2. The scaled coordinates vector is separated to its components who are combined to 3 pairs of planar coordinates XY, XZ and YZ, and fed as the sample coordinates to the 3 Texture Sample nodes.
  3. The Vertex Normal input vector is transformed to local space, converted to absolute value (absolute orientation in the positive axes octant) and separated to its X, Y and Z components so they can serve as blend weights in the mix.
  4. Each of the 3 planar axis projections is multiplied by the blend factors, and the resulting values are added to the raw mix.
  5. A value of 1.0 is divided by the Normal vector component values to obtain the factor needed to normalize the blend result to a value of 1.0.
  6. The raw blend value is multiplied by the normalizing factor so the blend resulting color will be normalized.
    * The blend weights should add to a value of 1.0, but a unit vector’s values add up to more than 1 in diagonal directions. for this reason, without this final step, the color of the texture in point on the surface that are diagonal to the projection axes will appear brighter than in points on the surface that face a projection axis.

An example of Triplanar Projection Mapping in world space:

A bunch of Blender monkeys (Suzanne) continuously textured using world space Triplanar Projection Mapping:

Related posts:
UE4 – Material Functions
UE4 – Material Instances
UE4 – Bump mapping
UE4 – Procedural bump mapping

Maya – Using Multiple UV Sets

Software:
Maya 2018

Annotation 2019-12-26 232222

Note:
This post isn’t about “tiled UVs” (“UDIM”), it’s about multiple UV sets (layouts).

Explanation:
Polygon mesh models can have multiple UV sets. this becomes useful when the UV layout that is optimal for a certain texture isn’t efficient for different texture (in the same material).
For example, we might have a model of furniture, or clothing, in which the UV layout that is best for the fabric weave pattern, isn’t the best for dirt and wear & tear, or stickers.
In such cases we can define different UV sets for the model, each suitable for a different texture.

In this example, having a separate UV Set for the logo texture allows placing it without affecting the checker texture that is displayed an all the surfaces:uvsets

To create multiple UV sets:

  1. In the UV editor view, from the UV Sets menu, select UV Set Editor to open the UV Set Editor:
    Annotation 2019-12-26 234412.jpg
  2. In the UV Set Editor, press the New button to create a new UV Set and double click it in the list to rename it:
    Annotation 2019-12-26 234522
  3. Close the UV Sets Editor.
    The UV Editor view  now displays the new UV Set that is empty, and UV creation and editing operations will now affect the new UV Set.
  4. To switch to edit a different UV Set, select it from the list at the bottom of the UV Sets menu:
    Annotation 2019-12-26 235925

 

To link a texture to a specific UV Set:

  1. Make sure the texture is connected to the material set for the model.
  2. Select the model.
  3. Open Windows > Relationship Editors > UV Linking > Texture-Centric:
    Annotation 2019-12-27 000308.jpg
  4. Select the wanted texture from the material texture list on the left and select the wanted UV Set from the models UV Sets list on the right:
    Annotation 2019-12-27 000336

 

Related:
Basic UV Unwrapping

More posts about Maya