Jump to content
MarkusR

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.

post-13423-0-81629200-1420754246.png

Share this post


Link to post

Hi,

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::CheckStereoKeys(window);
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

stereo_render.zip

Share this post


Link to post

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. ;)

Share this post


Link to post

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

stereo_lua.zip

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
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...