TresJS Documentation
repository·main·Indexed 25 days ago
https://github.com/tresjs/tresOfficial monorepo for TresJS, a declarative library for creating ThreeJS scenes using Vue components via a Vue Custom Renderer. The repository includes the core library, Cientos docs, a documentation boilerplate, the TresJS Lab for demo experiments, and CubeBot, a GitHub App for issue triage and RAG-based documentation assistance.
What's inside TresJS
- TresJS is an open-source library that provides a declarative way to use Three.js within Vue 3. It works by creating a custom Vue renderer that transforms Vue components into Three.js objects. This allows developers to build 3D scenes using Vue's component-based architecture and reactivity system instead of writing imperative Three.js code.
Overview of @tresjs/cientos
mainCientos is a collection of ready-to-go helpers and components for TresJS that are not included in the
@tresjs/corepackage. It provides high-level abstractions to extend your 3D capabilities.Key Technical Detail: Cientos uses the
three-stdlibmodule instead of the standardthree/examples/jsmmodule. Because of this, you do not need to manually use theextendmethod to add these components to your TresJS catalogue; Cientos handles the registration for you automatically.Overview of TresJS
mainTresJS is a framework designed to bring Three.js into the Vue ecosystem. It allows you to build 3D scenes using a declarative approach with familiar Vue components and composables.
Key features include:
- Declarative Syntax: Build 3D scenes using Vue components.
- Three.js Integration: Stays up to date with the latest Three.js features.
- Developer Experience: Includes official devtools for inspecting 3D scenes.
- TypeScript Support: Provides a fully typed development experience.
- Nuxt Integration: Offers a dedicated Nuxt module for a seamless experience.
- Extensible Ecosystem: Can be extended with packages like
@tresjs/cientosand@tresjs/post-processing.
Overview of TresJS Post-processing
mainTresJS Post-processing is an effect composer library designed for TresJS. It allows you to enhance 3D rendering flows by applying visual effects such as bloom, depth of field, glitch, and god rays using a declarative Vue component approach. It is powered bypmndrs/postprocessingfor high performance and provides a fully typed TypeScript development experience.Overview of @tresjs/rapier
main@tresjs/rapieris a Vue-first wrapper for the Rapier physics engine. It provides a declarative API for integrating realistic physics into TresJS scenes using rigid bodies, colliders, and joints. It is built on top of the official@dimforge/rapier3dJavaScript bindings (WASM).Overview of Rapier for TresJS
mainRapier brings declarative physics to the TresJS ecosystem. It allows you to build physics-based 3D scenes using familiar Vue components and composables. It is based on the Rapier physics engine (written in Rust) and provides a fully typed development experience via TypeScript. It is designed to be compatible with the entire TresJS ecosystem and is particularly suited for game development.Overview of CubeBot 🧊
mainCubeBot is a GitHub App designed for TresJS to assist with issue triage and documentation. It automates bug vs. feature detection, redirects feature requests to GitHub Discussions, validates bug reports for required information, and provides documentation assistance via RAG (Retrieval-Augmented Generation) in response to @mentions.Understand the TresJS Declarative Paradigm
mainTresJS transforms the imperative Three.js approach (step-by-step instructions) into a declarative, component-based system using Vue. Instead of manually managing scene creation, object instantiation, and resource disposal, you describe the desired state of your 3D scene using Vue templates and components.
Key Benefits:
- Reactive State Management: Uses Vue's reactivity to automatically update 3D object properties.
- Automatic Cleanup: TresJS handles the disposal of geometries, materials, and other resources automatically.
- Component Reusability: 3D objects can be encapsulated into reusable Vue components.
- Easier Debugging: Integration with Vue DevTools allows for visual inspection of 3D objects and states.
Explore TresJS talks and articles
mainFor deeper insights into advanced usage, you can refer to these community-contributed resources:
Recent Talks
- Bring the Magic of 3D to Your Vue Applications With TresJS by Alvaro Saburido.
- Vue.js Nation 2025: TresJS Effects for Jaw-Dropping Visuals! by Alvaro Saburido.
- Nuxt Nation 2024: Playing with Nuxt in 3D by Thorsten Seyschab.
Technical Articles
- Multi-Cameras with TresJS
- How to create an infinite tube with TresJS
- 3D Pixel Art on the Web
Understand the docs-boilerplate project structure
mainThe
docs-boilerplateuses a standard Nuxt directory structure for application logic and a separatecontent/directory for Markdown-based documentation.app/components/: Vue componentsapp/composables/: Composable functionsapp/layouts/: Page layoutsapp/pages/: Route pagesapp/assets/: Static assetscontent/: Markdown content filespublic/: Public static files
Community plugins for TresJS
mainThe TresJS community provides several plugins to extend functionality, including:
- Gltf-Type-Toolkit: Generates type-safe glTF file representations in TypeScript.
- three-scatter: A tool to help scatter meshes using Three.js.
Use SMAA for antialiasing
mainSMAA (Subpixel Morphological Antialiasing) can be used to smooth out jagged edges in your 3D scenes. To use it, wrap the
<SMAA />component inside an<EffectComposer />component within your<TresCanvas />.<script setup lang="ts"> import { EffectComposer, SMAA } from '@tresjs/post-processing' </script> <template> <TresCanvas> <!-- Your scene --> <Suspense> <EffectComposer> <SMAA :width="1024" :height="768" /> </EffectComposer> </Suspense> </TresCanvas> </template>