Reputation: 2337
I'm having trouble with custom geometry and transparent .svf meshes. I'm doing the following to add a custom mesh:
const material = new THREE.MeshBasicMaterial({ color: 0xff0000 });
const geom = new THREE.SphereGeometry(10, 8, 8);
const sphereMesh = new THREE.Mesh(geom, material);
sphereMesh.position.set(10, 10, 3);
if (!viewer.overlays.hasScene('custom-scene')) {
viewer.overlays.addScene('custom-scene');
}
viewer.overlays.addMesh(sphereMesh, 'custom-scene');
The custom geometry is loaded in a scene together with geometry from my IFC-derived .svf model. The problem is that I cannot see the custom mesh through any transparent parts of the .svf mesh (e.g. a window). One can see other .svf meshes through the transparent mesh but not the custom geometry.
The problem can be reproduced with the following:
viewer
with NOP_VIEWER
)One should then see a big red sphere. However, when looking at it from a perspective where a window is in front of the sphere, the custom geometry is not visible.
Upvotes: 0
Views: 135
Reputation: 9942
This is a known limitation. Rendering opaque vs transparent objects is a common problem that must be handled carefully (for example, Forge Viewer first renders opaque objects, from front to back, and then it renders transparent objects, from back to front), and introducing additional scenes that get rendered separately makes things even more difficult.
I'd suggest that you try and embed the custom geometry using the SceneBuilder. That way the geometry will be part of the standard rendering pipeline (instead of being "an overlay"), and the transparency should work properly in that case.
Upvotes: 1