Skip to content
UISpell
Prompt Guide

3D Hero Section Prompt for Claude, Cursor and DeepSeek

A copyable prompt that produces a 3D hero with a real budget: scene, camera, material, interaction, performance cap and a no-WebGL fallback.

3D Hero Section Prompt for Claude, Cursor and DeepSeek

“Build a 3D hero section” is a request for a demo, not a page. The model will deliver a spinning object, a three.js import from a CDN, a 60fps render loop that never stops, and a hero that blocks the largest contentful paint because the headline waits behind a canvas. It looks good in the preview and fails on a phone at 4G.

The demo below is the same idea done with a budget: one canvas, no 3D library, one draw call per frame, and a scene that stops when it is not visible.

Live demo · Raymarched chrome hero Open full screen
Pointer movement shifts the camera; the loop pauses offscreen. With reduced motion enabled it renders one static frame.

Why the default request fails

AI-generated 3D heroes fail in four specific ways, and each one is a missing constraint rather than a missing skill.

  1. No budget. The model cannot know your target device, so it writes for the demo machine and ships a shader that renders at 3x device pixel ratio on a 4K monitor.
  2. LCP behind the canvas. The headline is often rendered in HTML — good — but the hero image or canvas mounts first and pushes the text. Or the text is inside the 3D scene, which means nothing paints until WebGL boots.
  3. Interaction that hijacks. Scroll-driven camera moves that trap the page, or pointer parallax that fires on touch and makes the layout jitter.
  4. No exit. There is no fallback for blocked WebGL, no reduced-motion path, and no way to pause the loop.

The six constraints

Write these into the prompt and most of the failures disappear before the first line of code.

ConstraintWhat to specifyWhy
SceneOne object, one light direction, described as geometryStops the model from adding fog, bloom, reflections and a planet
CameraFOV, distance, what moves with the pointerGives you a stable composition to lay text over
MaterialMetal / glass / matte, plus the two colors it may reflectPrevents rainbow shaders
InteractionPointer parallax only, no scroll hijack; touch ignores parallaxKeeps the page usable
BudgetOne canvas, one draw call, DPR cap, pause when offscreenTurns the demo into a page
FallbackStatic first frame, no-WebGL gradient, reduced-motion single frameKeeps it ship-able

The prompt, copyable

Build a 3D hero section for a landing page.

SCENE
One object: a chrome gyroscope — a ring, a smaller tilted ring, and a
sphere at the centre. No floor, no fog, no particles, no bloom.
Background is a two-stop vertical gradient that works in light and dark.

CAMERA
Perspective, 1.85 focal depth, object centred and offset to the right
on desktop, centred on mobile. Pointer parallax max 0.45 units.
No scroll-linked camera movement. Touch devices: no parallax.

MATERIAL
Polished metal with a cool-to-warm environment gradient and a fresnel
rim. Two highlight colors only: one cool, one warm. No textures.

INTERACTION
Pointer moves the camera; pointer leaving the window returns it to rest.
Nothing animates on its own except a slow idle rotation under 6 degrees.

BUDGET
One canvas, one draw call per frame. DPR capped at 1.75 (1.25 under
640px). Stop the render loop when the canvas is offscreen or the tab is
hidden. First frame must render before any texture or model loads.

FALLBACK
If WebGL is unavailable, show a CSS gradient with no layout shift.
With prefers-reduced-motion, render a single static frame — no loop.
All headline and CTA text is real DOM text above the canvas,
selectable and visible without WebGL.

OUTPUT
Vanilla WebGL or three.js; state which and why. No other dependencies.
No scroll hijacking. No audio. No analytics in the render loop.

The output block matters as much as the constraints. Asking for the choice to be justified (“state which and why”) forces a decision instead of the default import.

Checking the result

Do not judge the hero by how it looks in the preview. Check it in this order:

CheckPass condition
LCPHeadline paints before the canvas; measured on a throttled phone profile
Draw callsOne per frame; watch the renderer’s own counter, not the visual
DPRmin(devicePixelRatio, 1.75) — canvas width matches, no 3x backing store
Offscreen pauseScroll past the hero, confirm the loop stops
Reduced motionOne frame, no motion, identical layout
No WebGLGradient fallback, text intact, no layout shift
TouchParallax disabled; no jitter while scrolling
ContrastHeadline over the brightest part of the shader still passes AA
The 3D hero with WebGL disabled, showing a CSS gradient fallback behind intact text

The same page with WebGL disabled. The gradient is CSS, the headline and CTAs are untouched, and nothing moves — which is the only fallback test that matters.

What the demo does

The demo skips three.js entirely. A single fragment shader raymarches three primitives — two tori rotated against each other and one sphere — with a soft key light, a fresnel rim and a procedural environment gradient. Total cost is one fullscreen quad and one draw call.

The important parts are not the shader:

// Cap the backing store, not just the CSS size
const dpr = Math.min(window.devicePixelRatio || 1, window.innerWidth < 640 ? 1.25 : 1.75);

// Stop the loop when the hero is not on screen
new IntersectionObserver(([entry]) => {
  entry.isIntersecting ? startLoop() : stopLoop();
}).observe(canvas);

// Reduced motion: render one frame, never start the loop
if (matchMedia('(prefers-reduced-motion: reduce)').matches) drawOnce();

Those four lines are what separate a hero from a performance bug. A shader that renders 84 march steps at 1.25 DPR on a phone is cheaper than a three.js scene with shadows at 3x DPR, and both are cheaper than a loop nobody stopped.

Shader, three.js, or CSS 3D

  • CSS 3D is enough for tilted cards, layered depth and parallax on text. It costs nothing and never breaks. Use it when the “3D” is really depth ordering.
  • three.js wins when you need a real model, glTF assets, or a scene graph with several objects and lighting. Budget for loading the model and for a loader state.
  • A single shader wins when the hero is one abstract object: a gradient mesh, a chrome shape, a noise field. No dependency, one draw call, and full control over the fallback.

The prompt works for all three. Only the scene and output blocks change.

Text over a moving background

Two rules keep the headline readable as the shader drifts:

  1. Hold one region of the canvas visually quiet. In the demo that is the left half; the object sits right of centre on desktop and centres on mobile, where the text moves above it.
  2. Give the text its own contrast floor with a soft text shadow that follows the theme — light shadow in light mode, dark in dark mode. Do not add a frosted panel behind the headline unless the shader is bright everywhere.

Tuning it

The knobs that change the feel, in order of impact: camera distance (composition), fresnel exponent (how much rim glow), key-light direction (where the highlight sits relative to your text), and idle rotation speed (below 6 degrees per second, it reads as breathing; above 12 it reads as a loading spinner).

Everything else — bloom, chromatic aberration, grain — adds cost and subtracts legibility. Grain is in the demo at 1.2% and it is the only post-process worth keeping.

If the hero also carries glass UI, the liquid glass button breakdown covers the layers and the fallbacks, and how to write UI prompts is the general structure behind both.