Thursday, May 23, 2013

[UDK] Reconstruct Normals from Depth

This is a UDK material to re-construct (view space) normals from scene depth. 





Unfortunately the depth buffer suffers from serious precision errors in DX9 mode which limits the use of this technique quite a lot. For post process effects like SSAO or SSGI it might be best practice to combine 'depth only' approaches with 'normals from depth'.

DX9:

DX11:


A blur pass after reconstructing the normals helps to reduce artifacts but also lowers the precision, espacially for fine details and across object edges.


3 comments:

  1. Do you have the code for the custom node posted somewhere?

    ReplyDelete
  2. Hi, I named the custom nodes by their code so you can tell from the screenshot.

    1) return mul(IN,,ViewProjectionMatrix);

    2) return ddx(IN);

    3) return ddy(IN);

    ReplyDelete