Shape effects

Pick the 2D, 3D or custom SVG shape that Glass, Neon, Emboss and other shape effects draw inside.

Glass, Neon, Emboss and a few others are shape effects: they draw inside a shape you pick with the shape prop.

Each shape is stored as a signed distance field (SDF): for every pixel, how far it is from the shape's edge. Picture a contour map of the shape. The edge sits at zero, and the numbers grow as you move away. That distance is what lets Glass bend light at the edge and Neon glow at a fixed width.

Shapes come in two kinds:

  • 2D: flat outlines such as circles, stars, rounded rectangles, or your own SVG.
  • 3D: solids such as spheres, cubes and toruses. Glass refracts through their volume.

You can also extrude your own SVG into a solid 3D slab.

Setting the shape

Pass a config object to shape. The type key picks the shape, such as circleSDF or sphere3D. Every other key is specific to that shape and optional. A missing key falls back to its default.

Each of these effects draws in a different 2D shape:

<Shader>
  {/* Circle */}
  <Glass shape={{ type: 'circleSDF', radius: 0.35 }} />

  {/* Six-pointed star */}
  <Neon shape={{ type: 'starSDF', radius: 0.35, sides: 6, innerRatio: 0.45 }} />

  {/* Rounded rectangle */}
  <Emboss shape={{ type: 'roundedRectSDF', width: 0.4, height: 0.25, rounding: 0.06 }} />
</Shader>

Without a shape prop, every shape effect uses a sphere: { type: 'sphere3D', radius: 0.35 }. A JSON string of the same config also works.

Using a 2D shape

2D shapes are flat outlines. Sizes are in UV units, where 0.5 is roughly the distance from the center to the edge of the effect's area. Rotations are in degrees.

2D sub-props take plain numbers only. Anything else falls back to the default, so animate sub-props on 3D shapes instead.

Circle (circleSDF)

A circle. Shaders also draws a circle when the config has no type.

PropTypeDefaultDescription
radiusnumber0.35Circle radius

A circle at the default size:

{ "type": "circleSDF", "radius": 0.35 }

Ellipse (ellipseSDF)

A stretched circle with separate horizontal and vertical radii.

PropTypeDefaultDescription
widthnumber0.35Horizontal radius
heightnumber0.25Vertical radius
rotationnumber0Rotation in degrees

A wide, flat ellipse:

{ "type": "ellipseSDF", "width": 0.4, "height": 0.25, "rotation": 0 }

Polygon (polygonSDF)

A regular polygon with any number of sides: triangle, square, hexagon and so on.

PropTypeDefaultDescription
radiusnumber0.35Distance from the center to the middle of each edge
sidesnumber6Number of sides
roundingnumber0Blend toward a circle, 0–1: 0 keeps sharp corners, 1 is a full circle
rotationnumber0Rotation in degrees

A hexagon with slightly softened corners:

{ "type": "polygonSDF", "radius": 0.3, "sides": 6, "rounding": 0.05, "rotation": 0 }

Star (starSDF)

A star with any number of points.

PropTypeDefaultDescription
radiusnumber0.35Distance from the center to each tip
sidesnumber6Number of points
innerRationumber0.4Radius of the inner corners as a fraction of radius. 0.382 gives the classic five-point star.
rotationnumber0Rotation in degrees

A classic five-point star:

{ "type": "starSDF", "radius": 0.35, "sides": 5, "innerRatio": 0.382, "rotation": 0 }

Flower (flowerSDF)

A flower with any number of petals and V-shaped valleys between them.

PropTypeDefaultDescription
radiusnumber0.35Distance from the center to each petal tip
sidesnumber6Number of petals
innerRationumber0.4Valley depth as a fraction of radius: 0.2 gives deep, narrow valleys, 0.8 a subtle scalloped edge
rotationnumber0Rotation in degrees

A six-petal flower with medium valleys:

{ "type": "flowerSDF", "radius": 0.35, "sides": 6, "innerRatio": 0.5, "rotation": 0 }

Ring (ringSDF)

A hollow ring. The effect draws on the band itself, not the hole in the middle.

PropTypeDefaultDescription
radiusnumber0.35Distance from the center to the middle of the band
thicknessnumber0.4Half the band's width, measured each side of its middle

The default thickness is wider than the default radius, so the hole closes. Set both:

{ "type": "ringSDF", "radius": 0.3, "thickness": 0.08 }

