Multiple viewports with surfaces/deferred rendering problem

xenonii

Member
Hi,
I've implemented deferred lighting by drawing on 3 surfaces for diffuse, normals and specular and then merging them with a shader on the application surface.. It's all good until I got to multiple views (for local multiplayer.) This used to work fine before but now I cannot get it to work. It is rendering the 2nd view, but it's as if clipping is being done with the room view of the first view. You can see it in the screenshot, where player 2 moved a bit to the left. The camera moved fine, but that black bar is like it's clipped off by player 1's room view. If player 1 moves too to the same position, you would see player 2's view filling the black bar accordingly!



I've tried updating the view_xport and view_yport but it ended up scaling the rendering instead which was totally unexpected. I also tried updating the view lookat matrix when starting rendering of view_current == 1, but that didn't work either. It's ostensibly using the clipping region of the first view.

Any ideas?
 

xenonii

Member
I fixed the issue by rendering each view passes on separate surfaces, a set for player 1 and another set for player2.

Still don't know why sharing the same surface was not working.
 
Top