QUOTE (MarkTheEchidna @ Apr 8 2011, 07:10 AM)
We can "pack" the normal on a single value while losing some precision if we use some sort of parametric spiral. This is how MD3 stores normals, if I recall correctly.
It could be possible yeah. I know that *some* engines will store the X and Y screen space normal across 4 channels, and dynamically reconstructing Z (which in screen space, is just depth). But since we can only handle one FBO and Renderbuffer, I think it'd be best if we just stored normal, depth, and specular exponent if we're going to be reusing the same buffer over and over until we have the final result.
more or less:
Red: Normal X
Green: Normal Y
Blue: Specular Exponent
Stored across whatever the highest common bit depth we can (primarily due to depth information likely needing more than 8BPP for decent quality)
Specular exponent is easy to store in a deferred renderer since it's always a 0 to 1 constant that later gets multiplied by 128 by the deferred shader it's self. I'm interested in finding better ways to pack normals while retaining as high quality normals as possible, but keep in mind partial derivatives can eat into ALUs quite a bit. F..
There's also the stencil buffer. Can you write directly to it from the shaders?
...That's actually a very good question.
Edit: It would actually be interesting to see if we could almost do a surface shader approach, where the light buffer's RGB components are simply multiplied against each mesh's albedo, and the alpha is multiplied against an object's specular map, and added.
This post has been edited by Gen: 08 April 2011 - 11:09 AM