Frame uniforms

Read time, camera, matrices, weather, and depth through the generated frame interface.

Sulkan 0.5.1 · Minecraft 26.3 · Native format 1

Include the frame block

Graphics and scene shaders can include:

#version 450
#include "sulkan/frame.glsl"

Compute receives the block automatically: do not include or redeclare it. Members are accessed directly, for example TimeDeltaFrame.x, without a block-instance prefix.

User includes resolve from the pack root and are case-sensitive. Include cycles and excessive nesting fail validation.

Matrices and camera

MemberMeaning
Projection, ViewCurrent render matrices
InverseProjection, InverseViewTheir inverses
PreviousProjection, PreviousViewPrevious-frame matrices
CameraDeltaAndHistoryValidXYZ camera displacement; W history validity
CameraPositionHighAndFogTypeXYZ high camera position; W air 0 / water 1 / lava 2 / powder snow 3
CameraPositionLowAndFarPlaneXYZ residual position; W far plane
InverseHandProjectionInverse hand projection
HandProjectionValidX validity; other components reserved

Follow Minecraft’s rendering coordinates. Preserve camera high and low components separately when precision matters; combining them immediately loses the residual.

Time and environment

MemberComponents
TimeDeltaFrameelapsed seconds, delta seconds, frames since history reset, partial tick
ViewSizeAndInversewidth, height, inverse width, inverse height
WorldTimeWeatherDimensionclock modulo 24000, rain, thunder, dimension (0 Overworld / -1 Nether / 1 End / 2 custom)
SunDirectionAndRainBrightnessXYZ world-space sun direction; W sky rain brightness
MoonDirectionAndPhaseXYZ moon direction; W phase index
FogColorAndStartRGB fog; W environmental start
FogDistancesenvironmental end, render-distance start/end, sky end
SkyColorAndStarBrightnessRGB sky; W star brightness
CloudOffsetAndGameTimeX vanilla-rate cloud offset modulo 4096; other components reserved

Held-item lighting

The frame block includes HeldLightPositionRadius, HeldLightColor, and HeldLightViewProjection[6], representing the active held light and six shadow-face projections. Study the bundled shaders/held-light.glsl for usage. Do not treat reserved components as stable data.

A time-dependent effect

Add the frame include to the starter, then use this inside main() after sampling scene:

float pulse = 1.0 + 0.05 * sin(TimeDeltaFrame.x);
fragColor = vec4(clamp(scene.rgb * float(EXPOSURE) * pulse, 0.0, 1.0), scene.a);

Depth and history

Minecraft 26.3 uses reversed depth: cleared pixels are 0. Reconstruct positions with the supplied inverse matrices and Vulkan/Minecraft conventions, not an unmodified OpenGL formula.

$depth preserves world depth before the hand clear; $handDepth is the subsequent image. Use the hand projection when working with the latter.

Honor CameraDeltaAndHistoryValid.w before trusting temporal data. Zero initialization is not a complete TAA implementation; your pack must handle reprojection and invalidation.