Does the performance cost of Triplanar/Stochastic really matter anymore?

In the context of triplanar shaders, it’s said that it’s more expensive than a regular shader because it has to sample three times instead of one. It keeps getting worse as you add normals which doubles the count. Then say you want a triplanar stochastic shader, which increases the sampling exponentially more…

In these modern times though does that really matter for PC games, is the performance cost noticeable with a reasonable amount of game objects rendering at once? And does this cost scale proportionally with the number of objects that have the material, or how much of your screen is rendering it?

It can still matter, especially on integrated graphics. Memory access is still the most expensive calls in a shader. The hardware has ways to hide the cost but it’s still there.

I’ve once had to optimize a triplanar terrain shader. It was sampling multiple sets of textures (albedo, normal, specular, …) for different splatmap layers with different uv coordinates for near and far. It ended up doing over hundred texture samples.

If you don’t go that crazy it might be ok, but there is only one way to tell for sure: profile it!

1 Like

It scales with the number of pixels that run that shader. Keep in mind that there is some overdraw if you don’t have a depth-prepass.

1 Like