Projects · Lumix3D

Turning flat SVGs into 3D scenes

Drop in a logo or an icon, and Lumix3D extrudes it into a real 3D object you can light, texture, animate and drop onto any web page. It's a small 3D studio built on Three.js and React Three Fiber, running entirely in the browser.

7 min read

  • three.js
  • react three fiber
  • svg
  • webgl
github.com/sawissac/Lumix3D

The idea

A 3D version of a logo makes a great hero section, but the usual route is to open Blender, import the SVG, extrude it, set up lights and a camera, render, then export something a web page can use. Lumix3D folds that into one browser tab: upload the SVG, shape it, light it, and copy an embed snippet.

From SVG to mesh

Three.js has an SVGLoader that turns SVG paths into shapes it can extrude. It has one big blind spot: it only understands filled paths and ignores stroke-width completely. A huge share of real-world icons are drawn with strokes, not fills (fill="none", stroke-width="2"), so loading them directly produces invisible or broken geometry.

Lumix3D runs every upload through a preprocessing step first:

  1. Parse the SVG in a hidden element so the browser resolves styles and stroke widths.
  2. For each stroke-only shape, walk its outline with getPointAtLength and build a closed, filled path that traces the stroke's edges.
  3. Run the result through SVGO's browser build to flatten transforms, collapse groups and normalise colours.

What comes out contains only filled paths, which is exactly what SVGLoader can extrude. There's also a 2D edit mode, built on Fabric.js, for adjusting a shape's fill, stroke colour and stroke width before it goes 3D.

Shaping the extrusion

ControlRangeWhat it does
Depth1–50How far the shape extends into 3D space
Curve segments1–64Smoothness of curves; lower renders faster
Bevel thickness0–5Depth of the bevel along the extruded side
Bevel size0–3How far the bevel spreads out from the shape edges
Bevel segments1–8Steps in the bevel curve; higher is rounder

Settings apply to the whole scene by default and can be overridden per shape, so one letter of a logo can sit deeper than the rest.

Working in the scene

Editing feels like a lightweight 3D app:

  • Select an object by clicking it; hold Ctrl (or Cmd on Mac) to add more. Selected objects get yellow edges and a soft amber glow.
  • Transform with Blender-style keys: G to move, R to rotate, S to scale, Esc to deselect. Rotation can be locked to specific axes.
  • Group two or more objects, name the group, and move it as one. Ungroup any time.
  • Undo and redo cover shape, material, light and texture changes. During a drag, Lumix3D takes one snapshot when you press the mouse, not one per frame, so a single undo puts the object back where it started.

You can also import .glb and .gltf models and place them alongside your extruded shapes.

Making it look good

Materials and textures

Each object can take a full PBR texture set, one image per channel:

  • Base colour, normal, roughness, metalness
  • Displacement, ambient occlusion, emissive
  • Alpha, light map

Like extrusion, textures can be set globally and overridden per object.

Lighting presets

Eleven presets set up a complete light rig in one click: three-point, high-key, low-key, soft, hard, backlighting, side lighting, frontal, underlighting, top lighting and silhouette. Pick one as a starting point, then switch to custom and adjust individual lights.

Effects and ground

  • Viewport mode — normal, solid, or wireframe to see the mesh edges.
  • Bloom — a glow with controls for intensity, the brightness threshold that triggers it, and how softly it fades.
  • Ground shadow — a shadow plane under the object with its own colour, opacity, blur and height.
  • Background and grid — set the backdrop and toggle the grid.

Quick scenes load a finished demo setup when you'd rather start from something than from nothing.

Animation

A timeline sits under the scene. Select a single object, move the playhead, and add a keyframe; Lumix3D records the object's position, rotation and scale at that time. Set the total duration, scrub through, and play it back. Finished animations can be saved and reused.

Saving your work

The scene saves itself. Lumix3D stores its state in the browser (IndexedDB through localforage), so closing the tab doesn't lose anything. For a portable copy, Export Project downloads the whole scene as lumix3d-project.json, and Import Project loads one back. Starting a new project asks for confirmation first, since it clears the current scene.

Embedding a scene anywhere

This is the part that makes Lumix3D more than an editor. The 3D canvas is also packaged as a standard web component, <lumix-scene>, bundled into a single script with esbuild:

bash
pnpm build:embed

That writes public/lumix-embed.js. The Embed Code dialog then generates a snippet for the current scene, either as plain HTML or as a React component. You choose which interactions viewers get: rotate, zoom and pan, with rotation lockable per axis. The HTML version looks like this, trimmed:

html
<script src="https://your-lumix-host/lumix-embed.js" defer></script>

<lumix-scene id="lumix"></lumix-scene>

<script>
const scene = {
/* the exported scene: shapes, lights, materials, camera, timeline */
};
const el = document.getElementById("lumix");
const apply = () => {
el.scene = scene;
};
if (customElements.get("lumix-scene")) apply();
else customElements.whenDefined("lumix-scene").then(apply);
</script>

The element renders its own React tree into itself, so the host page doesn't need React at all. The scene arrives as a property, and the element waits for itself to be defined before applying it. Embedded scenes are view-only: editing and transform tools are switched off.

The generated snippet loads lumix-embed.js from wherever Lumix3D is running. Embedding from localhost only works on your own machine, so host Lumix3D (or at least the script) somewhere public before you paste the snippet into a live site.

Under the hood

LayerTech
FrameworkNext.js 16, React 19
3DThree.js, React Three Fiber, drei, postprocessing
StateRedux Toolkit with redux-persist over localforage
SVGSVGO (browser build), Three.js SVGLoader, Fabric.js
UITailwind v4, Radix UI, shadcn, react-resizable-panels
Embed buildesbuild, bundled as a self-contained browser script

Run it locally

bash
git clone https://github.com/sawissac/Lumix3D.git
cd Lumix3D
pnpm install
pnpm dev

Then open localhost:3000. Lumix3D is built for large screens; below tablet width it shows a "Desktop Only" notice instead of the editor.


Lumix3D is a side project that grew from "extrude this logo" into a small 3D studio with its own embed format. The source is on GitHub.