# Shadow provide by transparency texture

**URL:** <https://discourse.threejs.org/t/shadow-provide-by-transparency-texture/25678>\
**Category:** Questions\
**Tags:** materials\
**Created:** [April 25, 2021, 3:21pm UTC](https://discourse.threejs.org/t/shadow-provide-by-transparency-texture/25678 "2021-04-25T15:21:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![elysium11](https://avatars.discourse-cdn.com/v4/letter/e/8e7dd6/32.png) [@elysium11](https://discourse.threejs.org/u/elysium11)\
**Post date:** [April 25, 2021, 3:21pm UTC](https://discourse.threejs.org/t/shadow-provide-by-transparency-texture/25678/1 "2021-04-25T15:21:56Z")

</div>

Hello ,

```
 i does try to create shadow through a texture with tranparency like here 
https://discourse.threejs.org/t/shadows-not-taking-alpha-mask-into-account/11127

```

or here  
[three.js examples](https://threejs.org/examples/#webgl_animation_cloth)

i try to understand an re use code provide on those webpage , but it doesn’t work in my case and i dont understand well what i have to do .

work very well under blender , but export from blender and import in js doesn’t work in this case .

 ![serre](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/b/c/bcfb2e0fea8222894f60894a081a7e4c9d5c5169.jpeg)

---

<div class="post-metadata">

**Author:** ![elysium11](https://avatars.discourse-cdn.com/v4/letter/e/8e7dd6/32.png) [@elysium11](https://discourse.threejs.org/u/elysium11)\
**Post date:** [April 30, 2021, 3:31pm UTC](https://discourse.threejs.org/t/shadow-provide-by-transparency-texture/25678/2 "2021-04-30T15:31:01Z")

</div>

Hello ,

i found the solution here [Cast shadow through alpha masked mesh & customDepthMaterial](https://discourse.threejs.org/t/cast-shadow-through-alpha-masked-mesh-customdepthmaterial/12760)

the solution is to use MeshDistanceMaterial instead of MeshDepthMaterial cause i use PointLight so the code is

```
 var aa=scene.getObjectByName('serre36') ;
var bb = aa.children[3] ;
  var cc= bb.material;
bb.customDistanceMaterial = new THREE.MeshDistanceMaterial( {
			     map: cc.map, // use map provide by blender 
				alphaTest: 0.5
			} );

```

work very well see result

 ![shadow_texture](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/b/8/b8b16f5e1127568ef687601ff27defd1b01faf62.jpeg)
