Create SDF field
create_sdf_fieldConstruct a programmable SDF raymarcher in TouchDesigner using a CSG tree of sphere, box, and torus primitives with boolean operations and live controls.
Instructions
Build a programmable signed-distance-field (SDF) raymarcher in TouchDesigner as a self-contained GLSL TOP. Compose a CSG tree of sphere / box / torus primitives with union / intersect / subtract boolean ops and optional smooth blending. Exposes live CameraZ / Speed / StepCount / Intensity / Rotate / ColorA / ColorB / Background controls and previews the output.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| primitives | No | CSG tree of SDF primitives (max 16). First prim is always union (root). Each subsequent prim is combined with the running fold via its op. | |
| camera_z | No | Camera distance from origin (uCameraZ). Live 'CameraZ' control. | |
| camera_target | No | Look-at point baked as GLSL constant (not a live control). | |
| speed | No | Animation speed multiplier (drives uTime). Live 'Speed' control. | |
| step_count | No | Raymarch iterations (uSteps); SDF CSG benefits from more steps. Live 'StepCount'. | |
| intensity | No | Output brightness multiplier (uIntensity). Live 'Intensity' control. | |
| light_direction | No | Light direction normalised in shader — baked as GLSL constant. | |
| color_a | No | Near colour hex (e.g. '#33ccff'). Live RGB swatch 'ColorA'. | #33ccff |
| color_b | No | Far colour hex (e.g. '#ff2266'). Live RGB swatch 'ColorB'. | #ff2266 |
| background | No | Background / miss colour hex. Live RGB swatch 'Background'. | #06080c |
| rotate_scene | No | Y-axis rotation speed (radians/s applied to SDF space via uRotate * uTime). Live 'Rotate'. Reads 0 when TD timeline is paused. | |
| resolution | No | Output resolution [width, height] of the GLSL TOP. | |
| expose_controls | No | Expose live CameraZ/Speed/StepCount/Intensity/Rotate/ColorA/ColorB/Background controls. | |
| parent_path | No | Parent COMP path the self-contained 'sdf_field' container is created inside. | /project1 |