Skip to content

Overview: Uniforms

Uniforms are values sent from the CPU, and as such they cannot change from one shader invocation to the next within a render call. Most uniforms provided by Iris are constant across the entire frame, some values change between different geometry (such as renderstage).

Below is an index of all Uniforms available in Iris. Uniforms marked as Iris Exclusive are only available in Iris, and uniforms marked as Optifine CU / Iris are available in Optifine only through custom uniforms but are available anywhere in Iris. Any unmarked uniforms is available in either Optifine or Iris.

Camera/Player

UniformTypeValue RangeDescriptionTag
cameraPositionvec3Position of the camera in world space
eyeAltitudefloatY coordinate of the player in blocks
cameraPositionFractvec3[0,1)Fractional component of the camera position in world spaceIris Exclusive
cameraPositionIntivec3Integer component of the camera position in world spaceIris Exclusive
previousCameraPositionvec3Value of cameraPosition from the previous frameIris Exclusive
previousCameraPositionFractvec3[0,1)Value of cameraPositionFract from the previous frameIris Exclusive
previousCameraPositionIntivec3Value of cameraPositionInt from the previous frameIris Exclusive
eyePositionvec3World space position of the player’s head modelIris Exclusive
relativeEyePositionvec3World space offset from the player head to the cameraIris Exclusive
playerBodyVectorvec3[0,1]World aligned direction of player model’s bodyIris Exclusive
playerLookVectorvec3[0,1]World aligned direction of player model’s headIris Exclusive
upPositionvec3[0, 100]Upwards direction in view space, length of 100
eyeBrightnessivec2[0, 240]Light value at the player’s location: (block, sky)
eyeBrightnessSmoothivec2[0, 240]eyeBrightness smoothed over time by eyeBrightnessHalfLife
centerDepthSmoothfloat[0,1]Depth buffer value at the center of the screen, smoothed over time
firstPersonCamerabooltrue / falseWhether the player camera is in first person modeIris Exclusive

Player Status

UniformTypeValue RangeDescriptionTag
isEyeInWaterint0, 1, 2, 3Fluid that the camera is currently in
isSpectatorbooltrue / falseWhether the player is currently in spectator modeIris Exclusive
isRightHandedbooltrue / falseWhether the player’s main hand is set to right handIris Exclusive
blindnessfloat[0,1]Blindness effect multiplier
darknessFactorfloat[0,1]Strength of the darkness effect
darknessLightFactorfloat[0,1]Strength of the dimming effect from the darkness status effect
nightVisionfloat[0,1]Night vision effect multiplier
playerMoodfloat[0,1]Player mood value
constantMoodfloat[0,1]playerMood but it doesn’t reset at 1.0Iris Exclusive
currentPlayerAirfloat[0,1]Normalized air the player has remainingIris Exclusive
maxPlayerAirfloat-1, 300Maximum player air when underwaterIris Exclusive
currentPlayerArmorfloat-1, [0,1]Normalized armor player has equippedIris Exclusive
maxPlayerArmorfloat50Maximum player armor valueIris Exclusive
currentPlayerHealthfloat-1, [0,1]Normalized health the player has remainingIris Exclusive
maxPlayerHealthfloat-1, [0, 1024]Maximum player health valueIris Exclusive
currentPlayerHungerfloat-1, [0,1]Normalized hunger level of playerIris Exclusive
maxPlayerHungerfloat20Maximum player hunger valueIris Exclusive
is_burningbooltrue / falseWhether the player is currently on fireOptifine CU / Iris
is_hurtbooltrue / falseWhether the player is currently taking damageOptifine CU / Iris
is_invisiblebooltrue / falseWhether the player is invisibleOptifine CU / Iris
is_on_groundbooltrue / falseWhether the player is currently touching the groundOptifine CU / Iris
is_sneakingbooltrue / falseWhether the player is currently sneakingOptifine CU / Iris
is_sprintingbooltrue / falseWhether the player is currently sprintingOptifine CU / Iris
hideGUIbooltrue / falseWhether the player’s GUI is hidden

Screen/System

UniformTypeValue RangeDescriptionTag
viewHeightfloat[1,∞)Height of the game window in pixels
viewWidthfloat[1,∞)Width of the game window in pixels
aspectRatiofloat(0,∞)Aspect ratio of the game window
screenBrightnessfloat[0,1]Screen brightness from video settings
frameCounterint[0, 720719]Number of frames since start of program
frameTimefloat(0,∞)Frame time of the previous frame in seconds
frameTimeCounterfloat[0, 3600)Running time of the game in seconds
currentColorSpaceint0, 1, 2, 3, 4Display color space, controlled through video settingsIris Exclusive
currentDateivec3System date: (year, month, day)Iris Exclusive
currentTimeivec3System time: (hour, minute, second)Iris Exclusive
currentYearTimeivec2Time since beginning of the year and until the end of the yearIris Exclusive

ID

