Skip to content

Documentation: shader_interface.glsl

Essentuan edited this page May 28, 2026 · 2 revisions

/photonics/shader_interface.glsl (since v0.3.0)

This is the main file Photonics uses interface with your shader for its own render passes. All the following methods need to be defined for Photonics lighting to work properly.

load_world_position (since v0.3.0)

vec3 load_world_position();

Used by Photonics to obtain the world positon of the current fragment.

load_fragment_variables (since v0.3.0)

void load_fragment_variables(
    out vec3 albedo, // The albedo of the current fragment
    out vec3 world_pos, // The world pos of the current fragment, 
    out vec3 geometry_normal, // The geometry normal of the current fragment in world space
    out vec3 texture_normal // The texture normal of the current fragment in world space
);

Used by Photonics to obtain data of the current fragment.

For more information see How to adapt your Shaderpack.

sun_direction (since v0.3.0)

vec3 sun_direction;

The current direction to the sun or moon (depending on which one is the active light source)

indirect_light_color (since v0.3.0)

vec3 sun_direction;

The color used by indirect for the sun/sky, should be your sky color.

get_taa_jitter (since v0.3.0)

vec2 get_taa_jitter();

The TAA jitter for the current fragment, in NDC space. Should only be used if you apply TAA in load_world_position/load_fragment_variables.

is_in_world (since v0.3.0)

bool is_in_world();

Returns true if the current fragment is in the world for.

Clone this wiki locally