Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17625

Compact normal for deferred shading

$
0
0

Hello.

I fight this problem already long time.

As we know naive z coordinate reconstruction from x and y coordinates doesn't work properly since there is a sign loss.

That is why i use cry engine approach:

The formulas are very simple:

Normal to GBufffer:

G=normalize(N.xy)*sqrt(N.z*0.5+0.5)

GBuffer to Normal:

N.z=length2(G.xy)*2-1

N.xy=normalize(G.xy)*sqrt(1-N.z*N.z)

I checked it in python and it gives very small error for normalized normal vector - 8.0e-07

But the image with this approach has …


Viewing all articles
Browse latest Browse all 17625

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>