POV-Ray : Newsgroups : povray.binaries.images : Raytracing 1A Server Time
13 Nov 2024 06:27:37 EST (-0500)
  Raytracing 1A (Message 1 to 3 of 3)  
From: Stephen Klebs
Subject: Raytracing 1A
Date: 3 Dec 2010 15:40:01
Message: <web.4cf953668711d815fc413f510@news.povray.org>
I'm not sure how to interpret this:
The first two images are renders of a cylinder in 3.6 (left)
and in 3.7 (right) using default settings and the following scene:

//+W1600 +H1600

light_source {-100*x color rgb 1 parallel}

#local w = 2;
camera {
  orthographic
  location -z*1E3
  look_at y
  right w*x
  up w*y*image_height/image_width
}

cylinder {
 0, w*y, w/2
 pigment {color rgb 1}
}

The bottom row of images are height fields corresponding to the above two
images. Irrespective of the overall brightness (full shading in 3.7,
for example, is not totally black), one can see clearly that there is a
difference in the relative distribution of tones: 3.6 is a straight linear
gradient, 3.7 seems to be a partial parabolic curve.
I haven't done the math but this seems a straight-forward question for
anyone who knows more about the geometry of raytracing:
Is the reflection off a cylindrical surface, with parallel lights,
distributed along a straight line or a curve? If a curve, 3.7 seems more
accurate, though still not sure why full shadow isn't black.


Post a reply to this message


Attachments:
Download 'cylinder_3-6_3-7.png' (74 KB)

Preview of image 'cylinder_3-6_3-7.png'
cylinder_3-6_3-7.png


 

From: clipka
Subject: Re: Raytracing 1A
Date: 3 Dec 2010 17:09:10
Message: <4cf96a86$1@news.povray.org>
Am 03.12.2010 21:35, schrieb Stephen Klebs:
> I'm not sure how to interpret this:
> The first two images are renders of a cylinder in 3.6 (left)
> and in 3.7 (right) using default settings and the following scene:
>
> //+W1600 +H1600
>
> light_source {-100*x color rgb 1 parallel}
>
> #local w = 2;
> camera {
>    orthographic
>    location -z*1E3
>    look_at y
>    right w*x
>    up w*y*image_height/image_width
> }
>
> cylinder {
>   0, w*y, w/2
>   pigment {color rgb 1}
> }
>
> The bottom row of images are height fields corresponding to the above two
> images. Irrespective of the overall brightness (full shading in 3.7,
> for example, is not totally black), one can see clearly that there is a
> difference in the relative distribution of tones: 3.6 is a straight linear
> gradient, 3.7 seems to be a partial parabolic curve.
> I haven't done the math but this seems a straight-forward question for
> anyone who knows more about the geometry of raytracing:
> Is the reflection off a cylindrical surface, with parallel lights,
> distributed along a straight line or a curve? If a curve, 3.7 seems more
> accurate, though still not sure why full shadow isn't black.

Diffuse reflection off a surface is a difficult thing, so raytracing 
software typically uses an idealized diffuse reflection model called 
"lambertian reflectance". In this model, the intensity of reflected 
light is directly proportional to the cosine between the incident light 
ray and the surface normal or, in other terms, the dot product between 
the normalized normal vector and normalized light-direction vector.

A cylindrical surface around the y axis follows the formula

     z = sqrt(r^2 - x^2)

and the normal at any given x coordinate is equal to

     N(x) = <x/r,0,z/r>
          = <x/r,0,sqrt(1-(x/r)^2)>

Thus the corresponding light intensity is proportional to

     I(x) ~= V       . N(x)
          ~= <1,0,0> . <x/r,0,sqrt(1-(x/r)^2)>
          ~= x/r
          ~= x

So the first observation is that we /should/ indeed see a (physically) 
linear gradient.

However, the question remains what the height fields /really/ shows us. 
Presuming that the height field images were both produced with POV-Ray 
3.7, the values used as height field data will actually be the raw 
values from the file - which are usually pre-corrected for a display 
gamma of 2.2 (even in PNG files they are typically gamma-encoded). 
(POV-Ray 3.6 follows the same rules for most file types; PNG may be a 
different story though, I'm not sure there.) So what the left height 
field actually shows is that

     I(x)^(1/2.2) ~= x
     I(x)         ~= x^2.2

which is /wrong/.


As for the shadowed side not being absolutely black, this is simply due 
to the default ambient value being non-zero. Try setting ambient_light 
to 0, or explicitly specifying ambient 0 in your texture.


Post a reply to this message

From: Stephen Klebs
Subject: Re: Raytracing 1A
Date: 3 Dec 2010 18:35:01
Message: <web.4cf97e74fa75f7eafc413f510@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
>
> So the first observation is that we /should/ indeed see a (physically)
> linear gradient.
>
 So what the left height
> field actually shows is that
>
>      I(x)^(1/2.2) ~= x
>      I(x)         ~= x^2.2
>
> which is /wrong/.
>
>
> As for the shadowed side not being absolutely black, this is simply due
> to the default ambient value being non-zero. Try setting ambient_light
> to 0, or explicitly specifying ambient 0 in your texture.

Here is an amended version of the same test according to your suggestions.
Both height fields were created in 3.7. Ambient light in all cases was set to 0.

What I notice, however, in this new rendering is that the border between light
and shadow appears even more unnaturally abrupt. Your expertise in these
matters in absolutley astonishing (was all that off the top of your head?)
but maybe even you would admit that this picture, if someone did not know
what it was of, does not look like a cylinder, as the hf attests.
To my eye it almost looks like a band of white next to band of black.

I'm not really disputing but skeptical and trying to understand.
I've run into a related problem with this mysterious parabola before, where I
least expected to find it -- with so-called "linear perspective" where
it turns out, if you plot a graph of size to distance, you don't get
the famous Brunelleschi vanishing lines but a parabola instead. Which if you
think of a plane cutting through a cone makes sense.


Post a reply to this message


Attachments:
Download 'cylinder_3-6_3-7(2).png' (89 KB)

Preview of image 'cylinder_3-6_3-7(2).png'
cylinder_3-6_3-7(2).png


 

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