[Sidefx-houdini-list] Stereo Cameras

Andrew D Lyons tstexture at gmail.com
Fri Oct 27 15:59:02 EDT 2006


Damn. I had the eye shift and the anaglyph channels back to front.
I've fixed it now. Sorry for the bandwidth. Run this instead:

##############################################

# Automatically generated script: Friday October 27, 12:57
\set noalias = 1
set saved_path = `execute("oppwf")`
opcf /img

# Node stereo_anaglyph
opadd -n img stereo_anaglyph
oplocate -x 0 -y 0 stereo_anaglyph
opset -d off -r off -h off -f off -y off -t off -l off -s off -u off
-c off -C on -p on -e on -b off stereo_anaglyph
opcf stereo_anaglyph

# Node static_background
opadd -n noise static_background
oplocate -x 4.18642 -y 2.42825 static_background
chblockbegin
chadd -t 0 0 static_background aspect
chkey -t 0 -v 0 -m 0 -A 0 -F '$CPIXA' static_background/aspect
chadd -t 0 0 static_background depthglobal
chkey -t 0 -v 0 -m 0 -A 0 -F '$CDEPTH' static_background/depthglobal
chadd -t 0 0 static_background bwpoints1
chkey -t 0 -v 0 -m 0 -A 0 -F '$CBP' static_background/bwpoints1
chadd -t 0 0 static_background bwpoints2
chkey -t 0 -v 0 -m 0 -A 0 -F '$CWP' static_background/bwpoints2
chblockend
opparm static_background seed ( 0 ) percomp ( off ) turb ( 4 ) rough (
0.277 ) exp ( 0.339 ) sfreq ( 5 5 ) tfreq ( 0.01 ) toffset ( 0.462 )
amp ( 29 29 29 29 ) effectamount ( 0.702 ) overridesize ( on ) size (
500 500 ) addplanes ( m3 ) overriderange ( on ) singleimage ( on )
start ( 1 ) length ( 240 )
opcolor -c 0.5 0.7 0.6 static_background
opset -d off -r off -h off -f off -y off -t off -l off -s off -u off
-c off -C off -p off -e on -b off static_background

# Node getting_closer
opadd -n ramp getting_closer
oplocate -x 4.10611 -y 4.82589 getting_closer
chblockbegin
chadd -t 0 0 getting_closer aspect
chkey -t 0 -v 0 -m 0 -A 0 -F '$CPIXA' getting_closer/aspect
chadd -t 0 0 getting_closer start
chkey -t 0 -v 0 -m 0 -A 0 -F '$FSTART' getting_closer/start
chadd -t 0 0 getting_closer length
chkey -t 0 -v 0 -m 0 -A 0 -F '$NFRAMES' getting_closer/length
chadd -t 0 9.95833 getting_closer p2pos
chkey -t 0 -v 0.211 -m 0 -a 0.333333 -A 3.31944 -T a  -F 'cubic()'
getting_closer/p2pos
chkey -t 9.95833 -v 0.529 -m 0 -a 3.31944 -A 0.333333 -T a  -F
'cubic()' getting_closer/p2pos
chadd -t 0 9.95833 getting_closer p3pos
chkey -t 0 -v 0.208 -m 0 -a 0.333333 -A 3.31944 -T a  -F 'cubic()'
getting_closer/p3pos
chkey -t 9.95833 -v 0.526 -m 0 -a 3.31944 -A 0.333333 -T a  -F
'cubic()' getting_closer/p3pos
chblockend
opparm getting_closer stdswitcher ( 1 1 1 1 1 ) ramp ( concentric )
numpoints ( 4 )  overridesize ( on ) size ( 500 500 ) planes ( rgba3 )
customplanes ( Pz ) depth ( float16 ) depthglobal ( 0 ) usebwpoints (
on ) bwpoints ( 32768 65535 ) p2pos ( p2pos ) p2color ( 0 0 0 1 )
p3pos ( p3pos ) p4pos ( 1 ) p4color ( 0 0 0 1 )
opcolor -c 0.5 0.7 0.6 getting_closer
opset -d off -r off -h off -f off -y off -t off -l off -s off -u off
-c off -C off -p off -e on -b off getting_closer

