Skip to content

Texture Atlases

The coordinates used to sample the texture atlases in a gbuffers pass are obtained in the vertex shader using the following code:

Compatibility Profile
coord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
Core Profile
coord = (textureMatrix * vec4(vaUV0, 0.0, 1.0)).xy;

For more information, see gl_MultiTexCoord0.

Texture atlases are not bound in non-gbuffers passes. To access them in other passes, custom textures can be used.

gtexture is the main texture atlas, used to obtain the albedo color of any geometry rendered in a gbuffers pass. It is usually multiplied by the result of gl_Color/vaColor (passed through from the vertex shader) to obtain the final color value.

normals is the normal map atlas. If the resource pack does not have a texture suffixed with _n for the current geometry, or there is no resource pack loaded, then the value returned will be as follows.

ComponentValue (0-255)
r127
g127
b255
a255

Note that the values returned when sampling the texture are in the 0-1 range, whereas they are displayed here in the 0-255 range.

For information on how to use these values, see PBR Standards.

specular is the specular map atlas. If the resource pack does not have a texture suffixed with _s for the current geometry, or there is no resource pack loaded, then the value returned will be as follows.

ComponentValue (0-255)
r0
g0
b0
a0

Note that the values returned when sampling the texture are in the 0-1 range, whereas they are displayed here in the 0-255 range.

For information on how to use these values, see PBR Standards.