Same model twice breaks the scene (with culler in place)
Describe the bug 📝
I am loading same IFC model twice to to my scene to exact same location. When having only one, culler works perfectly fine. However, if I have same model twice, somehow my scene breaks for the first loaded model. Easiest to visualize is moving one model completely in some axis. I will try to share how i am adding my models to culler, and how i am moving so that it is easy to reproduce. Note that i have tried in a sample app with only codes from this repo to ensure i am not doing anything wrong additionally.
- create model and add to the scene (do it twice from same IFC source file)
- create culler
- add model meshes to the culler
newModel.traverse(child => {
if ((child as any).isMesh || (child as any).isInstancedMesh) {
(<Mesh>child).geometry.computeBoundingBox();
(<Mesh>child).geometry.computeBoundingSphere();
child.updateMatrix();
culler.add(child as THREE.Mesh | THREE.InstancedMesh);
}
});
- move one of the models
setInterval(() =>
{
for (const fragID in fragsIdMap) {
const ids = fragsIdMap[fragID];
const fragment = fragmentsManager.list.get(fragID);
if (fragment) {
fragment.mesh.position.x += 1;
}
culler.needsUpdate = true;
}
}, 100);
Can you please help me if i am doing anything wrong or is this a bug? Thanks!
Reproduction ▶️
No response
Steps to reproduce 🔢
No response
System Info 💻
System:
OS: macOS 14.4.1
CPU: (10) arm64 Apple M1 Pro
Memory: 40.75 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.19.0 - ~/.nvm/versions/node/v18.19.0/bin/node
npm: 10.2.3 - ~/.nvm/versions/node/v18.19.0/bin/npm
Browsers:
Chrome: 127.0.6533.100
Edge: 127.0.2651.98
Safari: 17.4.1
Used Package Manager 📦
npm
Error Trace/Logs 📃
No response
Validations ✅
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a repository issue and not a framework-specific issue. For example, if it's a THREE.js related bug, it should likely be reported to mrdoob/threejs instead.
- [X] Check that this is a concrete bug. For Q&A join our Community.
- [X] The provided reproduction is a minimal reproducible example of the bug.
@onderilkesever what's the use case for loading the model twice? We have cloning functionality that allows you to clone full models or parts of it.
@agviegas The use case is comparing two fazes of the same model. It does not have to be %100 same, say %5 has changed. Nevertheless, as I investigated further, I believe the issue is not duplication of the model. If I understand the code correctly, the issue is that the culler is not updating its scene when things are moving. Basically once you add stuff the culler, offscreen is decided. Then even though you move your model somewhere else, culler is not aware of it. I wonder if you can think of an easy way to get around this? Thanks in advance for the support!
closing as the issue not related with uploading twice, will open another issue more focused on moving objects.