Changing world position offset normals

I’m using world position offset in my shader to offset a flat plane. My problem is that I can’t seem to update my normals to point in the direction of my offset faces, all my normals stay the same. Is there a way to solve this in my shader? I just want the face normals and I’m not using any normal maps at the moment.

Thanks for the reply, but I’m not using any textures

Assuming you’re using a texture, the NormalFromHeightmap function should do what you need.

If not, you’ll have to do it manually by recalculating the offset at an adjacent location on the x axis, then subtracting the original offset from that to get the x derivative, then do the same for the y axis, append those, and then use DeriveNormalZ.

The NormalFromHeightmap function does something similar, so you could also take a look inside that and recreate it with whatever method you’re using instead of the texture lookups.

A friendly post over at polycount solved this issue for me. Here is the answer:


You could try this, it worked for me.