POV-Ray : Newsgroups : povray.newusers : stereo camera : Re: stereo camera - 1 attachment (1/2) Server Time
29 Jul 2024 18:16:03 EDT (-0400)
  Re: stereo camera - 1 attachment (1/2)  
From: John Salmon
Date: 28 May 2005 16:05:59
Message: <Xns966499923FC48jsalmonhoustonrrcom@203.29.75.35>
"Ajees" <ala### [at] yahoocom> wrote in
news:web.429755fca665835a5ea7462e0@news.povray.org: 

> Hai
> I wish to create a stereo pictuers side by side (left and right) for
> my molecule using the following camera position.
> 
> // Pov 'camera'
> //  to view default ribbons box:  X+-25; Y+-20
> /**** pov-image script should replace this with something:
> camera {
>  //location <0.0,0.0,500.0>    // far away in Z
>  // for stereo, eye-separation = 0.1*distance
>  location <25.0,0.0,500.0> // stereo 'Right' Z
>  //location <-25.0,0.0,500.0>// stereo 'Left' Z
>  up y                        // like the screen
>  right -5/4*x                // makes right-handed
>  angle 5.73                  // 2*atan(25/500)
>  look_at <0.0,0.0,0.0>       // origin of ribbons box
> }
> 
> ****/
> 
> I will just comment / uncomment the Left and Right location to get the
> two pictures. Unfortunatley the pictures which I am getting is not 3
> dimensional.
> Is there any suggestions?
> Thanking you,
> Yours
> Ajees
> 
> 
> 

I've been playing around with just this topic. I've been using POV's 
standard "woodbox.pov" file to develope the procedure. Here's what I have 
so far.

Replace the original camera with the following;

//########################################
// Replace the original camera with this

// Save the original camera location
#declare viewLoc = <-7, 10, -15>;

// Save the original look_at location
#declare lookAt = <0, 0, 0>;

// Find the actual vector between the camera and the location looked at
#declare lookDir = lookAt - viewLoc;

// Make sure that up is the same for the camera and for the calculations
#declare vrt = y;

// Use cross product to fins a vector perpindicular to both up and the
// viewing direction and normalize it.
#declare eyeDir = vnormalize(vcross(lookDir, vrt));

// Find the distance between the camera and the location looked at
#declare lookDist = vlength(lookDir);

// Scale the eye seperation for good viewing. The value 20 seems to work
// well, but can be changed
#declare eyeSep = lookDist / 20;

// Find the positions of the eyes
#declare leftEye = viewLoc + (eyeSep / 2.0) * eyeDir;           // One of 
these will
#declare rightEye = viewLoc - (eyeSep / 2.0) * eyeDir;          //   be 
unused

// Now, use the above info
camera {
// location leftEye             // Use this one in the left eye file
   location rightEye
   direction <0, 0,  2.25>
   up vrt
   right x * 0.8
   look_at lookAt
}

//########################################

The comments should be easy to follow. As of now I use two files; left and 
right. My next step is to combine them into one two-frame animation file so 
that both will be generated in one pass. I've also used an 8/5 aspect ratio  
for display on my 8/5 monitor. In the resolution.ini file add the 
following;

[512/2*320, AA 0.3]
Width=256
Height=320
Antialias=on
AQntialias_Threshold=0.3

Also, I used Paint Shop Pro to combine the two images.

I use the "cross-eyed" viewing method (right eye image on the left - left 
eye image on the right) because it isn't limeted in spacing as the "splay-
eyed" viewing method.

Im including the entire "woodbox.pov" file for one side and a copy of my 
derived image.

// woodbox.pov
// POV-Ray 3.5 scene file by Dan Farmer
// Copyright POV-Team, 1995
// Demonstrates some of the woods.inc textures.
// Several wooden spheres (and one glass one), in and around
// a wooden box.

#include "colors.inc"
#include "textures.inc"
#include "shapes.inc"
#include "metals.inc"
#include "glass.inc"
#include "woods.inc"

global_settings {max_trace_level 5}

//########################################
// Replace the original camera with this

// Save the original camera location
#declare viewLoc = <-7, 10, -15>;

// Save the original look_at location
#declare lookAt = <0, 0, 0>;

