Documentation / Node reference / mat nodes
mat/RaymarchingBuilder
Builds a raymarched material from a graph of code/ SDF nodes inside it.
Builder
Go inside this node and describe a shape as a signed distance function, using the code/SDF nodes and a code/Output to collect the result. The material then draws that shape by marching a ray through it per pixel, so what you see is the function itself rather than triangles: it stays smooth however close you get, and shapes can be blended and repeated in ways geometry cannot. It still needs a surface to draw on, usually a box or a sphere large enough to contain the shape. The params here tune the march, and the defaults are a reasonable starting point: reach for them when the shape is clipped, banded, or costing too much.
Parameters
| Name | Type | What it does |
|---|---|---|
| pass | UInt8 ALL · P · N · ALBEDO · AO | What the material outputs. ALL is the shaded result and is what you ship. The others show one part on its own for debugging: P the hit position, N the surface normal, ALBEDO the colour before lighting, and AO the ambient occlusion term. |
| samples | UInt8 | How many rays are marched per pixel. 1 is one ray through the pixel centre. Raising it softens the edges of the shape at a cost that multiplies straight through, since every extra sample is another full march. |
| maxSteps | UInt32 | The most steps one ray may take before it gives up. This is the main cost dial. Too few and the ray stops before reaching the surface, which shows as the shape being eaten away where it is viewed at a glancing angle or far off. |
| maxDist | Float | How far a ray travels before it counts as a miss, in world units. Anything further away than this is not drawn, so raise it if a distant part of the shape is missing and lower it to stop wasting steps on empty space. |
| surfDist | Float | How close a ray must get to count as having hit the surface. Small values give a crisp accurate surface and take more steps to reach; larger values stop the march early, which rounds off fine detail but is cheaper. |
| normalBias | Float | The offset used to work out the surface normal, which is read by sampling the distance function around the hit point. Too small and the normal picks up numerical noise as speckle; too large and it smooths real detail away. |
| aoSamples | UInt32 | How many samples the ambient occlusion term takes, darkening creases and contact points in the marched shape. 0 turns it off. Only shown while pass is AO, since that is the only pass it affects. |
| rayOriginOnSurface | Float | Where each ray starts. 1 starts it at the surface being drawn on, which is the cheap choice and correct while the camera is outside that surface. 0 starts it at the camera instead, which is what you need once the camera can enter the volume. |
| transparencyMode | UInt8 AUTO · OPAQUE · MASK · BLEND | Whether this material is drawn in the opaque pass or through order-independent transparency. AUTO decides from the material itself, which for most materials means its colour alpha below 1. OPAQUE always draws in the opaque pass and ignores alpha entirely, which is what you want for a material whose alpha is incidental. MASK draws in the opaque pass but throws away fragments below alphaCutoff, which is what hard-edged cutouts want: they still write depth, so they occlude each other correctly. BLEND always goes through transparency, which is the only way to get soft texture alpha to show, since nothing on the CPU side can inspect the texels. |
| sides | UInt8 FRONT · BACK · BOTH | Which side of each triangle is drawn. FRONT draws the outward-facing side only, which is what a closed mesh wants: its inner surface is hidden anyway, so drawing it is wasted work. BACK draws the inward-facing side, for a surface seen from the inside such as a skydome or a box the camera sits in. BOTH draws either side, which is what an open single surface needs: a cutout leaf, a sheet of cloth, or a plane the camera can walk around, all of which disappear from one side under FRONT. The shadow pass follows BOTH so an open surface still casts a shadow whichever way it faces the light, and draws FRONT otherwise. |
This page is generated from the engine, so it describes the release you can download. The same text is in the editor's Help panel next to the node itself.