Bring the Magic of 3D to Your Vue Applications With TresJS

This ad is not shown to multipass and full ticket holders
JSNation US
JSNation US 2025
November 17 - 20, 2025
New York, US & Online
See JS stars in the US biggest planetarium
Learn More
In partnership with Focus Reactive
Upcoming event
JSNation US 2025
JSNation US 2025
November 17 - 20, 2025. New York, US & Online
Learn more
Bookmark
Rate this content

Meet TresJS, a Vue custom renderer that enables you to craft immersive 3D experiences declaratively using ThreeJS components. In this lightning talk, we’ll demonstrate how Tres breaks down the barrier between developers and the 3D world using their favorite framework.

This talk has been presented at JSNation US 2024, check out the latest edition of this JavaScript Conference.

FAQ

Trace.js is a Vue custom renderer on top of 3ds, a core JavaScript library for rendering WebGL experiences. It allows you to build 3D scenes declaratively using Vue components and composables.

You can install Trace.js using your preferred package manager or try it out on the Vue JS playground. The library provides different flavors for integration.

The TraceCampos component acts as a context provider for 3D scenes in Trace.js, facilitating the integration and management of 3D content within a Vue application.

To create a 3D object, you add a perspective camera and define objects using components like TraceMesh. You can adjust properties such as geometry and material of objects to customize their appearance.

The new feature announced is the post-processing library for Trace.js, which simplifies adding effects like glow to 3D scenes, enhancing the visual experience.

Post-processing in Trace.js involves applying effects to rendered scenes after the initial rendering. It is similar to post-production in movies or video games, allowing for enhanced visual effects.

Yes, Trace.js supports animations, and its community contributes recipes on how to create animations and load models, as shared in their cookbook.

You can refer to the documentation, community cookbook, and YouTube playlist provided by Alvaro Sabu, which includes tutorials and guides on getting started with Trace.js.

Trace.js was presented by Alvaro Sabu, a developer experience engineer originally from Venezuela, now based in Barcelona, Spain. He creates content on Alvaro DevLabs.

Trace.js receives support from various sponsors, including companies that provide monetary support to contributors, enabling continued development and collaboration.

Alvaro Saburido
Alvaro Saburido
9 min
18 Nov, 2024

Comments

Sign in or register to post your comment.
Video Summary and Transcription
What if I told you that this scene or game is entirely done with Vue components? I'm presenting Trace.js, a library to bring 3D to Vue applications. In the setup syntax of Vue, we import the TraceCampos component and add it with a prop called window size. By adding a light to the scene, we can create our first 3D renderer. The post processing library for TresCS was launched, allowing developers to easily add effects like glow to their 3D scenes. TresCS allows you to build impressive scenes with minimal code. Let's quickly demo some galaxies using view components.

1. Introduction to Vue components in 3D

Short description:

What if I told you that this scene or game is entirely done with Vue components? I have another example. It's a sound created by one of our core team members, entirely done with Vue components and composables. That's what my talk is about.

So, what if I told you that... This is so cool. I never did a talk in an observatory. What if I told you that this scene right here or this game, because I can play with it, is entirely done with Vue components? So this is done decoratively, and I have another example. This is a sound where it comes from. It's done by one of our core team members. He created this synth wave kind of thing. It's also done entirely with Vue components and composables. So that's what my talk is about. And I'm going to mute so you don't have the sound all the time. Okay?

2. Introducing Trace.js for 3D in Vue

Short description:

I'm presenting Trace.js, a library to bring 3D to Vue applications. Trace.js is a custom renderer that allows you to build scenes declaratively using Vue components and composables. You can install it with your packet manager of choice or play with it on our Vue JS playground.

Yeah. So, hi, everyone. I'm going to present today... My library is called Trace.js. And the idea is to bring the magic of 3D to your Vue applications.

My name is Alvaro Sabu. I'm a DevRel engineer... Or, well... I had to update this. I'm a developer experience engineer in the starter block. I'm from Barcelona, Spain. But originally from Venezuela. Creating content on Alvaro DevLabs. And also my portfolio that I never finish is around there. And my Twitter and socials. So you're welcome to say hi anytime.

