Download

Terrain puddles normal direction.

Hey, I’ve been trying to create water puddles on a terrain and it works ok, however I can’t seem to figure out a way to force the puddle normals to always point upwards even if there is a slope in the terrain. Is there a way this can be done?

This sort of shows what I’m talking about, the thick black blotches are the “puddles” int his case.
bf92b16411936bfa40f9ab4b27e2fd32c598b6b6.jpeg

I’ve tried transforming the normals to world space and masking the puddles so that the normal points straight up. But even when doing this they still get normal information from the terrain mesh.

I am already masking the puddles based on the slope of the terrain so they won’t show up on slopes, however getting a good mask is very delicate and you still get some large-scale normal information transferred to the puddle surface, and that’s why I’d like to force it to point up.

Most likely your problem is because the material is set to “Tangent Space Normal” = True. If that is the case, the shader adds a final World->Tangent transform at the end.

Multiple ways of counteracting this. The easiest, is to use a value for “up” that has been transformed from Tangent->World. That way when it undergoes the World->Tangent transform it ends up as a worldspace 0,0,1 again.

Or you could uncheck the “Tangent Space Normal” option and use 0,0,1 as the upvector and do a Tangent->World transform on every other part of your normal map setup.