threejs

Create interactive 3D scenes, animations, and WebGL visualizations using Three.js.

Updated May 18, 2026
One-click install
npx skills add https://github.com/FredoAi/fredo --skill threejs-fredoai
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: threejs
Source: https://github.com/FredoAi/fredo/tree/main/.opencode/skills/threejs
Command: npx skills add https://github.com/FredoAi/fredo --skill threejs-fredoai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building 3D graphics in the browser involves many moving parts—scene setup, cameras, renderers, lighting, animation loops, and resize handling—and small mistakes like missing lights or incompatible API versions cause blank screens. This Skill provides systematic patterns and working code templates for creating reliable Three.js experiences. ## Core Features & Use Cases - Complete Scene Setup: Covers scene, camera, renderer, geometry, materials, lighting, and animation loop initialization with the CDN-compatible r128 build. - Interaction Patterns: Includes custom camera controls (replacing unavailable OrbitControls), raycasting for object selection, mouse-driven camera movement, and particle systems. - Visual Polish & Production Guidance: Documents shadows, environment maps, tone mapping, fog, plus modern production practices like GSAP animations, GLTF loading, and React Three Fiber integration for the Fredo stack. - Use Case: A user asks for an interactive 3D sphere that responds to mouse movement; the Skill guides setup of geometry, lit materials, mouse tracking, and resize handling to produce a working result. ## Quick Start Ask the AI to create an interactive 3D scene, such as a rotating textured cube with mouse-controlled camera movement, using the Three.js skill.

Frequently Asked Questions about threejs

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a 3D scene with Three.js?▼

Create a THREE.Scene, a PerspectiveCamera with position and field of view, and a WebGLRenderer with antialias enabled. Add meshes built from geometry and material to the scene, then call renderer.render inside a requestAnimationFrame loop.

How to add mouse controls to a Three.js scene without OrbitControls?▼

Track mousedown, mousemove, and mouseup events on the renderer's DOM element, then update camera position based on mouse deltas and call camera.lookAt. Add a wheel event listener to adjust camera.position.z for zooming.

Why is my Three.js scene showing a black screen?▼

Black screens usually occur when objects are not added to the scene, the camera is positioned inside objects, or lit materials like MeshStandardMaterial are used without any lights. Verify scene.add calls, camera position, and that renderer.render runs in the animation loop.

Does Three.js r128 support CapsuleGeometry?▼

No, CapsuleGeometry was introduced in r142 and is unavailable in r128. Combine a CylinderGeometry with two SphereGeometry caps, or build custom BufferGeometry from vertices as an alternative.

Can I use Three.js with React in a Tauri desktop app?▼

Yes, use @react-three/fiber and @react-three/drei instead of vanilla Three.js patterns, wrapping the Canvas in a container with explicit dimensions. Avoid creating multiple WebGL contexts since the GPU context lives inside Tauri's webview.

How do I detect clicks on 3D objects in Three.js?▼

Use THREE.Raycaster with a normalized mouse Vector2, call raycaster.setFromCamera with the camera, then intersectObjects against your clickable meshes. The first intersected object in the returned array is the clicked target.