Swap stereoscopic eyes?

Anyone know how to “swap the eyes” in quadbuffered stereo? I have a stoooopid projector that arbitrarily picks up either eye for the sync signal each time I start. Sometimes right, sometimes wrong.

I already tried to invert the “eye separation” value but it will not go below zero.

I’m thinking a keyboard event logic tied to a python call would do it, but I don’t know how to access “eye separation,” or the syntax. If the current eye separation could be changed to a negative value I’m thinking a keypress it would change it on the fly.

Any ideas?

As always, thanks very much for the help.

I’m not sure, but you might need to do this via your display driver. The BGE produces the separated output but the display has to deal with it (left -> left and right -> right). Usually stereo devices have a setting to switch left and right view (at least the devices I know).

I imagine it would involve patching the code to accept a negative value for eye seperation. I guess we’re in the minority of people who have no problem crossing their eyes to view stereo pairs, I never understood why the default is always the opposite.

Edit: just run a script with this:


bge.render.setEyeSeparation(-2.0)

Thanks jplur - that’s the type of suggestion I was looking for - however i have not got it to work.

Here’s the code I used:

import bge.render

invert eyes for stereo correctness

bge.render.setEyeSeparation(-2.0)

I set that to a keyboard sensor set to F7.
I clicked F7 during game and it did not affect it.
Is my code syntax correct?

Thanks.

NOTE: If it affects the code or usability, I’m actually using the blenderplayer to display stereo with the following batch file:

“blenderplayer.exe 1024 768 32 120 -s hwpageflip Master_game_ted11_TEST42.blend”

Can anyone tell me if my code syntax is correct?

import bge.render

invert eyes for stereo correctness

bge.render.setEyeSeparation(-2.0)

Thanks for the link, Monster. Your example works great but I have one question. Referencing the CMD, I see that the file loads with 0.1 separation and 0.0 focalLength. As I hit either * or / the CMD updates with a focusLength of 3. From that point on, it scales with your separation at the same rate. My question is this:

Where does the value of 3 exist and how does it get applied?

The reason I ask is because I added an “invert” game property float with a value of -1. The intent is to flip the current stereo settings to their exact invert. My logic bricks look like:

Keyboard(f7) > And > Property (Mode: Assign, Property: sep, Value: sep*invert)

From the logic I can reference in your scene and python script, it should exactly invert the settings, but this is what I see in my CMD when I hit the f7 key:

0.1 separation, 0 focusLength
-0.1 separation, 3 focusLength
0.1 separation, -3 focusLength
-0.1 separation, 3 focusLength
etc

From my understanding on 3D in blender, the convergence point of the 3D camera rig is at the focusLength. Since the value of 3 is being applied after the initial state, when I invert, the relationship of my camera separation to focusLength changes. This causes the visual “depth” of the scene to change with the invert rather than stay the same, but with flipped camera positions.

Ideally, my CMD would read like this when I hit my f7 invert key:

0.1 separation, 0 focusLength
-0.1 separation, 0 focusLength
0.1 separation, 0 focusLength
-0.1 separation, 0 focusLength
or
0.1 separation, 3 focusLength
-0.1 separation, 3 focusLength
0.1 separation, 3 focusLength
-0.1 separation, 3 focusLength
etc

This will allow my depth budget in relation to my focusLength to remain consistent when the camera position switch.

As always, thanks for the help and continued support from you and the whole blender community!

Nevermind, I solved it by editing your StereoView.py script to include an explicit setting for focusLength value. Once this was done, the CMD window displayed the value initially AND it was not effected by the invert key. My CMD read out now shows:

0.1 separation, 35 focalLength
-0.1 separation, 35 focalLength
0.1 separation, 35 focalLength
-0.1 separation, 35 focalLength
etc…

Here is the line of code I added to your script:

Rasterizer.setFocalLength(35)

Thanks for the help, Monster!