Skip to content

What Are Uniforms?

Uniforms are special inputs that allow data to be passed from Splitshade into your shaders. Uniforms are constant across a single draw call — they don’t change per vertex or fragment.

They enable your shader to respond to external parameters such as time, mouse position or screen resolution, making it possible to create dynamic, interactive visuals.

Why Uniforms Matter

Uniforms are the bridge between your shader and the world outside it. For instance:

  • Want to adapt visuals to screen size? Use iResolution.
  • Want to react to user input? Use iMouse.
  • Want to animate something over time? Use iTime.

These values are essential for building interactive and visually responsive effects.

Uniforms in Splitshade

Splitshade provides a set of built-in uniforms automatically available in every shader:

  • iResolution: Canvas resolution in pixels
  • iMouse: Current mouse coordinates and button state
  • iTime: Elapsed time in seconds