Download

Custom heightmap to normals for fresnel!?

Hello,

I’m wondering how I can use the ‘NormalFromHeightmap’ function to generate normals to be fed into a fresnel node correctly.
I have my own noise based heightmap function, ie not a texture heightmap, and have duplicated the normal generation functionality and trying to get an accurate fresnel effect on my deformed mesh.
I am trying using my noise heightmap both as WorldPositionOffset and WorldDisplacement.
The normal generating function does generate some kind of normals but they don’t seem to work correctly when using them with the fresnel. I’m not sure if I need to transform the normals somehow and that is the problem or something else.

I’d be grateful for any advice.
Below is part of the shader that generates the normals.

Cheers, Fred

​​​​​​​

Hmm…I found this thread that seem promising…