Cross (crossSDF)

A plus sign with adjustable arm length, thickness and corner rounding.

PropTypeDefaultDescription
radiusnumber0.35Half the length of each arm
thicknessnumber0.4Half the width of each arm
roundingnumber0Rounds every corner, growing the arms by the same amount
rotationnumber0Rotation in degrees. 45 gives an X.

A slim plus sign:

{ "type": "crossSDF", "radius": 0.25, "thickness": 0.08, "rounding": 0.02, "rotation": 0 }

Rounded rectangle (roundedRectSDF)

A rectangle with evenly rounded corners.

PropTypeDefaultDescription
widthnumber0.35Half the width
heightnumber0.25Half the height
roundingnumber0Corner radius
rotationnumber0Rotation in degrees

A card-shaped rectangle:

{ "type": "roundedRectSDF", "width": 0.35, "height": 0.25, "rounding": 0.05, "rotation": 0 }

Vesica (vesicaSDF)

A lens or eye shape: the overlap of two circles.

PropTypeDefaultDescription
radiusnumber0.35Radius of each circle
spreadnumber0.4Half the distance between the circle centers, as a fraction of radius. 0 is a single circle, 1 an infinitely thin lens.
rotationnumber0Rotation in degrees

An eye shape:

{ "type": "vesicaSDF", "radius": 0.35, "spread": 0.5, "rotation": 0 }

Crescent (crescentSDF)

A moon shape: a large circle with a smaller, offset circle cut out of it.

PropTypeDefaultDescription
radiusnumber0.35Radius of the outer circle
innerRationumber0.4Radius of the cut-out circle as a fraction of radius. Larger values give a thinner crescent.
offsetnumber0.2Horizontal distance between the two circle centers, which sets how much they overlap
rotationnumber0Rotation in degrees

A thin crescent moon:

{ "type": "crescentSDF", "radius": 0.35, "innerRatio": 0.75, "offset": 0.15, "rotation": 0 }

Trapezoid (trapezoidSDF)

A four-sided shape with parallel top and bottom edges of different widths.

PropTypeDefaultDescription
bottomWidthnumber0.35Half the width of the bottom edge
topWidthnumber0.4Half the width of the top edge
heightnumber0.25Half the height
rotationnumber0Rotation in degrees

A trapezoid that narrows toward the top:

{ "type": "trapezoidSDF", "bottomWidth": 0.35, "topWidth": 0.2, "height": 0.25, "rotation": 0 }

Heart (heartSDF)

A heart, point down.

PropTypeDefaultDescription
radiusnumber0.35Size: the heart fits within this radius
rotationnumber0Rotation in degrees

A heart:

{ "type": "heartSDF", "radius": 0.32, "rotation": 0 }

Arc (arcSDF)

A filled pie wedge. At 360 it closes into a full circle.

PropTypeDefaultDescription
radiusnumber0.35Radius of the wedge
aperturenumber270Opening angle in degrees, 0 to 360
rotationnumber0Rotation in degrees

A three-quarter wedge:

{ "type": "arcSDF", "radius": 0.38, "aperture": 270, "rotation": 0 }

Teardrop (teardropSDF)

A round bulb that tapers to a point. Keep height larger than radius, or the point sits inside the bulb and the shape reads as a circle.

PropTypeDefaultDescription
radiusnumber0.35Radius of the bulb
heightnumber0.25Distance from the bulb's center to the point
rotationnumber0Rotation in degrees

A teardrop:

{ "type": "teardropSDF", "radius": 0.22, "height": 0.4, "rotation": 0 }

Parallelogram (parallelogramSDF)

A rectangle with its top edge slid sideways.

PropTypeDefaultDescription
widthnumber0.35Half-width
heightnumber0.25Half-height
skewnumber0.2How far the top edge shifts horizontally. Negative values lean the other way.
rotationnumber0Rotation in degrees

A parallelogram:

{ "type": "parallelogramSDF", "width": 0.32, "height": 0.22, "skew": 0.15, "rotation": 0 }

Using a 3D shape

3D shapes are solids. Shaders raymarches them: for each pixel, it steps a ray through the scene until it hits the surface. Shape effects that support volume, including Glass, Crystal and Emboss, then refract, shade and crease along that real surface instead of a flat outline.

