Skip to content

Documentation: Uniforms

Essentuan edited this page Mar 28, 2026 · 2 revisions

Uniforms

Some uniforms are defined in /photonics/photonics.glsl, and will be noted as such.

phFirstBuildTime (since v0.3.1)

uniform int phFirstBuildTime;

The frame Photonics finished its first build. This does not mean blocks have finished voxelizing yet.

This value uses the same counter as frameCounter.

phLastBuildTime (since v0.3.1)

uniform int phLastBuildTime;

The frame Photonics finished its most recent build.

This value uses the same counter as frameCounter.

world_offset (since v0.3.0)

uniform vec3 world_offset;

This uniform is defined by /photonics/photonics.glsl.

The origin of Photonics tracing structure, in blocks. Useful to convert world space to and from RT space:

vec3 world_pos;
vec3 rt_pos = world_pos - world_offset;

world_camera_position (since v0.3.0)

uniform vec3 world_camera_position;

This uniform is defined by /photonics/photonics.glsl.

The camera position in world space. Unlike cameraPosition, this value does not wrap around.

rt_camera_position (since v0.3.0)

uniform vec3 rt_camera_position;

This uniform is defined by /photonics/photonics.glsl.

The camera position in the RT coordinate space (E.g. rt_camera_position = world_camera_position - world_offset). This computation is done on the CPU with double precision.

Can be useful to convert player pos to rt space without precision errors.

vec3 player_pos;
vec3 rt_pos = player_pos + rt_camera_position;

ph_light_count

uniform int ph_light_count;

This uniform is defined by /photonics/photonics.glsl.

The number of lights loaded in the light list.

left_handed

uniform bool left_handed;

This uniform is defined by /photonics/photonics.glsl.

true when the players main hand is set to their left hand.

main_hand_has_light

uniform bool main_hand_has_light;

This uniform is defined by /photonics/photonics.glsl.

true when the players main hand is holding a light.

off_hand_has_light

uniform bool off_hand_has_light;

This uniform is defined by /photonics/photonics.glsl.

true when the players offhand is holding a light.

Clone this wiki locally