PDA

View Full Version : what is need of integer and SNORM textures



debonair
03-19-2014, 10:00 PM
What is the advantage or need of integer and SNORM textures? when do we use (-1,0) range for textures? Any example where we need specifically integer or SNORM textures?

mhagain
03-20-2014, 12:13 AM
SNORM textures don't go {-1, 0}, they go {-1, 1}: https://www.opengl.org/registry/specs/EXT/texture_snorm.txt


This extension provides a set of new "signed normalized" integer texture formats. These are taken to represent a floating-point value in the range [-1.0,1.0] with an exact 0.0.

You'd use this for e.g storing normals in a g-buffer (the guaranteed exact 0 is useful here).

debonair
03-20-2014, 04:44 PM
and what about integer textures? when do we need those specifically?

mhagain
03-20-2014, 05:44 PM
One example that goes way back is a D24S8 depth texture stores depth as an integer. That aside, it's just functionality; you may as well ask "why do we need an integer data type in C?" and the answer will be the same - for times when you need to use an integer. So if you're implementing an algorithm and that algorithm needs an integer at some point then you may wish to use an integer texture. But it all depends on the algorithm you're implementing.