HELP

Getting Started Deformation Functions Writing Shortcuts Keyboard Shortcuts Coordinate Systems Shader Editor Symmetry & Transforms Import / Export

Getting Started

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.

Quick start

  • Pick a form from the radio list on the left (Catenoid, Torus, Mobius...)
  • Adjust the U / V range sliders to change how much of the surface is drawn
  • Adjust the Steps U / V sliders to change mesh resolution
  • Edit the X, Y, Z equations directly to define a custom surface
  • Use variables A–M (right panel) as real-time parameters in your equations

Available variables

VariableDescription
u, vParametric coordinates of the surface
x, y, zCartesian vertex position
xN, yN, zNVertex normal components (normal deformation)
tTime (animated)
A – MUser-adjustable mesh variable sliders
P, Q, S, T, UShader variable sliders
piπ ≈ 3.14159
eEuler's number e ≈ 2.71828
Normal deformation displaces each vertex of the mesh in the direction perpendicular to its surface, creating organic-looking bumps, waves, and patterns.

Deformation Functions

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.

Surface deformation

FunctionFormulaDescription
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

Fragment shader only (color shader)

FunctionFormulaDescription
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

Math utilities

FunctionFormulaDescription
c(v)cos(v)Short cosine alias
s(v)sin(v)Short sine alias
ca(v)0.5 × cos(v) + 0.5Cosine normalized to [0, 1]
sa(v)0.5 × sin(v) + 0.5Sine 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|pSigned power (preserves sign)

Vector operations

FunctionFormulaDescription
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)

Writing Shortcuts

The equation parser automatically expands shorthand notations. This lets you write compact formulas that get expanded before compilation.

Trigonometric shortcuts

You writeExpands toDescription
cucos(u)c + variable = cos(variable)
cvcos(v)
susin(u)s + variable = sin(variable)
svsin(v)
cxcos(x)Also works with x, y, z, t
sysin(y)
ctcos(t)

Implicit multiplication

Variables and parentheses are automatically multiplied when juxtaposed:

You writeExpands to
2u2*u
uvu*v
3pi3*pi
ABA*B
)()*(

Other shortcuts

You writeExpands toNote
Rh(x,y,z)Radius – distance from origin
llogNatural logarithm
²**2Square
³**3Cube
ù*3mctTime multiplier shortcut
Standalone letters a, b, o, m (when not part of a word) are expanded to their function call form: a(), b(), o(), m().

Keyboard Shortcuts

Camera & View

KeyAction
+Zoom in
-Zoom out
Shift + HCenter camera on origin
Shift + VAlign camera to axis view
Shift + BToggle wireframe
Alt + +Increase auto-rotation speed
Alt + -Decrease auto-rotation speed

UV Parameter Animation

KeyAction
7 / 8Animate U − / + (large step)
0 / 1Animate U − / + (small step)
4 / 5Animate V − / + (large step)
6 / 9Animate V − / + (small step)
uIncrease mesh resolution
jDecrease mesh resolution

Time & Animation

KeyAction
aToggle pause / play
fDouble time speed
qHalve time speed

Colors & Display

KeyAction
hRandomize colors
"Special randomize (high variation)
*Initialize color UI

Other

KeyAction
$Generate random surface
pOpen import dialog
'Toggle UV ↔ XY mode
; / ,Switch writing type − / +
<Toggle form suite mode
Shift + QCopy X equation to Y and Z

Shader Editor

KeyAction
Ctrl + SCompile shader
Ctrl + DDuplicate line

Coordinate Systems

SURFACE supports three coordinate systems. The equations you write in X, Y, Z are interpreted differently depending on the active system.

Cartesian (default)

AxisEquation
Xx = f(u, v)
Yy = f(u, v)
Zz = f(u, v)

Direct mapping – each axis is defined independently as a function of u and v.

Spherical

InputRoleConversion
X → rRadiusx = r × sin(θ) × cos(φ)
Y → θPolar angley = r × sin(θ) × sin(φ)
Z → φAzimuthal anglez = r × cos(θ)

Best for spheres, globes, and closed shells.

Cylindrical

InputRoleConversion
X → rRadiusx = r × cos(θ)
Y → θAngley = r × sin(θ)
Z → zHeightz = z

Best for tubes, spirals, and surfaces of revolution.

Shader Editor

SURFACE includes two GLSL shader editors that let you customize the visual output in real time.

Fragment (Color) Shader

Controls the color of each pixel on the mesh surface. The editable zone starts after vec3 col = meshBg; and ends before // __FOOTER_START__.

  • col – the output color (vec3 RGB)
  • vPosition – vertex position in world space
  • vNormal – surface normal
  • vUV – parametric UV coordinates
  • uTime – elapsed time
  • meshBg – default mesh background color

Normal Deformation Shader

Displaces vertices along their normals. The editable zone is between float result = 0.0; and return result;.

  • result – the displacement amount (float)
  • x, y, z – vertex position
  • nx, ny, nz – normal direction
  • All deformation functions (m, o, f, a, b, etc.) are available

Shader management

  • Select – switch between saved shaders via the dropdown
  • New – create a new shader (named via first-line comment // My Shader)
  • Save – save current shader to browser localStorage
  • Delete – remove current shader
  • Export / Import – download or upload all shaders as a .js file
  • Opt 1, 2, 3 – toggle shader options (checkboxes)
Shaders are saved in localStorage. The storage indicator shows "Local" when you have local modifications, or "Server" / "Default" when using the originals.

Symmetry & Transformations

Symmetrize

Repeats the mesh along each axis to create symmetric patterns.

ControlDescription
X, Y, ZNumber of repetitions along each axis (1 = no repetition, up to 48)
AngleRotation angle between repetitions
CheckerboardAlternating pattern of repetitions (0 = off)
ScaleScale factor for normal deformation
S orderOrder in which X, Y, Z symmetries are applied (click to cycle)
S ADD / MULAdditive or multiplicative symmetry blending

Transformations

TransformDescription
Scaling X/Y/ZScale the mesh along each axis
Rotation X/Y/ZRotate the mesh (in radians)
Position X/Y/ZTranslate the mesh
Center Symmetry X/Y/ZMove the symmetry center point

Blender

Blends two surface components together:

  • U (X/Y/Z) – first blend factor per axis
  • O (X/Y/Z) – second blend factor per axis

Waves

The Waves panel adds normal-based wave deformation with linked sliders:

  • Norm X/Y/Z – wave amplitude per axis
  • n X/Y/Z – wave frequency coefficient per axis

Colors

ControlDescription
Add R/G/BAdd a constant color offset to the shader output
TintOverall color intensity multiplier (0–2)

Import / Export

Export formats

FormatDescriptionBest for
JSONFull parametric surface data (equations, parameters, colors)Reloading in SURFACE
OBJStandard 3D mesh (vertices + faces)Blender, Maya, 3D printing prep
STLTriangulated mesh3D printing

Import

  • JSON – restores a previously exported SURFACE scene
  • OBJ – loads an external 3D mesh (replaces current surface)
  • Example JSON surfaces are available in the import dialog dropdown

Shader files

  • Export shaders – downloads all fragment/normal shaders as a .js file
  • Import shaders – load shaders from a .js file (replace or append)

Export mesh - Weight in OBJ

Cancel Export

Import mesh

File

BABYLONJS ROTATION CONVENTIONS

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)

code Éditeur de Shader GLSL
fullscreen close
Opt 1,2,3
add save delete file_download file_upload
refreshRéinitialiser buildCompiler
code Éditeur de Shader GLSL - Normal déformation
fullscreen close
Opt 1,2,3
add save delete file_download file_upload
refreshRéinitialiser buildCompiler