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.
是否需要设置任何材料属性来避免这种情况?还是需要和forge的材料经理打交道?
Is there any material properties I need to set to avoid this? Or do I need to deal with the material manager in forge?
我使用的是伪造查看器版本 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)
:
We can suppress this behavior by turning useIdBufferSelection
in the initOptions
like below when calling viewer.start/loadModel(svf,options,cb,cb,cb,initOptions)
:
viewer.loadModel(svf,null,null,null,{useIdBufferSelection:true});
查看现场演示这里
这篇关于Forge 3D 查看器中的某些材质颜色的叠加网格是透明的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!