WorldNormal ignores World Position Offset

The SceneTexture: WorldNormal pass in a post processing material does not render the real normals. It basically ignores everything changed by World Position Offset, as if nothing had a offset applied. So where World Offset Position offset is used in a material the normal in SceneTexture: WorldNormal is wrong.

Hi Davision -

WPO actually only affects vertex placement in world space and is not meant to effect the vertex normal at all. This is why you can only really stretch meshes so far in WPO before you will get some rendering errors. YOu can do a little bit of math using Absolute World Position Coordinate and derive the Normal which can then be added to any existing normal maps.

Here is the Basic Material Setup:

Here is a sample Project with the Working Material in Place:
[Test_Project][2]

Thank You

Eric Ketchum

Thanks, I will try that then.

It didn’t work out, my material without it:

With the changed normal:

I recreated it like in the screenshot and also tried some variations since I was wondering why the blue channel of the normal map isn’t used?
I don’t know much about DDX and DDY and the documentation doesn’t say much either. But it made me curious and I created a new question on it here: DDX and DDY material nodes? - Rendering - Unreal Engine Forums

HI Davision -

The small area on the lower right of your second image looks correct to me based on the normals and Offset I see in the first image. The large sphere area does not look correct though, can you share the WPO setup you are using? and can you show a wireframe of the mesh you are offsetting without WPO applied?

DanielW answered your DDX/DDY question but just to expand a little, DDX and DDY functions in HLSL calculate the derivative of the pixels in the quad that is to say take the differences between the pixels in a quad. So DDX will subtract the values in the pixel on the left side of the quad from the values on the right side and DDY does the same Bottom from Top. The differences can then be returned as the derivative to all four pixels in the quad.

Thank You

Eric Ketchum

I can ensure you there is nothing right. It all gets very dark as if the normals are rotated towards the bottom and you can see the mesh faces as if the smoothing groups are hard.

The setup is the same as in you screenshot, I just don’t use a lerp for the offset amount. The mesh is just the Sphere found in Basic.

Hi Davision -

I apologize I believe I may have sidetracked your issue, so I want to return to your original post for a moment. Can you let me see a screenshot of your WPO objects with the Post Process Scene Texture:WorldNormal applied?

Thank You -

Eric Ketchum

I have giving up on any WPO for my terrain now. There are also other issues with WPO when using terrain. Also, terrain shader compiling takes often 15 minutes for me which makes it very tedious to iterate and test.

I had just recreated what you showed me in the screenshot. There was no use of Scene Texture:WorldNormal.

Hi Davision -

I understand, if you wish to revisit this issue feel free to comment and we can continue investigating.

Thank You -

Eric Ketchum

Did you normalize the cross product? It is worked well for me, however it gets a bit messy with pixel depth offset but, perhaps, it can be solved by averaging
/blurring multiple normals nearby.