Blending 3D Environments in Anaglyphic 3D

Gutterkisser's picture

Hi all.

I've hit a roadblock with anaglyphic (red/cyan) 3D visuals in QC. No doubt a collective groan is let out at the very mention of gimmicky 3D, but please bear with me!

The actual 3D effect works fine, in terms of X-axis offset of two 3D Spaces, and the red/cyan blend.

The problem I'm having is I can't figure out how to blend the two 3D Spaces WITHOUT using Render In Image (and twice, at that). Render In Image tends to cripple the frame rate on my machine, so any motion is jerky and destroys the 3D effect.

Is there a more efficient way of layer blending 3D objects?

I've attached a basic .qtz example- two Render In Image macros blended through an Anaglyph Blend patch. Both Render In Image is an ugly nest of Render In Image > 3D Space > Lighting > 3D objects, and that's where my computer is struggling.

My aim is for everything to sit inside one 3D Space. Each object within that Space would be duplicated with appropriate X-axis offset and red/cyan colour difference. However, here I'm not sure how to blend their overlaps with the appropriate effect - changing the Blend Mode of each object to 'Add' doesn't quite work.

...Wow, apologies for the wall of text guys - hope you can wade through it all, any suggestions or feedback will be greatly appreciated!

PreviewAttachmentSize
Anaglyph 3D Space.zip15.26 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

cybero's picture
Re: Blending 3D Environments in Anaglyphic 3D

Anaglyph is something that I'm using the 3d Stereo patch for.

It does , in effect & practice, do the dual rendering required, but in a single stereo rendering environment.

http://kineme.net/forum/Release/Production/GLTools15StereoRendererBug covers the bases pretty well for that patch.

Interesting to see another anaglyph construct that avoids using that patch.

I get about between 30 to 60 fps, not too bad.

Perhaps you could give the Stereo Renderer a try, otherwise I can't immediately think of an alternate approach that doesn't use two render image , like the GL Viewport, for example and that won't give you a true Anaglyph ..

Variety is the Spice of Life :-)

franz's picture
Re: Blending 3D Environments in Anaglyphic 3D

you don't need a render in image. (Render Left eye)-blue color, clear the depth buffer, (Render Right eye)-red. See the rewrite of your comp. Parameters are approx,. but you'll get the idea.

you'll need KnM GLtools btw.

PreviewAttachmentSize
_1024_Anaglyph 3D Space.qtz52.33 KB

cybero's picture
Re: Blending 3D Environments in Anaglyphic 3D

Missed this when it got uploaded yesterday.

That's a really neat reconstruction.

Two renders of the main scene, though in slightly different constructs.

A 3D Space [Transformation] inside of a Color Mask Patch, with one placed within a Blend Equation patch. Neat.

No Render in Image nor Stereo Environment required neither :-).

A very good study example.

You've got it dialled.

gtoledo3's picture
Re: Blending 3D Environments in Anaglyphic 3D

There's something about this that doesn't look like it renders correctly... I guess it's that it isn't a true frustum render, or have the non-accurate tow in method. As stuff moves back, it doesn't look right to me. Also, it would be totally non compatible with polarized 3D.

The question that's being asked though, is if there is anything that can speed up FPS. The answer is, not really, besides culling faces and limiting pixel width and height. Any of the methods require that consumer patches execute twice.

Gutterkisser's picture
Re: Blending 3D Environments in Anaglyphic 3D

Thanks for your prompt responses, everyone!

I haven't had a chance to do much testing yet, but at the moment Franz's version seems to be a rather elegant solution. I had to download the Kineme GL Tools, and admittedly still haven't taken the time to understand exactly what's going on, but I'm already seeing a marked improvement in frame rate stability.

The only issue I'm having is that there's a little ghosting happening in each lens (moreso in the Red I believe) - is there any way of adjusting the exact shade of Red and Blue that are unmasked, or is it a binary 'Red = on/off' choice? With the Colour Matrix method I was using initially, I was able to tweak the tone of the two colours until they were invisible in the appropriate lens.

Anyway, thanks again for all your thoughts - I may be back in a few days with more annoying questions but at the moment my major hurdle looks to be toppled.

dust's picture
Re: Blending 3D Environments in Anaglyphic 3D

nice one franz. i was wondering how this could be done in qc with out a gl stereo patch. last semester i was getting into these for a class on perceptions. i did a thing in unity3d by rendering two first person controller cameras into textures that i then blended based on paul bourkes stereo stuff. its amazing how complex stereo vision gets but yet a simple photoshop file can produce an image without messing with IOD's and camera settings. most stereo stuff works for me but those pictures you stare at until you see an image in 3d or something never work me ;(

ahoeben's picture
Re: Blending 3D Environments in Anaglyphic 3D

I've been having lots of fun rendering scenes in anaglyph using Franz' technique. Here's a version of his composition with the following improvements:

  • use an iterator for the two "passes" so you only have to build the scene once
  • use asymmetric frustrums ("lens shifting") instead of rotated cameras for a better stereo effect
  • use IOD (inter occular distance) and distance to Focal Plane as parameters

The Focal Plane is the plane in front of the stereo camera where the two views match (ie: no stereo shift). Objects in front of that plane seem to pop out of the screen, objects behind that plane are... well... behind the screen.

Finally I turned on mipmapping for the textures in the demo scene.

PreviewAttachmentSize
_1024_AH_Anaglyph 3D Space.qtz23.48 KB

franz's picture
Re: Blending 3D Environments in Anaglyphic 3D

nice patch ! very useful indeed.

bonerton's picture
Re: Blending 3D Environments in Anaglyphic 3D

great work from franz and ahoeben! i'm trying to get AH's version to work in vdmx, but it just comes up blank? Any ideas? Digging into now...

bonerton's picture
Re: Blending 3D Environments in Anaglyphic 3D

looks like the problem comes with the Kineme GL Color Mask being inside the Kineme GL Blend Equation. gonna take this over to the vdmx forums...

**Edit: Enable the alpha channel on the GL Color Mask and it'll work in vdmx. Thanks again Franz and Ahoeben!