|
![](/i/fill.gif) |
Le 17.09.2007 20:32, remigagne nous fit lire :
> 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?
>
Notice that direction here is originally as +z.
Therefore, dz = 0.
And you should simplify your orthographic camera by remplacing the
look_at with direction.
If dx=dy=0 give you a center at (500,500) of the big one, the new
camera will be centered on 500+dx,500+dy.
So, if you want the center at (XX,YY), dx = XX-500 and dy = YY-500.
(30,400) -->>>> dx = -470, dy = -100.
--
The superior man understands what is right;
the inferior man understands what will sell.
-- Confucius
Post a reply to this message
|
![](/i/fill.gif) |