Skip to main content
gamedev.net
🔒 Locked

Water normal maps

Started by MGB 1 reply 1.4k views
Original Post
MGB
MGB
Hi all, I'm trying to do ye olde water via (GLSL) shaders, and having 'fun' with the normal map. From the examples I've looked at, a normal is read from the normal map texture and then some funny things are done to it, like:

  surfNorm = surfNorm * 2.0 - 1;
I think this is transforming the range of the normal (i.e. from 0..1 to -1..1)? Thing is, applying fresnel to this and visualising gives totally wrong results: (red is 'refracted', blue is 'reflected') I suspect the normals are the problem, because using an up-vector normal + fresnel gives a correct image: Umm, so any ideas on how I should manipulate the water normal map?
jamesw
jamesw
Make sure your up vector in whatever space you are doing the calculations (tangent or world most likely) matches the up vector in the normal map. So for example if z is up you should see mostly blue in the normal map.
MGB
MGB
...and funnily enough, my normal map is mostly... blue!
Doh, that'll be it then - I'll swap the g & b - cheers jamesw.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.