带 alpha 蒙版的 threejs 网格,投射阴影

threejs mesh with alpha mask, cast shadow

具有 alpha 蒙版的单个平面必须投射阴影。它确实适用于整个平面 - 不应用 alpha 掩码 -

四处搜索我发现向网格添加 customDeptMaterial 应该可以做到:

var customDepthMaterial = new THREE.MeshDepthMaterial( {
            depthPacking: THREE.RGBADepthPacking,
            alphaMap: alphaTex,  
            alphaTest: 0.5
        } );
figures.customDepthMaterial = customDepthMaterial;

并不是说我非常确定到底发生了什么,但我一定是遗漏了一些东西,因为它一直在投射整个飞机

请查看完整的fiddle: https://jsfiddle.net/truji7/gj7az9eo/34/

如何投射 "alpha filtered" 阴影?

PointLights are the only type of light that utilizes MeshDistanceMaterial instead of MeshDepthMaterial.

object.customDistanceMaterial = new THREE.MeshDistanceMaterial( {
    alphaMap: alphaTex,
    alphaTest: 0.5,
}

JSFiddle Example