// Find the actual vector between the camera and the location looked at
#declare lookDir = lookAt - viewLoc;

// Make sure that up is the same for the camera and for the calculations
#declare vrt = y;

// Use cross product to fins a vector perpindicular to both up and the
// viewing direction and normalize it.
#declare eyeDir = vnormalize(vcross(lookDir, vrt));

// Find the distance between the camera and the location looked at
#declare lookDist = vlength(lookDir);

// Scale the eye seperation for good viewing. The value 20 seems to work
// well, but can be changed
#declare eyeSep = lookDist / 20;

// Find the positions of the eyes
#declare leftEye = viewLoc + (eyeSep / 2.0) * eyeDir;           // One of 
these will
#declare rightEye = viewLoc - (eyeSep / 2.0) * eyeDir;          //   be 
unused

// Now, use the above info
camera {
// location leftEye             // Use this one in the left eye file
   location rightEye
   direction <0, 0,  2.25>
   up vrt
   right x * 0.8
   look_at lookAt
}

//########################################

// Uncomment the area lights only if you've got lots of time.
#declare Dist=80.0;
light_source {< -50, 25, -50> color White
     fade_distance Dist fade_power 2
//   area_light <-40, 0, -40>, <40, 0, 40>, 3, 3
//   adaptive 1
//   jitter
}
light_source {< 50, 10,  -4> color Gray30
     fade_distance Dist fade_power 2
//   area_light <-20, 0, -20>, <20, 0, 20>, 3, 3
//   adaptive 1
//   jitter
}
light_source {< 0, 100,  0> color Gray30
     fade_distance Dist fade_power 2
//   area_light <-30, 0, -30>, <30, 0, 30>, 3, 3
//   adaptive 1
//   jitter
}

sky_sphere {
    pigment {
        gradient y
        color_map {
            [0, 1  color Gray50 color Gray80]
        }
    }
}

#declare M_Wood18B =
colour_map {
    [0.00 0.25   color rgbf < 0.50, 0.26, 0.12, 0.10>
                 color rgbf < 0.54, 0.29, 0.13, 0.20>]
    [0.25 0.40   color rgbf < 0.54, 0.29, 0.13, 0.20>
                 color rgbf < 0.55, 0.28, 0.10, 0.70>]
    [0.40 0.50   color rgbf < 0.55, 0.28, 0.10, 0.70>
                 color rgbf < 0.50, 0.23, 0.15, 0.95>]
    [0.50 0.70   color rgbf < 0.50, 0.23, 0.15, 0.95>
                 color rgbf < 0.56, 0.29, 0.17, 0.70>]
    [0.70 0.98   color rgbf < 0.56, 0.29, 0.17, 0.70>
                 color rgbf < 0.54, 0.29, 0.13, 0.20>]
    [0.98 1.00   color rgbf < 0.54, 0.29, 0.13, 0.20>
                 color rgbf < 0.50, 0.26, 0.12, 0.10>]
}


#declare Floor_Texture =
    texture { pigment { P_WoodGrain18A color_map { M_Wood18A }}}
    texture { pigment { P_WoodGrain12A color_map { M_Wood18B }}}
    texture {
        pigment { P_WoodGrain12B color_map { M_Wood18B }}
        finish { reflection 0.25 }
    }

#declare Floor =
plane { y,0
    texture { Floor_Texture
        scale 0.5
        rotate y*90
        rotate <10, 0, 15>
        translate z*4
    }
}

#declare T0 = texture { T_Wood19 }

#declare T =
texture { T0
    finish { specular 0.50 roughness 0.1 ambient 0.25 }
}

#declare T1 = texture { T translate  x*10 rotate <0, 87, 0> }
#declare T2 = texture { T translate  y*10 rotate <0,  1, 0> }
#declare T3 = texture { T translate -x*10 rotate  <0, 88, 0> translate 
z*100}

#declare Front_Panel =
box      { <-3.75, 0.00, -0.5>,
           < 3.75, 1.75,  0.0> }

#declare Front_Top_Edge   =
cylinder { <-3.75, 1.75,  0.0>,
           < 3.75, 1.75,  0.0>, 0.5 }

