Calculating the normal of a sine wave

I’m trying to do something that has been done plenty of times before, but I’m struggling to find examples of what to do.

I have a couple of sine waves that I’m using to generate displacement on some water. I need to calculate the normal of each pixel. Is this possible?

Also, I’m getting this error when the two selected nodes are added. If I break the link the error goes away. Is this some interaction between normals and displacement maps?

Maybe this’ll shed some light?

http://www.gamedev.net/topic/551569-finding-the-normal-of-a-point-on-a-sine-wave/

Don’t you need to make a vector to plug into the normal slot? its complaining about the conversion.

I’ve figured this out. It’s because I’m using a transparent material. Switch to opaque and it’s fine.

I’m basically trying to create water, but with transparency. Right now it seems impossible.

Check out this thread: Ocean shader normal issues! - Rendering - Epic Developer Community Forums

You can get the normals by calculating the derivatives of your sine function.
If you have issues figuring these out post a screenshot of your material showing the displacement part and there’s probably somebody willing to help.