Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

248
Views
ThreeJS MeshDepthMaterial Shadows Not Working With Animations

In order to cast shadows through transparent parts of my Mesh I use the MeshDepthMaterial but when I do this, the shadows of the animated parts of my objects stop moving with the animation.

You can take a look at the example here: https://jsfiddle.net/miger/kj8gwue5/

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

If you comment out the customDepthMaterial-input you can see that the shadow would normally go with the animation, as shown in this example here. However as you can see the shadow does not cast through the the transparent part of my mesh anymore, which is not the effect I'd like to have here.

How can I fix this? Updating the depth material with needsUpdate, did not do anything..

Is it even possible to make the shadows work correctly with animations when using the depth material?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Add skinning: true to your depth material:

var customDepthMaterial = new THREE.MeshDepthMaterial( {
    depthPacking: THREE.RGBADepthPacking,
    alphaMap: alphaTex,
    alphaTest: 0.5,
    skinning: true // add this property
})
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!