Missing stereo types

Something missing?
Post Reply
Marc
Posts: 10
Joined: Sun 24. Jan 2010, 16:08
Location: BHT Berlin

Missing stereo types

Post by Marc » Sun 24. Jan 2010, 17:27

Hi,

we are using jReality on a single machine with two graphic-cards and two projectors for stereo projection. So we need two viewer objects in one application. One viewer for the right and one viewer for the left eye. But we are missing equivalent stereotypes for this setup. We had to extend the AbstractViewer and the JOGLRenderer classes with two additional stereo types:

Code: Select all

public static final int 	CROSS_EYED_STEREO = 0;
public static final int 	RED_BLUE_STEREO = 1;
public static final int 	RED_GREEN_STEREO = 2;
public static final int 	RED_CYAN_STEREO =  3;
public static final int 	HARDWARE_BUFFER_STEREO = 4;
public static final int 	STEREO_TYPES = 5;
public static final int	LEFT_EYE_STEREO = 6; //<-- New
public static final int	RIGHT_EYE_STEREO = 7; //<-- New
Is it possible to include this modification in the future releases? So we could always update to the newest version of jReality without the need of continuous modification.

thx Marc

User avatar
gunn
Posts: 323
Joined: Thu 14. Dec 2006, 09:56
Location: TU Berlin
Contact:

Re: Missing stereo types

Post by gunn » Sun 24. Jan 2010, 21:08

That's interesting. I would like to know more details about the setup you have.

We also have a similar hardware configuration in our 3-wall CAVE http://www.tu-berlin.de/3dlabor/ausstat ... ng/portal/. Each wall is controlled by a single Linux computer which drives two projectors. I believe each has a single graphics card which sends signals to both left and right projectors. We are currently using the quad-buffered stereo mode on this card (an nvidia quadro card) but we have also successfully used the so-called "twin" mode on this card for the same purpose (here one creates a huge single window 2560 x 1024, used cross-eyed stereo mode in the viewer, and then uses the x-window system driver to send the left haft of the window to the right eye beamer and the right half to the left-eye beamer.

You on the other hand have two graphics cards, one for each beamer. So you could expect much better graphics performance. Are you able to synchronize the two viewers successfully so that the two images are also synchronized?

Regarding the two new stereo modes you have introduced: I assume you have also had to make changes to the JOGLRenderer class, where these stereo modes are implemented, in order that the viewer only renders one (either left or right) image. Is that correct? In any case, please post all the code changes associated to the change you have made, and if they seem reasonable we'll incorporate them into the source code.
jReality core developer

Marc
Posts: 10
Joined: Sun 24. Jan 2010, 16:08
Location: BHT Berlin

Re: Missing stereo types

Post by Marc » Sun 24. Jan 2010, 23:17

At the moment we only have one wall with one quadcore machine with two Geforce and two projectors with circular polarization stereo. Later we want to upgrade a floor projection with four graphic cards in one machine. We solved the synchronization problem as follows:

Code: Select all

leftViewer = new Viewer();
leftViewer.setAutoSwapMode(false); 

rightViewer = new Viewer();
rightViewer.setAutoSwapMode(false);

while(true)
{
   leftViewer.renderAsync();
   rightViewer.renderAsync();

   //sync barrier
   leftViewer.waitForRenderFinish();
   rightViewer.waitForRenderFinish();

   //show all frames at the same time
   leftViewer.swapBuffers();
   rightViewer.swapBuffers();
}


Our changes at the JOGLRenderer class:

Code: Select all

//JOGLRenderer.java
public void display(GL gl) {
...
		else if (theCamera.isStereo())		{
            if(renderingState.stereoType==de.jreality.jogl.Viewer.LEFT_EYE_STEREO){
                setupLeftEye(width, height);
                renderingState.currentEye = whichEye;
                render();               
            }else if(renderingState.stereoType==de.jreality.jogl.Viewer.RIGHT_EYE_STEREO){
                setupRightEye(width, height);
                renderingState.currentEye = whichEye;
                render();                   
            }else{          
                setupRightEye(width, height);
                renderingState.currentEye = whichEye;
                render();
                setupLeftEye(width, height);
                renderingState.currentEye = whichEye;
                render();
                renderingState.colorMask =15; //globalGL.glColorMask(true, true, true, true);
            }
		} 
		else {
			renderingState.clearBufferBits = clearColorBits | GL.GL_DEPTH_BUFFER_BIT;
			myglViewport(0,0,width, height);
			whichEye=CameraUtility.MIDDLE_EYE;
			render();			
		}
...
}

protected void setupRightEye(int width, int height) {
...
		case de.jreality.jogl.Viewer.HARDWARE_BUFFER_STEREO:
			myglViewport(0,0, width, height);
			renderingState.clearBufferBits = clearColorBits | GL.GL_DEPTH_BUFFER_BIT;
			globalGL.glDrawBuffer(GL.GL_BACK_RIGHT);
			break;
        case de.jreality.jogl.Viewer.RIGHT_EYE_STEREO:
            renderingState.clearBufferBits = clearColorBits | GL.GL_DEPTH_BUFFER_BIT;
            myglViewport(0,0, width, height);
            break;			
		}		
		whichEye=CameraUtility.RIGHT_EYE;
...
}

protected void setupLeftEye(int width, int height) {
...
		case de.jreality.jogl.Viewer.HARDWARE_BUFFER_STEREO:
			globalGL.glDrawBuffer(GL.GL_BACK_LEFT);
			renderingState.clearBufferBits = clearColorBits | GL.GL_DEPTH_BUFFER_BIT;
			break;
	    case de.jreality.jogl.Viewer.LEFT_EYE_STEREO:
	        renderingState.clearBufferBits = clearColorBits | GL.GL_DEPTH_BUFFER_BIT;
	        myglViewport(0,0, width, height);
	        break;	
		}
		whichEye=CameraUtility.LEFT_EYE;
...
}

User avatar
gunn
Posts: 323
Joined: Thu 14. Dec 2006, 09:56
Location: TU Berlin
Contact:

Re: Missing stereo types

Post by gunn » Mon 25. Jan 2010, 13:53

Regarding running jReality in CAVE-like installations: if you haven't seen it already, you might want to look at this jReality document: http://www3.math.tu-berlin.de/jreality/ ... t_Tutorial

It seems reasonable to me to add these two stereo types to de.jreality.jogl.AbstractViewer. So I've done that. Additionally I've made the changes you indicated in JOGLRenderer to support rendering these new types -- essentially rendering only one of the two stereo images. I've made a simple test to verify that the code works. And it's all now checked into the repository.

Please post if there are still problems.
jReality core developer

Marc
Posts: 10
Joined: Sun 24. Jan 2010, 16:08
Location: BHT Berlin

Re: Missing stereo types

Post by Marc » Mon 25. Jan 2010, 20:23

Many thanks for the new stereotypes. Now we can update to newer versions of jr without the need of adding this modes every time.

I've already saw the vr-tutorial and we will use the distributed rendering option in case of performance problems. At the moment we render it all on one machine and it seems to bee fast enough.

Post Reply