So what is Trace.js? Trace.js is a Vue custom renderer on top of 3ds, which is the core library in JavaScript to render WebGL experiences. So you can use it to build a scene declaratively, like you would do with a UI, to create different things like Vue components and composables. Trace is a Spanish word for 3ds. And it's pronounced Tress. And in reference of the library. So how do you get started with it? We have several flavors. But you can install it with your packet manager of choice. Or you can always play with it on our Vue JS playground. So you can go here and directly code. And you will see the output here. I'm gonna share it later on my socials. Okay?

So... Let's create our first 3ds scene. So this is like the setup syntax of Vue with a script and a template.

3. Setting up the Vue scene and adding objects

Short description:

In the setup syntax of Vue, we import the TraceCampos component and add it with a prop called window size. Then we use another component called the scene to contain the context of our 3D. We add a perspective camera to set the position and look at. Then we add a box object, built with a trace mesh, which combines the geometry and material of the object.

So this is like the setup syntax of Vue with a script and a template. What we're gonna do is we're gonna import the TraceCampos component from the core. And then we're gonna add it with a prop called window size, so it occupies the whole size. Is it visible? Yeah? Okay. So we import it. We use it in the template. And then as a good practice, we can use another component on Vue, a subcomponent called... I don't know. The experience, the scene. Just because the TraceCampos is a context provider. So all the context of our 3d is gonna live inside of it. So it's gonna make things easier. Okay?

Then... I'm forgetting that I have the animations. This is super fancy now. First we need to see something, right? Something rendered on the scene. So we add a perspective camera. With a position in the scene. And a look at. Which is like... Where it's gonna point out. So you can start noticing that this is a parallel between the 3ds objects and how they use as components here. Then we can add some objects into our scene. So I'm gonna add a box. Okay? A box is built with a trace mesh. So you can do the analogy between the geometry being the HTML of the 3d object. And then the material is gonna be like the CSS of the object. It's gonna declare what color it has. If it's reflective, if it's not. Okay? All that comes together in something that is called a mesh.

4. Adding Lights and Post Processing Effects

Short description:

By adding a light to the scene, we can create our first 3D renderer. We can customize the box geometry by modifying its properties like width, height, and depth. We can also rotate the cube. Additionally, the post processing library for TresCS was launched, allowing developers to easily add effects like glow to their 3D scenes.

And if we're lucky enough and we add a light to the scene, because if not, everything is dark, we come up with something like this. Okay? So... Hey! We have our first 3d renderer ever on the screen already with these components. So we can say, like, woohoo! Clap your backs. You already did your first 3d scene ever. But can it get better than that? Of course it can.

So right now we are using the plane directly on the middle of the scene. But we can add some arguments for the constructor. So the arguments will depend on the component that you're using. In this case, I'm going to modify how the box geometry looks like. So I'm adding some properties to the width, the height, and the depth, let's say. Or I can change the rotation of the whole cube by changing the property here and using some math in order to change it. So this is how it's gonna look like after we do those changes. So we increase the size of the cube and also we rotate it a little bit.

Let's make it glow. Right? And this is when I have something to announce. And we just launched today the post processing library for TresCS. So you remember at the beginning of the talk, I was showing you a cool game with glowing lights and such. Post processing library is meant to make it easy and focus on developer experience. So you can add it as TresCS post processing. And it's as easy as adding for the material, you need to enable the emissive. So it's a property that allows you to say, okay, I want to have this intensity. And also the color of the glow. Okay? And then you can import something called the bloom and the effect composer. So the effect composer is gonna be like the context of the effect. So you can pass several passes. And every pass is gonna be a different effect. So you can build up different post processing effects. Why it's called post processing? Because it's not rendering in realtime, it's just taking what you render and then adding post processing, as you will do with movies or video games. It's the same concept.

5. Glowing Cubes and Acknowledgements

Short description:

We're using the bloom effect to create a glowing cube and showcase the possibilities of 3D on the web. TresCS allows you to build impressive scenes with minimal code. Check the documentation, cookbook, and YouTube playlist for more resources. Thanks to our sponsors, including StackBlitz, for their support. Let's quickly demo some galaxies using view components.

So we're using the bloom effect with an intensity, luminance, threshold, yadda yadda. Really technical, but it's what allows you to detect when to glow. And voila! We have a glowing cube! Amazing! Woohoo! So this is when we can start dancing and figure out, okay, we can do pretty cool stuff with 3D on the web.

