USW projects

4. Fast tri-planar mapping

While building my landscape material by deconstructing wonderful work from Joe Garth (Brushify), tri-planar mapping got me thinking. Common approach is to use distance blends for global-macro-detail maps for example. But for slope blending this causes a bit of performance hit since you need to do tri-planar mapping. One can look up tri-planar mapping implementation in WorldAlignedTexture node and see that it uses 3 texture samplers. So having 3 blends each using 3 samplers and having all this for normals as well makes things not ideal. This is why I figured brushify auto material uses only top mapping and guards full tri-planar under switch.

There is a way to do tri-planar mapping having only one texture sampler. The only downside is that there are no blends/lerps, so seams are visible. But for slope application this is not really an issue due to usual type of the textures (rock/cliff) which hide seams pretty well. Especially at a distance.

See below 3 screens, I disabled normal mapping and noise to check how bad seams would look.

Fast tri-planar implementation, checker map

Fast tri-planar

True tri-planar, 3 samplers with lerps

As you can see results are pretty good and seams are not really noticeable. Also see the difference in shader complexity. Of course I shouldn’t compare shade of green in editor viewport and just do performance profile for real numbers. But this comparison will do for now. Left part: fast tri-planar mapping is used for global and macro texture blends, regular tri-planar is used for detail blend. Right part: all three blends use regular tri-planar mapping.

Below is the fast tri-planar implementation.

You can see blending in action. Global/macro - fast tri-planar, detail - regular tri-planar.

2 Likes