Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Red/Cyan Anaglyph Stereoscopy + Depth Of Field  (Read 37199 times)
Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« on: July 13, 2009, 02:00:42 AM »

Another WIP sample, started this afternoon and already mostly complete!

I had a couple of requests to release the stereoscopy code from Super HYPERCUBE, but I didn't want to do that because the code was really messy.
So instead I'm redoing a proper sample with most of the techniques I used in sHC, plus a couple of other experiments.



Current features :
- Optimized anaglyph filters to reduce eye-strain but still keep some color information
- Red channel gamma correction to compensate for the low amount of light perceived by the left eye (as suggested by the same link above)
- A first person camera with auto-focus based on depth information

The last point is what I'm still working on but it's nearly finished. The idea is to make a depth pass before rendering each eye, and use the depth information of what's close to the center of the screen to know where each eye should look at.
Keeping eyes parallel is simpler and works, but it's not realistic, since both eyes are hooked at a single brain that wants to focus at one point only!

After that I'd love to try and add depth-of-field to it so that objects wildly out-of-focus don't hurt the eyes so much.
« Last Edit: July 19, 2009, 01:15:54 AM by Zaknafein » Logged

Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« Reply #1 on: July 19, 2009, 12:01:09 AM »

Sooo... I'm trying to implement depth-of-field based on this paper, it's proving a little more difficult than I thought.

Not much to show as it doesn't really work right now. Grin

Edit : Ah what the hell, here's where I'm at.

I found a good resource on DoF plane distances calculation : http://www.cambridgeincolour.com/tutorials/depth-of-field.htm

This allows me to get the distances of the nearest and farthest "focused" plane distances based on many physical lens and camera settings. What "focused" means is defined by the Circle-of-Confusion parameter.


(the DoF algorithm is still early, it'll look better)

One big problem that I just found is that I'm going to have to do DoF for each eye, separately. And render depths twice.
I can't use a single post-process DoF shader because the depth buffer of a single "cyclops" eye doesn't match any of the eyes' depth buffers, and it causes discontinuities that really don't look natural.

I'm not sure if this is going to be too slow. It means a lot of sampling. We'll see.
« Last Edit: July 19, 2009, 01:22:23 AM by Zaknafein » Logged

ZaPPZion
Moderator
Community Member
*****
Posts: 570


« Reply #2 on: July 19, 2009, 06:21:26 AM »

looks like a lot of fun already Smiley
Why do you use light blue cyan and red instead of green and red btw?
« Last Edit: July 19, 2009, 06:23:19 AM by ZaPPZion » Logged

Check out my website: www.bartkuipers.com
GD
Customers
Community Member
*****
Posts: 384


« Reply #3 on: July 19, 2009, 10:10:16 AM »

Chromatically opposite colors must be used. Cyan vs red is the current norm. Green would go with magenta I believe.
Logged
Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« Reply #4 on: July 19, 2009, 11:15:25 AM »

Yup! (1, 0, 0) for an eye, (0, 1, 1) for the other.
But since that way the left eye recieves half as much light as the other one, I use gamma correction to compensate, which makes the overall image look reddish.
Logged

Lenn
Customers
Community Member
*****
Posts: 876

+/-


« Reply #5 on: July 20, 2009, 11:00:14 AM »

Why dont you just do (1,0,0) vs (0,0.5, 0.5) ?

Using DOF with this sounds pretty complicated. Nice work, as usual... I only wish I had one of those blue/red glasses, they seem to be so hard to come by since the 80s ended such a long time ago. Smiley
Logged

TV3D 6.5 Community Docs - Read, use and please contribute!
Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« Reply #6 on: July 20, 2009, 02:14:10 PM »

The actual color filter matrix is :

The anaglyph filter comparison placed topmost as the one with the less retinal rivalry and ghosting, and I trust the guy's results...
Logged

Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« Reply #7 on: July 26, 2009, 11:37:11 PM »

Stereoscopy + two-eye DOF is still ways off, but "cyclops" one-eye depth of field alone is looking good now.
...at least from some selected angles. Cheesy



I've also been adding real camera controls because it fit with the formulas I'm using for "near focus plane" and "far focus plane" calculation.
The "focal length" parameter actually changes the field-of-view angle based on physical calculations, which is cool. But it also assumes wierd things like that I'm viewing the image on a 35mm full-frame print... there is no actual "sensor size" when you're viewing on a screen.

Progress, though! Grin

Edit : A view of the checkboard with eye separation to show how it works together when there's no depth difference between the two eyes and the "middle eye" that I use for depth sampling.

« Last Edit: July 26, 2009, 11:50:05 PM by Zaknafein » Logged

ZaPPZion
Moderator
Community Member
*****
Posts: 570


« Reply #8 on: July 28, 2009, 01:18:12 AM »

Looks like it's really comming together already Smiley great work
Logged

Check out my website: www.bartkuipers.com
petrus
Customers
Community Member
*****
Posts: 115


« Reply #9 on: July 29, 2009, 03:37:26 AM »

Awesome... Actually I was planning on trying this today, opened my browser to check form discussions and here's your discussion. Grin
Seems like a lot more work than I anticipated
Logged
Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« Reply #10 on: July 29, 2009, 10:30:29 AM »

Red/cyan anaglyphs stereoscopy as-is is simpler than what I'm trying to achieve... If you know what point or distance you're focusing on at all times (for example if your camera orbits around a point), it's a lot simpler.

What's making it hard for me is making a full first-person camera with stereoscopy, and trying to put in depth-of-field on top to make it look cool. Grin
Logged

petrus
Customers
Community Member
*****
Posts: 115


« Reply #11 on: September 14, 2009, 02:27:11 AM »

Hi Zaknafein I need your help on this...
I have to create a anaglyph filters demo before end of this month (september). I did take a look at the interesting anaglyph filters website link you referenced to but... I still need some basic idea on how to use it. Should I render what the left eye should see and then multiply the rgb by the filter color? (Lerp) and then do the same for the "right eye view".

Please help... I don't need depth of field.

Thanks again Grin Please  Undecided  Huh
Logged
Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« Reply #12 on: September 14, 2009, 10:06:38 AM »

Ha! Just yesterday I was thinking about releasing that sample without the depth-of-field part (which is too much trouble for me right now).
So I'll do that soon.

My implementation uses two surfaces, one for each eye, and a shader to combine them (using the matrix filters) onto the main buffer.
Logged

petrus
Customers
Community Member
*****
Posts: 115


« Reply #13 on: September 15, 2009, 08:26:30 AM »

It will be very AWESOME of you to let me take a look at your sample Grin
I just don't know how you used the matrix filters... Tongue
Logged
Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« Reply #14 on: September 24, 2009, 11:22:16 AM »

It's done!

http://theinstructionlimit.com/?p=478
Logged

ZaPPZion
Moderator
Community Member
*****
Posts: 570


« Reply #15 on: September 24, 2009, 02:50:38 PM »

Woa, great work  Shocked Grin
Logged

Check out my website: www.bartkuipers.com
petrus
Customers
Community Member
*****
Posts: 115


« Reply #16 on: October 07, 2009, 02:55:40 AM »

You Rock Zaknafein  Grin
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks