Skip to content

Overview: attributes

Attributes are per-vertex data available only in the vertex stage. These values encode most of the information that is specific to each vertex, compared to uniforms which are the same across all vertices/fragments of a shader. Attribute data can be passed to the fragment stage with a varying, or stored to a buffer and read for any other shaders.

Compatibility attributes

The glsl compatibility profile provides several built in attributes. Iris/Optifine provide several attributes/uniforms to replace these when using the core profile. These “core profile” attributes are only available in MC 1.17+. The following shows these attributes:

CompatibilityCoreDescription
gl_VertexvaPosition + chunkOffsetvertex position
gl_ColorvaColorvertex color
gl_NormalvaNormalvertex normal
gl_NormalMatrixnormalMatrixnormal matrix
gl_MultiTexCoord0vaUV0texture uv coordinate
gl_TextureMatrix[0]textureMatrixtexture uv matrix
entityColorvaUV1 (not recommended even in core)entity overlay
gl_MultiTexCoord1 / gl_MultiTexCoord2vaUV2lightmap coordinate
gl_TextureMatrix[1]TEXTURE_MATRIX_2 (hardcoded matrix)lightmap coordinate matrix