Building an Interactive 3D Portfolio with React Three Fiber: A Complete Build Log
November 30, 2026
After the success of my earlier 3D dice roller project, I wanted to push further: build a fully interactive 3D environment that visitors can explore, one that showcases work and pulls in real data. This is the story of that build, with all the lessons learned.
Why 3D for a Portfolio?
Three reasons:
- It stands out. Most portfolios are grids and cards. A 3D scene makes you memorable.
- It's interactive. Visitors can't get bored — they're in control, rotating, exploring.
- It demonstrates skill. A polished 3D scene proves you can ship complex, performant interactions.
The challenge: keeping it fast. 3D can easily tank performance if you're not careful.
The Architecture
I decided on a central orb (representing me, the maker) surrounded by orbiting project cards. Visitors can click cards to focus on them, see project details, and open links. The camera follows smoothly. It's exploration, not navigation.
import { Canvas } from "@react-three/fiber";
import { useGLTF } from "@react-three/drei";
import { Suspense } from "react";
export function PortfolioScene() {
return (
<Canvas
camera={{ position: [0, 0, 15], fov: 50 }}
style={{ width: "100%", height: "100vh" }}
>
<Suspense fallback={null}>
<ambientLight intensity={0.6} />
<pointLight position={[10, 10, 10]} intensity={1} />
<Portfolio />
<OrbitControls />
</Suspense>
</Canvas>
);
}
Simple entry point. All the magic lives in the <Portfolio /> component.
The Portfolio Component
Here's the core loop:
function Portfolio() {
const projects = [
{ id: 1, title: "3D Dice Roller", url: "...", angle: 0 },
{ id: 2, title: "Animation Toolkit", url: "...", angle: Math.PI * 0.5 },
{ id: 3, title: "WebGL Experiment", url: "...", angle: Math.PI },
{ id: 4, title: "Live Editor", url: "...", angle: Math.PI * 1.5 },
];
return (
<group>
{/* Central orb */}
<Orb />
{/* Project cards, orbiting */}
{projects.map((project) => (
<ProjectCard
key={project.id}
{...project}
radius={8}
/>
))}
</group>
);
}
Each <ProjectCard /> is positioned in 3D space using trigonometry:
function ProjectCard({ id, title, angle, radius }) {
const ref = useRef();
const [focused, setFocused] = useState(false);
useFrame(() => {
// Orbit animation
const x = Math.cos(angle) * radius;
const z = Math.sin(angle) * radius;
ref.current.position.set(x, 0, z);
// Smooth rotation toward camera
ref.current.lookAt(0, 0, 0);
});
return (
<group ref={ref} onClick={() => setFocused(!focused)}>
<mesh>
<boxGeometry args={[2, 3, 0.1]} />
<meshStandardMaterial color={focused ? "#10b981" : "#1a1a1a"} />
</mesh>
{/* Text label */}
<Html transform-translate-z={0.1}>
<p className="text-white text-sm font-bold">{title}</p>
</Html>
</group>
);
}
This orbits each card and keeps it facing the camera. Click it, and we focus.
The Orb (Central Piece)
The orb is a simple icosahedron with animated material:
function Orb() {
const materialRef = useRef();
useFrame(({ clock }) => {
if (materialRef.current) {
materialRef.current.emissiveIntensity =
0.5 + Math.sin(clock.elapsedTime) * 0.3;
}
});
return (
<mesh>
<icosahedronGeometry args={[1.5, 4]} />
<meshStandardMaterial
ref={materialRef}
color="#10b981"
emissive="#10b981"
emissiveIntensity={0.5}
metalness={0.3}
roughness={0.4}
/>
</mesh>
);
}
Pulsing emissive intensity creates that living, breathing feel.
Interaction: Focusing on a Card
When a user clicks a card, the camera animates to frame it:
const [focusedProject, setFocusedProject] = useState(null);
const cameraRef = useRef();
useFrame(() => {
if (focusedProject) {
// Smoothly transition camera to frame the card
const targetPos = {
x: focusedProject.x + 5,
y: 2,
z: focusedProject.z + 5,
};
cameraRef.current.position.lerp(targetPos, 0.05);
cameraRef.current.lookAt(focusedProject.x, 0, focusedProject.z);
} else {
// Return to default orbit view
cameraRef.current.position.lerp(new THREE.Vector3(0, 0, 15), 0.05);
cameraRef.current.lookAt(0, 0, 0);
}
});
This creates smooth camera transitions without jarring snaps.
Performance Considerations
3D is fast until it isn't. Here's what I did:
- Instancing: If you have 50 identical objects, use
<Instances />from Drei, not 50 individual meshes. - LOD (Level of Detail): Far-away objects use lower poly counts. Close ones get detail.
- Culling: Turn off rendering for objects outside the camera frustum.
- Lazy load data: Fetch project details on-demand, not upfront.
import { Instances, Instance } from "@react-three/drei";
<Instances>
{projects.map((p) => (
<Instance key={p.id} {...p} />
))}
</Instances>
- Monitor performance: Use React Three Fiber's stats. Aim for 60fps consistently.
import { Stats } from "@react-three/drei";
<Canvas>
<Stats />
{/* ... */}
</Canvas>
What I'd Do Differently
Looking back:
- Use Drei helpers more.
<Environment />for lighting,<Float />for floating animations. They're battle-tested. - Plan the interaction before coding. I changed the camera behaviour three times mid-project.
- Test on mobile early. 3D on phones is different. Touch controls, lower frame rates, reduced feature set.
- Preload geometry. Use
useGLTF.preload()to fetch models before the scene renders.
The Result
The 3D portfolio gets views. It's a talking point. Performance is solid: 55–60fps on modern machines, still playable on older hardware with reduced effects.
More importantly, building it was fun. That enthusiasm translates when visitors explore it.
Tools & Resources
- React Three Fiber
- Drei Helpers — seriously, use these
- Three.js Docs
- WebGL Inspector — debug WebGL issues
What did you think of this post?
If you build something similar, I'd love to hear how it goes. The 3D web is still new enough that there's room for innovation — go wild with it.
Related posts
Building a 3D Dice Roller with React Three Fiber in One Night
June 22, 2026
How I built a realistic physics-based 3D dice roller with React Three Fiber in 8 hours, adapting a Codrops tutorial with mobile accelerometer support.
Chess BORED!: Stockfish in WebAssembly and a 3D Board Made of Cylinders
October 5, 2026
How Chess BORED! runs Stockfish as WebAssembly in a Web Worker and draws a 3D board with React Three Fiber and chess.js, with live demos.
Framer Motion vs CSS Animations: Which Should You Use?
November 23, 2026
A deep dive into performance, complexity, and real-world use cases for Framer Motion and native CSS animations in 2026.