I have been setting up a multi monitor framework, that is, I am rendering to multiple outputs on multiple adapters, with one device per adapter and one swapchain per output.
Each output additionally has its own backbuffer and zBuffer.
I do not want clones of the scene, which is working fine so far.
Instead, I want the scene to span the entire area spanned by all monitors ( easy to get as DXGI_OUTPUT_DESC).
So naturally, my thought was to use and set a different viewport before each Draw call.
But what it does instead, is clipping my scene to the size of, what it seems, is my back buffer (On a screen of 1280x1024, if I set
viewport.TopLeftX = -640;my scene gets clipped vertically in the middle, showing only the left half)
It seems to me now, I could be creating a larger back buffer, but for n outputs I would at least let a (n-1)th of the buffer go to waste, while I seriously doubt most devices could create buffers that large.
Am I right?
Second, I might have to vary the camera matrix or the projection matrix (or even both?) for each render call, but I am a bit clueless as to how this should be done.
Currently my cam matrix is generated using D3DXMatrixLookAtLH .
To vary for a different viewport, I would have to multiply a Translation onto it for sure. I think, the translation in screen coordinates would be the vector from the center of the first monitor to the center of a second.
But then? How do I get this 2d translation into my 3d view space?
Or should it be entirely different?
Thanks for your help.
Just a small edit:
I reconsidered the part with different views, and came to the conclusion, that my program could only benefit from this, if the user actually ordered the displays in a circle around them.
So after a bit more experimenting, I think my desired result could be achieved using different projectionMatrices for each output.
I maybe could use D3DXMatrixPerspectiveOffCenterLH to render for different monitors.
Then I would have to specify different view volumes. Here's where I'm lost at now:
I should once calculate the entire bounding box of all view volumes, maybe determine the barycentre of the view volumes, make this barycentre origin of an additional coordinate system, so that it can be the vanishing point for all windows, and then express all view volumes relative to this origin??