重叠网格对于Forge 3D查看器中的某些材料颜色是透明的 [英] Overlay mesh is transparent for certain material colors in Forge 3D viewer
问题描述
我正在尝试按照此示例.除使用某些颜色外,它通常都可以正常工作.
I'm trying to add custom geometry to my forge viewer, following this example. It mostly works fine, except when using certain colors.
我正在使用以下代码添加球体网格:
I'm using the following code to add a sphere mesh:
const geometry = new THREE.SphereGeometry(0.4, 32, 32)
const material = new THREE.MeshBasicMaterial({
color: someColor,
transparent: false,
})
const sphere = new THREE.Mesh(geometry, material)
viewer.overlays.addScene('sphere-mesh-scene')
viewer.overlays.addMesh(sphere, 'sphere-mesh-scene')
对于 someColor
的某些值,球体是透明的,对于其他值,则不是:例如
for certain values of someColor
the sphere is transparent, for other values, it's not:
e.g.
#6b6e75
和#54ffff
产生一个透明的球体,尽管#000000
和#988888
产生不透明的球体.
#6b6e75
and #54ffff
yields a transparent sphere,
while
#000000
and #988888
yields an opaque sphere.
是否需要设置任何材料属性来避免这种情况?还是我需要与伪造中的物料经理打交道?
Is there any material properties I need to set to avoid this? Or do I need to deal with the material manager in forge?
我使用的是Forge Viewer 7.14.0版本.
I'm using forge viewer version 7.14.0.
修改
对于点云,我也得到相同的结果-点云具有许多不同的颜色,其中一些点是透明的,并且对Forge几何图形具有发光的轮廓".
I also get the same result for point clouds - with a point cloud with many different colors, some of the points are transparent, and get a "glowing outline" against the Forge geometry.
推荐答案
之所以发生这种情况,是因为默认情况下,混合着色器确定是否应通过其色相颜色在叠加层中添加透明度(例如,添加到选定的节点)...
This is happending because by default the blend shader determines if it should add transparency (to selected nodes for instance) by its hue color in the overlay...
我们可以通过在调用 viewer.start/loadModel(svf,options,cb,cb,cb,initOptions)
:
viewer.loadModel(svf,null,null,null,{useIdBufferSelection:true});
在此处
这篇关于重叠网格对于Forge 3D查看器中的某些材料颜色是透明的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!