Hi all,
I was wondering if there’s a way to tell THREE to use a different mesh for the shadow pass? Ie having high-quality model for the rendering itself, and a low-poly model just for the shadow, since its just the edges that count in most cases.
I believe shadowmaps use depth values, not colors, so it should be possible to have invisible meshes casting sadows.
I dont think there is a ready-to-use mechanism for mesh-shadow-swapping, so you will probably have to create and manage both models yourself.
In regards to making such object, I tested some material values and found 3.js ways to do it:
transparent: true, opacity: 0
transparent: true, colorWrite: false
alphaTest: 3. (Actually any value greater than 1 will do the trick. In the shader chunk code you can see that any pixel with alpha value below ALPHATEST will be discarded and opaque values are 1 by default)
As far as which one is best… Im not sure
I would guess 3 - 2 - 1 is the most to least efficient due to alpha blending being pretty costly, but I can be wrong. Would love to hear an expert’s opinion on this.
I’ve added a callback in the renderObject function in WebGLShadowMap.js so scene objects like IndexedVolume can take over the render calls. Instanced impostors for shadows gave me a huge performance boost especially with CSM on a massive distance for vegetation (forests, bushes etc) preserving the silhouette details with minimal cost.
CSM just uses a directional light per cascade, the way it’s rendered is the same as regular lights, btw CSM is actually added to the latest release of THREE now with major improvements (as module).