3D stereoscopic + Motion Blur

Started by
8 comments, last by SixeliA 12 years, 9 months ago
Hi,
My software (a roller coaster simulator) uses 3D stereo. When the speed of the car increases, I would like to add a motion blur effect using the accumulation buffer.
When 3D stereo is off it works well.

The problem is that I don't know how to do the same thing with the 3D on (I have to display the scene for the right eye and the left eye differently).

any help is welcome :)

The code :

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
drawEverything();
glAccum(GL_MULT, q);
glAccum(GL_ACCUM, 1-q);
glAccum(GL_RETURN, 1.0);
Advertisement
Are you using the NVidia 3D automatic mode? If so, I'm not sure how you'd go about processing the image for each view.
Though if you're doing it manually, surely you could just apply the process to each eye individually?

Funnily enough, I'm also working on a 3D rollercoaster simulation :)

Saving the world, one semi-colon at a time.

No I'm doing it manually :


glDrawBuffer( GL_BACK_RIGHT );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(...);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(...);

drawEverything();
glAccum(GL_MULT, q);
glAccum(GL_ACCUM, 1-q);
glAccum(GL_RETURN, 1.0);

glDrawBuffer( GL_BACK_LEFT );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(...);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(...);

drawEverything();

glAccum(GL_MULT, q);
glAccum(GL_ACCUM, 1-q);
glAccum(GL_RETURN, 1.0);


but it doesn't work at all. Obviously something is missing but I don't know what ...

Do you have some screen-shot of your roller coaster ? (just curious :) )
I'm used to DirectX more than openGL. But assuming the accumulation buffer is interpolated between the last frame and this frame, can't you create the accumulation buffer to be twice the size of the final render? And then copying the left image to the left side and right image to the right side per frame. I'm unsure if this would work, but possibly this might accumulate the effect. You could then sample the two halves of the accumulation buffer. (Is this possible?)
I haven' t used OpenGL really, so this is all assumptions.


EDIT: I've just realised I think you're doing this already. Though should you be clearing the colour buffer? Try just clearing the depth buffer. - this will cause issues if there are any pixels which don't get rendered - but if your scene has a skybox/similar then it'll be fine.



Do you have some screen-shot of your roller coaster ? (just curious :) )


Unfortunately no, it's very much a work in progress... but at the moment the track is merely a repeating cube+pyramid shape. I'm cloning the "Dark Knight" ride at six flags - seeing as I'm not creative enough to make my own rollercoaster. :(

Saving the world, one semi-colon at a time.

I am not a professional opengl user but I am not sure we can do that using the accumulation buffer (or at least I don't know how to do that) ...

Edit : OK I'll try that thanks !
I fixed it!
In fact I needed to tell opengl which buffer I wanted to read ...
For the right eye :
glReadBuffer(GL_BACK_RIGHT);

and for the left eye:
glReadBuffer(GL_BACK_LEFT);

thank you anyway!

and good luck for your roller coaster !
Glad you fixed it!
And thanks, you should post some images, I'll post some images when it's done. =)

Saving the world, one semi-colon at a time.

mini_110728054309293249.jpg

mini_110728054437203645.jpg

mini_110728054605172944.jpg
This looks great! Are you creating the track mesh dynamically? - That's my ultimate goal, though at the moment it's just being modelled in Blender.

Saving the world, one semi-colon at a time.

Yes I use .txt file in which you can write all the tracks informations (but I am not the one who wrote this part of the software) so you can create as many tracks as you want !

This topic is closed to new replies.

Advertisement