Sizes are in UV units, the same as 2D shapes. Each 3D shape also takes three rotations in degrees: rotX, rotY and rotZ.

Rotating a 3D shape

Picture the shape on a table in front of you:

  • rotY: spins it like a turntable, left and right.
  • rotX: tips it toward or away from you.
  • rotZ: rolls it in the plane of the screen.

Shaders always applies them in the same order: Y first, then X, then Z. Rotations in 3D don't commute, so the order changes the result. The order you write the keys in has no effect. If a combination of angles doesn't land where you expect, change the values.

Animating a 3D shape

Each size and rotation sub-prop of a 3D shape can be a dynamic prop instead of a number. This torus spins continuously, with rotY looping from -180 to 180:

{ "type": "torus3D", "radius": 0.3, "tube": 0.12,
  "rotY": { "type": "auto-animate", "mode": "loop", "outputMin": -180, "outputMax": 180, "speed": 0.5 } }

Sphere (sphere3D)

A sphere. It's the default shape for every shape effect.

PropTypeDefaultDescription
radiusnumber0.35Sphere radius
rotX rotY rotZnumber0Rotation around each axis, in degrees

The default sphere:

{ "type": "sphere3D", "radius": 0.35, "rotX": 0, "rotY": 0, "rotZ": 0 }

Cube (cube3D)

A box with separate dimensions on each axis and rounded edges.

PropTypeDefaultDescription
sizeXnumber0.27Half the width (X)
sizeYnumber0.27Half the height (Y)
sizeZnumber0.27Half the depth (Z)
roundingnumber0.02Edge and corner rounding
rotX rotY rotZnumber25 / 35 / 0Rotation around each axis, in degrees

The default cube:

{ "type": "cube3D", "sizeX": 0.27, "sizeY": 0.27, "sizeZ": 0.27, "rounding": 0.02, "rotX": 25, "rotY": 35, "rotZ": 0 }

Torus (torus3D)

A doughnut.

PropTypeDefaultDescription
radiusnumber0.3Distance from the center to the middle of the tube
tubenumber0.12Tube radius
rotX rotY rotZnumber55 / 0 / 0Rotation around each axis, in degrees

The default torus:

{ "type": "torus3D", "radius": 0.3, "tube": 0.12, "rotX": 55, "rotY": 0, "rotZ": 0 }

Octahedron (octahedron3D)

An eight-faced diamond: two pyramids joined at the base.

PropTypeDefaultDescription
radiusnumber0.42Distance from the center to each vertex
rotX rotY rotZnumber10 / 25 / 0Rotation around each axis, in degrees

The default octahedron:

{ "type": "octahedron3D", "radius": 0.42, "rotX": 10, "rotY": 25, "rotZ": 0 }

Cylinder (cylinder3D)

A capped cylinder with rounded edges.

PropTypeDefaultDescription
radiusnumber0.22Cylinder radius
heightnumber0.26Half the height
roundingnumber0.02Edge rounding
rotX rotY rotZnumber60 / 0 / 30Rotation around each axis, in degrees

The default cylinder:

{ "type": "cylinder3D", "radius": 0.22, "height": 0.26, "rounding": 0.02, "rotX": 60, "rotY": 0, "rotZ": 30 }

Capsule (capsule3D)

A pill: a cylinder with rounded caps.

PropTypeDefaultDescription
radiusnumber0.16Capsule radius
heightnumber0.2Half the length of the straight section
rotX rotY rotZnumber0 / 0 / 35Rotation around each axis, in degrees

The default capsule:

{ "type": "capsule3D", "radius": 0.16, "height": 0.2, "rotX": 0, "rotY": 0, "rotZ": 35 }

Cone (cone3D)

A cone, or a cone with its tip cut flat. Raise topRadius above 0 to flatten the tip.

PropTypeDefaultDescription
radiusnumber0.3Base radius
topRadiusnumber0.02Top radius. 0 gives a sharp point.
heightnumber0.3Half the height
rotX rotY rotZnumber25 / 0 / 15Rotation around each axis, in degrees

The default cone:

{ "type": "cone3D", "radius": 0.3, "topRadius": 0.02, "height": 0.3, "rotX": 25, "rotY": 0, "rotZ": 15 }

Pyramid (pyramid3D)

A pyramid with a square base.

PropTypeDefaultDescription
sizenumber0.3Half the width of the base
heightnumber0.45Height of the apex
rotX rotY rotZnumber-10 / 30 / 0Rotation around each axis, in degrees

