Built-in Uniforms
The following uniforms are available for all the passes, and are compatible with Shadertoy’s conventions:
vec3 iResolutionViewport resolution (
zis pixel aspect ratio, currently always set to1.0).
int iFrameCurrent frame index.
float iTimeCurrent time, in seconds.
float iTimeDeltaTime passed between the render start of the previous, and the current frame, in seconds.
float iFrameRateNumber of frames rendered per second.
vec4 iDatex- Yeary- Monthz- Dayw- Time of day, in seconds.
vec4 iMouseabs(zw)- Pressed mouse position.z > 0.0- Is mouse currently down (true for multiple frames).w > 0.0- Is mouse down started at the current frame (“pressed” event, true for a single frame).Note that when mouse is down / pressed atx = 0ory = 0, a small delta (0.0001) is added tozorw, in order to keep the checks above correct.
sampler2D iChannel#Channel# sampler.
float[] iChannelTimeChannel time, in seconds (for
.gif, orTextureSequencebindings).
float[] iChannelDurationChannel duration, in seconds (for
.gif, orTextureSequencebindings).
vec3[] iChannelResolutionChannel resolution.
- Viewer Uniforms
The following uniforms are mostly needed for the Viewer Pass, but are also available for all the passes.
sampler2D iViewerChannelSelected pass framebuffer sampler.
vec3 iViewerChannelResolutionSelected pass framebuffer resolution.
float iViewerScaleViewer transformation scale.
vec2 iViewerOffsetViewer transformation offset.
Output Uniforms / Variables
- Fragment Shader
out vec4 FragColor#(where # is a number between 0 and 7)FragColor0is set automatically to themainImageoutput variablefragColor.
- Compute Shader
writeonly image2D OutputTexture#(where # is a number between 0 and 7)Compute shader outputs can be set using
imageStore(for example:
imageStore(OutputTexture0, texelCoord, vec4(1.0))).
By default only one texture is assigned, for additional textures the Pass Outputs property can be set.