Sign in to follow this  

Rotation problem on multiple monitors

This topic is 2316 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to use multiple monitors to extend the field of view. To do so, I apply an offset to my view matrix like this:
[source]

Matrix4 matXYZ; matXYZ.translation(m_position);
Matrix4 matRotation; matRotation.setYawPitchRoll(m_yaw, m_pitch, m_roll);
Matrix4 matOffset; matOffset.rotationY(offset);
Matrix4 matTransformation = matOffset * matRotation * matXYZ;
[/source]

Now the problem is when I rotate around Y axis, the horizon will not appear on a line (there are discontinuities on the borders). How can I fix this problem?

(Attached image shows what I want to achieve!)

Share this post


Link to post
Share on other sites
[quote name='CodeLord' timestamp='1313188548' post='4848442']
I am trying to use multiple monitors to extend the field of view. To do so, I apply an offset to my view matrix like this:
[source]

Matrix4 matXYZ; matXYZ.translation(m_position);
Matrix4 matRotation; matRotation.setYawPitchRoll(m_yaw, m_pitch, m_roll);
Matrix4 matOffset; matOffset.rotationY(offset);
Matrix4 matTransformation = matOffset * matRotation * matXYZ;
[/source]

Now the problem is when I rotate around Y axis, the horizon will not appear on a line (there are discontinuities on the borders). How can I fix this problem?

(Attached image shows what I want to achieve!)
[/quote]

Its easier to calculate your view & projection matricies as per normal, but then edit the [i]projection matrix[/i] with a scale & translate matrix to shift the results onto the appropriate screen.

Remember that the results of the final projection matrix yield a clip space coordinate from -1 : 1. You want -1 : 0 to end up on the left screen and 0 : 1 to end up on the right screen.

Share this post


Link to post
Share on other sites
[quote name='Digitalfragment' timestamp='1313235333' post='4848597']
Its easier to calculate your view & projection matricies as per normal, but then edit the [i]projection matrix[/i] with a scale & translate matrix to shift the results onto the appropriate screen.

Remember that the results of the final projection matrix yield a clip space coordinate from -1 : 1. You want -1 : 0 to end up on the left screen and 0 : 1 to end up on the right screen.
[/quote]



Trouble with that is it's all projected into the same viewing plane, just with a huge horizontal FOV which creates pretty atrocious warping at the edges of the display with multiple monitors (I run three monitors in compatible games, and my usual horizontal FOV is 160 degrees).

Ideally you want all the monitors to face the player and each display produced by a different view matrix, essentially using three cameras at different angles, instead of one stretched across all displays This creates a pleasing psudo-cylindrical projection, lets you run FOVs over 180 degrees and limits the warping to just the kind of extents you usually see on a single monitor with 90 degree FOV.

See the difference between these screenshots, both with 160 degree FOV (the discontinuities in the second shot are due to it compensating for the monitor bezels)

[url="http://dl.dropbox.com/u/22129898/SoftTH_LFS_000003704384.png"]http://dl.dropbox.co...00003704384.png[/url]
[url="http://dl.dropbox.com/u/22129898/SoftTH_LFS_000003988555.png"]http://dl.dropbox.co...00003988555.png[/url]

In response to the OP, is it not just a case of tweaking your offset value until they line up?

Share this post


Link to post
Share on other sites
[quote name='Digitalfragment' timestamp='1313235333' post='4848597']
Its easier to calculate your view & projection matricies as per normal, but then edit the [i]projection matrix[/i] with a scale & translate matrix to shift the results onto the appropriate screen.

Remember that the results of the final projection matrix yield a clip space coordinate from -1 : 1. You want -1 : 0 to end up on the left screen and 0 : 1 to end up on the right screen.
[/quote]

I came up with this projection matrix:

[source]

void Matrix4::perspectiveFovOffCenter(float fov, float aspect, float zn, float zf, float cX, float cY)
{
float yScale = cotf(fov/2);
float xScale = yScale / aspect;
float xOffset = -2*cX;
float yOffset = -2*cY;

_11 = xScale; _12 = 0; _13 = 0; _14 = 0;
_21 = 0; _22 = yScale; _23 = 0; _24 = 0;
_31 = xOffset; _32 = yOffset; _33 = zf/(zf-zn); _34 = 1;
_41 = 0; _42 = 0; _43 = zn*zf/(zn-zf);_44 = 0;
}[/source]


This seems to work fine except it messes up half of my shaders, and I get all distorted shadows and lighting artifacts on the translated image!

Share this post


Link to post
Share on other sites

This topic is 2316 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this