threejs带有Alpha蒙版的网格物体,投射阴影

时间:2020-02-14 15:57:54

标签: three.js shadow

带有alpha蒙版的单个平面必须投射阴影。它确实适用,但在整个平面上都没有应用Alpha蒙版。

四处搜寻,我发现向网格中添加一个customDeptMaterial应该可以做到:

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

不是我很确定发生了什么,但我必须丢失一些东西,因为它会不断投射整个飞机

请参阅完整的小提琴: https://jsfiddle.net/truji7/gj7az9eo/34/

如何投射“ alpha过滤”阴影?

1 个答案:

答案 0 :(得分:2)

PointLights是唯一使用MeshDistanceMaterial而非MeshDepthMaterial的光类型。

this

JSFiddle Example