Code Deb

How to convert a 2D logo into a 3D model using Three.js

A step-by-step technical breakdown on parsing 2D SVG vector paths and converting them into extruded 3D WebGL meshes in Three.js with studio lighting and custom PBR materials.

Code Deb is a software engineering studio based in Kathmandu, Nepal. Explore our services and company information, browse our engineering articles or contact the team for support and project enquiries.

Brand emblems on the web are evolving beyond flat 2D graphics. While vector SVGs render crisply at any screen resolution, presenting a brand emblem as a tactile, light-reflecting 3D sculpture creates a lasting visual impression.

Traditionally, bringing a 3D logo to the web meant hiring a 3D artist to model a polygon mesh in Blender or Cinema4D, exporting a heavy GLTF file, and baking lighting textures. This workflow introduces heavy network payloads and rigid geometry that cannot be updated dynamically when brand assets change.

At CodeDeb, we took a vector-first approach. By parsing raw SVG path strings directly inside Three.js using SVGLoader and extruding them with ExtrudeGeometry, we render fully interactive 3D brand sculptures directly from vector source code. In this guide, we walk through the entire pipeline: from preparing vector artwork to material engineering, studio lighting setups, and live custom SVG extrusion.

Phase 1: Preparing and Normalizing Vector SVGs

Before an SVG path can be converted into 3D geometry in Three.js, the vector artwork must meet specific topological requirements:

  • Compound Path Conversion: In tools like Figma or Adobe Illustrator, outline stroke contours into filled shapes and combine overlapping geometry into compound vector paths.
  • Path Winding Rules: Ensure inner cutout holes (like the inner counter of an 'O' or 'D') follow proper winding order for SVG path conversion.
  • Coordinate Scale Calibration: Standardize vector artwork within an 800x800 bounding box canvas for predictable extrusion scaling.

Phase 2: Converting SVG Paths to 3D ExtrudeGeometry

With a clean vector path prepared, we load Three.js's SVGLoader to parse the SVG string and generate 2D vector shapes. These shapes are then extruded along the Z-axis using THREE.ExtrudeGeometry.

Extrusion geometry is defined by core parameters:

  • Depth: The extrusion length along the Z-axis, establishing the physical thickness of the mark.
  • Bevel Enabled & Size: Adds chamfered edge highlights that catch specular rim lighting.
  • Bevel Segments & Curve Segments: Controls mesh polygon density along curved corners for smooth, fluid reflections.

Try the live generator below. Select a preset vector logo or paste your own custom SVG path string to render it in 3D WebGL instantly:

Below is the core TypeScript implementation for converting an SVG path string into an extruded Three.js mesh with centered pivot geometry:

Phase 3: Material Engineering & Surface Finishes

In Three.js, THREE.MeshPhysicalMaterial provides Physically Based Rendering (PBR) capabilities, including metalness, roughness, clearcoat layers, and transmission.

By tuning these physical properties, we create distinct material finishes for the same vector logo:

1. Brushed Titanium & Steel

High metalness (0.95), low roughness (0.1), and full clearcoat (1.0). Creates crisp metallic highlights and industrial weight.

2. Cyber Cobalt Neon

Incorporates emissive glow (#1D4ED8) with intensity (0.35) combined with blue specular rim lighting for a vibrant futuristic aesthetic.

3. Obsidian Glass & Onyx

Deep obsidian color tone (#0f172a), mirror-like reflectivity, and clearcoat gloss. Delivers luxury dark-mode aesthetics.

4. Champagne Gold & Brass

Warm golden tone (#f59e0b) with balanced roughness (0.22) and warm directional key lighting for executive branding.

Explore the interactive material gallery below to test each physical material preset on the 3D CodeDeb logo:

Here are the MeshPhysicalMaterial configuration snippets for each material subtype:

Phase 4: Studio Lighting & Camera Calibration

Lighting brings PBR materials to life. We employ a three-point studio lighting setup:

  1. Key Light (White Directional): Positioned at (300, 400, 500) with high intensity to create primary surface highlights.
  2. Fill Light (Cool Blue Directional): Positioned at (-300, 200, -300) to illuminate recessed shadows with soft fill light.
  3. Rim Light (Specular Rim): Positioned behind and below the logo to highlight chamfered bevel edges along the silhouette.

Phase 5: Auto-Centering and Floating Elevation

To ensure smooth rotation around the true center of mass, we compute the mesh's 3D bounding box using new THREE.Box3().setFromObject(meshGroup), extract the geometric center, and offset the mesh position to local (0, 0, 0) coordinates.

Complete 3D Logo Studio Inspector

Inspect the fully assembled 3D CodeDeb Logo studio below with orbit controls, lighting toggles, animation physics, and wireframe inspection modes:

Here is the full bounding box auto-centering and animation loop implementation:

Conclusion: Vector-First 3D Architecture

By combining vector SVG path parsing with Three.js WebGL extrusion and PBR materials, web teams can build interactive, high-performance 3D brand assets that load instantaneously, look razor-sharp on high-DPI displays, and adapt dynamically to custom brand palettes.

More from Code Deb

Read about our studio, explore available services, or contact the team for a project discussion.