← Back to Blog

Building an Interactive 3D Portfolio with React Three Fiber: A Complete Build Log

November 30, 2026

ReactThree.jsReact Three FiberWebGL3D

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:

  1. It stands out. Most portfolios are grids and cards. A 3D scene makes you memorable.
  2. It's interactive. Visitors can't get bored — they're in control, rotating, exploring.
  3. 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:

  1. Instancing: If you have 50 identical objects, use <Instances /> from Drei, not 50 individual meshes.
  2. LOD (Level of Detail): Far-away objects use lower poly counts. Close ones get detail.
  3. Culling: Turn off rendering for objects outside the camera frustum.
  4. 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>
  1. 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

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