technology· 9 min read

Prompt to 3D: How VULK Generates Three.js Code

The three-stage architecture behind turning an English prompt into production-ready Three.js/WebGL — what the model gets right, what still needs an expert, and the exact refinement loop.

João CastroJoão Castro
Prompt to 3D: How VULK Generates Three.js Code

Updated July 17, 2026 — refreshed with verified platform data and the current generation pipeline.

How does VULK turn a text prompt into Three.js code?

The short, complete answer: VULK runs a three-stage pipeline. Stage 1 parses your prompt into a scene architecture (geometry, lighting, interactions, constraints). Stage 2 generates the actual Three.js code — scene, camera, renderer, materials, animation loop — as real, runnable modules, not template fill-ins. Stage 3 adapts that code to a live web app: React lifecycle integration, responsive canvas, retina handling, loading states, TypeScript. The output renders in a live preview within seconds, and you refine it conversationally ("slow the rotation 50%", "add a bloom glow").

That collapses the traditional barrier. Learning Three.js well enough to ship a polished interactive scene takes weeks to months; describing one takes a sentence. Games and interactive experiences are already 5.4% of everything generated on the platform — the #2 app category after dashboards and admin panels (VULK platform data, July 2026, N = 10,994 active projects). 3D generation is available in the 3D Studio on Pro plans and above.


What happens in each stage of the pipeline?

Stage 1: Understand the request

The first model reads your prompt and builds a mental model of what you're describing:

"Create an interactive product showcase. A rotating 3D cube with product images on each face. Click to pause/resume rotation. Mobile-friendly."

The model extracts:

  • Core concept: rotating product showcase
  • Key geometry: cube
  • Key interaction: click to pause
  • Key constraint: mobile-friendly
  • Style hints: "interactive," "product"

From this, the model generates a detailed architecture plan:

Scene:
  - Camera (perspective, positioned to see cube)
  - Lighting (key light, fill light, back light)
  - Cube geometry with image textures on each face

Interaction:
  - Raycaster for mouse/touch input
  - Animation state machine (rotating/paused)
  - Toggle on click

