Frame uniforms
Read time, camera, matrices, weather, and depth through the generated frame interface.
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
| Member | Meaning |
|---|---|
Projection, View | Current render matrices |
InverseProjection, InverseView | Their inverses |
PreviousProjection, PreviousView | Previous-frame matrices |
CameraDeltaAndHistoryValid | XYZ camera displacement; W history validity |
CameraPositionHighAndFogType | XYZ high camera position; W air 0 / water 1 / lava 2 / powder snow 3 |
CameraPositionLowAndFarPlane | XYZ residual position; W far plane |
InverseHandProjection | Inverse hand projection |
HandProjectionValid | X 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
| Member | Components |
|---|---|
TimeDeltaFrame | elapsed seconds, delta seconds, frames since history reset, partial tick |
ViewSizeAndInverse | width, height, inverse width, inverse height |
WorldTimeWeatherDimension | clock modulo 24000, rain, thunder, dimension (0 Overworld / -1 Nether / 1 End / 2 custom) |
SunDirectionAndRainBrightness | XYZ world-space sun direction; W sky rain brightness |
MoonDirectionAndPhase | XYZ moon direction; W phase index |
FogColorAndStart | RGB fog; W environmental start |
FogDistances | environmental end, render-distance start/end, sky end |
SkyColorAndStarBrightness | RGB sky; W star brightness |
CloudOffsetAndGameTime | X 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.