oneshotlm
Compare all models on this prompt →

3D solar system · gemini-3-flash-preview

Using the pre-provided three.min.js (global THREE), build a 3D solar system with the sun and orbiting planets at varied speeds and sizes, orbit-drag camera controls, and a starfield.

⛨ sandboxed Open in new tab ↗
transcript · 12 messages
user

Using the pre-provided three.min.js (global THREE), build a 3D solar system with the sun and orbiting planets at varied speeds and sizes, orbit-drag camera controls, and a starfield.

assistant
thinking
**Building Solar System Logic**

I'm currently focused on implementing the core logic for the 3D solar system. My priority is to accurately represent the Sun and its planets, ensuring they have distinct sizes and orbital speeds. I'm also working on creating a custom orbit-drag camera control for user interaction, as external libraries are not an option.

bash {"command":"ls -F"}
toolResult

three.min.js

assistant
thinking
**Implementing Camera Controls**

My focus has shifted to camera interaction. Since I only have `three.min.js`, I'll be building custom orbit controls or a basic drag-camera functionality directly into the script. Next, I'll set up the HTML and CSS for a full-screen canvas.

write index.html (6555 bytes)
toolResult

Successfully wrote 6555 bytes to index.html

assistant
thinking
**Building the Cosmic Stage**

I've successfully laid the foundation for our solar system, incorporating a sun, planets with diverse characteristics, and essential orbital camera controls within a single HTML file, all powered by three.min.js. The starfield is also in place, completing the initial visual framework.

**Refining the Stellar Nursery**

My focus has shifted to the finer points of the celestial bodies. I'm verifying that the version of three.js I'm using includes the necessary `PhongMaterial` and `PointLight` for proper illumination and rendering. I'll also be examining the `RingGeometry` for orbits to ensure they appear smooth and appropriately scaled, avoiding any jaggedness.

**Enhancing Visual Fidelity**

I'm considering subtle enhancements to the sun's appearance and the distribution of stars. For now, the existing implementation seems robust. I've confirmed the sun uses `MeshBasicMaterial` for consistent brightness, while planets are correctly rendered with `MeshPhongMaterial` to reflect the sun's light. The orbital drag controls are functioning as expected, with appropriate rotation limits.

**Adjusting Stellar Positioning**

I'm refining the starfield positioning. While having the stars follow the camera offers a parallax-free view, it means they move with us. I'm confirming this approach is suitable for our current solar system simulation context. The planet and orbit rotations are consistent with the XZ plane.

**Confirming Coordinate Systems**

I've verified the camera's positioning logic aligns with a spherical coordinate system, which seems correct for our celestial simulation. I'm also re-evaluating the starfield's motion to ensure it behaves as expected, and I'll be adding a subtle glow to the sun while remaining mindful of the three.js version's potential limitations.

