How can I get screen space normals in a material?

Hi, I’m pretty new to Unreal, so please forgive me if this is a dumb question. How can I get screen space normals in a material? I’ve found a way to get world space normals, but not screen space. View space normals would be ok, too, if that works in Unreal. Pixel or vertex normals are fine- both would be even better.

Thank you!

If you want vertex normals in screen space, place down “Vertex Normal” node and then a transform node (not transform position, just transform) with the source set to WorldSpace and the destination set to ViewSpace. Then go to the material properties and uncheck “Tangent Space Normal”. You may need to flip the normals by multiplying by -1 depending on what you are trying to do.

For pixel normal just replace “VertexNormalWS” with “PixelNormalWS”.

Awesome! Thank you! This is exactly what I needed. I actually ended up using a method I found here:

The first seven nodes on the left end up giving me a screen space normal, minus the blue channel. Your way is so much simpler, so I’m switching it out.

post a result screen shot of what you’re doing :slight_smile:

Hello. I am trying to convert camera space normals into UV for rendering matcap material. Workflow is following:

  1. Getting pixel normals in world space
  2. Converting them to view/camera space
  3. Multiplying vector to matrix 0.5, 0, 0 ], 0, 0.5, 0 ], 0, 0, 0 ], 0.5, 0.5, 0 ]] so i get xy in range from 0 to 1
  4. Converting vector3 to vector2 and using it as UV coordinates.

Problem is as shown on picture i am getting perspective distoring when shader works. I have not found where to uncheck “Tangent Space Normal” as Ryan Brucks adviced. Somebody have idea please how to fix issue with perspective distorting?

This is working for us. Please let me know if you know how to optimize this at all.

sorry to revive this old topic, but I have the same problem and didn’t manage to solve it.
Did you find a solution?