#declare Front_Right_Edge =
cylinder { < 3.75, 0.00,  0.0>,
           < 3.75, 1.75,  0.0>, 0.5 }

#declare Front_Left_Edge  =
cylinder { <-3.75, 0.00,  0.0>,
           <-3.75, 1.75,  0.0>, 0.5 }

#declare Front_UL_Corner  = sphere   { <-3.75, 1.75,  0.0>, 0.5 }
#declare Front_UR_Corner  = sphere   { < 3.75, 1.75,  0.0>, 0.5 }


#declare Left_Panel      = box { <-0.50, 0, -2.75>, <0.50, 1.75, 2.75> }
#declare Left_Top_Edge   = cylinder { <0, 1.75, -2.75>, <0, 1.75, 2.75>, 
0.5 }

#declare Left_End =
intersection {
    union {
        object { Left_Panel       }
        object { Left_Top_Edge    }
    }
    plane { x, 0 }
    texture { T2 }
    bounded_by { box { <-0.501, 0.01, -3.251>, <0.01, 2.251, 3.251> } }
}

#declare Box_Front =
intersection {
    union {
        object { Front_Panel      }
        object { Front_Top_Edge   }
        object { Front_Left_Edge  }
        object { Front_Right_Edge }
        object { Front_UL_Corner  }
        object { Front_UR_Corner  }
    }
    plane { z, 0 }
    texture { T1}
    bounded_by { box { <-4.251, 0.01, -0.51>, <4.251, 2.251,  0.01> }}
}
#declare Box_Bottom = box {<-3.75, 0.0, -2.75> <3.75, 0.25, 2.75> texture 
{T3} }
#declare Box_Lid =    box {<-3.75, 0.0, -2.75> <3.75, 0.25, 2.75>
    translate -2.75*z    // put "hinge" at origin
    rotate x*25          // open the lid
    translate 2.75*z     // move "hinge" back
    translate y*2        // lift to top
    texture {T3}
}
#declare Box =
union {
    object { Box_Front translate -z*2.75}
    object { Box_Front scale <1,1,-1> translate z*2.75}
    object { Left_End translate -x*3.75 }
    object { Left_End scale <-1,1,1> translate x*3.75 }
    object { Box_Lid  }
    object { Box_Bottom }
}
#declare Spheres =
union {

    // Inside of box
    sphere { <1.5, 1.5, -0.75>, 1.25
        texture {
            T_Wood14
            finish { specular 0.35 roughness 0.05 ambient 0.3 }
            translate x*1
            rotate <15, 10, 0>
            translate y*2
        }
    }
    // Inside of box
    sphere { <-1.5, 1.25,  0.5>, 1
        texture { T_Wood18
            finish { specular 0.25 roughness 0.025 ambient 0.35 }
            scale 0.33
            translate x*1
            rotate <10, 20, 30>
            translate y*10
        }
    }
    // Inside of box
    sphere { <-0.75, 1.0, -1.5>, 0.75
        texture { T_Wood10
            finish { specular 0.5 roughness 0.005 ambient 0.35 }
            translate x*1
            rotate <30, 10, 20>
        }
    }

    // Outside of box
    sphere { <-0.75, 0.75, -4.25>, 0.75
        texture { T_Wood4
            finish { specular 0.25 roughness 0.015 ambient 0.2 }
        }
    }
    // Outside of box
    sphere { <-2.25, 0.45, -4.5>, 0.45
        texture { T_Wood20
            finish { specular 0.15 roughness 0.15 ambient 0.3 }
            rotate <45, 10, 45>
            translate x*10
        }
    }

    // Outside of box
    sphere { <-5.5, 0.95, 0.8>, 0.95 texture { T_Glass4 } interior {I_Glass 
caustics 1} }
    // Outside of box
    sphere { <-5.00, 0.75, -2.0>, 0.75 texture { T_Copper_2B} }
    // Outside of box
    sphere { <-1.75, 0.40, -5.4>, 0.40 texture { T_Brass_3B} }
}
union {
    object { Floor }
    object { Box }
    object { Spheres }
    rotate -y*35
}


Post a reply to this message


Attachments:
Download 'woodbox-3D.bmp' (481 KB)

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.