ponahoum / three-usdz-loader

A basic USDZ file (Pixar Universal Scene Description) loader for ThreeJS
Other
138 stars 24 forks source link

Texture not working #13

Closed hvvivek closed 2 months ago

hvvivek commented 11 months ago

Hi!

Thank you so much for making this library. I am able to load the model file. But when I try to add it to the scene I end up getting a webgl shader error. See image below. Has anyone experienced this?

The issue seems to do something with the texture because if I replace all the materials with a standard material, the error does not throw up. Any guidance is helpful!

image

ponahoum commented 11 months ago

Can you provide the basic steps (and code) to reproduce and the model causing the problem ? Thanks !

digitalw commented 3 months ago

seems like its an issue related to newer versions of Three.JS when changing from 0.164.1 to 0.140.0 (as used in the demo) the textures where displaying correctly.

ponahoum commented 2 months ago

Hi @hvvivek,

As @digitalw mentionned, this is due to ThreeJs upgrading its api since i did this package.

I built and tested the package with ThreeJS 0.140, so i cannot garantee it will perfectly work with the latest threejs (0.166 as of today).

I did some tests and it seems that starting at Three 0.153, three usdz loader doesn't work anymore and causes your error in particular (among others). After performing few tests, it seems due to the texture sampling in the shader not finding the proper uv channel (0 in this case). A simple modification of ThreeJsRenderDelegate by adding clonedTexture.channel = 0 fixes your issue.

For now, i would recommend that you use a version of threejs close or equal to 0.140, and certainly inferior to 0.153, I'll take some time to upgrade the package to the latest threejs version and fix other issues with textures handling, which seems to have been thoroughly modified since i did the first version of this package.

ponahoum commented 2 months ago

V1.0.8 should fix this issue for the latest versions of ThreeJS encountering this issue.