POV-Ray : Newsgroups : povray.general : Camera Conundrum : Re: Camera Conundrum Server Time
10 Aug 2024 01:18:10 EDT (-0400)
  Re: Camera Conundrum  
From: Josh English
Date: 27 Mar 2000 15:05:14
Message: <38DFBF2A.5F3978C8@spiritone.com>
It sounds like you are trying to place a background image in POV-Ray, which
cannot be done natively.
Here is some code and explanations (from a post on January 7th)
#local CamLook = <0,0,3>; // Camera's Look_at
#local CamLoc = <0,0.5,-6>; //where the camera's location is
#local cam_z = 2; //the amount of camera zoom you want
#local back_dist = 100; // how far away the background is
#local cam_a = 4/3; // camera aspect ratio
#local cam_s = <0,1,0>; // camera sky vectoy
#local cam_d = vnormalize(CamLook-CamLoc);
#local cam_r = vnormalize(vcross(cam_s,cam_d));
#local cam_u = vnormalize(vcross(cam_d,cam_r)); // camera up vector
#local cam_dir = cam_d * cam_z;
#local cam_right = cam_r * cam_a;

#declare fz = vlength(cam_dir);
#declare fx = vlength(cam_right)/2;
#declare fy = vlength(cam_u)/2;

camera {
  location CamLoc
  up cam_u
  right cam_r * cam_a
  direction (cam_d * cam_z)
}

box { <0,0,0> <1,1,0.1>
      pigment { image_map { png "background.png"
                                             map_type 0
                                             interpolate 2 } }
      translate <-0.5,-0.5,0>
      scale 2*<fx,fy,0.5>
      translate fz*z
      scale back_dist
      #local nz = vnormalize(CamLook-CamLoc);
      #local nx = vnormalize(vcross(cam_s,nz));
      #local ny = vcross(nz,nx);
      matrix <nx.x,nx.y,nx.z,
               ny.x,ny.y,ny.z,
              nz.x,nz.y,nz.z,
              CamLoc.x,CamLoc.y,CamLoc.z> }

This assumes a normal perspective camera. Remember that all the rays that are
traced are from one point, so the edges of the viewable area make a four sided
pyramid in space, so there are an infinite number of boxes that would work.

Josh



Charles Krause wrote:

> Here's something I'd like to do with a camera, and I havn't got a clue how.
>
> What I'd like to do is to set the camera, and the image so that the bounding
> box of an object fills the field of view completely. This if the object
> _was_ a box, the side of the box would fill the image, the WHOLE side of the
> box would show, and NOTHING else would show.
>
> any ideas?

--
Josh English
eng### [at] spiritonecom
"May your hopes, dreams, and plans not be destroyed by a few zeros."


Post a reply to this message

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