Sign in to follow this  
Farci

write out normalbuffer for ssao

Recommended Posts

Hello,

just a short question, a normal can point in any direction so it can cotain negativ values. So whats the best way to handle negativ values for an normalbuffer which will be used for ssao. (I'm writing the normals on rendertarget with 4 floats)
Or are these values saved as they are, even if they are negativ?

Share this post


Link to post
Share on other sites
[left]A common way to solve this problem is to convert the values in your normal vector from a range of [-1, 1] to a range of [0, 1] and back again when you do your ssao pass

You can do said conversion like this: n = (n + 1) / 2[/left]
[left]The conversion back to your original range would then become: n = n * 2 - 1[/left]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this