Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

3d screen mode for 3d glasses

Recommended Posts

i have a 3d monitor where each row is alternate the left or right eye cam.

with eye glasses i have 3d, thats really cool in 3d games.


its a nice to have in the engine.

i saw occulus rift is supported, but this device is very expensive now.


Link to post
Share on other sites


I did this once for c++. You can find the files in the attached zip-folder.

You can just add them to your c++-Project.

What you have to do to make this work:

Put the files StereoRender.cpp and StereoRender.h into the folder containing your Source-files and the shader-files into the Shaders/PostEffects - folder.


In App.h:

#include "StereoRender.h"


In App.cpp:

in App::Start() (Just put it at the end before the return statement):

(Actually there are some more parameters to specify e.g. the nearplane and the farplane that have a default-value. If you want to play with those, you can find them in the StereoRender.h)

StereoInterlaced::PrepareStereo(context, camera);


in App::Loop() (Between "world->Update();" and "context->Sync(...);")

StereoInterlaced::RenderStereo(world, camera);
StereoInterlaced::DrawStereoOffsetText(10, 220);


CheckStereoKeys will check the numpad keys "-" and "+" which control the offset, "/" and "*", which control the angular offset. Also the Tab-Key is used to turn on/off stereo and F1 is used to reload the shaders (you shouldn't need this one if you don't modify the shaders). Shift is used to switch between the "real" 3d using two renderings and a (more or less failed) try of having a reprojected stereo. The latter one will most likely only cause headache but I included it because I was to lazy to cut it out now wink.png. It is quite a challenge to find the most suiting values for the offset and the angular offset so you will need to play around with these and find something that suits you.


DrawStereoOffsetText will draw some info like the values for Angular Offset and Offset.


Have Fun and please tell me what you think about it smile.png


Link to post
Share on other sites

Also note that using the "real" mode will cause your fps to drastically go down which is by the nature of the thing since the world has to be rendered twice. The reprojected stereo followed a different approach which was meant as a pure post-processing-effect to recreate the two images from one image and its depth-image. This has a significant performance advantage against the former one. There are scientific papers out there that describe the approach, so it is possible to create decent looking 3d-images with that one, but at some point I just didn't have the time to continue that one and as it is now, it isn't really good. ;)

Link to post
Share on other sites

Oh, I see.

I quickly translated it to LUA (and removed the reprojection-approach).

You'll find Instructions on the README.txt included in the zip.


At the moment, the rendering is done in the WorldUpdate-Function which is probably not optimal. Feel free to move it anywhere more suited wink.png


Have Fun smile.png


  • Upvote 2
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...