POV-Ray : Newsgroups : povray.binaries.images : Raytracing 1A : Re: Raytracing 1A Server Time
30 Jul 2024 22:28:13 EDT (-0400)
  Re: Raytracing 1A  
From: clipka
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

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