TresJS Documentation

repository·main·Indexed 25 days ago

https://github.com/tresjs/tres

Official 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.

Tokens
206.7K
Snippets
465
Records
854
Agent score
85%

What's inside TresJS

  1. Introduction to TresJS

    main
    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.
  2. Overview of @tresjs/cientos

    main

    Cientos is a collection of ready-to-go helpers and components for TresJS that are not included in the @tresjs/core package. It provides high-level abstractions to extend your 3D capabilities.

    Key Technical Detail: Cientos uses the three-stdlib module instead of the standard three/examples/jsm module. Because of this, you do not need to manually use the extend method to add these components to your TresJS catalogue; Cientos handles the registration for you automatically.

  3. Overview of TresJS

    main

    TresJS 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/cientos and @tresjs/post-processing.
  4. Overview of TresJS Post-processing

    main
    TresJS 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 by pmndrs/postprocessing for high performance and provides a fully typed TypeScript development experience.
  5. Overview of Rapier for TresJS

    main
    Rapier 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.
  6. Overview of CubeBot 🧊

    main
    CubeBot 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.
  7. Understand the TresJS Declarative Paradigm

    main

    TresJS 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.
  8. Explore TresJS talks and articles

    main

    For 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
  9. Understand the docs-boilerplate project structure

    main

    The docs-boilerplate uses a standard Nuxt directory structure for application logic and a separate content/ directory for Markdown-based documentation.

    • app/components/: Vue components
    • app/composables/: Composable functions
    • app/layouts/: Page layouts
    • app/pages/: Route pages
    • app/assets/: Static assets
    • content/: Markdown content files
    • public/: Public static files
  10. Use SMAA for antialiasing

    main

    SMAA (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>