edit {"edits":[{"newText":" renderer.setPixelRatio(window.devicePixelRatio);\n renderer.setSize(window.innerWidth, window.innerHeig
toolResult

Found 2 occurrences of edits[0] in index.html. Each oldText must be unique. Please provide more context to make it unique.

assistant
edit {"edits":[{"newText":" const renderer = new THREE.WebGLRenderer({ antialias: true });\n renderer.setPixelRatio(window.devicePi
toolResult

Successfully replaced 2 block(s) in index.html.

assistant
read {"path":"index.html"}
toolResult

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>3D Solar System</title> <style> body { margin: 0; overflow: hidden; background-color: #000; font-family: sans-serif; } canvas { display: block; } #info { position: absolute; top: 10px; left: 10px; color: white; pointer-events: none; text-shadow: 1px 1px 2px black; } </style> </head> <body> <div id="info">Drag to rotate, Scroll to zoom</div> <script src="three.min.js"></script> <script> // Configuration const PLANETS = [ { name: "Mercury", size: 0.8, dist: 15, speed: 0.04, color: 0xAAAAAA }, { name: "Venus", size: 1.5, dist: 22, speed: 0.015, color: 0xE3BB76 }, { name: "Earth", size: 1.6, dist: 30, speed: 0.01, color: 0x2233FF }, { name: "Mars", size: 1.2, dist: 38, speed: 0.008, color: 0xE27B58 }, { name: "Jupiter", size: 4.5, dist: 55, speed: 0.002, color: 0xD39C7E }, { name: "Saturn", size: 3.8, dist: 75, speed: 0.0009, color: 0xC5AB6E, ring: true }, { name: "Uranus", size: 2.5, dist: 95, speed: 0.0004, color: 0xBBE1E4 }, { name: "Neptune", size: 2.4, dist: 110, speed: 0.0001, color: 0x6081FF } ]; // Scene setup const scene = new THREE.Scene(); const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 2000); const renderer = new THREE.WebGLRenderer({ antialias: true }); renderer.setPixelRatio(window.devicePixelRatio); renderer.setSize(window.innerWidth, window.innerHeight); document.body.appendChild(renderer.domElement); // Lighting const ambientLight = new THREE.AmbientLight(0x333333); scene.add(ambientLight); const sunLight = new THREE.PointLight(0xffffff, 2, 500); scene.add(sunLight); // Sun const sunGeometry = new THREE.SphereGeometry(8, 32, 32); const sunMaterial = new THREE.MeshBasicMaterial({ color: 0xffcc00 }); const sun = new THREE.Mesh(sunGeometry, sunMaterial); scene.add(sun); // Starfield const starGeometry = new THREE.BufferGeometry(); const starMaterial = new THREE.PointsMaterial({ color: 0xffffff, size: 0.7 }); const starVertices = []; for (let i = 0; i < 10000; i++) { const x = (Math.random() - 0.5) * 2000; const y = (Math.random() - 0.5) * 2000; const z = (Math.random() - 0.5) * 2000; starVertices.push(x, y, z); } starGeometry.setAttribute('position', new THREE.Float32BufferAttribute(starVertices, 3)); const stars = new THREE.Points(starGeometry, starMaterial); scene.add(stars); // Planets const planetMeshes = []; PLANETS.forEach(p => { const orbitGroup = new THREE.Group(); scene.add(orbitGroup); // Orbit path line const pathGeom = new THREE.RingGeometry(p.dist - 0.1, p.dist + 0.1, 64); const pathMat = new THREE.MeshBasicMaterial({ color: 0x444444, side: THREE.DoubleSide }); const path = new THREE.Mesh(pathGeom, pathMat); path.rotation.x = Math.PI / 2; scene.add(path); // Planet mesh const geom = new THREE.SphereGeometry(p.size, 32, 32); const mat = new THREE.MeshPhongMaterial({ color: p.color, shininess: 20 }); const mesh = new THREE.Mesh(geom, mat); mesh.position.x = p.dist; orbitGroup.add(mesh); // Saturn's Rings if (p.ring) { const ringGeom = new THREE.RingGeometry(p.size * 1.4, p.size * 2.2, 64); const ringMat = new THREE.MeshBasicMaterial({ color: 0x888888, side: THREE.DoubleSide, transparent: true, opacity: 0.6 }); const ring = new THREE.Mesh(ringGeom, ringMat); ring.rotation.x = Math.PI / 2.5; mesh.add(ring); } planetMeshes.push({ group: orbitGroup, speed: p.speed, mesh: mesh }); }); // Camera control variables let isMouseDown = false; let mouseX = 0, mouseY = 0; let targetRotationX = 0.5; let targetRotationY = 0; let distance = 150; // Mouse controls document.addEventListener('mousedown', (e) => { isMouseDown = true; mouseX = e.clientX; mouseY = e.clientY; }); document.addEventListener('mouseup', () => isMouseDown = false); document.addEventListener('mousemove', (e) => { if (isMouseDown) { const deltaX = e.clientX - mouseX; const deltaY = e.clientY - mouseY; targetRotationY -= deltaX * 0.01; targetRotationX -= deltaY * 0.01; // Limit vertical rotation to avoid flipping targetRotationX = Math.max(-Math.PI/2 + 0.1, Math.min(Math.PI/2 - 0.1, targetRotationX)); mouseX = e.clientX; mouseY = e.clientY; } }); document.addEventListener('wheel', (e) => { distance += e.deltaY * 0.1; distance = Math.max(20, Math.min(600, distance)); }); // Resize handler window.addEventListener('resize', () => { camera.aspect = window.innerWidth / window.innerHeight; camera.updateProjectionMatrix(); renderer.setSize(window.innerWidth, window.innerHeight); }); function animate() { requestAnimationFrame(animate); // Rotate planets planetMeshes.forEach(pm => { pm.group.rotation.y += pm.speed; pm.mesh.rotation.y += 0.02; // Self rotation }); // Camera movement camera.position.x = distance * Math.sin(targetRotationY) * Math.cos(targetRotationX); camera.position.y = distance * Math.sin(targetRotationX); camera.position.z = distance * Math.cos(targetRotationY) * Math.cos(targetRotationX); camera.lookAt(0, 0, 0); // Make stars follow camera (effectively infinite distance) stars.position.copy(camera.position); renderer.render(scene, camera); } camera.position.z = 150; animate(); </script> </body> </html>

assistant

I have created a self-contained 3D solar system in `index.html`. It uses the local `three.min.js` file to render a sun, eight planets with varied sizes and orbital speeds, and a starfield. ### Features: - **3D Solar System**: Includes Sun, Mercury, Venus, Earth, Mars, Jupiter, Saturn (with rings), Uranus, and Neptune. - **Dynamic Orbits**: Planets orbit at different speeds and rotate on their own axes. - **Camera Controls**: - **Click and Drag**: Rotate the camera around the solar system. - **Scroll Wheel**: Zoom in and out. - **Starfield**: A background of 10,000 stars that moves with the camera to simulate infinite distance. - **Visuals**: Realistic lighting with a central point light from the sun and varied planet colors. The app is fully self-contained in `index.html` and requires no network access or external CDNs.

TAKE IT TO CODE

A single self-contained HTML file — copy it and open in any browser, or reuse the prompt with your own pi-agent run.

RUN

modelgemini-3-flash-preview
vendorGoogle
harnesspi-agent
generated2026-07-22

EVALUATION

4/5 working

Solar system with sun, orbiting planets, rings, starfield, and drag/wheel zoom-rotate camera controls all work well.

Vision grade · anthropic/claude-sonnet-5

MEASUREMENTS

Raw readings from the capture, not a verdict — the grade above is the only judgement. Percentages are how much of the screen changed; the measure under-reports sparse motion on a dark background.

idle motion0.4%
on click0.6%
on drag1.9%
on wheel2.4%
on enter + space1.2%
on arrow keys1.4%
on w/a/s/d1.5%
frame spread17.1 / 255
console errors0
js errors none

METRICS

runtime40.9s
tokens in25k
tokens out4.5k
cached0
cost / run$0.0260