参考如下代码: //假设已获取相应nodeId和model var model = ... var nodeId = ... var fragList = viewer.model.getFragmentList(); var fragIds = [] model.getData().instanceTree.enumNodeFragments( nodeId, (fragId) => { fragIds.push(fragId) }); fragIds.forEach((fragId) => { //获取材质 var material = fragList.getMaterial(fragId); if(material) { //设置透明度 material.opacity = 0.5; material.transparent = true; //标记更新 material.needsUpdate = true } }) }) //更新viewer viewer.impl.invalidate(true, true, true) }
参考如下代码: