Three.js: InstancedMesh shadows are wrong

Created on 3 Oct 2019  路  10Comments  路  Source: mrdoob/three.js

Description of the problem

InstancedMesh shadows don't show up correctly. It seems only one instance shadow is rendered always at the origin.

This online experiment shows the bug. Please look at the center of the tower to see the instance shadow:
https://yomboprime.github.io/instancedBricks/examples/instancedBricks.html

Three.js version
  • [x] Dev
Browser
  • [x] All of them
OS
  • [x] All of them
Bug

Most helpful comment

I made sure shadows worked when implementing InstancedMesh, I'll have a look.

All 10 comments

Instancing currently requires a customDepthMaterial for proper shadow support.

See https://threejs.org/examples/webgl_buffergeometry_instancing_lambert.html.

I made sure shadows worked when implementing InstancedMesh, I'll have a look.

@yomboprime could you turn the example into a jsfiddle?

@yomboprime could you turn the example into a jsfiddle?

I will.

BTW, it is the casting that doesn't work. The receiving of shadows by the instances is working right.

Oh, I think I know what's happening. Do they work if you hide the floor?

No need for the jsfiddle. I'm pretty sure I know what it is.

Oh, I already did it:
https://jsfiddle.net/cb1g24mq/

Note that I edited the fiddle link, it was wrong.

Oh, I think I know what's happening. Do they work if you hide the floor?

Yes, they do!

imagen

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fuzihaofzh picture fuzihaofzh  路  3Comments

danieljack picture danieljack  路  3Comments

filharvey picture filharvey  路  3Comments

konijn picture konijn  路  3Comments

boyravikumar picture boyravikumar  路  3Comments