pmndrs / gltfjsx

🎮 Turns GLTFs into JSX components
https://gltf.pmnd.rs
MIT License
4.45k stars 290 forks source link

memory access out of bounds, Decoding failed #132

Open mohAmineBrs opened 2 years ago

mohAmineBrs commented 2 years ago

Hello there, I'm facing this error as showen in image while rendering this floating-shoe example and i don't know the real source of bug, any solution or even a hint. The model was working 100% then i was working on an other component ib the same app without touching the model code then suddenly the error occured...I tried to reinstall the project file from this repos without any other componenet just the shoe model boilerplate, and the same error occured. floating-shoe

donmccurdy commented 2 years ago

Likely cause is a recent update to the Draco CDN:

Updating to latest @react-three/drei should solve the issue, since it pins its Draco decoders to 1.4 instead of using the latest copy from the CDN.

mohAmineBrs commented 2 years ago

The update of @react-three/drei still throw the same error for me

donmccurdy commented 2 years ago

Hm, it "shouldn't" based on Draco dev's suggestions and the decoder URL defined here...

https://github.com/pmndrs/drei/blob/9bf123bb577d2468323f64f1dcc3a7d655560248/src/core/useGLTF.tsx#L18

... but I don't have a direct way to test that. You may want to check your Network tab to see what URL the decoders are downloaded from? If it's broken on any URL that includes /1.4 or /1.5 that would be something good to report on the upstream Draco issue.

mohAmineBrs commented 2 years ago

Hi, sorry for late reply because i was trying to find a way to a solution... but there is an improvment. I changed the importing way of the @react-three/fiber and @react-three/drei components from this :

import { Canvas, useFrame } from "react-three-fiber"
import { ContactShadows, Environment, useGLTF, OrbitControls } from "drei"

to this :

import { Canvas, useFrame } from "@react-three/fiber"
import { ContactShadows, Environment, useGLTF, OrbitControls } from "@react-three/drei"

and it displayed this : Capture

and throwed this error : error

Notice that the original model should look like this : Capture1

donmccurdy commented 2 years ago

Looks like the upstream issue with the Draco CDN has resolved: https://github.com/google/draco/issues/819#issuecomment-1046081914, you should be able to use the previous version of drei now.

The error you see above is caused by having versions of drei, three-stdlib, and/or three.js that do not match.

mohAmineBrs commented 2 years ago

Yesss, now it's working perfectly. Thank you so much Mr @donmccurdy