# Node left_eye_shift
opadd -n xform left_eye_shift
oplocate -x 6.21627 -y 5.56208 left_eye_shift
chblockbegin
chadd -t 0 0 left_eye_shift tx
chkey -t 0 -v 0.18 -m 0 -A 0 -F 'ch("../getting_closer/p2pos")*10'
left_eye_shift/tx
chblockend
opparm left_eye_shift units ( pixel ) t ( tx 0 ) p ( 50 50 ) currange ( 240 )
opset -d off -r off -h off -f off -y off -t off -l off -s off -u off
-c off -C off -p off -e on -b off left_eye_shift

# Node right_eye_shift
opadd -n xform right_eye_shift
oplocate -x 6.19924 -y 4.29475 right_eye_shift
chblockbegin
chadd -t 0 0 right_eye_shift tx
chkey -t 0 -v 0.18 -m 0 -a 0 -A 0 -T a  -F
'-ch("../getting_closer/p2pos")*10' right_eye_shift/tx
chblockend
opparm right_eye_shift units ( pixel ) t ( tx 0 ) p ( 50 50 ) currange ( 240 )
opset -d off -r off -h off -f off -y off -t off -l off -s off -u off
-c off -C off -p off -e on -b off right_eye_shift

# Node left_eye2_shift
opadd -n xform left_eye2_shift
oplocate -x 6.24189 -y 3.05091 left_eye2_shift
opparm left_eye2_shift units ( pixel ) t ( 2 0 ) p ( 50 50 ) currange ( 240 )
opset -d off -r off -h off -f off -y off -t off -l off -s off -u off
-c off -C off -p off -e on -b off left_eye2_shift

# Node right_eye2_shift
opadd -n xform right_eye2_shift
oplocate -x 6.22486 -y 1.78358 right_eye2_shift
opparm right_eye2_shift units ( pixel ) t ( -2 0 ) p ( 50 50 ) currange ( 240 )
opset -d off -r off -h off -f off -y off -t off -l off -s off -u off
-c off -C off -p off -e on -b off right_eye2_shift

# Node final_left_eye
opadd -n over final_left_eye
oplocate -x 7.64577 -y 4.843 final_left_eye
opset -d off -r off -h off -f off -y off -t off -l off -s off -u off
-c off -C off -p off -e on -b off final_left_eye

# Node final_right_eye
opadd -n over final_right_eye
oplocate -x 7.65004 -y 2.62206 final_right_eye
opset -d off -r off -h off -f off -y off -t off -l off -s off -u off
-c off -C off -p off -e on -b off final_right_eye

# Node anaglyph
opadd -n pixel anaglyph
oplocate -x 8.98991 -y 3.732 anaglyph
chblockbegin
chadd -t 0 0 anaglyph rexpr
chkey -t 0 -v 0 -m 0 -A 0 -F '$R' anaglyph/rexpr
chadd -t 0 0 anaglyph gexpr
chkey -t 0 -v 0 -m 0 -A 0 -F '$CS2' anaglyph/gexpr
chadd -t 0 0 anaglyph bexpr
chkey -t 0 -v 0 -m 0 -A 0 -F '$CS3' anaglyph/bexpr
chadd -t 0 0 anaglyph aexpr
chkey -t 0 -v 0 -m 0 -A 0 -F '$A' anaglyph/aexpr
chadd -t 0 0 anaglyph c1expr
chkey -t 0 -v 0 -m 0 -A 0 -F '$C1' anaglyph/c1expr
chadd -t 0 0 anaglyph c2expr
chkey -t 0 -v 0 -m 0 -A 0 -F '$C2' anaglyph/c2expr
chadd -t 0 0 anaglyph c3expr
chkey -t 0 -v 0 -m 0 -A 0 -F '$C3' anaglyph/c3expr
chadd -t 0 0 anaglyph c4expr
chkey -t 0 -v 0 -m 0 -A 0 -F '$C4' anaglyph/c4expr
chblockend
opparm anaglyph gexpr ( gexpr ) bexpr ( bexpr ) currange ( 240 )
opset -d on -r on -h off -f off -y off -t off -l off -s off -u off -c
off -C on -p on -e on -b off anaglyph
oporder -e static_background getting_closer left_eye_shift
right_eye_shift left_eye2_shift right_eye2_shift final_left_eye
final_right_eye anaglyph
opcf ..

