POV-Ray : Newsgroups : povray.newusers : sphere proportions : Re: sphere proportions Server Time
17 Jun 2021 13:38:29 EDT (-0400)
  Re: sphere proportions  
From: Bald Eagle
Date: 1 Jun 2021 16:55:00
Message: <web.60b69e55dfb9240b1f9dae3025979125@news.povray.org>
"Psnarf" <nomail@nomail> wrote:
> The code for demo.pov:
>
> #include "colors.inc"    // The include files contain
> #include "stones.inc"    // pre-defined scene elements
>
> camera {
>     location <0, 2, -3>
>     look_at  <0, 1,  2>
> }
>
> sphere {
>     <0, 1, 2>, 2
>     texture {
>         pigment { color Yellow }
>     }
> }
>
> light_source { <2, 4, -3> color White}
>
> -=-=-=-=-=-=-=-=-
> Why does the radius of the sphere change if the render window is not 1:1.333?
> A ratio of 1:1.777 (16/9) produces the attached image.

I don't think it's the "render window", but rather the camera configuration
which is the controlling factor.  In the same way that you can scale the sphere,
you can scale the camera.  Depending on the aspect ratio of the image, you're
going to need to compensate for that in some way - the easiest being the camera.

If you look at the diagram of the camera, you get a "viewport" with "uv
coordinates" of the image going from -0.5 to 0.5 both vertically and
horizontally, or one unit in each orthogonal direction.  If those are not
equally subdivided into the same number of pixels per unit, then when you try to
draw a circle, you get an ellipse.   When you try to draw a square, you get a
rectangle.  So when the image aspect tries to "pull" in one direction, you
"squash" it the same relative amount in the other so that it all balances out.

Believe, me, we've covered this very topic from a variety of angles, and if
you're intensely interested, I can point you to a number of threads, and you can
try to do some experiments of your own to demonstrate to yourself how it all
works.

http://news.povray.org/povray.binaries.images/thread/%3Cweb.5bb3646e813dde7ac437ac910%40news.povray.org%3E/

http://news.povray.org/povray.binaries.images/thread/%3Cweb.587ce3fc782d1af2c437ac910%40news.povray.org%3E/?ttop=418740
&toff=50&mtop=415328


While not "POV-Ray", I personally find it instructive to learn how people code
pixel shaders from scratch, which gives me a lot of easily-accessible insight
into how things like cameras, light, shadows, transform matrices, pattern
functions, mathematical object primitives, and CSG operations work "under the
hood".

https://www.youtube.com/watch?v=dKA5ZVALOhs
https://www.youtube.com/watch?v=PBxuVlp7nuM

https://iquilezles.org/www/articles/frustum/frustum.htm


Post a reply to this message

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