Taking web interaction to the next level: My experience adding 3D to the 10K Zaragoza

PUBLISHED: 2026-07-19
AUTHOR: MANUEL PRIETO
Web-3d

The 10K Zaragoza website project is one of those challenges that gets you excited from day one. The base of the website was already designed by another development team, but the company Corre en Zaragoza hired me to join the technical team with a very clear goal: give it an extra layer of interaction and surprise the user.

How did we achieve that? It all started, like the best ideas, with a round of questions and a joint brainstorming session. Each team member brought their vision and proposals.

For my part, I've always dabbled in the 3D world. Years ago I used to work a lot with 3D Studio Max, so when my turn came, I had it clear: what if we add an interactive 3D viewer of the official t-shirt directly on the website? The proposal fit perfectly and the team thought it was an incredible idea.

Going back to the origins: From 3D Studio Max to Blender

With the team's green light, I got to work alongside the design colleagues. My first stop was Blender. I had to dust off knowledge that I hadn't used in years. It was a nostalgic but intense process, remembering how the basic pillars of the three-dimensional world worked: positioning the camera, configuring the lights, working with textures, materials, and motion in the scene.

Modeling and editing of the official t-shirt in Blender

I took a specific object to serve as the base for our t-shirt and began applying materials to achieve the realistic finish we were looking for.

From Blender to the Web: The magic of Three.js and React

While I was fighting with vertices and textures in Blender, I started working on the code. The goal was clear: take that model and render it in the browser, giving the user the ability to interact with it.

I started by testing the model 'naked' (without complex textures or dynamic lights) using Three.js, the standard library par excellence for 3D rendering on the web. However, since we were working in a modern React environment, I soon made the jump to React Three Fiber (R3F).

This is where the technical experience became really interesting. One of the biggest challenges was changing my way of thinking. If you are interested in the more technical side of this paradigm shift, I recommend reading my article on React Three Fiber and Declarative 3D Programming where I explain the differences with Vanilla Three.js.

But to give you a quick idea of how elegant and declarative it is to work with R3F, this is a small snippet of how the scene is built:

Page Architecture and Optimization (TShirt3DPage)

To release this development to production on the official website, we couldn't just dump the 3D renderer onto the screen. A 3D viewer loads heavy scripts and geometric models that can ruin loading performance (First Contentful Paint) and SEO if not structured properly.

Therefore, we implemented a decoupled structure with key optimizations:

1. Dynamic Lazy Loading of the Scene

The main page component (TShirt3DPage.jsx) imports the viewer dynamically. This way, the browser prioritizes downloading the structured HTML and SEO tags (handled with react-helmet-async) before loading and initializing WebGL:

2. Scale Normalization and Automatic Positioning

Since designers model at arbitrary scales in Blender, we programmed an analyzer (SceneProcessor) that reads the real geometric bounding box of the model to automatically scale and center it on the screen, regardless of its original export size:

3. Dynamic Studio Lighting

To make the t-shirt look premium and not "flat", we created a set of counter-lights (RotatingLights) that rotate constantly on each render using useFrame, highlighting the textures and shadows of the fabric's wrinkles:

4. UX on Mobile Devices: Interaction Locking

On small touch screens, dragging a 3D model can trap the user inside the viewer, preventing them from scrolling down the page. To solve this, we created a manual activation layer: by default, the Canvas has touch events disabled (pointer-events-none) and displays a translucent overlay to activate it on demand.

Technical Challenges and Solutions

To take the t-shirt experience to another level, we implemented several key solutions:

  1. Dynamic Scaling and Centering: In 3D, exporting a model at the perfect scale for web is difficult. We programmed a processor (THREE.Box3) that reads the mathematical 'box' enclosing the t-shirt and scales it automatically so that it always frames perfectly on the user's screen.
  2. Dynamic Materials: The user not only rotates the t-shirt, but the web applies the color in real time. R3F allows us to connect the React state (e.g., the selected color) directly to the properties of the t-shirt's MeshStandardMaterial.
  3. Dynamic Studio Lighting: To prevent the fabric from looking 'flat' and make it look like a premium product, I created a rotating lights component. A set of directional lights (gold, maroon, and white) that rotate perpetually around the garment, highlighting its wrinkles and texture like in a real storefront.

Conclusion

The true value of bringing 3D to the browser does not lie only in the visual spectacularity, but in maintainability and workflow. Tools like React Three Fiber allow us to handle complex Three.js scenes with the same ease with which we manage the state of a button or a modal in React.

The greatest learning from this project has been confirming that the bridge between pure design (modeling and texturing in Blender) and declarative programming is finally unified. Adjusting dynamic studio lights, injecting colors in real time, or recalculating the scale of the model to fit the screen no longer involves dealing with obscure DOM mathematics; it is simply a natural extension of our UI.

Creating this interaction for the 10K Zaragoza has shown me that the real evolutionary leap in current web development is being able to offer an immersive product experience without sacrificing performance or code cleanliness. And seeing the user play with the garment on the screen is priceless!