Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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 ?

share|improve this question

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.