opcf /img
opcf stereo_anaglyph
opwire -n getting_closer -0 left_eye_shift
opwire -n getting_closer -0 right_eye_shift
opwire -n static_background -0 left_eye2_shift
opwire -n static_background -0 right_eye2_shift
opwire -n left_eye_shift -0 final_left_eye
opwire -n left_eye2_shift -1 final_left_eye
opwire -n right_eye_shift -0 final_right_eye
opwire -n right_eye2_shift -1 final_right_eye
opwire -n final_left_eye -0 anaglyph
opwire -n final_right_eye -1 anaglyph
opcf ..
opcf $saved_path

##############################################

On 27/10/06, Andrew D Lyons <tstexture at gmail.com> wrote:
> Hi Mark,
>
> Here's a quik comp script that demonstrates the stereo shift technique
> with anaglyph display. To load it just cut and paste the lines beneath
> into a Houdini textport - or a file which you can source.
>
> In doing it I've remembered/realised that you don't want to use zdepth
> information so much as the animation z distance of your objects. So
> instead of using the channels in the ramp to drive the xform COPs, use
> a channel that represents that distance.
>
> I checked it out with glasses and it seems to work. :)
>
> Good luck!
>
> Cheers
>
> ####################################################
>
> # Automatically generated script: Friday October 27, 12:46
> \set noalias = 1
> set saved_path = `execute("oppwf")`
> opcf /img
>
> # Node stereo_anaglyph
> opadd -n img stereo_anaglyph
> oplocate -x 0 -y 0 stereo_anaglyph
> opset -d off -r off -h off -f off -y off -t off -l off -s off -u off
> -c off -C on -p on -e on -b off stereo_anaglyph
> opcf stereo_anaglyph
>
> # Node static_background
> opadd -n noise static_background
> oplocate -x 4.18642 -y 2.42825 static_background
> chblockbegin
> chadd -t 0 0 static_background aspect
> chkey -t 0 -v 0 -m 0 -A 0 -F '$CPIXA' static_background/aspect
> chadd -t 0 0 static_background depthglobal
> chkey -t 0 -v 0 -m 0 -A 0 -F '$CDEPTH' static_background/depthglobal
> chadd -t 0 0 static_background bwpoints1
> chkey -t 0 -v 0 -m 0 -A 0 -F '$CBP' static_background/bwpoints1
> chadd -t 0 0 static_background bwpoints2
> chkey -t 0 -v 0 -m 0 -A 0 -F '$CWP' static_background/bwpoints2
> chblockend
> opparm static_background seed ( 0 ) percomp ( off ) turb ( 4 ) rough (
> 0.277 ) exp ( 0.339 ) sfreq ( 5 5 ) tfreq ( 0.01 ) toffset ( 0.462 )
> amp ( 29 29 29 29 ) effectamount ( 0.702 ) overridesize ( on ) size (
> 500 500 ) addplanes ( m3 ) overriderange ( on ) singleimage ( on )
> start ( 1 ) length ( 240 )
> opcolor -c 0.5 0.7 0.6 static_background
> opset -d off -r off -h off -f off -y off -t off -l off -s off -u off
> -c off -C off -p off -e on -b off static_background
>
> # Node getting_closer
> opadd -n ramp getting_closer
> oplocate -x 4.10611 -y 4.82589 getting_closer
> chblockbegin
> chadd -t 0 0 getting_closer aspect
> chkey -t 0 -v 0 -m 0 -A 0 -F '$CPIXA' getting_closer/aspect
> chadd -t 0 0 getting_closer start
> chkey -t 0 -v 0 -m 0 -A 0 -F '$FSTART' getting_closer/start
> chadd -t 0 0 getting_closer length
> chkey -t 0 -v 0 -m 0 -A 0 -F '$NFRAMES' getting_closer/length
> chadd -t 0 9.95833 getting_closer p2pos
> chkey -t 0 -v 0.211 -m 0 -a 0.333333 -A 3.31944 -T a  -F 'cubic()'
> getting_closer/p2pos
> chkey -t 9.95833 -v 0.529 -m 0 -a 3.31944 -A 0.333333 -T a  -F
> 'cubic()' getting_closer/p2pos
> chadd -t 0 9.95833 getting_closer p3pos
> chkey -t 0 -v 0.208 -m 0 -a 0.333333 -A 3.31944 -T a  -F 'cubic()'
> getting_closer/p3pos
> chkey -t 9.95833 -v 0.526 -m 0 -a 3.31944 -A 0.333333 -T a  -F
> 'cubic()' getting_closer/p3pos
> chblockend
> opparm getting_closer stdswitcher ( 1 1 1 1 1 ) ramp ( concentric )
> numpoints ( 4 )  overridesize ( on ) size ( 500 500 ) planes ( rgba3 )
> customplanes ( Pz ) depth ( float16 ) depthglobal ( 0 ) usebwpoints (
> on ) bwpoints ( 32768 65535 ) p2pos ( p2pos ) p2color ( 0 0 0 1 )
> p3pos ( p3pos ) p4pos ( 1 ) p4color ( 0 0 0 1 )
> opcolor -c 0.5 0.7 0.6 getting_closer
> opset -d off -r off -h off -f off -y off -t off -l off -s off -u off
> -c off -C off -p off -e on -b off getting_closer
>
> # Node left_eye_shift
> opadd -n xform left_eye_shift
> oplocate -x 6.21627 -y 5.56208 left_eye_shift
> chblockbegin
> chadd -t 0 0 left_eye_shift tx
> chkey -t 0 -v 0.18 -m 0 -A 0 -F '-ch("../getting_closer/p2pos")*10'
> left_eye_shift/tx
> chblockend
> opparm left_eye_shift units ( pixel ) t ( tx 0 ) p ( 50 50 ) currange ( 240 )
> opset -d off -r off -h off -f off -y off -t off -l off -s off -u off
> -c off -C off -p off -e on -b off left_eye_shift
>
> # Node right_eye_shift
> opadd -n xform right_eye_shift
> oplocate -x 6.19924 -y 4.29475 right_eye_shift
> chblockbegin
> chadd -t 0 0 right_eye_shift tx
> chkey -t 0 -v 0.18 -m 0 -a 0 -A 0 -T a  -F
> 'ch("../getting_closer/p2pos")*10' right_eye_shift/tx
> chblockend
> opparm right_eye_shift units ( pixel ) t ( tx 0 ) p ( 50 50 ) currange ( 240 )
> opset -d off -r off -h off -f off -y off -t off -l off -s off -u off
> -c off -C off -p off -e on -b off right_eye_shift
>
> # Node left_eye2_shift
> opadd -n xform left_eye2_shift
> oplocate -x 6.24189 -y 3.05091 left_eye2_shift
> opparm left_eye2_shift units ( pixel ) t ( -2 0 ) p ( 50 50 ) currange ( 240 )
> opset -d off -r off -h off -f off -y off -t off -l off -s off -u off
> -c off -C on -p off -e on -b off left_eye2_shift
>
> # Node right_eye2_shift
> opadd -n xform right_eye2_shift
> oplocate -x 6.22486 -y 1.78358 right_eye2_shift
> opparm right_eye2_shift units ( pixel ) t ( 2 0 ) p ( 50 50 ) currange ( 240 )
> opset -d off -r off -h off -f off -y off -t off -l off -s off -u off
> -c off -C off -p off -e on -b off right_eye2_shift
>
> # Node final_left_eye
> opadd -n over final_left_eye
> oplocate -x 7.64577 -y 4.843 final_left_eye
> opset -d off -r off -h off -f off -y off -t off -l off -s off -u off
> -c off -C off -p off -e on -b off final_left_eye
>
> # Node final_right_eye
> opadd -n over final_right_eye
> oplocate -x 7.65004 -y 2.62206 final_right_eye
> opset -d off -r off -h off -f off -y off -t off -l off -s off -u off
> -c off -C off -p off -e on -b off final_right_eye
>
> # Node anaglyph
> opadd -n pixel anaglyph
> oplocate -x 8.98991 -y 3.732 anaglyph
> chblockbegin
> chadd -t 0 0 anaglyph rexpr
> chkey -t 0 -v 0 -m 0 -A 0 -F '$CS1' anaglyph/rexpr
> chadd -t 0 0 anaglyph gexpr
> chkey -t 0 -v 0 -m 0 -A 0 -F '$G' anaglyph/gexpr
> chadd -t 0 0 anaglyph bexpr
> chkey -t 0 -v 0 -m 0 -A 0 -F '$B' anaglyph/bexpr
> chadd -t 0 0 anaglyph aexpr
> chkey -t 0 -v 0 -m 0 -A 0 -F '$A' anaglyph/aexpr
> chadd -t 0 0 anaglyph c1expr
> chkey -t 0 -v 0 -m 0 -A 0 -F '$C1' anaglyph/c1expr
> chadd -t 0 0 anaglyph c2expr
> chkey -t 0 -v 0 -m 0 -A 0 -F '$C2' anaglyph/c2expr
> chadd -t 0 0 anaglyph c3expr
> chkey -t 0 -v 0 -m 0 -A 0 -F '$C3' anaglyph/c3expr
> chadd -t 0 0 anaglyph c4expr
> chkey -t 0 -v 0 -m 0 -A 0 -F '$C4' anaglyph/c4expr
> chblockend
> opparm anaglyph rexpr ( rexpr ) currange ( 240 )
> opset -d on -r on -h off -f off -y off -t off -l off -s off -u off -c
> off -C off -p off -e on -b off anaglyph
> oporder -e static_background getting_closer left_eye_shift
> right_eye_shift left_eye2_shift right_eye2_shift final_left_eye
> final_right_eye anaglyph
> opcf ..
>
> opcf /img
> opcf stereo_anaglyph
> opwire -n getting_closer -0 left_eye_shift
> opwire -n getting_closer -0 right_eye_shift
> opwire -n static_background -0 left_eye2_shift
> opwire -n static_background -0 right_eye2_shift
> opwire -n left_eye_shift -0 final_left_eye
> opwire -n left_eye2_shift -1 final_left_eye
> opwire -n right_eye_shift -0 final_right_eye
> opwire -n right_eye2_shift -1 final_right_eye
> opwire -n final_left_eye -0 anaglyph
> opwire -n final_right_eye -1 anaglyph
> opcf ..
> opcf $saved_path
>
> ####################################################
>
> On 27/10/06, Bolstad, Mark (Cont, ARL/CISD) <mbolstad at arl.army.mil> wrote:
> >
> > I'm not hung up on any particular method, just the one that gives the best appearance. The OpenGL method is the run that I'm familiar with having using and written software for it for 15 years.
> >
> > I've had problems using the toe-in method where the stereo fails at the edge of the display since it was in view by only one eye.
> >
> > I like the depth idea, but really don't have much of a clue as to how to futz with the image in the compositor. I did a simple two sphere scene and dumped and a deep raster with Pz, but once back in the compositor, what do I do with it?
> >
> > An exemplar or a pointer to a tutorial would be helpful.
> >
> > Thanks,
> >
> > Mark
> >
> > -----Original Message-----
> > From:   sidefx-houdini-list-bounces at sidefx.com on behalf of Andrew D Lyons
> > Sent:   Fri 10/27/2006 12:32 PM
> > To:     sidefx-houdini-list at sidefx.com
> > Cc:
> > Subject:        Re: [Sidefx-houdini-list] Stereo Cameras
> >
> > Hi Mark,
> >
> > I'm no expert - but I've done a little stereo over the years. The
> > toe-in method is one I've used, and thought well enough of. The
> > problem is that you need to render each object seperately and
> > composite afterwards. This is so that you can have both cameras
> > converging on a "lookat" object that matches the z distance (distance
> > from cameras) of each object you are trying to render. This is fine in
> > pre-rendered stereo because we are accustomed to rendering objects
> > seperately and compositing layers. However it doesn't work for
> > realtime applications as easily, when you might have multiple objects
> > in the scene at different z-depths. In scenes like this, if your
> > cameras converge on the foreground object, you get terrible sight line
> > crossing behind it, and the distant objects diverge and disassociate
> > from each other. This is part of the reason why I think the paper you
> > refer us to has deprecated the "toe-in" method. This paper is
> > concerned primarily with Open GL methods - in which the toe-in method
> > would cause bad eye-crossing, and be difficult to work with - unless
> > you defined a seperate camera for every object and it's varying depth
> > and somehow combined image buffers afterwards. If you think about how
> > we look at things, our eyes do in fact converge on objects, so in a
> > way toe-in is correct - unless you are trying to implement stereo in
> > open GL - in which it is difficult to the point of being impossible.
> >
> > If you are set on the so called "correct" method, I'd suggest
> > experimenting with the Houdini camera "crop" settings. It looks as if
> > you could keep your camera's sight lines parallel, and just crop off
> > the outer side of each camera to get an equivalent viewing frustum to
> > the one they describe.
> >
> > If this so called "correct method" is what you are doing though, you
> > are proabably better off doing what most big stereo productions seem
> > to do these days, and render with one camera, but store depth
> > information for every pass. You can replicate the stereo effect in
> > COPs by splitting off two image streams from the original render, and
> > then use the depth information to shift each one away from the center
> > as it gets closer to your cameras. You would need to devise an
> > expression that calculates exactly what that divergence should be for
> > your camera, but this will save you a lot of time compared to
> > rendering every layer with two cameras and trying to manage that.
> >
> > Finally, if you don't already have some workstation based way of
> > previewing your stuff in stereo, I'd suggest the red/blue anaglyph
> > technique. Get a pair of red-blue 3D glasses from somewhere, (the web)
> > and use a channel copy COP to split your color planes out correctly
> > for each camera so you can preview your stereo effects on your
> > computer. Merge the red layer from the left camera, and cyan (which is
> > equal parts blue and green) from the right camera and you'll be in
> > business. (Works better with low-chroma or grayscale images.)
> >
> > http://en.wikipedia.org/wiki/Anaglyph_image
> > http://www.stereoscopy.com/reel3d/anaglyph-glasses.html
> >
> > Enjoy!
> >
> > Cheers
> >
> >
> >
> >
> >
> > On 27/10/06, Dan Seddon <dan.seddon at framestore-cfc.com> wrote:
> > > Mark A. Bolstad wrote:
> > > >
> > > > Searching the mailing list, I saw a couple of previous postings are
> > > > creating stereo images, but none of the methods actually accomplish
> > > > what I need. We're going to a show with a large projection system that
> > > > is running a passive stereo system (very cool system that uses color
> > > > shifting instead of polorization).
> > > >
> > > > What I need is a way to compute a pair of asymmetrically-skewed
> > > > cameras. I have parented a left and right eye camera with what appears
> > > > to be the correct eye separation. What I need is a way to set up the
> > > > cameras similar to this (see "Correct method):
> > > >
> > > > http://local.wasp.uwa.edu.au/~pbourke/stereographics/stereogl/
> > > >
> > > > It's easy to setup the toe in method, but I would like the method above.
> > > >
> > > > Thanks,
> > > >
> > > > Mark
> > > >
> > > Hi Mark
> > >
> > > You could use the Window X/Y offset to do what you want - I think it's
> > > more correct than using the crop as it's post-perspective in terms of
> > > it's transform (which I think is more correct - but could be completely
> > > wrong). You'll have to mess around with numbers to get it right though,
> > > if you're not sure about this perhaps your could create a number of
> > > reference objects to define your field of views (a bit like a look at
> > > null) and mess around with the numbers until they fit.
> > >
> > > Cheers
> > >
> > > Dan
> > > _______________________________________________
> > > Sidefx-houdini-list mailing list
> > > Sidefx-houdini-list at sidefx.com
> > > https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
> > >
> >
> >
> > --
> > =======================================
> > Andrew D Lyons | Digital Artist | http://www.tstex.com
> > =======================================
> > _______________________________________________
> > Sidefx-houdini-list mailing list
> > Sidefx-houdini-list at sidefx.com
> > https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
> >
> >
> >
> > _______________________________________________
> > Sidefx-houdini-list mailing list
> > Sidefx-houdini-list at sidefx.com
> > https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
> >
>
>
> --
> =======================================
> Andrew D Lyons | Digital Artist | http://www.tstex.com
> =======================================
>


-- 
=======================================
Andrew D Lyons | Digital Artist | http://www.tstex.com
=======================================



More information about the Sidefx-houdini-list mailing list