The default pyramid:

{ "type": "pyramid3D", "size": 0.3, "height": 0.45, "rotX": -10, "rotY": 30, "rotZ": 0 }

Prism (prism3D)

A hexagonal prism.

PropTypeDefaultDescription
radiusnumber0.28Distance from the center to each flat side of the hexagon
heightnumber0.14Half the depth of the prism
rotX rotY rotZnumber25 / 30 / 0Rotation around each axis, in degrees

The default prism:

{ "type": "prism3D", "radius": 0.28, "height": 0.14, "rotX": 25, "rotY": 30, "rotZ": 0 }

Ellipsoid (ellipsoid3D)

A sphere with a separate radius on each axis.

PropTypeDefaultDescription
radiusXnumber0.38Radius along X
radiusYnumber0.22Radius along Y
radiusZnumber0.3Radius along Z
rotX rotY rotZnumber0 / 0 / 20Rotation around each axis, in degrees

The default ellipsoid:

{ "type": "ellipsoid3D", "radiusX": 0.38, "radiusY": 0.22, "radiusZ": 0.3, "rotX": 0, "rotY": 0, "rotZ": 20 }

Diamond (diamond3D)

A faceted gemstone with a crown on top and a pavilion below. It pairs with the Crystal effect.

PropTypeDefaultDescription
radiusnumber0.3Radius at the widest point (the girdle)
heightnumber0.42Total height of crown and pavilion
rotX rotY rotZnumber15 / 0 / 0Rotation around each axis, in degrees

The default diamond:

{ "type": "diamond3D", "radius": 0.3, "height": 0.42, "rotX": 15, "rotY": 0, "rotZ": 0 }

A rounded chain link.

PropTypeDefaultDescription
radiusnumber0.18Inner radius of the link's curved ends
lengthnumber0.15Half the length of the straight section
tubenumber0.08Tube radius
rotX rotY rotZnumber20 / 30 / 0Rotation around each axis, in degrees

The default link:

{ "type": "link3D", "radius": 0.18, "length": 0.15, "tube": 0.08, "rotX": 20, "rotY": 30, "rotZ": 0 }

Gem (gem3D)

A cut gemstone with a flat top and faceted sides.

PropTypeDefaultDescription
radiusnumber0.3Radius at the widest point
heightnumber0.32Half-height
facetsnumber8Number of facets around the sides, 5 to 12
rotX rotY rotZnumber15 / 0 / 0Rotation around each axis, in degrees

The default gem:

{ "type": "gem3D", "radius": 0.3, "height": 0.32, "facets": 8, "rotX": 15, "rotY": 0, "rotZ": 0 }

Helix (helix3D)

A coiled tube with three turns.

PropTypeDefaultDescription
radiusnumber0.22Radius of the coil
tubenumber0.06Tube radius
pitchnumber0.16Height the coil climbs per turn
rotX rotY rotZnumber20 / 0 / 0Rotation around each axis, in degrees

The default helix:

{ "type": "helix3D", "radius": 0.22, "tube": 0.06, "pitch": 0.16, "rotX": 20, "rotY": 0, "rotZ": 0 }

Metaballs (metaballs3D)

Spheres that drift around and melt into each other where they meet. It animates on its own; set speed to 0 to hold it still.

PropTypeDefaultDescription
ballsnumber4Number of spheres, 1 to 8
ballRadiusnumber0.16Radius of each sphere
spreadnumber0.2How far the spheres drift from the center
blendnumber0.12How smoothly the spheres merge. Higher values give thicker bridges.
speednumber1Animation speed
rotX rotY rotZnumber0 / 0 / 0Rotation around each axis, in degrees

The default metaballs:

{ "type": "metaballs3D", "balls": 4, "ballRadius": 0.16, "spread": 0.2, "blend": 0.12, "speed": 1, "rotX": 0, "rotY": 0, "rotZ": 0 }

Dodecahedron (dodecahedron3D)

A solid with twelve pentagon faces.

PropTypeDefaultDescription
radiusnumber0.34Distance from the center to each face
rotX rotY rotZnumber20 / 10 / 0Rotation around each axis, in degrees

The default dodecahedron:

{ "type": "dodecahedron3D", "radius": 0.34, "rotX": 20, "rotY": 10, "rotZ": 0 }

