POV-Ray : Newsgroups : povray.newusers : sphere proportions Server Time
24 Sep 2022 16:30:28 EDT (-0400)
  sphere proportions (Message 5 to 14 of 24)  
<<< Previous 4 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: jr
Subject: Re: sphere proportions
Date: 31 May 2021 14:00:00
Message: <web.60b5236ddfb9240b79819d986cde94f1@news.povray.org>
hi,

"Psnarf" <nomail@nomail> wrote:
> "jr" <cre### [at] gmailcom> wrote:
> ....
> Thank you, jr. I am a noob, running the demo.pov from the tutorial. I haven't
> come to the camera, yet. As the poet Frost might say, I have miles to go before
> I can create anything worthy of the top-100.

you're welcome.  hope you will find "povving" a pleasant hobby.  re camera,
personally I like to use an aspect ratio (eg "right * (16/9)"), because it's
readable.


regards, jr.


Post a reply to this message

From: jr
Subject: Re: sphere proportions
Date: 31 May 2021 14:05:00
Message: <web.60b524bcdfb9240b79819d986cde94f1@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:
> ...> personally I like to use an aspect ratio (eg "right * (16/9)"), because

sheesh..  should read "right x * (16/9)".  sorry.


regards, jr.


Post a reply to this message

From: Bald Eagle
Subject: Re: sphere proportions
Date: 31 May 2021 14:25:00
Message: <web.60b52929dfb9240b1f9dae3025979125@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:
> "jr" <cre### [at] gmailcom> wrote:
> > ...> personally I like to use an aspect ratio (eg "right * (16/9)"), because
>
> sheesh..  should read "right x * (16/9)".  sorry.


Yes,  and a lot of us are lazy and very naughty and use:

right x*image_width/image_height

https://wiki.povray.org/content/Knowledgebase:Language_Questions_and_Tips#Topic_19


It's worth pointing out at this early stage that "x" is a reserved keyword,
shorthand for the cardinal x basis vector, <1, 0, 0>.

So after multiplying, you get: <image_width/image_height, 0, 0>

Maybe this will help explain better, or help to further confuse you...  :D

http://news.povray.org/povray.binaries.images/thread/%3Cweb.5d881ea3763463c54eec112d0%40news.povray.org%3E/?ttop=430067
&toff=50


Post a reply to this message

From: Psnarf
Subject: Re: sphere proportions
Date: 1 Jun 2021 13:35:00
Message: <web.60b66e93dfb9240b8b87fe773aaaf4dc@news.povray.org>
> x*image_width/image_height = <image_width/image_height, 0, 0>
> "x" is a reserved keyword, shorthand for the cardinal x basis vector, <1, 0, 0>.

That seems intuitive. Thanks for the tip!

Obquote:
  "Ad hoc, ad hoc,
  And quid pro quo.
  So little time,
  And so much to know." -J. Hillary Boob, Phud.


Post a reply to this message

From: Psnarf
Subject: Re: sphere proportions
Date: 1 Jun 2021 13:40:00
Message: <web.60b6701edfb9240b8b87fe773aaaf4dc@news.povray.org>
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.


Post a reply to this message


Attachments:
Download 'demo.png' (4 KB)

Preview of image 'demo.png'
demo.png


 

From: jr
Subject: Re: sphere proportions
Date: 1 Jun 2021 14:00:00
Message: <web.60b674e9dfb9240b79819d986cde94f1@news.povray.org>
hi,

"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.

when I cut'n'paste the above in a file and render it all defaults (here 4/3, ie
960x720), the sphere's round.  if I insert 'right x * (16/9)' in the camera, and
render with '+w960 +h540', the sphere's round.

if you do not want to modify the camera, you'll have to stick with the (default)
4/3 aspect to see the shape you expect.


regards, jr.


Post a reply to this message

From: Bald Eagle
Subject: Re: sphere proportions
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

From: Psnarf
Subject: Re: sphere proportions
Date: 1 Jun 2021 17:50:00
Message: <web.60b6ab68dfb9240b8b87fe773aaaf4dc@news.povray.org>
I did not know the default aspect ratio was 4/3, or 1.333. I still don't see the
connection between the rendered object in 3d space and the +W +H switches to the
povray command. A ball should look the same no matter the size of the rendered
image. If the aspect ratio of the povray scene is different than the dimensions
of the rendered scene, should not the borders be extended, leaving a 4/3 box in
the center of the final image? I'm looking for a keep-aspect-ratio switch.


Post a reply to this message

From: jr
Subject: Re: sphere proportions
Date: 1 Jun 2021 18:00:00
Message: <web.60b6ad4fdfb9240b79819d986cde94f1@news.povray.org>
hi,

"Psnarf" <nomail@nomail> wrote:
> ... I still don't see the
> connection between the rendered object in 3d space and the +W +H switches to the
povray command.

the width + height were used to ensure the ratio matches that specified in the
camera; any size will do as long as you have the aspect ratio be the same for
both camera _and_ image.  ;-)


regards, jr.


Post a reply to this message

From: Psnarf
Subject: Re: sphere proportions
Date: 1 Jun 2021 18:25:00
Message: <web.60b6b315dfb9240b8b87fe773aaaf4dc@news.povray.org>
Hunted down section 1.4.2.4 in the manual.
camera
{ right x*ImageWidth/ImageHeight
  (other camera settings...)
}


Post a reply to this message

<<< Previous 4 Messages Goto Latest 10 Messages Next 10 Messages >>>

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