是否可以在材料周围添加边框,如图所示,
我可以通过以下代码设置材质颜色
object.traverse( function ( child )
{
if ( child instanceof THREE.Mesh )
child.material.color.setRGB (1, 0, 0);
});
where object is my loaded 3d model, so am assume there should be a way to draw the border, is there any option in three.js.
根据@shiva的评论,我尝试使用以下代码来绘制发光效果
if(childObject.material.name=="material4046")
{
mesh = new THREE.Mesh( globalGeomtry, material );
// mesh.visible = false
scene.add( mesh );
console.log(mesh);
// create a glowMesh
var glowMesh = new THREEx.GeometricGlowMesh(mesh);
mesh.add(glowMesh.object3d);
// example of customization of the default glowMesh
var insideUniforms = glowMesh.insideMesh.material.uniforms;
insideUniforms.coeficient.value = 2;
insideUniforms.power.value = 1.4;
insideUniforms.glowColor.value.set('red');
var outsideUniforms = glowMesh.outsideMesh.material.uniforms;
outsideUniforms.coeficient.value = 2;
outsideUniforms.power.value = 1.4;
outsideUniforms.glowColor.value.set('red');
}
now the ouput is looking as like in the second image,
i want this glow effect as the border around that material, is it is possible
我想这就是你所追求的。它是通过以下方式实现的:
new THREE.MeshBasicMaterial( { color: 0x00ff00, side: THREE.BackSide } );
您可以在这里查看演示:https://stemkoski.github.io/Three.js/Outline.html https://stemkoski.github.io/Three.js/Outline.html
演示源代码:https://github.com/stemkoski/stemkoski.github.com/blob/master/Three.js/Outline.html https://github.com/stemkoski/stemkoski.github.com/blob/master/Three.js/Outline.html
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)