New convergence formular added.

The place for all discussion of the Oculus Rift compatible open source 3D drivers.
Post Reply
User avatar
EisernSchild
Vireio Perception Developer
Vireio Perception Developer
Posts: 225
Joined: Tue Jun 11, 2013 9:39 am
Location: Graz / Austria

New convergence formular added.

Post by EisernSchild »

Based on explanaitons from NVidia i added new convergence functionality.

Here is the new method to update the projection matrices for both left/right eye:
(please post if you find anything dubious here)

Code: Select all

/**
* Updates left and right projection matrices.
* Now, the convergence point is specified in real, physical meters, since the IPD is also specified
* in physical meters. That means, if the game-specific world scale is set correctly, a convergence
* value of 3.0f would mean that the virtual screen, neutral point or convergence point is 3 meters
* ahead of us.
* @param aspectRation The aspect ratio for the projection matrix.
***/
void ViewAdjustment::UpdateProjectionMatrices(float aspectRatio)
{
	t = 0.5f / aspectRatio;
	b = -0.5f / aspectRatio;

	D3DXMatrixPerspectiveOffCenterLH(&matProjection, l, r, b, t, n, f);
	D3DXMatrixInverse(&matProjectionInv, 0, &matProjection);
	
	// convergence frustum adjustment, based on NVidia explanations
	//
	// It is evident that the ratio of frustum shift to the near clipping plane is equal to the ratio of 
	// IOD/2 to the distance from the screenplane. (IOD=IPD) 
	// frustumAsymmetryInMeters = ((IPD/2) * nearClippingPlaneDistance) / convergence
	// <http://www.orthostereo.com/geometryopengl.html>
	//
	// (near clipping plane distance = physical screen distance)
	// (convergence = virtual screen distance)
	// ALL stated in meters here !
	const float nearClippingPlaneDistance = 1; // < TODO !! Assumption here : near clipping plane distance = 1 meter 
	float frustumAsymmetryInMeters = ((ipd/2) * nearClippingPlaneDistance) / convergence;

	// divide the frustum asymmetry by the assumed physical size of the physical screen
	const float physicalScreenSizeInMeters = 1; // < TODO !! Assumption here : physical screen size = 1 meter
	float frustumAsymmetryLeftInMeters = (frustumAsymmetryInMeters * LEFT_CONSTANT) / physicalScreenSizeInMeters;
	float frustumAsymmetryRightInMeters = (frustumAsymmetryInMeters * RIGHT_CONSTANT) / physicalScreenSizeInMeters;

	// get the horizontal screen space size and compute screen space adjustment
	float screenSpaceXSize = abs(l)+abs(r);
	float multiplier = screenSpaceXSize/1; // = 1 meter
	float frustumAsymmetryLeft = frustumAsymmetryLeftInMeters * multiplier;
	float frustumAsymmetryRight = frustumAsymmetryRightInMeters * multiplier;

	// now, create the re-projection matrices for both eyes using this frustum asymmetry
	D3DXMatrixPerspectiveOffCenterLH(&projectLeft, l+frustumAsymmetryLeft, r+frustumAsymmetryLeft, b, t, n, f);
	D3DXMatrixPerspectiveOffCenterLH(&projectRight, l+frustumAsymmetryRight, r+frustumAsymmetryRight, b, t, n, f);
}
Convergence is now specified in real, physical meters, since IPD is also specified in physical meters now.

That means, if convergence is set to 3.0f, the neutral plane is 3 meters ahead. Here is a video of Left4Dead anaglyph rendering using the new driver architecture : (In this case i did set convergence to 3.0f - 3 meters, world scale is set game-specific to 4.15f - so our view is focused to 3 meters ahead)

[youtube-hd]http://www.youtube.com/watch?v=yTQXFPwE ... e=youtu.be[/youtube-hd]
Last edited by EisernSchild on Wed Sep 04, 2013 2:55 am, edited 1 time in total.
User avatar
cybereality
3D Angel Eyes (Moderator)
Posts: 11407
Joined: Sat Apr 12, 2008 8:18 pm

Re: New convergence formular added.

Post by cybereality »

Cool.

However, the 3D effect looks pretty shallow. I would hope users could adjust this to get a greater 3D effect.

Otherwise looks good.
User avatar
EisernSchild
Vireio Perception Developer
Vireio Perception Developer
Posts: 225
Joined: Tue Jun 11, 2013 9:39 am
Location: Graz / Austria

Re: New convergence formular added.

Post by EisernSchild »

You already can adjust, new SHOCT is scheduled, at least a few keys work now: (did commit that all)

F1 : Screenshot (outputs left/right and stereo)
F2-F3 : Adjust world scale. (Use SHIFT to speed up, CTRL to lower speed)
F4-F5 : Adjust convergence. (Use SHIFT to speed up, CTRL to lower speed)
F6 : Swap Eyes.
SHIFT-F6 : Reset world scale/convergence.
User avatar
cybereality
3D Angel Eyes (Moderator)
Posts: 11407
Joined: Sat Apr 12, 2008 8:18 pm

Re: New convergence formular added.

Post by cybereality »

OK, awesome.
User avatar
EisernSchild
Vireio Perception Developer
Vireio Perception Developer
Posts: 225
Joined: Tue Jun 11, 2013 9:39 am
Location: Graz / Austria

Re: New convergence formular added.

Post by EisernSchild »

Here is a first rift render test using convergence. The new synchronous render technique is really much much better, especially with convergence added.

[youtube-hd]http://www.youtube.com/watch?v=sBOfwD8g ... e=youtu.be[/youtube-hd]

All working hotkeys:
F1 : Screenshot (outputs left/right and stereo)

F2 : Decrease world scale
F3 : Increase world scale
F4 : Decrease convergence
F5 : Increase convergence
(hold CTRL to lower speed, SHIFT to speed up)

ALT-F4 : Decrease Oculus Rift distortion scale.
ALT-F5 : Increase Oculus Rift distortion scale

F6 : Swap Eyes.
SHIFT-F6 : Reset world scale, convergence, multipliers
ALT-F6 : Reset distortion scale

F8 : Decrease tracker yaw multiplier
F9 : Increase tracker yaw multiplier

SHIFT-F8 : Decrease tracker pitch multiplier
SHIFT-F9 : Increase tracker pitch multiplier

CTRL-F8 : Decrease tracker roll multiplier
CTRL-F9 : Increase tracker roll multiplier
User avatar
cybereality
3D Angel Eyes (Moderator)
Posts: 11407
Joined: Sat Apr 12, 2008 8:18 pm

Re: New convergence formular added.

Post by cybereality »

Looking good.
Post Reply

Return to “Development / General Discussion”