I’m trying to update threejs from 103 to 104 but my 3d model is being rendered all black (without vertex colors). I am using PhongMaterial to load the 3d model and have set the vertexColors as THREE.vertexColors. It works on 103 and below but doesn’t on 104. I am wondering if anyone knows what the issue could be and how do I fix it? The migration guide doesn’t suggest any breaking change when going from 103 to 104. Let me know. Thanks!
Do you mind demonstrating the issue with a live example? I’m not aware of any changes in r104
that coulld cause the issue.
@Mugen87 Apologies for the late response. I’ve created a working example here: https://jsfiddle.net/canuck1/3f9tbuar/. Please change r103 to r104 on line 13 in HTML editor to see the issue.
It seems your issues are cause by PLYLoader_New
and Vector3_New
which look like custom modifications. These are probably not compatible to newer versions of the core library. You should try to fix your app code by using the standard classes: https://jsfiddle.net/dat81r0n/1/
The fiddle shows at least one problem. Your app operates on a buffer attribute called objectId
which never existed in the official build files.
Thanks for taking a look. I just compared PLYLoader
from r103 and r104 and they are both identical. So, I don’t think it’s due to my custom PLYLoader since it’s working in r103. For Vector3_New
, I’m using Vector3 from your yuka project (with a bit of customization). Can you please suggest what I might need to change in your Vector3 (yuka) for it to work with r104?
Update:
I’m no longer using custom Vector3
but it still didn’t fix it. I also just modified PLYLoader
in r104 with my custom attributes and used it with three r103 and it worked. It didn’t work when I used three r104 with modified PLYLoader
r104. I printed the geometry and it has the rgb color values for each vertex. There’s definitely something that changed in three.js from r103 to r104 to cause this issue.
Update #2:
Adding geometry.computeVertexNormals()
to my loader function helped a bit but the colors are not accurate.
Update #3:
Using geometry.computeVertexNormals()
and only keeping AmbientLight
seems to have resolved the issue. I need to compare the results. What do you think was the issue here? The colors are still a bit off.
Update #4: No longer using custom PLYLoader, Vector3, or OrbitControls
@Mugen87 I just checked that these two changes only work up to r111
but don’t in r112
and above (faded 3d model). Updated example: Edit fiddle - JSFiddle - Code Playground If you change r111
to r112
the colors of 3d model are washed out