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...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help