Hemisphere (hemisphere3D)

A sphere sliced flat by a plane.

PropTypeDefaultDescription
radiusnumber0.4Sphere radius
cutnumber0Height of the slice. 0 keeps half the sphere, negative values keep a shallower cap, positive values keep more of it.
rotX rotY rotZnumber30 / 0 / 0Rotation around each axis, in degrees

The default hemisphere:

{ "type": "hemisphere3D", "radius": 0.4, "cut": 0, "rotX": 30, "rotY": 0, "rotZ": 0 }

Ribbon (ribbon3D)

A flat strip that waves and twists along its length. It animates on its own; set speed to 0 to hold it still.

PropTypeDefaultDescription
widthnumber0.15Width of the strip
thicknessnumber0.03Thickness of the strip
lengthnumber0.38Length of the strip
wavenumber0.1How far the strip waves
waveFrequencynumber7Number of waves along the strip
twistnumber140Twist along the strip, in degrees
speednumber1Animation speed
rotX rotY rotZnumber12 / 18 / 0Rotation around each axis, in degrees

The default ribbon:

{ "type": "ribbon3D", "width": 0.15, "thickness": 0.03, "length": 0.38, "wave": 0.1, "waveFrequency": 7, "twist": 140, "speed": 1, "rotX": 12, "rotY": 18, "rotZ": 0 }

Blob (blob3D)

A sphere whose surface wobbles. It animates on its own; set speed to 0 to hold it still.

PropTypeDefaultDescription
radiusnumber0.3Base radius
wobblenumber0.07How far the surface bulges in and out
wobblinessnumber5How many bulges there are
speednumber1Animation speed
rotX rotY rotZnumber0 / 0 / 0Rotation around each axis, in degrees

The default blob:

{ "type": "blob3D", "radius": 0.3, "wobble": 0.07, "wobbliness": 5, "speed": 1, "rotX": 0, "rotY": 0, "rotZ": 0 }

Gyroscope (gyroscope3D)

Three nested flat rings that spin on different axes around a small sphere. It animates on its own; set speed to 0 to hold it still.

PropTypeDefaultDescription
radiusnumber0.34Radius of the outer ring. The inner rings are 78% and 56% of it.
widthnumber0.1Width of each ring band
thicknessnumber0.028Thickness of each ring band
roundingnumber0.006Edge rounding on the bands
corenumber0.14Radius of the center sphere
speednumber1Animation speed
rotX rotY rotZnumber15 / 0 / 0Rotation around each axis, in degrees

The default gyroscope:

{ "type": "gyroscope3D", "radius": 0.34, "width": 0.1, "thickness": 0.028, "rounding": 0.006, "core": 0.14, "speed": 1, "rotX": 15, "rotY": 0, "rotZ": 0 }

Using your own SVG

To draw inside your logo or icon, give the effect a pre-built SDF file. Set shapeSdfUrl to the URL of an SDF .bin file.

To get one, upload your SVG in the design editor: the code export includes a hosted .bin URL. With the Shaders MCP, your agent can also generate an SDF from any SVG in your project.

Point shapeSdfUrl at the file:

<Glass shapeSdfUrl={logoSdfUrl} />

Extruding an SVG into 3D

An SVG can also become a solid slab with rounded bevels, so shape effects that support volume treat your logo as a 3D object. Keep shapeSdfUrl, and set the shape type to svgExtrude3D:

PropTypeDefaultDescription
depthnumber0.12Total thickness of the slab, front to back
bevelnumber0.02Radius of the rounded edge on the sides
rotX rotY rotZnumber15 / 30 / 0Rotation around each axis, in degrees

These sub-props also accept dynamic prop configs, such as an auto-animate rotation for a spinning logo.

Set the extrusion alongside the SDF file:

<Glass
  shapeSdfUrl={logoSdfUrl}
  shape={{ type: 'svgExtrude3D', depth: 0.12, bevel: 0.02, rotX: 15, rotY: 30, rotZ: 0 }}
/>

To get the .bin file and a matching shape config together, set up the extrusion in the design editor and use the code export.

Next steps

  • Dynamic props: animate shape rotations and sizes, or drive them from the mouse.
  • Blending and masking: control how a shape effect mixes with the layers behind it.
  • Color space: match colors to your design tool and tame bright glows with tone mapping.
  • MCP: connect an agent that can generate SDFs from your SVGs.