Performance:
  - Texture compression
  - Simple geometry (don't overdraw)
  - No unnecessary effects

This architecture is not random. It's based on thousands of examples of well-written Three.js code.

Stage 2: Generate the code structure

The second model takes that architecture and generates the full Three.js implementation:

import * as THREE from 'three';
import { TextureLoader } from 'three';

export class ProductShowcase {
  constructor(container) {
    this.scene = new THREE.Scene();
    this.camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
    this.renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
    this.isRotating = true;
  }

  setupLighting() {
    const keyLight = new THREE.DirectionalLight(0xffffff, 1);
    keyLight.position.set(5, 5, 5);
    this.scene.add(keyLight);

    const fillLight = new THREE.DirectionalLight(0xffffff, 0.5);
    fillLight.position.set(-5, 3, 5);
    this.scene.add(fillLight);

    const backLight = new THREE.DirectionalLight(0xffffff, 0.3);
    backLight.position.set(0, 5, -5);
    this.scene.add(backLight);
  }

  setupCube() {
    const loader = new TextureLoader();
    const materials = [
      new THREE.MeshPhongMaterial({ map: loader.load('/faces/front.jpg') }),
      new THREE.MeshPhongMaterial({ map: loader.load('/faces/back.jpg') }),
      // ... rest of faces
    ];

    const geometry = new THREE.BoxGeometry(2, 2, 2);
    this.cube = new THREE.Mesh(geometry, materials);
    this.scene.add(this.cube);
  }

  setupInteraction() {
    document.addEventListener('click', (e) => {
      this.isRotating = !this.isRotating;
    });
  }

  animate() {
    requestAnimationFrame(() => this.animate());

    if (this.isRotating) {
      this.cube.rotation.x += 0.005;
      this.cube.rotation.y += 0.01;
    }

    this.renderer.render(this.scene, this.camera);
  }
}

This is not a template with blanks filled in. This is actual, runnable code.

Notice what the model does correctly:

  • Proper Three.js patterns (Scene, Camera, Renderer, Mesh)
  • Sensible lighting setup with three-point lighting
  • Materials that work with those lights (MeshPhongMaterial responds to directional lights)
  • Proper animation loop using requestAnimationFrame
  • Touch-friendly interaction
  • Mobile consideration (responsive camera setup)

A junior developer would take 4+ hours to write this. The model generates it in seconds — across the whole platform, the median time from signup to a first generated app is 47 seconds (VULK platform data, July 2026).

Stage 3: Adapt to the platform

The code doesn't just compile in isolation. It needs to fit into a running web application:

  • Hook it into React lifecycle (useEffect, cleanup)
  • Add responsive canvas resizing
  • Handle pixel density on retina displays
  • Provide loading states while textures load
  • Export to TypeScript

That last point is not cosmetic: 65% of all code files generated on VULK are TypeScript (VULK platform data, July 2026, N = 124,755 files), and the 3D output follows the same convention. The result is a complete, deployable component that drops into a Vite + React project and renders in the live server-side preview with hot reload.


Why does prompt-to-3D generation actually work?

Three.js has patterns. Every scene follows the same basic structure:

  1. Setup scene, camera, renderer
  2. Add geometry and materials
  3. Add lighting
  4. Implement render loop
  5. Handle user input

The model has seen thousands of examples of each pattern. It has learned not just the syntax, but the reasoning. It knows why you use DirectionalLight for key light, why MeshPhongMaterial responds to lighting, why you need the render loop, why you handle window resize events.

What does the model reliably get right?

Area What the generated code covers
Geometry BoxGeometry, SphereGeometry, PlaneGeometry, ConeGeometry; correct UVs for texture mapping; vertex normals for lighting
Materials MeshBasicMaterial (unlit), MeshPhongMaterial (shiny), MeshStandardMaterial (PBR), ShaderMaterial for custom effects
Lighting Ambient, Directional, Point, and Spot lights with sensible positions and intensities
Animation Linear/easing/looping animations, tweened position/rotation/scale, state-driven conditionals
Performance Overdraw avoidance, frustum culling, texture compression hints, LOD strategies
Mobile Touch input, responsive canvas sizing, device pixel ratio compensation, mobile GPU budgets

How do follow-up prompts refine a 3D scene?

The generation doesn't stop at code. You can refine it:

"The cube rotates too fast. Slow it down 50%."

The model understands this refers to the rotation speed and adjusts the increment:

if (this.isRotating) {
  this.cube.rotation.x += 0.0025; // Changed from 0.005
  this.cube.rotation.y += 0.005;  // Changed from 0.01
}

"Add a glow effect around the cube."

The model generates a postprocessing pipeline using Three.js's EffectComposer and UnrealBloomPass, adding the necessary imports and setup.

"Make the background a gradient from blue to purple."

The model replaces the flat background color with a canvas gradient applied to a large sphere, or renders to a canvas texture.

Each follow-up is a genuine, surgical code modification that understands the context of the scene. This matches how people use the platform generally: the median build conversation is just 4 messages, but the top 10% of projects run past 25 messages — one prompt to get the scene, then an iteration loop to make it yours (VULK platform data, July 2026).

What still requires 3D expertise?

The model cannot:

  • Optimize for 2 million polygons and maintain 60fps (that requires profiling)
  • Implement custom physics (you still need Cannon or Rapier)
  • Create bespoke shaders for proprietary effects
  • Integrate with external 3D models in exotic formats
  • Debug GPU-specific performance issues

For most use cases, these are edge cases. For the large majority of 3D web projects — product showcases, hero scenes, browser games, data visualizations — the generated code is production-ready.

What does this mean for 3D web development?

This is the consolidation of web graphics skills into a single interface. You don't learn Three.js. You learn how to describe a 3D experience in English. The model handles the translation.

The barrier to 3D on the web just collapsed from "months of learning" to "seconds of waiting."


FAQ

Do I need to know Three.js to generate a 3D scene with VULK?

No. You describe the scene in plain language — geometry, motion, interaction, style — and the pipeline produces the Three.js/React Three Fiber code. Knowing 3D vocabulary (materials, bloom, orbit controls) helps you refine faster, but it is not required to get a working scene.

Can I edit the generated Three.js code by hand?

Yes. The output is standard TypeScript in a standard Vite + React project. Every file is visible and editable in the editor, and you can export the full source as a ZIP or push it to GitHub (GitHub sync on Pro+). There is no proprietary runtime.

What 3D features can I ask for in a prompt?

Geometry primitives and composed shapes, textures, three-point lighting, PBR materials, orbit/pointer-lock controls, raycaster interactions, postprocessing (bloom, depth of field), skyboxes, and animation loops. For physics (gravity, collisions), ask for Cannon.js or Rapier integration explicitly.

Does the 3D preview run in my browser?

The app compiles server-side in VULK's live preview and streams to your browser with hot reload; the WebGL rendering then runs on your GPU like any Three.js site. It works on Safari and mobile because compilation is not done in the browser.

Which plan do I need for 3D generation?

3D Studio access starts on the Pro plan ($39.99/mo). VULK is paid-only — there is no free tier — but every plan starts with a 3-day full-access intro (Pro intro is $9.99, credited to your first month if you continue).

Can I deploy a generated 3D scene?

Yes — one-click deploy to Cloudflare Pages. A Three.js scene builds to static assets, so it ships to a global CDN with a public URL, and you can attach a custom domain (Pro+).


Try it at vulk.dev/3d-studio. Prompt any 3D idea and see the code it generates. This is not autocomplete — it is genuine 3D generation.

Published by João Castro · 9 min read

Keep reading

All articles
VULK Support

Online

Hi! How can I help you today?

Popular topics

AI support • support.vulk.dev

Prompt to 3D: How VULK Generates Three.js Code — Blog | VULK