A fast, practical way to start writing GLSL fragment shaders with ShaderMate
using the Codevre
browser IDE. You’ll be coding online in a clean
browser code editor: write your first mainImage, understand
UVs,
wire up essential uniforms (with explicit GLSL declarations), and build a clean
procedural pattern you can iterate on. Great for creative
coding,
generative art, and WebGL shader prototyping.
ShaderMate 16 min Codevre browser IDE
What you’ll build
You’ll build a ShaderMate “sketch” that renders a crisp, remixable procedural pattern. You’ll
learn:
UV coordinates, core ShaderMate uniforms, and a clean layering
approach
(base + pattern + accent) that you can iterate on quickly.
This guide is optimized for the Codevre browser IDE: prototype shaders in a
browser code editor, iterate instantly, and share a link so others can
run/remix your
ShaderMate sketch while coding online.
A ShaderMate sketch is intentionally small and readable. In the Codevre browser
IDE, open:
/index.html — canvas + loads ShaderMate + your sketch script
/style.css — fullscreen canvas styling
/sketch.js — defines passes and typed uniforms
/frag.glsl (or /sketch.glsl) — your fragment shader code
Important ShaderMate detail: declare the uniforms you use in GLSL
(for example uniform vec3 iResolution;, uniform float iTime;,
etc.).
And when you add custom uniforms in sketch.js, ShaderMate
expects a
typed uniform object like { type: '1f', value: 0.35 }.
Step 1 — Load ShaderMate (CDN) in index.html
Your HTML needs a canvas (ShaderMate defaults to glcanvas) and the ShaderMate
script must load
before your sketch script.
Step 3 — Start ShaderMate with a pass + typed uniforms
ShaderMate can start from a single shader path, but most templates use an explicit pass object.
This is also how you attach channels and typed uniforms.
ShaderMate updates built-in uniforms like iResolution, iTime, and
iMouse automatically.
For your own uniforms, use the typed format (type + value) in
sketch.js
and declare them in GLSL with matching names and types.
Step 4 — First fragment shader with explicit uniforms
Start simple: UV gradient + time pulse. The key point is declaring the uniforms you use.
Understand UVs: normalize, center, and aspect-correct
Normalize pixels into UVs (0..1), then convert to a centered coordinate system (-1..1) and
correct aspect ratio.
This makes procedural patterns scale cleanly across screen sizes.
uniform vec4 iMouse; — mouse data (position/click)
uniform int iFrame; — current frame index
And you can add custom uniforms per pass in sketch.js, using typed
uniforms:
uZoom: { type: '1f', value: 1.6 }. Then declare uniform float uZoom;
in GLSL.
Build a clean procedural pattern you can iterate on
This pattern is intentionally layered and tweakable: a soft base, animated stripes, and a subtle
grid overlay.
It also uses iMouse for an interactive control and custom uniforms for easy
iteration.
Iteration strategy: keep “knobs” as uniforms. When you like a direction, duplicate the
project and tweak the uniform defaults.
This is perfect for building a personal shader study library in a browser IDE.
Quick edits (make it yours)
Toggle debug mode (show UVs)
Flip uDebug to 1 in sketch.js:
uDebug: { type: '1i', value: 1 }
Change the main ink color
uInk: { type: '3f', value: [0.95, 0.45, 0.85] }
Share your ShaderMate sketch
Share the Codevre project link so others can run/remix the shader in a
browser editor
Screenshot / screen-record for sharing visuals
Duplicate the project for variations (change uniforms + palette)
FAQ: ShaderMate uniforms and setup
Do I need to declare ShaderMate uniforms in GLSL?
Yes—declare the uniforms you use (for example uniform vec3 iResolution;,
uniform float iTime;,
uniform vec4 iMouse;). ShaderMate supplies their values automatically each frame.
How do custom uniforms work in ShaderMate?
Add them per pass in sketch.js using typed uniforms like
{ type: '1f', value: 0.35 },
then declare matching GLSL uniforms (example: uniform float uZoom;).
Why use mainImage instead of main()?
ShaderMate supports a ShaderToy-like workflow by wrapping mainImage into the WebGL
fragment entry point,
so you can focus on shader logic with fragCoord and familiar uniforms.
Next steps
Next, try multi-pass rendering (buffer → screen), add feedback with a ping-pong pass, or sample
textures using
iChannel0. ShaderMate stays fast in a Codevre browser IDE when
your shaders stay modular,
readable, and easy to remix.