Shadows not taking alpha mask into account

I have a model with some transparent areas in the texture, but the shadows don’t seem to care :slight_smile:

Anyone has a solution to this? I’m a bit lost

here’s without shadows:

here’s what the actual geometry looks like:

any ideas?

Seems, this example has the effect you want to achieve, but all it does is set alphaTest: 0.5.


Try it with a custom depth material like in the example mentioned by @prisoner849:

clothTexture would be the diffuse (PNG) texture of your model.


Thanks guys! Totally blanked out on that example, it is exactly what I’m after.

1 Like

Okay, got it working

One extra thing to watch out for:

when you clone a mesh - it doesn’t retain customDepthMaterial attribute, so you have to be careful about that.

here’s the relevant piece in the source that does Mesh cloning:

again, thanks a bunch!

1 Like

Hi! I tried this but the result is just…

const popUpBase_mat = new THREE.MeshDepthMaterial( {
    depthPacking: THREE.RGBADepthPacking,
    alphaTest: 0.5
} );

export const hito1_atlas_mat = popUpBase_mat.clone() = imagesLoader('Hito1_atlas.png')

Why didnt work?