Prevent decal from showing on inside of mesh

别来无恙 提交于 2020-01-06 21:09:47

问题


I'm looking at the example here: http://threejs.org/examples/#webgl_decals

If I shoot a decal on the lips, adjust the orbital controls minimum distance, and go inside the mesh, I can see the decal on the inside of the mesh. Is there a way to prevent this? I'm trying to use the decal for something else where it is not desireable to have the decal show on both sides. Since THREE.DoubleSide is not the default, I'm not sure how this is happening.


回答1:


When you create your material, simply set which side (or both) you want the decal to appear on using THREE.DoubleSide, THREE.FrontSide (default) or THREE.BackSide. Look at the material object for more info...

var decalMaterial = new THREE.MeshPhongMaterial( {
    map: decalNormal,
    transparent: true,
    depthTest: true,
    depthWrite: false,
    polygonOffset: true,
    polygonOffsetFactor: - 4,
    side: THREE.DoubleSide
});


来源:https://stackoverflow.com/questions/37823981/prevent-decal-from-showing-on-inside-of-mesh

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!