SURFACE lets you create and explore parametric surfaces in real time. Write a mathematical equation f(u, v) in the X, Y, Z input fields and the mesh will update instantly.
| Variable | Description |
|---|---|
| u, v | Parametric coordinates of the surface |
| x, y, z | Cartesian vertex position |
| xN, yN, zN | Vertex normal components (normal deformation) |
| t | Time (animated) |
| A – M | User-adjustable mesh variable sliders |
| P, Q, S, T, U | Shader variable sliders |
| pi | π ≈ 3.14159 |
| e | Euler's number e ≈ 2.71828 |
These functions are available in both the equation inputs and the normal deformation shader. The variables gx, gy, gz refer to vertex position, and gu, gv to parametric coordinates.
| Function | Formula | Description |
|---|---|---|
| m() m(c) m(cx,cy,cz) |
cos(cx·x) × cos(cy·y) × cos(cz·z) | Multiplicative cosine – creates a 3D grid-like pattern |
| o() o(c) o(cx,cy,cz) |
cos(cx·x) + cos(cy·y) + cos(cz·z) | Additive cosine – creates gyroid / Schwarz-like shapes |
| f(nc, np) f(nc, npx, npy, npz) f(ncx,npx,ncy,npy,ncz,npz) |
cos(nc·x + np) × cos(nc·y + np) × cos(nc·z + np) | Phase-shifted cosine product – like m() with phase offset |
| a() a(n) a(nU, nV) |
cos(nU·u) × sin(nV·v) | Angular UV deformation – pattern tied to parametric coords |
| b() b(c) b(cx,cy,cz) |
length(cos(cx·x), cos(cy·y), cos(cz·z)) | Euclidean length of cosines |
| ce(c) | cos(ec|x|) × cos(ec|y|) × cos(ec|z|) | Exponential cosine – rapid frequency increase outward |
| se(c) | sin(ec|x|) × sin(ec|y|) × sin(ec|z|) | Exponential sine – same as ce() but with sin |
| Function | Formula | Description |
|---|---|---|
| hc(x,y,z) hc(vec3 p) hc(x,y,z,c) |
length(cos(x), cos(y), cos(z)) | Hypot of cosines – for color patterns |
| Function | Formula | Description |
|---|---|---|
| c(v) | cos(v) | Short cosine alias |
| s(v) | sin(v) | Short sine alias |
| ca(v) | 0.5 × cos(v) + 0.5 | Cosine normalized to [0, 1] |
| sa(v) | 0.5 × sin(v) + 0.5 | Sine normalized to [0, 1] |
| h(x,y) / h(x,y,z) | length(vec2/3(...)) | Euclidean distance (hypot) |
| q(a, b, t) | mix(a, b, t) | Linear interpolation |
| r(e0, e1, x) | smoothstep(e0, e1, x) | Smooth Hermite interpolation |
| g(edge, x) | step(edge, x) | Step function (0 or 1) |
| cpow(v, p) | sign(v) × |v|p | Signed power (preserves sign) |
| Function | Formula | Description |
|---|---|---|
| cr(x1,y1,z1, x2,y2,z2) | cross(v1, v2) | Cross product (returns vec3) |
| crl(x1,y1,z1, x2,y2,z2) | length(cross(v1, v2)) | Cross product length |
| cc(x1,y1, x2,y2) | dot(v1, v2) | Dot product (2D or 3D) |
The equation parser automatically expands shorthand notations. This lets you write compact formulas that get expanded before compilation.
| You write | Expands to | Description |
|---|---|---|
| cu | cos(u) | c + variable = cos(variable) |
| cv | cos(v) | |
| su | sin(u) | s + variable = sin(variable) |
| sv | sin(v) | |
| cx | cos(x) | Also works with x, y, z, t |
| sy | sin(y) | |
| ct | cos(t) |
Variables and parentheses are automatically multiplied when juxtaposed:
| You write | Expands to |
|---|---|
| 2u | 2*u |
| uv | u*v |
| 3pi | 3*pi |
| AB | A*B |
| )( | )*( |
| You write | Expands to | Note |
|---|---|---|
| R | h(x,y,z) | Radius – distance from origin |
| l | log | Natural logarithm |
| ² | **2 | Square |
| ³ | **3 | Cube |
| ù | *3mct | Time multiplier shortcut |
| Key | Action |
|---|---|
| + | Zoom in |
| - | Zoom out |
| Shift + H | Center camera on origin |
| Shift + V | Align camera to axis view |
| Shift + B | Toggle wireframe |
| Alt + + | Increase auto-rotation speed |
| Alt + - | Decrease auto-rotation speed |
| Key | Action |
|---|---|
| 7 / 8 | Animate U − / + (large step) |
| 0 / 1 | Animate U − / + (small step) |
| 4 / 5 | Animate V − / + (large step) |
| 6 / 9 | Animate V − / + (small step) |
| u | Increase mesh resolution |
| j | Decrease mesh resolution |
| Key | Action |
|---|---|
| a | Toggle pause / play |
| f | Double time speed |
| q | Halve time speed |
| Key | Action |
|---|---|
| h | Randomize colors |
| " | Special randomize (high variation) |
| * | Initialize color UI |
| Key | Action |
|---|---|
| $ | Generate random surface |
| p | Open import dialog |
| ' | Toggle UV ↔ XY mode |
| ; / , | Switch writing type − / + |
| < | Toggle form suite mode |
| Shift + Q | Copy X equation to Y and Z |
| Key | Action |
|---|---|
| Ctrl + S | Compile shader |
| Ctrl + D | Duplicate line |
SURFACE supports three coordinate systems. The equations you write in X, Y, Z are interpreted differently depending on the active system.
| Axis | Equation |
|---|---|
| X | x = f(u, v) |
| Y | y = f(u, v) |
| Z | z = f(u, v) |
Direct mapping – each axis is defined independently as a function of u and v.
| Input | Role | Conversion |
|---|---|---|
| X → r | Radius | x = r × sin(θ) × cos(φ) |
| Y → θ | Polar angle | y = r × sin(θ) × sin(φ) |
| Z → φ | Azimuthal angle | z = r × cos(θ) |
Best for spheres, globes, and closed shells.
| Input | Role | Conversion |
|---|---|---|
| X → r | Radius | x = r × cos(θ) |
| Y → θ | Angle | y = r × sin(θ) |
| Z → z | Height | z = z |
Best for tubes, spirals, and surfaces of revolution.
SURFACE includes two GLSL shader editors that let you customize the visual output in real time.
Controls the color of each pixel on the mesh surface. The editable zone starts after vec3 col = meshBg; and ends before // __FOOTER_START__.
Displaces vertices along their normals. The editable zone is between float result = 0.0; and return result;.
Repeats the mesh along each axis to create symmetric patterns.
| Control | Description |
|---|---|
| X, Y, Z | Number of repetitions along each axis (1 = no repetition, up to 48) |
| Angle | Rotation angle between repetitions |
| Checkerboard | Alternating pattern of repetitions (0 = off) |
| Scale | Scale factor for normal deformation |
| S order | Order in which X, Y, Z symmetries are applied (click to cycle) |
| S ADD / MUL | Additive or multiplicative symmetry blending |
| Transform | Description |
|---|---|
| Scaling X/Y/Z | Scale the mesh along each axis |
| Rotation X/Y/Z | Rotate the mesh (in radians) |
| Position X/Y/Z | Translate the mesh |
| Center Symmetry X/Y/Z | Move the symmetry center point |
Blends two surface components together:
The Waves panel adds normal-based wave deformation with linked sliders:
| Control | Description |
|---|---|
| Add R/G/B | Add a constant color offset to the shader output |
| Tint | Overall color intensity multiplier (0–2) |
| Format | Description | Best for |
|---|---|---|
| JSON | Full parametric surface data (equations, parameters, colors) | Reloading in SURFACE |
| OBJ | Standard 3D mesh (vertices + faces) | Blender, Maya, 3D printing prep |
| STL | Triangulated mesh | 3D printing |
X = PITCH
Y = YAW
Z = ROLL
BABYLON.Matrix.RotationYawPitchRoll(Y, X, Z)
alpha = ROT Y = YAW
beta = ROT Z = ROLL
theta = ROT X = PITCH
BABYLON.Matrix.RotationYawPitchRoll(alpha, theta, beta)