POV-Ray : Newsgroups : povray.general : 3D images : Re: 3D images Server Time
2 Jun 2024 14:25:13 EDT (-0400)
  Re: 3D images  
From: Bill Pragnell
Date: 13 Jan 2016 15:20:01
Message: <web.5696b0b077c0d9bd5d6ac23a0@news.povray.org>
Mike Horvath <mik### [at] gmailcom> wrote:
> Are there tutorials on how set up POV-Ray to make such images? I'm not
> using the look_at keyword in my camera statement. I am using up, right,
> and direction instead. How can I compensate for this?

I'm not sure if I'm replying to the right post, but anyway. If you have MegaPOV,
I wrote a macro to generate a cross-eye pair image in a single parse and render,
using the camera pigment feature. I've listed it below for interest - if you're
after a parallel pair you can just swap the sign of the CamX vectors in the
location statements of each pigment camera. I can't remember exactly but I think
you just set the macro parameters as if for a single view, call the macro
instead of making a camera, then use double the horizontal resolution for the
render size (I don't really run MegaPOV any more these days so I can't check
quickly).

It generates images like these:
http://news.povray.org/povray.binaries.images/thread/%3C4f0b6ac6@news.povray.org%3E/?ttop=374865&toff=50

If this isn't any use to you, never mind, maybe someone else will find it
interesting!

Bill


----------------------------------------
// Stereo pair camera macro
// needs megapov for camera view pigment

#version unofficial megapov 1.21;

#macro StereoPair(CPos, CLook, CAngle, CRight, CUp, BaseLine, Border)
 // camera coord system
 #local CamZ = vnormalize(CLook - CPos);
 #local CamX = vnormalize(vcross(CUp, CamZ));
 #local CamY = vnormalize(vcross(CamZ, CamX));
 // replacement camera
 camera {
  location CPos
  up CUp
  right x*CRight
  angle CAngle
  look_at CLook
 }
 // coordinates for mesh screen
 #local XDist = tan(radians(CAngle/2));
 #local YDist = XDist / CRight;
 #local LeftP1 = CPos + CamZ - XDist*CamX - YDist*CamY;
 #local LeftP2 = CPos + CamZ - YDist*CamY;
 #local LeftP3 = CPos + CamZ + YDist*CamY;
 #local LeftP4 = CPos + CamZ - XDist*CamX + YDist*CamY;
 #local RightP1 = CPos + CamZ - YDist*CamY;
 #local RightP2 = CPos + CamZ + XDist*CamX - YDist*CamY;
 #local RightP3= CPos + CamZ + XDist*CamX + YDist*CamY;
 #local RightP4 = CPos + CamZ + YDist*CamY;
 // mesh screen
 // left
 mesh {
 triangle { LeftP1, LeftP2, LeftP3 uv_vectors <0, 0>, <1, 0>, <1, 1> }
 triangle { LeftP1, LeftP3, LeftP4 uv_vectors <0, 0>, <1, 1>, <0, 1> }
 texture {
  uv_mapping
  pigment {
   camera_view {
    location CPos + CamZ*1.1 + CamX*BaseLine/2
    up CUp
    right x*CRight/2
    angle CAngle/2
    look_at CLook }
  }
  finish { ambient 1 }
 }
 no_shadow
 no_reflection }
 // right
 mesh {
 triangle { RightP1, RightP2, RightP3 uv_vectors <0, 0>, <1, 0>, <1, 1> }
 triangle { RightP1, RightP3, RightP4 uv_vectors <0, 0>, <1, 1>, <0, 1> }
 texture {
  uv_mapping
  pigment {
   camera_view {
    location CPos + CamZ*1.1 - CamX*BaseLine/2
    up CUp
    right x*CRight/2
    angle CAngle/2
    look_at CLook }
  }
  finish { ambient 1 }
 }
 no_shadow
 no_reflection }
 #local R = Border * vlength(RightP2 - LeftP1);
 union {
  cylinder { LeftP1, RightP2, R }
  cylinder { RightP2, RightP3, R }
  cylinder { RightP3, LeftP4, R }
  cylinder { LeftP4, LeftP1, R }
  cylinder { LeftP2, LeftP3, R/2 }
  pigment { rgb 0 }
  finish { ambient 0 diffuse 0 }
  no_shadow
  no_reflection
 }
#end


Post a reply to this message

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