Matrix Uniforms
These uniforms store matrices used for converting between coordinate spaces. More info on the coordinate spaces used in Iris can be found in the Coordinate Spaces page.
gbufferModelView
uniform mat4 gbufferModelView;
Transforms coordinates from player space to view/eye space.
vec3 view_pos = gbufferModelView * vec4(feet_player_pos, 1.0);vec3 view_pos = mat3(gbufferModelView) * eye_player_pos;
gbufferModelViewInverse
uniform mat4 gbufferModelViewInverse;
Equal to inverse(gbufferModelView)
, but calculated on the CPU to avoid running the expensive inverse()
function on the GPU.
gbufferProjection
uniform mat4 gbufferProjection;
Equal to the projectionMatrix
used by all gbuffers programs except for gbuffers_hand
and gbuffers_hand_water
, where the projectionMatrix
multiplies the Z axis by MC_HAND_DEPTH
to move the hand closer to the camera than the rest of the world.
gbufferProjectionInverse
uniform mat4 gbufferProjectionInverse;
Equal to inverse(gbufferProjection)
, but calculated on the CPU to avoid running the expensive inverse()
function on the GPU.
shadowModelView
uniform mat4 shadowModelView;
Equal to the modelViewMatrix
when the shadow map was generated in the shadow program.
shadowModelViewInverse
uniform mat4 shadowModelViewInverse;
Equal to inverse(shadowModelView)
, but calculated on the CPU to avoid running the expensive inverse()
function on the GPU.
shadowProjection
uniform mat4 shadowProjection;
Equal to the projectionMatrix
when the shadow map was generated in the shadow program.
shadowProjectionInverse
uniform mat4 shadowProjectionInverse;
Equal to inverse(shadowProjection)
, but calculated on the CPU to avoid running the expensive inverse()
function on the GPU.
gbufferPreviousModelView
uniform mat4 gbufferPreviousModelView;
The value of gbufferModelView
in the previous frame.
gbufferPreviousProjection
uniform mat4 gbufferPreviousProjection;
The value of gbufferProjection
in the previous frame.
modelViewMatrix
uniform mat4 modelViewMatrix;
Transforms coordinates from model/local space to view/eye space.
Equal to mat4(1.0)
in begin
, prepare
, deferred
, composite
and final
programs.
vec3 model_pos = vaPosition + chunkOffset;vec4 view_pos = modelViewMatrix * vec4(model_pos, 1.0);vec4 clip_pos = projectionMatrix * view_pos;
gl_Position = clip_pos;
Equivalent to gl_ModelViewMatrix
in the compatibility profile and older GLSL versions.
vec3 model_pos = gl_Vertex.xyz;vec4 view_pos = gl_ModelViewMatrix * vec4(model_pos, 1.0);vec4 clip_pos = gl_ProjectionMatrix * view_pos;
gl_Position = clip_pos;
modelViewMatrixInverse
uniform mat4 modelViewMatrixInverse;
Equal to inverse(modelViewMatrix)
, but calculated on the CPU to avoid running the expensive inverse()
function on the GPU.
projectionMatrix
uniform mat4 projectionMatrix;
Transforms coordinates from view/eye space to clip space.
vec3 model_pos = vaPosition + chunkOffset;vec4 view_pos = modelViewMatrix * vec4(model_pos, 1.0);vec4 clip_pos = projectionMatrix * view_pos;
gl_Position = clip_pos;
Equivalent to gl_ProjectionMatrix
in the compatibility profile and older GLSL versions.
vec3 model_pos = gl_Vertex.xyz;vec4 view_pos = gl_ModelViewMatrix * vec4(model_pos, 1.0);vec4 clip_pos = gl_ProjectionMatrix * view_pos;
gl_Position = clip_pos;
projectionMatrixInverse
uniform mat4 projectionMatrixInverse;
Equal to inverse(projectionMatrix)
, but calculated on the CPU to avoid running the expensive inverse()
function on the GPU.
normalMatrix
uniform mat3 normalMatrix;
Matrix to transform a model space normal vector to view space.
Equivalent to mat3(transpose(modelViewMatrixInverse))
, or gl_NormalMatrix
in the compatibility profile and older GLSL versions.
vec3 normal = normalMatrix * vaNormal;
vec3 normal = gl_NormalMatrix * gl_Normal;
textureMatrix
uniform mat4 textureMatrix;
Transforms texture coordinates. Mainly used in gbuffers_armor_glint
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 programs utilizing vaUV0
.
vec2 coord = (textureMatrix * vec4(vaUV0, 0.0, 1.0)).xy;
Equivalent to gl_TextureMatrix[0]
in the compatibility profile and older GLSL versions.
vec2 coord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;