A texture pack for a sponza model contains mask textures (black and white). I guess that I should read only a red channel from that texture, right ? I use deferred rendering and for shading calculations I use additive blending. A result is first save in a texture (for some post-process operations), so doesn't go directly to the default framebuffer. How to use a mask texture ?
1 Answer
Mask textures basically let you choose different shading branches depending on texels info.
For example simplest reflection mask Result = Ambient.rgb + Mix(Diffuse.rgb * Texture.rgb, Reflection.rgb, Mask.r);
will mask certain areas as reflective and others as normal.
Depending on mask texture format, e.g. GL_RGB
it may have each channel used for different purpose (r
for specular, g
for reflection, b
for something else). OpenGL allows number of texture format that have just one component GL_LUMINANCE
if you need only one mask.