And the cool thing is that also it's pre-performant. So since I have only seven minutes today, I only wanted to show you a little glimpse of what you can build with TresCS. And you can notice a small amount of code that it requires to get something working. So the next steps will be... I put some QR, so I hope they are working. You can check the documentation. We have a lot of nice to go, get my first scene running. We have a cookbook, where all the community is adding recipes on, for example, how to do animations, how to load models that you don't load from video games or like free in the internet. And we have a YouTube playlist that honestly I had to create more content next year. That's my hope. Where we show the basics of how to get started with.

It will not be a good talk for myself if I don't thank our sponsors. So this is all the people that allow us to continue working and to provide to the different contributors some monetary support. That's really important. We have companies as well that are supporting us by sponsoring. Big thanks to StackBlitz for the collaboration on the BitConf. And yeah, that's about it. Thank you very much. I still have 30 seconds. So do you want to see another demo? Yeah? Okay. Let's go real quick. Here and go back. Since we're in a planetarium, come on, quick, what about some galaxies? Yeah. So we can change the color. Is it visible? Kind of, right? I don't see it from here. Yeah, you can change the color, like how many randomnesses you have, size of it. And this is all as well done with view components. Thank you very much. Thank you. Thank you.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Everything Beyond State Management in Stores with Pinia
Vue.js London Live 2021Vue.js London Live 2021
34 min
Everything Beyond State Management in Stores with Pinia
Top Content
State management is not limited to complex applications and transitioning to a store offers significant benefits. Pinia is a centralized state management solution compatible with Vue 2 and Vue 3, providing advanced devtools support and extensibility with plugins. The core API of Pinia is similar to Vuex, but with a less verbose version of stores and powerful plugins. Pinia allows for easy state inspection, error handling, and testing. It is recommended to create one file per store for better organization and Pinia offers a more efficient performance compared to V-rex.
Welcome to Nuxt 3
Vue.js London Live 2021Vue.js London Live 2021
29 min
Welcome to Nuxt 3
Top Content
Nux3 has made significant improvements in performance, output optimization, and serverless support. Nuxt Bridge brings the Nitro engine for enhanced performance and easier transition between Nuxt 2 and Nuxt Read. Nuxt 3 supports Webpack 5, Bytes, and Vue 3. NextLab has developed brand new websites using Docus technology. Nuxt.js is recommended for building apps faster and simpler, and Nuxt 2 should be used before migrating to Nuxt 3 for stability. DOCUS is a new project that combines Nuxt with additional features like content modules and an admin panel.
One Year Into Vue 3
Vue.js London Live 2021Vue.js London Live 2021
20 min
One Year Into Vue 3
Top Content
Vue 3 has seen significant adoption and improvements in performance, bundle size, architecture, and TypeScript integration. The ecosystem around Vue 3 is catching up, with new tools and frameworks being developed. The Vue.js.org documentation is undergoing a complete overhaul. PNIA is emerging as the go-to state management solution for Vue 3. The options API and composition API are both viable options in Vue 3, with the choice depending on factors such as complexity and familiarity with TypeScript. Vue 3 continues to support CDN installation and is recommended for new projects.
Utilising Rust from Vue with WebAssembly
Vue.js London Live 2021Vue.js London Live 2021
8 min
Utilising Rust from Vue with WebAssembly
Top Content
In this Talk, the speaker demonstrates how to use Rust with WebAssembly in a Vue.js project. They explain that WebAssembly is a binary format that allows for high-performance code and less memory usage in the browser. The speaker shows how to build a Rust example using the WasmPack tool and integrate it into a Vue template. They also demonstrate how to call Rust code from a Vue component and deploy the resulting package to npm for easy sharing and consumption.
Vue: Feature Updates
Vue.js London 2023Vue.js London 2023
44 min
Vue: Feature Updates
Top Content
Watch video: Vue: Feature Updates
The Talk discusses the recent feature updates in Vue 3.3, focusing on script setup and TypeScript support. It covers improvements in defining props using imported types and complex types support. The introduction of generic components and reworked signatures for defined components provides more flexibility and better type support. Other features include automatic inference of runtime props, improved define emits and defined slots, and experimental features like reactive props destructure and define model. The Talk also mentions future plans for Vue, including stabilizing suspense and enhancing computer invalidations.
Local State and Server Cache: Finding a Balance
Vue.js London Live 2021Vue.js London Live 2021
24 min
Local State and Server Cache: Finding a Balance
Top Content
This Talk discusses handling local state in software development, particularly when dealing with asynchronous behavior and API requests. It explores the challenges of managing global state and the need for actions when handling server data. The Talk also highlights the issue of fetching data not in Vuex and the challenges of keeping data up-to-date in Vuex. It mentions alternative tools like Apollo Client and React Query for handling local state. The Talk concludes with a discussion on GitLab going public and the celebration that followed.

