- Home /
Two asynchronous renderings ?
Hi,
TL;DR: Is there a way to have a second rendering thread that does not block the main rendering thread ?
Longer version: I have two cameras in my scene: On is for the main rendering, the other is to render to a texture.
The render to texture requires heavy rendering, but I need that my main application runs fast. If the render texture is not updated at every frame it would be fine.
Is there a way to have the second rendering happen in a second rendering thread that is not blocking the main rendering thread ? And get notification of when the secondary rendering thread has finished rendering so we can update the texture in the main thread ?
Thanks
Answer by Teravisor · Feb 16, 2016 at 08:17 AM
No, it's impossible. It's limitation imposed by video drivers and CPU-to-GPU communication architecture. Before DX11/OpenGL4.0 it wasn't possible to access device context from another thread at all and even after only one thread at a time can access it. Not to mention GPU can't run two rendering tasks simultaneously so it will need to switch context anyway.
More to it, Unity still doesn't like a lot of methods to be called from another thread.
And about notification - just assume it's already finished when either call to Camera.Render(or any other render call) has finished or next frame starts.
Your answer
![](https://koobas.hobune.stream/wayback/20220612064257im_/https://answers.unity.com/themes/thub/images/avi.jpg)