UniformTypeValue RangeDescriptionTag
entityIdint[0, 65535]ID of the currently rendering entity (gbuffers_entities)
blockEntityIdint[-32768, 32767]ID of the currently rendering block entity (gbuffers_block)
currentRenderedItemIdint[0,65535]Item ID of currently rendering item/armor/trimIris Exclusive
currentSelectedBlockIdint[-32768, 32767]Block ID of block selected by the playerIris Exclusive
currentSelectedBlockPosvec3Player space position of the center of the block selected by the playerIris Exclusive
heldItemIdint[0, 65535]Item ID of the item in the player’s hand
heldItemId2int[0, 65535]Item ID of the item in the player’s offhand
heldBlockLightValueint[0,15]Light value of the item held in the player’s hand
heldBlockLightValue2int[0,15]Light value of the item held in the player’s offhand

World/Weather

UniformTypeValue RangeDescriptionTag
sunPositionvec3[0,100]Position of the sun in view space, length of 100
moonPositionvec3[0,100]Position of the moon in view space, length of 100
shadowLightPositionvec3[0,100]Position of shadow source in view space, length of 100
sunAnglefloat[0,1]Angle of the sun within the complete day-night cycle
shadowAnglefloat[0,0.5]Angle of shadow source (whichever is higher in the sky)
moonPhaseint[0,7]Current moon phase
rainStrengthfloat[0,1]Current strength of rain
wetnessfloat[0,1]rainStrength but smoothed over time with wetnessHalfLife
thunderStrengthfloat[0,1]Current strength of thunderstormIris Exclusive
lightningBoltPositionvec4Position of a lightning bolt being rendered, or vec4(0.0)Iris Exclusive
worldTimeint[0, 23999]Current in-game time
worldDayint[0 - )Number of in-game days passed

Biome/Dimension

UniformTypeValue RangeDescriptionTag
biomeintBiome currently occupied by the playerOptifine CU / Iris
biome_categoryintCategory of the biome currently occupied by the playerOptifine CU / Iris
biome_precipitationint0, 1, 2Type of precipitation in the current biomeOptifine CU / Iris
rainfallfloat[0,1]Rainfall property of the current biomeOptifine CU / Iris
temperaturefloatTemperature property of the current biomeOptifine CU / Iris
ambientLightfloat[0,1]Ambient light property of the current dimensionIris Exclusive
bedrockLevelint[-2032, 2016]Y coordinate of the bedrock floor in the current dimensionIris Exclusive
cloudHeightfloatY coordinate of the vanilla cloud planeIris Exclusive
hasCeilingbooltrue / falseWhether the current dimension has a ceilingIris Exclusive
hasSkylightbooltrue / falseWhether the current dimension has sky lightingIris Exclusive
heightLimitint[16, 4064]Distance from maximum to minimum block heights in current dimensionIris Exclusive
logicalHeightLimitintLogical height of the current dimensionIris Exclusive

Rendering

UniformTypeValue RangeDescriptionTag
nearfloat0.05Near clipping plane distance
farfloat(0, - )Current render distance in blocks
alphaTestReffloat[0,1]Cutout alpha discard threshold
chunkOffsetvec3Chunk offset for terrain model space position
entityColorvec4[0,1]Entity tint color
blendFuncivec4Alpha blending function multipliers: (srcRGB, dstRGB, srcA, dstA)
atlasSizeivec2[0, - )Size of the texture atlas, 0 if not bound
renderStageint”Render stage” of the current geometry
fogColorvec3[0,1]Horizon fog color
skyColorvec3[0,1]Upper sky color
fogDensityfloat[0,1]Relative fog density
fogStartfloat(0, - )Starting fog distance in blocks
fogEndfloat(0, - )Ending fog distance in blocks
fogModeint2048, 2049, 2048Fog type used for vanilla fog
fogShapeint0,1Fog shape used for vanilla fog

Matrices

UniformTypeValue RangeDescriptionTag
gbufferModelViewmat4Player space to view space in general
gbufferModelViewInversemat4Converts from view space to player space in general
gbufferProjectionmat4Converts from view space to clip space in general
gbufferProjectionInversemat4Converts from clip/screen to view space in general
shadowModelViewmat4Converts from player space to shadow view space in general
shadowModelViewInversemat4Converts from shadow view space to player space in general
shadowProjectionmat4Converts from shadow view space to shadow clip space in general
shadowProjectionInversemat4Converts from shadow clip/screen space to shadow view space in general
gbufferPreviousModelViewmat4Value of gbufferModelView from the previous frame
gbufferPreviousProjectionmat4Value of gbufferProjection from the previous frame
modelViewMatrixmat4Converts from model space to view space in general
modelViewMatrixInversemat4Converts from view space to model space for current geometry
projectionMatrixmat4Converts from view space to clip space for current geometry
projectionMatrixInversemat4Converts from clip/screen space to view space for current geometry
normalMatrixmat3Converts normals from model space to view space for current geometry
textureMatrixmat4Transforms texture coordinates before sampling