tres icon indicating copy to clipboard operation
tres copied to clipboard

When TresCanvas is unmounted, an error occurs equal to the number of Html components.

Open angrymusic opened this issue 1 year ago • 2 comments

Describe the bug

When TresCanvas is unmounted, an error occurs equal to the number of Html components. hook.js:608 THREE.Material: parameter 'vertexShader' has value of undefined.

<template>
  <div class="about">
    <h1>This is an about page</h1>
    <div class="canvas">
      <TresCanvas v-bind="gl">
        <OrbitControls />
        <TresPerspectiveCamera :position="[5, 5, 5]" />
        <!-- Your scene here -->
        <TresMesh cast-shadow :position="[0, 0, 0]">
          <TresBoxGeometry :args="[1, 1, 2]" />
          <TresMeshToonMaterial color="blue" />
          <Html center transform sprite>
            <div class="text">TEXT</div>
          </Html>
        </TresMesh>
      </TresCanvas>
    </div>
  </div>
</template>
<script setup lang="ts">
import { TresCanvas } from '@tresjs/core'
import { BasicShadowMap, SRGBColorSpace, NoToneMapping } from 'three'
import { Html, OrbitControls } from '@tresjs/cientos'
const gl = {
  clearColor: '#87CEEB',
  shadows: true,
  alpha: true,
  shadowMapType: BasicShadowMap,
  outputColorSpace: SRGBColorSpace,
  toneMapping: NoToneMapping,
}
</script>
<style>
.canvas {
  width: 500px;
  height: 500px;
  position: relative;
}
.text {
  color: white;
  font-weight: bold;
  font-size: 30px;
}
</style>


hook.js:608 THREE.Material: parameter 'vertexShader' has value of undefined.

now about page 스크린샷 2025-01-14 161928

if I go home? 스크린샷 2025-01-14 161935 If I add Html components, the error increases by the corresponding number.

Reproduction

https://stackblitz.com/edit/tresjs-basic-4pso7hpr?file=src%2Fcomponents%2FTheExperience.vue

Steps to reproduce

No response

System Info

npx envinfo --system --npmPackages '{vite,@tresjs/*, three, vue}' --binaries --browsers
Need to install the following packages:
[email protected]
Ok to proceed? (y) y


  System:
    OS: Linux 5.15 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
    CPU: (8) x64 13th Gen Intel(R) Core(TM) i7-1355U
    Memory: 1.70 GB / 7.76 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 20.18.0 - ~/.nvm/versions/node/v20.18.0/bin/node
    npm: 11.0.0 - ~/.nvm/versions/node/v20.18.0/bin/npm
  npmPackages:
    @tresjs/cientos: ^4.0.3 => 4.0.3 
    @tresjs/core: ^4.3.2 => 4.3.2 
    vite: ~6.0.6 => 6.0.6

Used Package Manager

npm

Code of Conduct

angrymusic avatar Jan 14 '25 07:01 angrymusic

askomarov avatar May 23 '25 09:05 askomarov

This is related to the undefined attributed to the vertexShader. I am currently fixing several issues with the <Html> component, and it will be available once those are resolved! 👌

damienmontastier avatar Aug 10 '25 18:08 damienmontastier