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

3ds max – Model a terrain from an Autocad topographical plan file

Software:
3ds max 2019

To model a terrain form an DWG (Autocad) file containing a topographical plan:

  1. Import the DWG file to into the 3ds max scene, and move the plan to the center of the 3ds max scene if necessary.
  2. Select the VIZBlock object and extract its linked geometry:
    Annotation 2019-12-12 181552.jpg
  3. Right click the Linked Geometry object and select:
    Convert To: Editable Spline
    Annotation-2019-12-12-181552b.jpg
  4. Enter Spline editing mode, select all the splines that are not part of the topography, and delete, or detach them so only the terrain ‘height lines’ will remain.
    Annotation 2019-12-12 182223.jpg
    Annotation 2019-12-12 182255.jpg
  5. With the topographical plan editable spline selected,
    Choose Create > Compound Objects > Terrain
    Annotation 2019-12-12 182640.jpg
  6. A Terrain object is now created:
    Annotation 2019-12-12 182716.jpg

To retopologize the terrain mesh to more usable quad polygon mesh:

  1. Create a new Plane primitive above the terrain mesh, slightly smaller at the sides, that has the wanted polygon resolution:
    Annotation 2019-12-12 183519.jpg
  2. From the Top view (important), with the new plane selected, choose:
    Create > Compound Objects > Conform:
    Annotation 2019-12-12 183607.jpg
  3. Set the creation method to ‘Move“, click Pick Wrap-To Object and than click the terrain mesh.
    It will now take some time for the new conformed mesh to be calculated..
    When the new object is ready, right click the viewport to exit the object picking mode.
    Annotation 2019-12-12 184044.jpg
  4. The Conform object is no ready, and contains both the terrain mesh and the new conformed quad polygon mesh:
    Right click it and choose:Convert To: Editable PolyAnnotation 2019-12-12 184552.jpg
  5. In Element editing mode, select the terrain mesh part and delete it to remain only with the new quad polygon mesh:
    Annotation 2019-12-12 184621.jpg
  6. Fix non conformed mesh parts by either moving or deleting them:
    Annotation 2019-12-12 184655Annotation 2019-12-12 184719
  7. The new retopologized terrain is ready:
    Annotation 2019-12-12 184752.jpg

 

The example demonstrated here is a DWG file by Jose Vega, free to download from Bibliocad.com