POV-Ray : Newsgroups : povray.newusers : window to viewport transformation Server Time
22 Dec 2024 16:38:18 EST (-0500)
  window to viewport transformation (Message 1 to 5 of 5)  
From: Jorrit
Subject: window to viewport transformation
Date: 11 Jul 2011 07:55:01
Message: <web.4e1ae3a8f0209c9a79dc58370@news.povray.org>
Hello all!

For a homework assignment I'm required to recreate a simple scene. It's going
well, but there are some things that I'm unclear about. I'm mostly unsure about
the camera variables and the window/viewport limits.

The assignment specifies the requirements for the camera:

COP = (0,0,10)
VRP = (0,0,2)
VUV = [0,1,0]

I believe this translates into:

camera {
    location <0, 0, 10> /* Center of Projection */
    look_at <0, 0, 2> /* View Reference Point */
    up <0, 1, 0> /* View-up Vector */
}

Can anyone confirm that?

Furthermore the assignment has the following parameters for the window limits
and the window-to-viewport transformation:

window limits:
x_wmin = -2, x_wmax = 2, y_wmin = -2, y_wmax = 2

viewport limits:
x_vmin = 400, x_vmax = 800, y_vmin = 200, y_vmax = 600

I'm at a loss here how to specify these variables. Can anyone give me some
pointers on how to define these?

Thanks in advance!

Jorrit


Post a reply to this message

From: Alain
Subject: Re: window to viewport transformation
Date: 11 Jul 2011 15:16:45
Message: <4e1b4c1d@news.povray.org>

> Hello all!
>
> For a homework assignment I'm required to recreate a simple scene. It's going
> well, but there are some things that I'm unclear about. I'm mostly unsure about
> the camera variables and the window/viewport limits.
>
> The assignment specifies the requirements for the camera:
>
> COP = (0,0,10)
> VRP = (0,0,2)
> VUV = [0,1,0]
>
> I believe this translates into:
>
> camera {
>      location<0, 0, 10>  /* Center of Projection */
>      look_at<0, 0, 2>  /* View Reference Point */
>      up<0, 1, 0>  /* View-up Vector */
> }

This looks correct.

>
> Can anyone confirm that?
>
> Furthermore the assignment has the following parameters for the window limits
> and the window-to-viewport transformation:
>
> window limits:
> x_wmin = -2, x_wmax = 2, y_wmin = -2, y_wmax = 2

This looks like it may be the extent of the vewable area at the look_at 
point. It hints at a 1:1 aspect ratio, or a square image.

>
> viewport limits:
> x_vmin = 400, x_vmax = 800, y_vmin = 200, y_vmax = 600

Also a square image or 1:1 aspect ratio.

Set: right <1,0,0>// Same lenght as up.

>
> I'm at a loss here how to specify these variables. Can anyone give me some
> pointers on how to define these?
>
> Thanks in advance!
>
> Jorrit
>
>
>

POV-Ray don't have settings for window limits and vieport limits.

You use direction OR angle (not both) to set the angle of view. It's the 
angle between the center of the image and the side.

right and up set the aspect ratio.

You can translate the camera.
You can rotate the camera.

The best I can tell: Recreate the scene as well as possible. Once it's 
done, alter the orientation of the camera and the angle to match the 
original scene.


Alain


Post a reply to this message

From: Jorrit
Subject: Re: window to viewport transformation
Date: 22 Aug 2011 10:15:00
Message: <web.4e5263c3d7fe654279dc58370@news.povray.org>
Alain <aze### [at] qwertyorg> wrote:
> POV-Ray don't have settings for window limits and vieport limits.
>
> You use direction OR angle (not both) to set the angle of view. It's the
> angle between the center of the image and the side.
>
> right and up set the aspect ratio.
>
> You can translate the camera.
> You can rotate the camera.
>
> The best I can tell: Recreate the scene as well as possible. Once it's
> done, alter the orientation of the camera and the angle to match the
> original scene.
>
>
> Alain

Alain,

A bit late, but thanks for your help! I think I got it figured out.

Jorrit


Post a reply to this message

From: Bald Eagle
Subject: Re: window to viewport transformation
Date: 28 Jul 2013 14:15:01
Message: <web.51f55f08d7fe654273fc9ebb0@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?


Post a reply to this message

From: Alain
Subject: Re: window to viewport transformation
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.