A Small Change to Significantly Improve Triplanar Mapping
cprimozic.net·69w
Preview
Report Post

2024-09-01

Triplanar Mapping is a method I make use of all the time in my 3D projects. Over time, I’ve experimented with tweaks and alterations to it with the goal of making it look better, run more performantly, and be useful in more situations.

The main change I present here is switching from using a linear mix of texture weights from each axis to a non-linear mix.

To explain what I mean by this, I’ll just show some code.

Here’s a basic triplanar mapping implementation:

vec4 triplanarTexture(sampler2D map, vec3 pos, vec3 normal) {
vec3 weights = abs(normal);
weights /= (weights.x + weights.y + weights.z);

vec4 outColor = vec4(0.);
outColor += texture2D(map, pos.yz) * weights.x;
outColor += texture2D(map, pos.zx) * weights.y;
outColor += texture2D(map, pos.xy) * weights...

Similar Posts

Loading similar posts...