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:
Compatibility | Core | Description |
---|---|---|
gl_Vertex | vaPosition + chunkOffset | vertex position |
gl_Color | vaColor | vertex color |
gl_Normal | vaNormal | vertex normal |
gl_NormalMatrix | normalMatrix | normal matrix |
gl_MultiTexCoord0 | vaUV0 | texture uv coordinate |
gl_TextureMatrix[0] | textureMatrix | texture uv matrix |
entityColor | vaUV1 (not recommended even in core) | entity overlay |
gl_MultiTexCoord1 / gl_MultiTexCoord2 | vaUV2 | lightmap coordinate |
gl_TextureMatrix[1] | TEXTURE_MATRIX_2 (hardcoded matrix) | lightmap coordinate matrix |