FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Topics & Contributions
   Beyond Categories
(Moderator: REAS)
   Stereoscopic images sans glasses
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: Stereoscopic images sans glasses  (Read 3829 times)
sinkblot

sinkblot
Stereoscopic images sans glasses
« on: May 3rd, 2004, 9:07am »

Hey again - I'm working on a stereoscopic sketch - no color glasses, but the kind where the perspective differs slightly and you use a viewer.   This requires two views, each 200 pixels on my LCD, separated by about 50px in the middle.
 
Wondering if someone can suggest a good method..  Here's what I've tried, and why they didn't work out:
 
-replicate() - too slow
-bSpace   - still uses implicit 3d space  
-running the L and R sketches in the same webpage - means you can have no random variables, no interactivity
-camera - still [sadly] unable to make it do what I want...
 
 
If anyone has an idea for how this can be worked around, please let me know.
 
justo


Re: Stereoscopic images sans glasses
« Reply #1 on: May 4th, 2004, 10:36pm »

hmm, you might be able to do this in processing, but if i had to do this in java, i would instantiate two processing applets and put them in the main applet frame side by side. pretty easy, actually, and then you can pass each one of them mouse interaction information manually.
 
youll have to ask one of the processing guys if you can do it in processing though...or if you have any experience using the processing libraries outside of the processing enviroment, go for it.
 
narain


Re: Stereoscopic images sans glasses
« Reply #2 on: May 5th, 2004, 2:12pm »

Somehow, this seems too obvious to not have already been tried, but here goes anyway.
 
Can't you just draw the left view, translate by 250px, do a small transform, and then draw the right view?
 
There MUST be something I'm missing.
 
justo


Re: Stereoscopic images sans glasses
« Reply #3 on: May 5th, 2004, 9:19pm »

that would definitely work, but youd have to clip the second draw somehow...you dont want to draw over the left hand view when you draw the right hand one. i dont think thats possible in processing right now.
 
now that i think about it, though, my idea is not so hot...a lot of wasted memory and processing cycles since the views will be almost exactly the same minus one small transform, as you pointed out. in java your idea is certainly possible...processing basically works by drawing to an image and when the drawing is complete, it draws the image to screen.
 
the code is essentially (with g as java's graphics object):
g.drawImage(0,0, imageBuffer);
 
it would be a bit of a hack, but you could do something like have the left hand view draw, call
g.drawImage(0, 0, imageBuffer);
then do a small transform in the object space, rerender it, then call
g.drawImage(250, 0, imageBuffer);
 
you just have to make sure that the imageBuffer is only 200x200 pixels.
 
this is really complicated, though, and it would be nice if there was a pure processing solution.
 
sinkblot

sinkblot
Re: Stereoscopic images sans glasses
« Reply #4 on: May 5th, 2004, 9:45pm »

These sound feasible... unfortunately, I've had problems getting eclipse to work on my mac.  I think for the interim I'm going to have to trim the random and input components of the sketch and export two separate sketches to the same site.
 
TomC

WWW
Re: Stereoscopic images sans glasses
« Reply #5 on: May 5th, 2004, 11:05pm »

Drawing in stereo in Processing is pretty much going to be half the speed of doing it without stereo, I reckon.
 
JohnG had some success with replicate...
 
http://www.hardcorepawn.com/Planet/
http://www.hardcorepawn.com/landgen3d3d/
 
Is your mono version running at a high framerate?
 
sinkblot

sinkblot
Re: Stereoscopic images sans glasses
« Reply #6 on: May 6th, 2004, 1:30am »

no, but I can try to borrow someone's g4 laptop.  Will post any useful info...
 
narain


Re: Stereoscopic images sans glasses
« Reply #7 on: May 6th, 2004, 6:09am »

Wow.
 
The LandGen3D sketch looks amazing.
Stereoscopic images have such an impact, I had no idea!
 
Can somebody tell me what's replicate() all about It copies rectangular areas, right, so how do you use it for stereoscopic vision
 
This might be useful: http://processing.org/discourse/yabb/board_Syntax_action_displa_y_num_1080671926.html
Basically, you can make a new image and draw directly onto it. This'll let you clip both renders by drawing first onto a 200x200 image then drawing the image.
 
Edit: I just noticed this is the imageBuffer method justo was talking about. So credits to him for the idea; and this is the pure Processing solution we were looking for.
« Last Edit: May 6th, 2004, 6:13am by narain »  
TomC

WWW
Re: Stereoscopic images sans glasses
« Reply #8 on: May 6th, 2004, 10:39am »

Say the image required for each eye is 100x100.  Then the sketch is 200x100.  
 
So:
 
* draw the right eye view normally, making sure it fits in 100x100 pixels
* replicate the left-side 100x100 into an image buffer (e.g. BImage righteye = replicate(...)),
* draw the left eye view normally,
* draw the right eye image 100 pixels over
 
You use replicate, rather than copy, because replicate lets you specify the dimensions.  So you could use copy, but it would be wasting the right 100x100.
 
I might have missed some calls to background() there, and IIRC JohnG actually buffered both eye views into images and did some stuff with the alpha channel too.  But basically you draw everything, buffer it, tweak the transform, draw everything, then copy the buffer over the right hand side.
 
Hope that makes sense.
 
narain


Re: Stereoscopic images sans glasses
« Reply #9 on: May 7th, 2004, 6:42am »

Ah, thanks. That would work. But I remember sinkblot saying it's too slow.
 
I guess you don't need to do that anymore, now that (as in the link I posted) you can draw directly onto images.
 
JohnG

WWW
Re: Stereoscopic images sans glasses
« Reply #10 on: May 12th, 2004, 1:47pm »

on May 6th, 2004, 10:39am, TomC wrote:

I might have missed some calls to background() there, and IIRC JohnG actually buffered both eye views into images and did some stuff with the alpha channel too.  But basically you draw everything, buffer it, tweak the transform, draw everything, then copy the buffer over the right hand side.
 
Hope that makes sense.

 
Yeah, I had to use copy rather than replicate, since I couldn't ever be 100% sure how wide each "eye" view would be, and making it big enough, would mean that one of the eye's could overlap another, and write the background colour over the top of part of the other eye's image,so I crated an alpha map based on wether it's the background colour or not.
 
sinkblot

sinkblot
Re: Stereoscopic images sans glasses
« Reply #11 on: May 19th, 2004, 11:36am »

it sounds good in theory... I've just now started learning about bufffering, so it will take me a while to implement.  Since these posts I've been working with the faux methods of subtle rotations and camera adjustments, with minor luck.  I think the solution for this and many of my other problems... is for me to acquire a laptop with more clout.  Anyone in Manhattan or Brooklyn want to hire an apprentice artist/programmer? Heh.  Thanks for your help, guys.
 
Pages: 1 

« Previous topic | Next topic »