POV-Ray : Newsgroups : povray.newusers : Displacing camera in 2D? : Displacing camera in 2D? Server Time
28 Jul 2024 20:22:36 EDT (-0400)
  Displacing camera in 2D?  
From: remigagne
Date: 17 Sep 2007 14:35:00
Message: <web.46eec6f4d509387a899005320@news.povray.org>
Hi all,

I have a scene that renders correctly at 1000 x 1000 with this true
orthographic camera:

camera { orthographic
 location <-28, -14.5, -28> * 1000
 right    1000 * x
 up       1000 * y
 look_at  <0, 0, 0> }

I'm now trying to create new 100 x 100 sub-portions of this scene.  For
example, if I render at 100 x 100 using this camera:

camera { orthographic
 location <-28, -14.5, -28> * 1000
 right    100 * x
 up       100 * y
 look_at  <0, 0, 0> }

I get a 100 x 100 image that's *identical* to the (450, 450) to (550, 550)
center of the original 1000 x 1000 image, which is perfect.  But how can I
generalize this to render any portion of the scene?  For example, how can I
generate a 100 x 100 image centered on the (30, 400) portion of the
original?

I think I can translate the camera and look_at point, doing something like:

camera { orthographic
 #declare dx = ?;
 #declare dy = ?;
 #declare dz = ?;
 location (<-28, -14.5, -28> * 1000) + <dx, dy, dz>
 right    100 * x
 up       100 * y
 look_at  <dx, dy, dz> }

I just can't wrap my head around the math required to calculate dx, dy & dz,
given a center pixel location of (30, 400).  Any advice?

A little more background: the scene is in a predefined pov file with no
camera.  I'm generating new pov files programmatically; these simply
include the original scene and a dynamically calculated camera (based on
user input).

Thanks in advance!


Remi


Post a reply to this message

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