Material Nodes Reference
Every node type in the material graph, with its pins and what it compiles to.
There are 168 node types in 14 categories. The definitions are
ALL_NODES in crates/renzora_shader/src/material/nodes/ (one module per
category) and the code each emits is in material/codegen/emit/, in files of
the same names. The file format, domains and compile paths are in the
Material API; to add a node, see
Custom Material Nodes.
This page is written by hand. Code that needs the list should read the
MaterialNodeCatalog resource, which renzora_shader fills from the same
definitions (see Material API).
Reading this page
Pins are written name: Type = default. A pin's name is what .material
files and connections use; the editor shows a label, given in brackets where
it differs in a way worth knowing. An input with no default compiles to zero
when unwired. Rules that hold everywhere:
- Numeric pins coerce.
Float,Vec2,Vec3,Vec4andColorconnect freely; a scalar widens into every component, a wider vector narrows to its leading components.Boolconnects only toBool. - Math nodes take the width of their widest wire. Every pin of a
math/*node is declaredFloat, but the node latches to the widest type among its connected inputs (resolve_math_ranks), so one Add adds two floats or two colours.math/lerp'ststays a scalar. With nothing wired, a math node isFloat. - Mesh UV fallback. The texture sampling nodes, the
input/uv_*transforms,procedural/hex_tile,animation/flipbook_uvand Sprite Color read the mesh UV when theiruvpin is unwired. The other procedural and animation nodes read theiruvpin's default (a constant), so wire a UV into them. - Settings are not pins. A few nodes read a value from the node's
input_valuesthat cannot be wired: the texture of every texture node (texture, aTexturePath), the constants of the Color category, Blend'smode, Swizzle'sout_*, Static Switch'suse_a, Component Mask'skeep_*and Function Call'sfunction.
Input
Data the fragment already has. Header colour blue.
| Node | Inputs | Outputs | What it does |
|---|---|---|---|
input/uv, UV | none | uv: Vec2, u, v: Float | The mesh UV |
input/uv_scale, UV Scale | uv: Vec2, scale: Vec2 = (2, 2), offset: Vec2 = (0, 0) | uv: Vec2 | uv * scale + offset, for tiling |
input/uv_polar, Polar UV | uv: Vec2, center: Vec2 = (0.5, 0.5) | uv: Vec2, angle, radius: Float | Cartesian to polar around center: x is the angle in 0 to 1, y the radius |
input/uv_rotator, UV Rotator | uv: Vec2, angle: Float = 0 (radians), center: Vec2 = (0.5, 0.5) | uv: Vec2 | Rotates UVs around center |
input/uv_panner, UV Panner | uv: Vec2, speed: Vec2 = (0.1, 0), time_offset: Float = 0 | uv: Vec2 | Time-driven pan in any direction |
input/world_position, World Position | none | position: Vec3, x, y, z: Float | Fragment position in world space |
input/world_normal, World Normal | none | normal: Vec3, x, y, z: Float | Fragment normal in world space |
input/view_direction, View Direction | none | direction: Vec3 | Normalized direction from the fragment to the camera |
input/time, Time | none | time, sin_time, cos_time: Float | globals.time in seconds, and its sine and cosine |
input/vertex_color, Vertex Color | none | color: Color, r, g, b, a: Float | The mesh's COLOR attribute, white on a mesh without one |
input/sprite_color, Sprite Color | uv: Vec2 (the sprite's UV when unwired) | color: Color, rgb: Vec3, a: Float | The sprite's own texture at a UV, with its flip, tiling and slicing applied. Sprite materials only; refused in a 3D domain |
input/camera_position, Camera Position | none | position: Vec3 | Camera position in world space |
input/object_position, Object Position | none | position: Vec3 | The object's pivot in world space (translation of its model matrix) |
input/particle_color, Particle Color | none | color: Color, rgb: Vec3, a: Float | On a particle, its colour after colour over life. White elsewhere |
input/particle_age, Particle Age | none | age: Float | On a particle, its age over its lifetime, 0 at birth to 1 at death. 0 elsewhere |
input/particle_random, Particle Random | none | value: Float | On a particle, a 0 to 1 random fixed for its life. 0 elsewhere |
input/particle_velocity, Particle Velocity | none | velocity: Vec3, speed: Float, direction: Vec3 | On a particle, its world-space velocity, speed and direction. Zero elsewhere |
The four Particle nodes read particle data in a Surface, Unlit or Vegetation graph drawn on a particle (see Particle System) and are the constants above anywhere else, so one material can dress both a level and its particles. A graph that uses them has no virtual geometry branch, since particle inputs come from the particle pipeline's own vertex stage. In a Sprite graph they are always the constants.
Parameter
Named values a material instance
overrides by name. name is the key; default is the value the master uses.
A graph holds at most 32 distinct names. Header colour purple.
| Node | Inputs | Output |
|---|---|---|
param/float, Float Parameter | name: String = "FloatParam", default: Float = 0 | value: Float |
param/color, Color Parameter | name: String = "ColorParam", default: Color = (1, 1, 1, 1) | value: Color |
param/vec2, Vec2 Parameter | name: String = "Vec2Param", default: Vec2 = (0, 0) | value: Vec2 |
param/vec3, Vec3 Parameter | name: String = "Vec3Param", default: Vec3 = (0, 0, 0) | value: Vec3 |
param/vec4, Vec4 Parameter | name: String = "Vec4Param", default: Vec4 = (0, 0, 0, 0) | value: Vec4 |
param/bool, Bool Parameter | name: String = "BoolParam", default: Bool = false | value: Bool |
Texture
Each node samples the image in its texture setting. A graph samples at most
16 distinct 2D images (6 in a Sprite graph); nodes reading the same image
share one slot. Every slot shares one sampler, the first 2D texture's. Header
colour tan.
| Node | Inputs | Outputs | What it does |
|---|---|---|---|
texture/sample, Sample Texture | uv: Vec2 | color: Color, rgb: Vec3, r, g, b, a: Float | Samples a 2D texture |
texture/sample_normal, Sample Normal Map | uv: Vec2, strength: Float = 1, flip_green: Bool = false | normal: Vec3 | Samples and decodes a tangent-space normal map, scaled by strength. Assumes the OpenGL convention (green up); flip_green reads a DirectX map |
texture/triplanar, Triplanar Sample | scale: Float = 1, sharpness: Float = 2 | color: Color, rgb: Vec3 | Projects the texture along world X, Y and Z and blends by the world normal: no UVs, no seams |
texture/sample_lod, Sample Texture LOD | uv: Vec2, lod: Float = 0 | color, rgb, r, g, b, a | textureSampleLevel at an explicit mip: blurred reflections, or sampling where automatic derivatives are invalid |
texture/sample_grad, Sample Texture Grad | uv: Vec2, ddx: Vec2 = (0, 0), ddy: Vec2 = (0, 0) | color, rgb, r, g, b, a | textureSampleGrad with explicit derivatives, for UVs rotated or warped in ways that fool the automatic ones |
texture/sample_cubemap, Sample Cubemap | direction: Vec3 = (0, 1, 0), lod: Float = 0 | color, rgb, a | Samples a cubemap of the material's own along a direction, separate from the scene's environment map |
texture/sample_2d_array, Sample 2D Array | uv: Vec2, layer: Float = 0 | color, rgb, r, g, b, a | Samples a layer of a 2D array texture; layer rounds to the nearest integer |
texture/sample_3d, Sample 3D Texture | uvw: Vec3 = (0.5, 0.5, 0.5) | color, rgb, r, g, b, a | Samples a volume texture at a coordinate in 0 to 1 cubed |
Math
Each has one output, result, and works per component at the node's latched
width. Domain guards are there because one NaN propagates through the rest of
the shader and blanks the surface. Header colour grey.
| Node | Inputs (defaults) | Computes |
|---|---|---|
math/add, Add | a = 0, b = 0 | a + b |
math/subtract, Subtract | a = 0, b = 0 | a - b |
math/multiply, Multiply | a = 1, b = 1 | a * b |
math/divide, Divide | a = 1, b = 1 | a / max(b, 0.000001) |
math/power, Power | base = 2, exp = 2 | pow(abs(base), exp) |
math/abs, Abs | value = 0 | abs(value) |
math/negate, Negate | value = 0 | -value |
math/one_minus, One Minus | value = 0 | 1 - value |
math/fract, Fract | value = 0 | fract(value) |
math/floor, Floor | value = 0 | floor(value) |
math/ceil, Ceil | value = 0 | ceil(value) |
math/min, Min | a = 0, b = 1 | min(a, b) |
math/max, Max | a = 0, b = 1 | max(a, b) |
math/clamp, Clamp | value = 0.5, min = 0, max = 1 | clamp(value, min, max) |
math/lerp, Lerp | a = 0, b = 1, t = 0.5 | mix(a, b, t); t stays scalar |
math/smoothstep, Smoothstep | edge0 = 0, edge1 = 1, value = 0.5 | smoothstep(edge0, edge1, value) |
math/step, Step | edge = 0.5, value = 0 | step(edge, value): 0 below the edge, 1 from it |
math/remap, Remap | value = 0.5, in_min = 0, in_max = 1, out_min = 0, out_max = 1 | out_min + (value - in_min) / max(in_max - in_min, 0.000001) * (out_max - out_min) |
math/sin, Sin | value = 0 | sin(value) |
math/cos, Cos | value = 0 | cos(value) |
math/saturate, Saturate | value = 0.5 | saturate(value): clamp to 0 to 1 |
math/modulo, Modulo | a = 0, b = 1 | a - b * floor(a / max(b, 0.000001)) |
math/sign, Sign | value = 0 | sign(value) |
math/atan2, Atan2 | y = 0, x = 1 | atan2(y, x) in radians |
math/trunc, Trunc | value = 0 | trunc(value) |
math/round, Round | value = 0 | round(value) |
math/exp, Exp | value = 0 | exp(value) |
math/log, Log | value = 1 | log(max(value, 0.000001)), natural log |
math/sqrt, Sqrt | value = 1 | sqrt(max(value, 0)) |
math/reciprocal, Reciprocal | value = 1 | 1 / max(value, 0.000001) |
math/tan, Tan | value = 0 | tan(value) |
math/asin, Asin | value = 0 | asin(clamp(value, -1, 1)) |
math/acos, Acos | value = 1 | acos(clamp(value, -1, 1)) |
math/radians, To Radians | value = 0 (degrees) | radians(value) |
math/degrees, To Degrees | value = 0 (radians) | degrees(value) |
Vector
Header colour green.
| Node | Inputs | Outputs | What it does |
|---|---|---|---|
vector/split_vec2, Split Vec2 | vector: Vec2 = (0, 0) | x, y: Float | Unpacks a Vec2 |
vector/split_vec3, Split Vec3 | vector: Vec3 = (0, 0, 0) | x, y, z: Float | Unpacks a Vec3 |
vector/combine_vec2, Combine Vec2 | x, y: Float = 0 | vector: Vec2 | Packs a Vec2 |
vector/combine_vec3, Combine Vec3 | x, y, z: Float = 0 | vector: Vec3 | Packs a Vec3 |
vector/combine_vec4, Combine Vec4 | x, y, z: Float = 0, w: Float = 1 | vector: Vec4 | Packs a Vec4 |
vector/dot, Dot Product | a, b: Vec3 = (0, 0, 0) | result: Float | dot(a, b) |
vector/cross, Cross Product | a: Vec3 = (1, 0, 0), b: Vec3 = (0, 1, 0) | result: Vec3 | cross(a, b) |
vector/normalize, Normalize | vector: Vec3 = (1, 0, 0) | result: Vec3 | normalize(vector) |
vector/distance, Distance | a, b: Vec3 = (0, 0, 0) | result: Float | distance(a, b) |
vector/length, Length | vector: Vec3 = (0, 0, 0) | result: Float | length(vector) |
vector/reflect, Reflect | incident: Vec3, normal: Vec3 | result: Vec3 | reflect(incident, normal) |
vector/refract, Refract | incident: Vec3, normal: Vec3 = (0, 1, 0), eta: Float = 1 [IOR Ratio] | result: Vec3 | refract(incident, normal, eta) |
vector/swizzle, Swizzle | vector: Vec4 = (0, 0, 0, 1); settings out_x = 0, out_y = 1, out_z = 2, out_w = 3 | vector: Vec4 | Each output channel picks 0 = X, 1 = Y, 2 = Z, 3 = W, 4 = zero, 5 = one |
Color
Constants, colour space and grading. The four constant nodes have no input
pins: their value is the node's color or value setting. Header colour
amber.
| Node | Inputs | Outputs | What it does |
|---|---|---|---|
color/constant, Color | setting color (white when unset) | color: Color, rgb: Vec3, r, g, b, a: Float | A constant colour |
color/float, Float | setting value | value: Float | A constant scalar |
color/vec2, Vec2 | setting value | value: Vec2 | A constant Vec2 |
color/vec3, Vec3 | setting value | value: Vec3 | A constant Vec3 |
color/lerp, Color Lerp | a: Color = (0, 0, 0, 1), b: Color = (1, 1, 1, 1), t: Float = 0.5 | color: Color | mix(a, b, t) |
color/cosine_palette, Cosine Palette | t: Float = 0, a: Vec3 = (0.5, 0.5, 0.5) [Bias], b: Vec3 = (0.5, 0.5, 0.5) [Amplitude], c: Vec3 = (1, 1, 1) [Frequency], d: Vec3 = (0, 0.33, 0.67) [Phase] | color: Vec3 | a + b * cos(2 pi (c * t + d)) |
color/fresnel, Fresnel | power: Float = 5 | result: Float | pow(1 - max(dot(view_dir, world_normal), 0), power): bright at grazing angles |
color/srgb_to_linear, sRGB → Linear | color: Color = (1, 1, 1, 1) | result: Color | Piecewise sRGB decode |
color/linear_to_srgb, Linear → sRGB | color: Color = (1, 1, 1, 1) | result: Color | Piecewise sRGB encode |
color/rgb_to_hsv, RGB → HSV | rgb: Vec3 = (1, 0, 0) | hsv: Vec3, h, s, v: Float | RGB to hue, saturation, value |
color/hsv_to_rgb, HSV → RGB | hsv: Vec3 = (0, 1, 1) | rgb: Vec3 | Back to RGB |
color/hue_shift, Hue Shift | rgb: Vec3 = (1, 0, 0), shift: Float = 0 | rgb: Vec3 | Rotates hue by shift (1 is a full turn) |
color/luminance, Luminance | rgb: Vec3 = (1, 1, 1) | value: Float | Rec.709 luminance |
color/gamma, Gamma | color: Color = (1, 1, 1, 1), gamma: Float = 2.2 | result: Color | pow(rgb, gamma), alpha unchanged |
color/brightness_contrast, Brightness / Contrast | color: Color = (0.5, 0.5, 0.5, 1), brightness: Float = 0, contrast: Float = 1 | result: Color | (rgb - 0.5) * contrast + 0.5 + brightness, alpha unchanged |
color/saturation, Saturation | color: Color = (1, 1, 1, 1), saturation: Float = 1 | result: Color | Mixes from Rec.709 grey (0) through the original (1) and beyond |
color/blend, Blend | base: Color = (0.5, 0.5, 0.5, 1), blend: Color = (1, 1, 1, 1), opacity: Float = 1; setting mode = 0 | result: Color | Layer blend. mode: 0 normal, 1 multiply, 2 screen, 3 overlay, 4 add, 5 subtract, 6 soft light, 7 hard light, 8 difference, 9 divide |
Procedural
Patterns computed in the shader. Header colour violet.
Noise
| Node | Inputs | Outputs | What it does |
|---|---|---|---|
procedural/noise_perlin, Perlin Noise | uv: Vec2, scale: Float = 10 | value: Float | Smooth gradient noise |
procedural/noise_simplex, Simplex Noise | uv: Vec2, scale: Float = 10 | value: Float | Gradient noise with fewer directional artifacts |
procedural/noise_voronoi, Voronoi | uv: Vec2, scale: Float = 5 | distance [F1], f2, edge, cell_id: Float | Cell noise: nearest and second-nearest distance, distance to the cell edge, and a per-cell id |
procedural/noise_fbm, FBM Noise | uv: Vec2, scale = 5, octaves = 4, lacunarity = 2, persistence = 0.5 | value: Float | Fractal Brownian motion: layered noise |
procedural/noise_ridged, Ridged FBM | uv: Vec2, scale = 4, octaves = 4, lacunarity = 2, persistence = 0.5 | value: Float | Ridged multifractal: sharp crests |
procedural/noise_turbulence, Turbulence | uv: Vec2, scale = 4, octaves = 5, lacunarity = 2, persistence = 0.5 | value: Float | Absolute noise summed over octaves |
procedural/noise_billow, Billow Noise | uv: Vec2, scale = 4, octaves = 4, lacunarity = 2, persistence = 0.5 | value: Float | Squared absolute noise summed over octaves: rounded, puffy shapes |
procedural/noise_white, White Noise | uv: Vec2, scale: Float = 50 | value: Float | Uncorrelated random value per cell |
procedural/noise_curl, Curl Noise | uv: Vec2, scale = 3, epsilon = 0.01 | flow: Vec2 | Divergence-free 2D flow field |
Triplanar noise
World-space noise projected on the X, Y and Z planes and blended by the world normal, so no UVs and no seams.
| Node | Inputs | Outputs |
|---|---|---|
procedural/noise_triplanar_fbm, Triplanar FBM | scale = 1, octaves = 4, lacunarity = 2, persistence = 0.5, sharpness = 4 | value: Float |
procedural/noise_triplanar_ridged, Triplanar Ridged | scale = 1, octaves = 4, lacunarity = 2, persistence = 0.5, sharpness = 4 | value: Float |
procedural/noise_triplanar_turbulence, Triplanar Turbulence | scale = 1, octaves = 5, lacunarity = 2, persistence = 0.5, sharpness = 4 | value: Float |
procedural/noise_triplanar_billow, Triplanar Billow | scale = 1, octaves = 4, lacunarity = 2, persistence = 0.5, sharpness = 4 | value: Float |
procedural/noise_triplanar_voronoi, Triplanar Voronoi | scale = 3, sharpness = 4 | distance [F1], cell_id: Float |
Patterns and gradients
| Node | Inputs | Outputs | What it does |
|---|---|---|---|
procedural/checkerboard, Checkerboard | uv: Vec2, scale: Float = 8 | value: Float | Alternating 0 and 1 |
procedural/gradient, Gradient | uv: Vec2 | u, v: Float | The UV's two ramps |
procedural/brick, Brick | uv: Vec2, scale: Vec2 = (4, 8), mortar: Float = 0.05 | value: Float | Offset rows of bricks with mortar lines |
procedural/gradient_radial, Radial Gradient | uv: Vec2 = (0.5, 0.5), center: Vec2 = (0.5, 0.5), radius = 0.5, softness = 0.3 | value: Float | 0 at the centre to 1 at radius, with soft falloff |
procedural/gradient_linear, Linear Gradient | uv: Vec2 = (0.5, 0.5), angle: Float = 0 (radians, 0 is +X), center: Vec2 = (0.5, 0.5) | value: Float | Ramp along a direction |
procedural/gradient_angular, Angular Gradient | uv: Vec2 = (0.5, 0.5), center: Vec2 = (0.5, 0.5), offset: Float = 0 | value: Float | 0 to 1 around the centre |
procedural/gradient_diamond, Diamond Gradient | uv: Vec2 = (0.5, 0.5), center: Vec2 = (0.5, 0.5), size: Float = 0.5 | value: Float | Manhattan-distance falloff around the centre |
Height, warp and anti-tiling
| Node | Inputs | Outputs | What it does |
|---|---|---|---|
procedural/normal_from_height, Normal From Height (tangent) | height: Float = 0, strength: Float = 1 | normal: Vec3 | Tangent-space normal (Z up) from a height, by screen-space derivatives |
procedural/world_normal_from_height, World Normal From Height | height: Float = 0, strength: Float = 1 | normal: Vec3 | World-space perturbed normal, with the tangent frame rebuilt per fragment from derivatives of the world position, so it works on any orientation. Wire it straight into Surface Output's normal |
procedural/domain_warp, Domain Warp | uv: Vec2, scale: Float = 1.5, strength: Float = 0.35, offset: Vec2 = (5.2, 1.3) | uv: Vec2 | Offsets UVs by FBM noise |
procedural/bump_offset, Bump Offset | uv: Vec2, height: Float = 0, reference: Float = 0.5, strength: Float = 0.05 | uv: Vec2 | Cheap parallax: shifts UVs along the view vector by a height |
procedural/hex_tile, Hex Tile UV | uv: Vec2, scale: Float = 1, variation: Float = 1 | uv1, uv2, uv3: Vec2, w1, w2, w3: Float | Hexagonal anti-tiling. Sample one texture with all three UVs and blend by the weights; variation is the random rotation per cell (0 plain tiling, 1 full scramble) |
Animation
Functions of globals.time. Header colour teal.
| Node | Inputs | Outputs | What it does |
|---|---|---|---|
animation/uv_scroll, UV Scroll | uv: Vec2, speed: Vec2 = (0.1, 0) | uv: Vec2 | uv + speed * time |
animation/flow_map, Flow Map | uv: Vec2, flow: Vec2 = (0.1, 0), speed: Float = 1, strength: Float = 0.1 | uv1, uv2: Vec2, blend: Float | Two UV phases half a cycle apart and the weight to crossfade them. Sample twice and mix by blend |
animation/sine_wave, Sine Wave | frequency = 1, amplitude = 1, offset = 0 | value: Float | sin(time * frequency + offset) * amplitude |
animation/ping_pong, Ping Pong | speed: Float = 1 | value: Float | Triangle wave, 0 to 1 to 0 |
animation/wind, Wind | strength = 0.3, speed = 1, direction: Vec2 = (1, 0), turbulence = 0.2, mask = 1 | displacement: Vec3 | A sway offset along direction (X and Z), phased by world position. Meant for a Vegetation Output's vertex_offset |
animation/flipbook_uv, Flipbook UV | uv: Vec2, frame: Float = 0, cols: Float = 4, rows: Float = 4 | uv: Vec2 | The UV of one frame of a cols by rows sheet; frame wraps. Drive it with time * fps |
Utility
Header colour slate.
| Node | Inputs | Outputs | What it does |
|---|---|---|---|
utility/world_pos_mask, World Position Mask | height: Float = 10, falloff: Float = 2 | mask: Float | saturate((world_y - height) / falloff): snow on peaks, water lines |
utility/slope_mask, Slope Mask | threshold: Float = 0.5, falloff: Float = 0.2 | mask: Float | smoothstep of the world normal's Y around threshold: flat ground against cliffs |
utility/depth_fade, Depth Fade | distance: Float = 1 | fade: Float | saturate(world_y / distance). Despite the name it does not read scene depth; for a real proximity fade use scene/depth_fade |
utility/dpdx, DDX | value: Float = 0 | result: Float | dpdx(value) |
utility/dpdy, DDY | value: Float = 0 | result: Float | dpdy(value) |
utility/fwidth, FWidth | value: Float = 0 | result: Float | fwidth(value) |
utility/dither, Dither | none | value: Float | 4 by 4 Bayer threshold from the screen position |
utility/hash, Hash | value: Vec2 = (0, 0) | result: Float | Deterministic 0 to 1 hash |
Control
Header colour yellow. Material functions' bracket and call nodes are also in this category; they are listed under Functions.
| Node | Inputs | Outputs | What it does |
|---|---|---|---|
control/if, If | condition: Float = 0, threshold: Float = 0.5, if_true: Vec4 = (1, 1, 1, 1), if_false: Vec4 = (0, 0, 0, 1) | result: Vec4 | select(if_false, if_true, condition > threshold). Both sides are computed |
control/static_switch, Static Switch | a: Vec4 = (1, 1, 1, 1), b: Vec4 = (0, 0, 0, 1); setting use_a = true | result: Vec4 | Compile-time choice: only the chosen input's subgraph is emitted |
control/component_mask, Component Mask | vector: Vec4 = (0, 0, 0, 1); settings keep_r, keep_g, keep_b = true, keep_a = false | vector: Vec4 | Zeroes the channels not kept |
control/greater_than, Greater Than | a, b: Float = 0 | result: Float | 1 if a > b, else 0 |
control/less_than, Less Than | a, b: Float = 0 | result: Float | 1 if a < b, else 0 |
control/equal, Equal | a, b: Float = 0, epsilon: Float = 0.001 | result: Float | 1 if abs(a - b) < epsilon, else 0 |
control/not_equal, Not Equal | a, b: Float = 0, epsilon: Float = 0.001 | result: Float | 1 if abs(a - b) >= epsilon, else 0 |
control/and, And | a, b: Float = 1 | result: Float | min(a, b) |
control/or, Or | a, b: Float = 0 | result: Float | max(a, b) |
control/not, Not | value: Float = 0 | result: Float | 1 - value |
Functions
Reusable subgraphs stored as .material_function files beside the material
(see Material API).
Category Control.
| Node | Inputs | Outputs | What it does |
|---|---|---|---|
function/input_point, Function Inputs | none | in_0 to in_3: Vec4 | Inside a function: the call site's four inputs |
function/output_point, Function Outputs | out_0 to out_3: Vec4 = (0, 0, 0, 0) | none | Inside a function: what it returns |
function/call, Function Call | in_0 to in_3: Vec4 = (0, 0, 0, 0); setting function (the name) | out_0 to out_3: Vec4 | Calls the named function. An empty or unknown name, or a recursive call, outputs zeros |
Scene
Reads of the frame's other buffers. Each depends on something the view may
not have, so each is gated with @if on its flag and falls back to the value
given here instead of failing to compile. Every one except Pixel Depth,
Refraction UV Offset and Screen UV is refused in a Sprite graph. A graph that
reads scene depth, scene normal, motion vectors, scene colour or the
environment map has no deferred G-buffer branch. Header colour cyan.
| Node | Inputs | Outputs | What it does |
|---|---|---|---|
scene/pixel_depth, Pixel Depth | none | depth: Float | Linear view-space depth of this fragment |
scene/scene_depth, Scene Depth | none | depth: Float | Linear depth of the opaque scene at this pixel, from the depth prepass. 1.0e6 without DepthPrepass |
scene/depth_fade, Scene Depth Fade | distance: Float = 1 | fade: Float | 0 where this surface meets the opaque scene, 1 once the scene is distance behind it: shoreline foam, soft intersections. 1 without DepthPrepass |
scene/scene_normal, Scene Normal | none | normal: Vec3 | World normal from the normal prepass. +Y without NormalPrepass |
scene/motion_vector, Motion Vector | none | velocity: Vec2, speed: Float | Screen-space motion from the motion vector prepass. Zero without MotionVectorPrepass |
scene/refraction_uv_offset, Refraction UV Offset | normal: Vec3 = (0, 0, 1), strength: Float = 0.05 | offset: Vec2 | normal.xy * strength, a screen-UV offset for refraction |
scene/screen_uv, Screen UV | none | uv: Vec2 | Screen UV of the fragment, (0, 0) top left to (1, 1) bottom right |
scene/scene_color, Scene Color (stub) | uv: Vec2 = (0.5, 0.5) | color: Color, rgb: Vec3 | Samples Bevy's view transmission texture. It is bound only when the camera has ScreenSpaceTransmission and filled only when something in the scene is transmissive; black otherwise. For sky in a refraction use Environment Map Sample |
scene/env_map_sample, Environment Map Sample | direction: Vec3 = (0, 1, 0), mip_level: Float = 0 | color: Color, rgb: Vec3 | The view's environment map along a direction; higher mips are blurrier. Black when the view has none |
scene/env_map_reflect, Environment Map Reflect | normal: Vec3 = (0, 1, 0), mip_level: Float = 0 | color: Color, rgb: Vec3 | The view direction reflected off normal, then sampled as above |
Landscape
What a terrain material is built from (see Terrain). A terrain binds its painted layer weights and bounds to its own copy of the material. On any other mesh these still compile: coordinates are world X and Z, and the first layer's weight is 1 and the rest 0. Surface, Vegetation and Unlit graphs can use them; a Sprite graph cannot. Header colour green.
| Node | Inputs | Outputs | What it does |
|---|---|---|---|
landscape/layer_coords, Landscape Layer Coords | scale: Float = 4 [Mapping Scale (m)], rotation: Float = 0 [degrees], pan: Vec2 = (0, 0) [metres] | uv: Vec2 | Coordinates across the whole terrain in metres from its corner, so tiling never restarts at a chunk edge |
landscape/layer_blend, Layer Blend | for each layer i from 0 to 7: name_i: String = "Layer i+1", blend_i: String = "Weight", layer_i: Vec4, height_i: Float = 0.5, auto_i: Float = 0; then height_blending: Float = 0.8 | result: Vec4, rgb: Vec3, normal: Vec3 (normalized), value: Float | Mixes up to eight named layers by the painted weights. blend_i is Weight (an even mix), Height (the taller layer wins where two meet, using height_i; height_blending sets how crisp) or Alpha (laid over the rest by its weight). auto_i paints the layer on by rule, over the painted weights. Unwired layers are ignored. One value type per node: use one Layer Blend each for colour, normal and roughness, with the same names |
landscape/layer_sample, Layer Sample | name: String = "Layer 1" | weight: Float | The painted weight of one named layer. A name no Layer Blend uses is a layer of its own, still paintable |
landscape/slope, Landscape Slope | none | degrees: Float, height: Float, normal_y: Float | Slope from flat in degrees (0 level, 90 a wall), world height in metres, and the normal's Y |
The layer names, in the order the Layer Blends (by node id, then slot) and
then the Layer Samples name them, are the layers the terrain's Paint tab
lists, at most eight (LANDSCAPE_MAX_LAYERS). From code:
renzora_shader::material::landscape::landscape_layers(&graph), also returned
as CompileResult::landscape_layers.
Custom
Header colour red.
custom/code, Custom Code. Inputs code: String = "result = a;" [WGSL],
a: Vec4 = (0, 0, 0, 1), b, c, d: Vec4 = (0, 0, 0, 0). Outputs
result: Vec4, rgb: Vec3, x, y, z, w: Float. WGSL has no
value-returning blocks, so the snippet becomes the body of a generated helper
mat_custom_<id>(a, b, c, d) with result declared as opaque black; assign
it:
result = a * b + vec4<f32>(sin(c.x), 0.0, 0.0, 1.0);
A compile error inside the snippet points at the node, through the shader's node line map.
Output
One per graph, set by the domain; it cannot be removed. An unwired pin uses the constant stored on the node, or the default given. Header colour dark red.
output/surface, Surface Output
| Pin | Type | Default | Drives |
|---|---|---|---|
base_color | Color | (0.8, 0.8, 0.8, 1) | Albedo, multiplied by vertex colour |
metallic | Float | 0 | Metalness |
roughness | Float | 0.5 | Perceptual roughness |
normal | Vec3 | none | Surface normal |
displacement | Float | 0 | Height for parallax occlusion mapping (white is the peak). Only a connection does anything; needs mesh tangents |
displacement_scale | Float | 0.05 | Parallax depth. Read as a literal, not an expression, because it is a loop constant |
emissive | Vec3 | (0, 0, 0) | Emission |
ao | Float | 1 | Ambient occlusion |
alpha | Float | 1 | Opacity, multiplied by vertex alpha |
reflectance | Vec3 | (0.5, 0.5, 0.5) | Dielectric specular reflectance |
specular_transmission | Float | 0 | Refraction (glass, water) |
diffuse_transmission | Float | 0 | Light through thin surfaces (leaves, skin) |
thickness | Float | 0 | Volume thickness |
ior | Float | 1.5 | Index of refraction |
attenuation_distance | Float | 1.0e37 | Distance over which light attenuates; 1.0e37 means never |
attenuation_color | Vec3 | (1, 1, 1) | Colour light attenuates toward |
clearcoat | Float | 0 | Second specular layer (car paint) |
clearcoat_roughness | Float | 0.5 | Its roughness |
anisotropy_strength | Float | 0 | Directional specular (brushed metal, hair) |
anisotropy_rotation | Float | 0 | Its direction |
Wiring either transmission pin, or storing a value above zero on it, turns on
Bevy's transmission pipeline for the material (requires_transmission).
output/vegetation, Vegetation Output
| Pin | Type | Default |
|---|---|---|
base_color | Color | (0.2, 0.5, 0.1, 1) |
metallic | Float | 0 |
roughness | Float | 0.7 |
normal | Vec3 | none |
emissive | Vec3 | (0, 0, 0) |
ao | Float | 1 |
alpha | Float | 1 |
vertex_offset | Vec3 | (0, 0, 0) |
The generated vertex stage adds vertex_offset to the world position; wire
Wind (or any Vec3) into it for sway. Only these eight pins exist: the other
Surface pins are not available on Vegetation.
output/unlit, Unlit Output
Pins color: Color = (1, 1, 1, 1) and alpha: Float = 1. The base material
is set unlit, so lighting returns the colour unchanged.
output/sprite, Sprite Output
Pins color: Color and alpha: Float, both without a default: an unwired
color is the sprite's own texture and an unwired alpha keeps that colour's
alpha, so an empty Sprite graph draws the sprite unchanged. The sprite's tint
and alpha mode apply on top.