Voxels

복셀화

Rebuilds a shape as chunky voxel art or a lit voxel model.

Also known as: VoxelsVoxelizationVoxel art

Moves in browsers that support WebGPU

This device could not render the demo — showing a still

React
// Renders only in browsers with WebGPU.
import { Shader, Voxels } from 'shaders/react'

export default function ShaderEffect() {
  return (
    <Shader style={{ width: '100%', height: 320 }} disableTelemetry>
      <Voxels />
    </Shader>
  )
}
Vue
<!-- Renders only in browsers with WebGPU. -->
<script setup lang="ts">
import { Shader, Voxels } from 'shaders/vue'
</script>

<template>
  <Shader style="width: 100%; height: 320px" :disable-telemetry="true">
    <Voxels/>
  </Shader>
</template>
Svelte
<!-- Renders only in browsers with WebGPU. -->
<script>
  import { Shader, Voxels } from 'shaders/svelte'
</script>

<Shader style="width: 100%; height: 320px" disableTelemetry>
  <Voxels />
</Shader>
Solid
// Renders only in browsers with WebGPU.
import { Shader, Voxels } from 'shaders/solid'

export default function ShaderEffect() {
  return (
    <Shader style={{ width: '100%', height: '320px' }} disableTelemetry>
      <Voxels />
    </Shader>
  )
}
JavaScript
// Renders only in browsers with WebGPU.
// expects <canvas id="canvas" style="width:100%;height:320px"></canvas> on the page
import { createShader } from 'shaders/js'

const shader = await createShader(document.getElementById("canvas"), {
  components: [
    {
      type: 'Voxels',
    }
  ]
}, { disableTelemetry: true })

Props · Voxels

Changes apply to the demo above and to the code tabs. Descriptions come from the library registry (MIT).

NameValueDefaultRange / optionsDescription
originOriginSet in codecenter—Reference edge the center position is measured from (center default). Lets you pin the shape relative to a corner or the canvas centre.
centerCenter
x0.5y0.5
{"x":0.5,"y":0.5}x, y: 0 – 1Center position of the voxel model
scaleScale10.1 – 3 (step 0.01)Scale of the voxel model (1 = default size)
rotationRotation00 – 360 (step 1)Rotation of the voxel model in degrees
voxelSizeVoxel Size0.0350.006 – 0.15 (step 0.001)Edge length of one voxel relative to the shape field — small for fine detail, large for chunky blocks
voxelShapeVoxel Shapecubecube · rounded · sphereWhat each cell is built from: hard cubes, rounded cubes (see Bevel) or spheres
voxelScaleVoxel Fill10.3 – 1 (step 0.01)Size of each voxel inside its cell — 1 = touching neighbours, lower opens gaps between the blocks
fillSurface Bias0-0.5 – 0.5 (step 0.01)How eagerly cells fill in along the surface — negative carves a thinner model, positive puffs it out
bevelBevel0.080 – 1 (step 0.01)Edge rounding of each voxel as a fraction of its size — a hairline chamfer catching light on cubes, the corner radius of rounded cubes
depthDepth0.120.01 – 0.6 (step 0.005)Thickness given to flat shapes (2D shapes and flat SVGs) so they become a slab of voxels — 3D shapes ignore it
gridSpaceGridshapeshape · viewModel: the grid rotates with the shape like a built voxel model. Screen: the grid is fixed to the canvas and the shape moves through it like a 3D pixelation
colorAColor A#6ea8ff—Base color of the voxels (the first color of the palette mode)
colorBColor B#1d2b4f—Second palette color — blended in by height, depth, per voxel or on the side faces
colorModePaletteheightsolid · height · depth · random · facesHow the two colors are laid over the model: one solid color, a gradient by height or depth, a random pick per voxel, or Color A on top faces and Color B on the sides
colorVariationVariation0.250 – 1 (step 0.01)Per-voxel tonal jitter — the slightly-off shades that make blocks read as individual bricks
colorSpaceColor Spaceoklablinear · oklch · oklab · hsl · hsv · lchColor space for color interpolation
lightAngleLight Angle2250 – 360 (step 1)Direction the key light comes from, in degrees around the canvas — shadows fall away from it
lightElevationLight Elevation425 – 85 (step 1)How high the key light sits above the canvas — low for long raking shadows, high for a flat top-down light
lightColorLight Color#fff2df—color of the key light
lightIntensityLight Intensity1.10 – 3 (step 0.01)Strength of the key light
ambientColorAmbient Color#9fb4d8—Sky color of the ambient light — the fill on faces the key light misses
ambientAmbient0.550 – 2 (step 0.01)Strength of the ambient sky/ground fill
shadowsShadows0.850 – 1 (step 0.01)Darkness of the shadows voxels cast onto each other
shadowSoftnessShadow Softness0.350 – 1 (step 0.01)Penumbra of the cast shadows — 0 is razor sharp, higher spreads the light into a soft area source whose shadows sharpen at contact
aoOcclusion10 – 2 (step 0.01)Ambient occlusion in the creases between voxels — the soft contact darkening that sells the geometry
glossinessGlossiness0.350 – 1 (step 0.01)How tight the specular highlight is — satin plastic at 0, lacquered at 1
specularSpecular0.60 – 2 (step 0.01)Strength of the specular highlight and the fresnel rim on grazing faces
seamsSeams0.20 – 1 (step 0.01)Dark seam lines along every voxel edge — 0 for seamless blocks, higher for a drawn-outline brick look
shapeShapeSet in code{"type":"sphere3D","radius":0.35}—Serialized shape configuration (JSON)
shapeSdfUrlshapeSdfUrlSet in code—URL to a pre-generated SDF .bin file
shapeTypeshapeTypeSet in code—Active SDF shape type

Every component also takes blendMode · opacity · visible · maskSource/maskType · boundingBox · id

It looks like a shape rebuilt from small blocks: a flat image becomes angular pixel art, while a 3D form gains lit voxel faces and shadows.

Raise `voxelSize` for chunkier blocks. `voxelShape` selects cubes, rounded cubes, or spheres. Lower `voxelScale` to open gaps between blocks; `fill` carves a thinner surface or puffs it outward. For flat shapes, `depth` adds thickness.

The effect rebuilds its own shape as blocks, making it useful for icons and large silhouettes. Larger blocks can erase thin strokes and small holes, so avoid it for small text or fine detail.

When to use

Use it for voxel-style icons, game-like logos, or large illustrated silhouettes. Avoid it when thin strokes or small cutouts must stay exact.

Open as page ↗