I’ve been implementing a way of showing a scene from a different camera angle as a small overlay (could be used as a minimap, or to show a model from behind etc), and I’ve had a few issues with the way a RenderTargetTexture (rtt) currently works when using a different camera (to the main scene camera). Some of these may be bugs, others may just be implementation decisions, or some may even just be me not knowing a more correct way to achieve this.
The issues are explained in comments in the playground, but listed here below too:
- Must explicitly set renderList to undefined to get fallback, as it’s set in the rtt constructor to the empty list (so nothing rendered by default).
- It seems odd that the rtt render method checks and has a fallback for the renderList being undefined if this is intended behaviour
- The fallback only renders active meshes marked as such from the point of view of the scene active camera, not the rtt camera.
- All meshes in the renderList are drawn regardless of LayerMask or being out of view
- Disposing and recreating a mesh causes the rtt to not draw for a frame, but still clear the screen (if the list is set to undefined)
- If I want the rtt camera to behave similarly to the scene camera and calculate active meshes before render, I had to access a private method (
- Perhaps there’s another way to do this?
scene._evaluateActiveMeshesalso requires a workaround to get instances that have their source mesh disabled rendering in both the main scene and the rtt.
I have what I need working as per that last playground (along with some additional functionality to only render when the camera properties change), but just wanted to highlight the above in case there’s something in there that should be addressed in a future update.