Workshops on related topic

How to make amazing generative art with simple JavaScript code
JS GameDev Summit 2022JS GameDev Summit 2022
165 min
How to make amazing generative art with simple JavaScript code
Top Content
Workshop
Frank Force
Frank Force
Instead of manually drawing each image like traditional art, generative artists write programs that are capable of producing a variety of results. In this workshop you will learn how to create incredible generative art using only a web browser and text editor. Starting with basic concepts and building towards advanced theory, we will cover everything you need to know.
Monitoring 101 for React Developers
React Summit US 2023React Summit US 2023
107 min
Monitoring 101 for React Developers
Top Content
WorkshopFree
Lazar Nikolov
Sarah Guthals
2 authors
If finding errors in your frontend project is like searching for a needle in a code haystack, then Sentry error monitoring can be your metal detector. Learn the basics of error monitoring with Sentry. Whether you are running a React, Angular, Vue, or just “vanilla” JavaScript, see how Sentry can help you find the who, what, when and where behind errors in your frontend project. 
Workshop level: Intermediate
Using Nitro – Building an App with the Latest Nuxt Rendering Engine
Vue.js London Live 2021Vue.js London Live 2021
117 min
Using Nitro – Building an App with the Latest Nuxt Rendering Engine
Top Content
Workshop
Daniel Roe
Daniel Roe
We'll build a Nuxt project together from scratch using Nitro, the new Nuxt rendering engine, and Nuxt Bridge. We'll explore some of the ways that you can use and deploy Nitro, whilst building a application together with some of the real-world constraints you'd face when deploying an app for your enterprise. Along the way, fire your questions at me and I'll do my best to answer them.
Vue3: Modern Frontend App Development
Vue.js London Live 2021Vue.js London Live 2021
169 min
Vue3: Modern Frontend App Development
Top Content
Workshop
Mikhail Kuznetsov
Mikhail Kuznetsov
The Vue3 has been released in mid-2020. Besides many improvements and optimizations, the main feature of Vue3 brings is the Composition API – a new way to write and reuse reactive code. Let's learn more about how to use Composition API efficiently.

Besides core Vue3 features we'll explain examples of how to use popular libraries with Vue3.

Table of contents:
- Introduction to Vue3
- Composition API
- Core libraries
- Vue3 ecosystem

Prerequisites:
IDE of choice (Inellij or VSC) installed
Nodejs + NPM
TresJS create 3D experiences declaratively with Vue Components
Vue.js London 2023Vue.js London 2023
137 min
TresJS create 3D experiences declaratively with Vue Components
Workshop
Alvaro Saburido
Alvaro Saburido
- Intro 3D - Intro WebGL- ThreeJS- Why TresJS- Installation or Stackblitz setup - Core Basics- Setting up the Canvas- Scene- Camera- Adding an object- Geometries- Arguments- Props- Slots- The Loop- UseRenderLoop composable- Before and After rendering callbacks- Basic Animations- Materials- Basic Material- Normal Material- Toon Material- Lambert Material- Standard and Physical Material- Metalness, roughness - Lights- AmbientLight- DirectionalLight- PointLights- Shadows- Textures- Loading textures with useTextures- Tips and tricks- Misc- Orbit Controls- Loading models with Cientos- Debugging your scene- Performance
Building Vue forms with VeeValidate
Vue.js London Live 2021Vue.js London Live 2021
176 min
Building Vue forms with VeeValidate
Workshop
Abdelrahman Awad
Abdelrahman Awad
In this workshop, you will learn how to use vee-validate to handle form validation, manage form values and handle submissions effectively. We will start from the basics with a simple login form all the way to using the composition API and building repeatable and multistep forms.

Table of contents:
- Introduction to vee-validate
- Building a basic form with vee-validate components
- Handling validation and form submissions
- Building validatable input components with the composition API
- Field Arrays and repeatable inputs
- Building a multistep form
Prerequisites:
VSCode setup and an empty Vite + Vue project.