Hi, I’m trying to use multiple render targets for a game I’m working on. Since I haven’t done that before I created a small project to try it. I have several questions :
-
what are the differences between :
void Camera.SetTargetBuffers(RenderBuffer colorBuffer, RenderBuffer depthBuffer);
and
static void Graphics.SetRenderTarget(RenderBuffer[] colorBuffers, RenderBuffer depthBuffer);
-
Camera.SetTargetBuffers doesn’t seem to work well : if I call it the buffers are not filled (they are black), they don’t cover the “render quad” and are placed on the bottom left of the screen. Am I missing something ?
-
where/when should I call those methods : OnPreRender (it seems to work) ? OnRenderImage ? …
-
The second buffer is not cleared each frames. Is there a way to clear a buffer manually (ask for it to be cleared) ?
Here is the small example project so you can see what I did. The project only render a sphere, the red channel of the sphere is rendered in the first target, the green channel of the sphere is rendered in the second target. They are then combine with the first target being on the left side of the screen and the second target being on the right side (they are squeezed and thats intended).
[30894-mrt.zip|30894]
And screenshots of what I get :
As you can see the right side (second target) the buffer is not cleared.
Thanks !