World Position Offset Recalculate Normal

When using World Position Offset to displace the vertices, what is the best way to calculate new Normals in the vertex shader?

it highly depends on how you make the WPO calculations in the first place. if it’s pure math, if it comes from a texture, etc

Thanks for getting back to me . I should of been a little more specific. The displacement would be WITHOUT texture sampling. I’ve generated a new normal map before by sampling a rendertarget heightmap before, but I was wondering if its even possible in the Material Editor to calculate a new vertex normal for a Vert that has been displaced by a simple sinewave pattern ( plus an intensity scalar )

You cannot modify tangent space directly at vertex shader but you can either redo all math at pixel shader and apply that to tangent/world space normal. You can also interpolate new tangent space to pixel shader. There are some materials for wpo and normal calculations in Content Example package. Maybe you should check that first.

Hey Kalle_H, can you point me to where the Normal Calculations are in the Content Examples?

In PivotPainter level.

You ever figure this out? I have a shader that modifies vertex position and need to update vert normals. Does simply plugging in the new vert normals into custom UV4 and UV5 solve this? (looking at this post: Pivot Painter - Understanding Values corretly - Content Creation - Unreal Engine Forums) Not sure how those new UVs ultimately get passed back and applied to normal/lighting calculations for smoothing & lighting.

Hi, I’m not sure about pixel versus vertex shaders, but this worked for me.
It’s that color because the -1 to 1 range is normalized.

I found this interesting video about that issue : Calculating Normals in the Shader - YouTube

1 Like