Skip to main content
GameDev.net gamedev.net
🔒 Locked

write out normalbuffer for ssao

Started by Farci Jul 29, 2012 at 8:03 PM 1 replies 950+ views
Original Post
Farci
Farci
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?
Radikalizm
Radikalizm

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


The conversion back to your original range would then become: n = n * 2 - 1

I gets all your texture budgets!
Farci
Farci
ahh ok then this way, thought there might be an more classy way

thx for help

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.