POV-Ray : Newsgroups : povray.newusers : window to viewport transformation : Re: window to viewport transformation Server Time
2 Jul 2024 11:22:14 EDT (-0400)
  Re: window to viewport transformation  
From: Alain
Date: 28 Jul 2013 16:51:43
Message: <51f5845f$1@news.povray.org>

>
> Interesting.
> Is there a way to say, determine the coordinates of the corners of the view?
> I realize this would be dependent upon the distance...
>
> I'm thinking:
> draw a line from the camera to the look_at point C=<1,1,-1> and L_A=<0,0,0>
> draw a plane perpendicular to that vector   plane {C-L_A, 0}
>
> .... then there must be a way to draw line extending from the camera to the
> corners, but I'm not familiar enough with the workings of the camera(s) to see
> how to do that.
> I guess this has something to do with direction and/or angle
>
> I've seen that you can actually texture the _camera_?!
> That would be useful to do with a grid - faster rendering than with a plane?
> Can the camera be textured with a "frosted" effect to simulate an old
> ground-glass view-camera?
>
>
>

You can't add a "texture" to the camera, you can add some normal 
perturbations that will distort the image rendered.

The line from the camera to a corner can be found as a line going from 
the camera's location to the corner.
The plane containing that corner can be assumed to pass by the look_at 
point, but it's not required, just easier.
The exact location of that point can be found using simple trigonometry.
The lateral location can be found using the tangent of the angle 
(converted to radians) time the distance between the location and 
look_at. Next, you adjust that value if the camera is not located on an 
axis. Still more trigonometry.

For the vertical part, just multiply the lateral position with the 
aspect ratio of your image.

If you use an orthographic camera located on the z axis with a field of 
view defined using up and right, it's even simpler:
Add the up and right to the point_at location to get the top right 
corner location.

Rendering a plane with a simple gird texture is about as fast as you can 
go. To go faster, you'd probably need to use a simple background colour.



Alain


Post a reply to this message

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