Hi People,

I've recently being getting into writing more complex shaders and have been getting to grips with the maths. However I have followed as many tutorials and read as many articles as I can find on calculating normals, but my results just don't seem to be correct and I'm struggling to understand why. (I'll link the articles below for anyone interested)

I am following this tutorial for an ocean shader, it is for Unity, but is easy enough to translate to UE4. I got stuck at the normals part, here is what I have so far:

But the result looks as follows:

I decided to boil it down and just try to get the normals of a simple static sine wave working. As far as I understand, calculating the normals should look something like this:

Sine wave = (x,y,(sinx))

Tangent = (1,0,(cosx)) = (T.x,T.y,T.z)

Normal = (-T.z,T.y,T.x) = Cross(Tangent, (0,1,0))

However the result of that looks like this:

I'm not sure if I'm missing something here but any help would be really appreciated! And if anyone could post a screenshot of a graph that'd be great, as all this maths is starting to hurt my brain now!

https://stackoverflow.com/questions/...urve-sine-wave

https://www.gamedev.net/forums/topic...n-a-sine-wave/

https://www.khanacademy.org/math/mul...ector-to-curve

I've recently being getting into writing more complex shaders and have been getting to grips with the maths. However I have followed as many tutorials and read as many articles as I can find on calculating normals, but my results just don't seem to be correct and I'm struggling to understand why. (I'll link the articles below for anyone interested)

I am following this tutorial for an ocean shader, it is for Unity, but is easy enough to translate to UE4. I got stuck at the normals part, here is what I have so far:

But the result looks as follows:

I decided to boil it down and just try to get the normals of a simple static sine wave working. As far as I understand, calculating the normals should look something like this:

Sine wave = (x,y,(sinx))

Tangent = (1,0,(cosx)) = (T.x,T.y,T.z)

Normal = (-T.z,T.y,T.x) = Cross(Tangent, (0,1,0))

However the result of that looks like this:

I'm not sure if I'm missing something here but any help would be really appreciated! And if anyone could post a screenshot of a graph that'd be great, as all this maths is starting to hurt my brain now!

https://stackoverflow.com/questions/...urve-sine-wave

https://www.gamedev.net/forums/topic...n-a-sine-wave/

https://www.khanacademy.org/math/mul...ector-to-curve

## Comment