diff --git a/src/content/docs/reference/Attributes/vaUV0.mdx b/src/content/docs/reference/Attributes/vaUV0.mdx index 7dc24d0..78959f6 100644 --- a/src/content/docs/reference/Attributes/vaUV0.mdx +++ b/src/content/docs/reference/Attributes/vaUV0.mdx @@ -20,4 +20,11 @@ import { Aside } from '@astrojs/starlight/components'; The vertex texture coordinate attribute, equivalent to `gl_MultiTexCoord0` from the compatibility profile. -Usually the coordinate in `vaUV0` corresponds directly to the atlas texture coordinate, however some geometry (such as enchantment glint) requires the texture matrix. Therefore it is always recommended to use [`textureMatrix`](/reference/uniforms/matrices/texturematrix) (or `gl_TextureMatrix[0]` in the compatibility profile). \ No newline at end of file +Usually the coordinate in `vaUV0` corresponds directly to the atlas texture coordinate, however some geometry (such as enchantment glint) requires a texture matrix. Therefore it is always recommended to use [`textureMatrix`](/reference/uniforms/matrices/texturematrix) (or `gl_TextureMatrix[0]` in the compatibility profile) in [gbuffers-style](/reference/programs/overview/#program-order) programs. +```glsl +vec2 coord = (textureMatrix * vec4(vaUV0, 0.0, 1.0)).xy; +``` +Equivalent to `gl_TextureMatrix[0]` in the compatibility profile and older GLSL versions. +```glsl +vec2 coord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; +``` \ No newline at end of file diff --git a/src/content/docs/reference/Uniforms/Matrices/textureMatrix.mdx b/src/content/docs/reference/Uniforms/Matrices/textureMatrix.mdx index 98dd7a0..207d46b 100644 --- a/src/content/docs/reference/Uniforms/Matrices/textureMatrix.mdx +++ b/src/content/docs/reference/Uniforms/Matrices/textureMatrix.mdx @@ -14,7 +14,7 @@ import { Aside } from '@astrojs/starlight/components'; ### `uniform mat4 textureMatrix;` -Transforms texture coordinates. Used by [`gbuffers_armor_glint`](/reference/programs/gbuffers) to scroll the texture over time. +Transforms texture coordinates. Mainly used in [`gbuffers_armor_glint`](/reference/programs/gbuffers) to scroll the texture over time, but may be applied to other geometry as well (especially by mods). It is therefore strongly recommended to use this matrix in all [gbuffers-style](/reference/programs/overview/#program-order) programs utilizing [`vaUV0`](/reference/attributes/vauv0/). ```glsl vec2 coord = (textureMatrix * vec4(vaUV0, 0.0, 1.0)).xy; ```