Shaders
R3NE compiles shaders to Metal at runtime. The Shader node lets you drop your own Metal Shading Language (MSL) fragment into the graph and have it rebuild as you type.
Anatomy of a node shader
You write only the fragment body — the part that returns a float4 color. Declare parameters with // @input annotations at the top; R3NE parses them into inspector controls and connectable ports, then wraps your body in a full-screen pass.
The @input syntax
One annotation per line, at the top of the source. Each becomes a port and an inspector control. For a float, the two numbers after the default are the slider min and max — there is no separate range annotation.
What the body gets
These are available inside the body without declaring them:
in.uv—float2, normalized 0–1 UV.in.position—float4, clip-space position.u.time— seconds on the timeline (frozen when paused);u.wallTimealways advances.u.resolution—float2render-target size in pixels.u.mouse—float4, andu.transform—float4x4.texSampler— a predeclared linear / clamp-to-edge sampler. Sample any input texture with it.
Helper functions are allowed: declare them above the body and they’re hoisted above the fragment function automatically. Set the node’s Output Resolution (presets or a custom W×H) in the inspector.
Live recompile
- Edit the shader in R3NE’s built-in editor; it rebuilds as you type.
- Compile errors surface in the editor with line numbers; the last good pipeline keeps running so the output never goes black.
- The same live-MSL approach powers
pbrMaterialfor 3D objects — there the body setsout.albedo,out.metallic,out.roughnessandout.emission.
What’s next
- Combine shaders with MCP to let a model author and tweak nodes from natural language.
- Browse the node reference for the built-in effects you can chain around your shader.