opened 11:30PM - 24 Jun 19 UTC
closed 08:42PM - 26 Mar 21 UTC
Enhancement
For my application, I need some fine-grained control over render order for a num…ber of reasons. Thankfully the layers system offers an easy and convenient way to render specific objects in a specific order.
```js
camera.layers.set(1);
renderer.render(scene, camera);
// Render some objects with depthRead/depthWrite set differently maybe
camera.layers.set(2);
renderer.render(scene, camera);
// Perhaps apply some postprocessing effect
camera.layers.set(3);
renderer.render(scene, camera);
// Render UI after postprocessing
camera.layers.set(4);
renderer.render(scene, camera);
```
The above pattern works fine, is flexible, and (I think) is perfectly performant. However, I have found that I need more granular control over shadow map rendering. In the above example, I have an object on layer 1 that needs to display the shadow of an object on layer 3.
To fix the issue, I'd need to render *only* the shadow map with both layers 1-3 active before layer 1 is rendered 'for real'. However, it doesn't appear that there is any way to actually do this.
the function `renderer.shadowMap.render()` is exposed but calling it directly results in errors as the render state isn't set up correctly.