Open stefano-ciotola opened 7 months ago
Having the same issue here, same specs.
This needs more attention.
same issue here.
Same issue here :).
Meanwhile, I've found a way to make it work. Just change the KTX2Loader to use threejs default instead of three-stdib. This is the code that worked for me:
import React, { useEffect, useRef } from 'react'
import { useGLTF } from '@react-three/drei'
import { extend, useThree } from '@react-three/fiber'
import { KTX2Loader } from 'three/examples/jsm/loaders/KTX2Loader'
extend({ KTX2Loader })
export default function House(props) {
const { nodes, materials } = useGLTF('/HouseV3_Final_baked.glb')
const meshRef = useRef()
const { gl } = useThree()
useEffect(() => {
const loader = new KTX2Loader()
.setTranscoderPath(
'https://cdn.jsdelivr.net/gh/pmndrs/drei-assets/basis/'
)
.detectSupport(gl)
loader.load('house_base.ktx2', (texture) => {
meshRef.current.material.map = texture
meshRef.current.material.needsUpdate = true
})
return () => loader.dispose()
}, [gl])
return (
<group {...props} dispose={null}>
<mesh
ref={meshRef}
castShadow
receiveShadow
geometry={nodes.house_base_Baked.geometry}
position={[0, 5.07, 0]}
scale={0.01}
>
<meshStandardMaterial />
</mesh>
</group>
)
}
useGLTF.preload('/HouseV3_Final_baked.glb')
It pays all the effort. I got a huge memory optimization. From 20MB VRAM usage for each mesh to 2.2 MB VRAM! It is fantastic! 🫶🏻
Same issue here. Did anybody find a solution that works globally (also for useGLTF)?
Fix it please :)
Environment:
Problem description:
When attempting to load a KTX2 texture using
useKTX2('my_texture_path')
, the console throws a ReferenceError:_KTX2Loader is not defined
, preventing the successful loading of KTX2 textures.Full error log:
The example provided in the documentation does not seem to work either (https://drei.pmnd.rs/?path=/docs/loaders-ktx2--docs).
I have followed the standard setup and installation procedures for three, @react-three/fiber, and @react-three/drei as recommended in the docs.