Closed tb-viktor closed 4 months ago
Thanks for the heads up. I had missed the notification from the threejs repo. I'll look into it. Very much appreciate your detailed report.
@tb-viktor I see what is going on. Your file has some meshes with vertex colors, some meshes without. None of the objects in your file have any assigned materials. I need to give objects materials in threejs, and since some of these objects have vertex colors, I switch on vertex colors for the "default" material I assign for objects without material assignments. This means then that any object without a material assignment will get assigned a default material with vertex colors. When the mesh has no vertex colors, it will render them black.
What I will do is to detect when the default material is used in situations with vertex colors. In this case I'll make a second default material with vertex colors switched on for meshes with vertex colors, and another default for meshes without vertex colors.
This will take some days to propagate into the threejs repo so my suggestion in the meantime would be to assign a material in Rhino to the objects without vertex colors. This way they won't get assigned the default material with vertex colors switched on.
I'll comment back here when I get the fix in.
@fraguada Thanks for your quick response. Looking forward to the fix 👍
The geometry we render in our product is user-generated, so we don't have much control over it nor know what to expect. Due to this it's important that we render all possibilities in a decent way.
@fraguada question - the second part of this problem is once we load a file that causes the loader to display the geometries black, the next file we load are also turns black, even if it loaded fine before with a clean loader instance. Will this problem also be addressed with the fix?
Yes. This is again due to the default material being set to try and render vertex colors.
Already better, but that one area still black!
Ok. A PR has been pushed to the threejs repo. Let's hope it passes!
It passed and this fix will go out in r162 tomorrow
Perfect, thank you for your work. I will let you know if there are any further problems 👍
@tb-viktor please test in threejs 162 and let me know if you find any issues.
@tb-viktor please test in threejs 162 and let me know if you find any issues.
So far everything works well, will let you know if we catch anything more 👍
This relates to an issue from the
three
repository since there was no further activity there: https://github.com/mrdoob/three.js/issues/27752Description
Hello,
We've encountered a regression with the
Rhino3dmLoader
after upgrading to the latest version ofthree
. We've upgraded from version0.156.1
to0.161.0
and with that loadedrhino3dm@8.0.1
which is required by the loader. After doing so, certain geometries seem to break the loader and result in the loaded geometry appearing black. After loading the file that causes this, the following files that are loaded also appear black for that loader instance.I've put together a quick codesandbox with the file in question, I am not sure whether it is the file size (around 50 MB) or something in the file that causes this: https://codesandbox.io/p/sandbox/three-rhino-latest-sxz2fy
I've uploaded the file separately here: https://filebin.net/a258vmwnae1nj10a - it has an expiration, so in case the link goes dead I will reupload.
Any ideas what is causing this?
Reproduction steps
Rhino3dmLoader
in the latest three version, withrhino3dm@8.0.1
.Code
Quick React example:
Before (![image](https://github.com/mrdoob/three.js/assets/96176911/1e1d0122-9703-4447-a90f-1eeb7147bb38)
three@0.156.1 & rhino3dm v7
): https://codesandbox.io/p/sandbox/three-rhino-v7-v99r8cAfter (![image](https://github.com/mrdoob/three.js/assets/96176911/5f7d3711-49ca-4fa9-b2e1-302fbc960339)
three r157+ & rhino3dm v8
): https://codesandbox.io/p/sandbox/three-rhino-latest-sxz2fyNote: This also happens with
rhino3dm@8.4.0
.