POV-Ray : Newsgroups : povray.documentation.inbuilt : Errors in light attenuation and height field documentation Server Time
28 Mar 2024 11:37:48 EDT (-0400)
  Errors in light attenuation and height field documentation (Message 1 to 8 of 8)  
From: Cousin Ricky
Subject: Errors in light attenuation and height field documentation
Date: 24 Mar 2013 02:05:01
Message: <web.514e96c832b818e778641e0c0@news.povray.org>
I have found a couple of errors in the 3.7 documentation.

At http://wiki.povray.org/content/Reference:Light_Source#Light_Fading in the
wiki and in section 3.4.4.1.9 of the 3.7 off-line documentation, an example
function is given to determine the brightness of a light source:

  #declare Intensity_Factor = function (LD,FD,FP) {pow(1+(LD/FD),FP)/2};

This should be:

  #declare Intensity_Factor = function (LD,FD,FP) {(1+pow(LD/FD,FP))/2};


At http://wiki.povray.org/content/Reference:Height_Field in the wiki and in
section 3.4.5.1.5 of the 3.7 off-line documentation, the syntax statement for a
height field function reads:

  HF_FUNCTION:
    function FieldResolution_X, FieldResolution_Y ( UserDefined_Function )

The parentheses should be curly braces:

  HF_FUNCTION:
    function FieldResolution_X, FieldResolution_Y { UserDefined_Function }

In addition, the documentation does not explain height field functions.  I'm
having to figure out how it works by experimentation.

The 3.6 documentation doesn't even describe the syntax of a height field
function.


Post a reply to this message

From: James Holsenback
Subject: Re: Errors in light attenuation and height field documentation
Date: 24 Mar 2013 10:25:49
Message: <514f0ced$1@news.povray.org>
On 03/24/2013 02:01 AM, Cousin Ricky wrote:
> I have found a couple of errors in the 3.7 documentation.
>
> At http://wiki.povray.org/content/Reference:Light_Source#Light_Fading in the
> wiki and in section 3.4.4.1.9 of the 3.7 off-line documentation, an example
> function is given to determine the brightness of a light source:
>
>    #declare Intensity_Factor = function (LD,FD,FP) {pow(1+(LD/FD),FP)/2};
>
> This should be:
>
>    #declare Intensity_Factor = function (LD,FD,FP) {(1+pow(LD/FD,FP))/2};

Indeed I added (well ... plagiarized) it from a NG discussion, that I 
couldn't find to check if a mistake was made. I did however find and 
check my own personal notes from when was putting the entry together and 
it appears that I at least got it right. I couldn't comment of the 
correctness of the math. Care to elaborate? Oh ... IIRC Trevor Quayle 
was the author.

> At http://wiki.povray.org/content/Reference:Height_Field in the wiki and in
> section 3.4.5.1.5 of the 3.7 off-line documentation, the syntax statement for a
> height field function reads:
>
>    HF_FUNCTION:
>      function FieldResolution_X, FieldResolution_Y ( UserDefined_Function )
>
> The parentheses should be curly braces:
>
>    HF_FUNCTION:
>      function FieldResolution_X, FieldResolution_Y { UserDefined_Function }

Hmmm ... OK good find, but for some reason your correction looked 
incomplete. RE: from the declarations above shouldn't it be:

HF_FUNCTION:
   function (FieldResolution_X, FieldResolution_Y) { UserDefined_Function }

>
> In addition, the documentation does not explain height field functions.  I'm
> having to figure out how it works by experimentation.
>
> The 3.6 documentation doesn't even describe the syntax of a height field
> function.

Maybe adding a link to http://wiki.povray.org/content/Reference:Function 
or one of it's sub-sections might do the trick ... maybe you have 
another section in mind.


Post a reply to this message

From: James Holsenback
Subject: Re: Errors in light attenuation and height field documentation
Date: 24 Mar 2013 10:46:09
Message: <514f11b1$1@news.povray.org>
On 03/24/2013 10:25 AM, James Holsenback wrote:
> On 03/24/2013 02:01 AM, Cousin Ricky wrote:
>> I have found a couple of errors in the 3.7 documentation.
>>
>> At http://wiki.povray.org/content/Reference:Light_Source#Light_Fading
>> in the
>> wiki and in section 3.4.4.1.9 of the 3.7 off-line documentation, an
>> example
>> function is given to determine the brightness of a light source:
>>
>>    #declare Intensity_Factor = function (LD,FD,FP) {pow(1+(LD/FD),FP)/2};
>>
>> This should be:
>>
>>    #declare Intensity_Factor = function (LD,FD,FP) {(1+pow(LD/FD,FP))/2};
>
> Indeed I added (well ... plagiarized) it from a NG discussion, that I
> couldn't find to check if a mistake was made. I did however find and
> check my own personal notes from when was putting the entry together and
> it appears that I at least got it right. I couldn't comment of the
> correctness of the math. Care to elaborate? Oh ... IIRC Trevor Quayle
> was the author.
>
>> At http://wiki.povray.org/content/Reference:Height_Field in the wiki
>> and in
>> section 3.4.5.1.5 of the 3.7 off-line documentation, the syntax
>> statement for a
>> height field function reads:
>>
>>    HF_FUNCTION:
>>      function FieldResolution_X, FieldResolution_Y (
>> UserDefined_Function )
>>
>> The parentheses should be curly braces:
>>
>>    HF_FUNCTION:
>>      function FieldResolution_X, FieldResolution_Y {
>> UserDefined_Function }
>
> Hmmm ... OK good find, but for some reason your correction looked
> incomplete. RE: from the declarations above shouldn't it be:
>
> HF_FUNCTION:
>    function (FieldResolution_X, FieldResolution_Y) { UserDefined_Function }

LOL ... after further review I /think/ I got that wrong. One's a 
declaration, the other (doc example) is a call


Post a reply to this message

From: Cousin Ricky
Subject: Re: Errors in light attenuation and height field documentation
Date: 24 Mar 2013 11:15:00
Message: <web.514f16dbe64ae1b678641e0c0@news.povray.org>
James Holsenback <nom### [at] nonecom> wrote:
> On 03/24/2013 02:01 AM, Cousin Ricky wrote:
> > At http://wiki.povray.org/content/Reference:Light_Source#Light_Fading in the
> > wiki and in section 3.4.4.1.9 of the 3.7 off-line documentation, an example
> > function is given to determine the brightness of a light source:
> >
> >    #declare Intensity_Factor = function (LD,FD,FP) {pow(1+(LD/FD),FP)/2};
> >
> > This should be:
> >
> >    #declare Intensity_Factor = function (LD,FD,FP) {(1+pow(LD/FD,FP))/2};
>
> Indeed I added (well ... plagiarized) it from a NG discussion, that I
> couldn't find to check if a mistake was made. I did however find and
> check my own personal notes from when was putting the entry together and
> it appears that I at least got it right. I couldn't comment of the
> correctness of the math. Care to elaborate?

I asked myself, how bright would the light source need to be in order to
illuminate an object to a certain level at a given distance.  What I came up
with turns out to be the reciprocal of the attenuation formula.  If you or
Trever thinks it should be otherwise, I'd like to see the derivation.

> Hmmm ... OK good find, but for some reason your correction looked
> incomplete. RE: from the declarations above shouldn't it be:
>
> HF_FUNCTION:
>    function (FieldResolution_X, FieldResolution_Y) { UserDefined_Function }

The parentheses are neither necessary nor permitted.  The following scene file
runs without parse errors:
______________________________________________________________

#version 3.7;
global_settings { assumed_gamma 1 }
camera { location <0, 5, -10> look_at 0 }
light_source { <-1, 1, -1> * 1000, rgb 1 parallel point_at 0 }

#declare fn_Hills = function
{ pigment { bumps warp { turbulence 0.5 } scale 0.12 }
}

height_field
{ function 500, 500 { fn_Hills (x, y, z).red }
  smooth
  translate -<0.5, 0, 0.5>
  scale <10, 1, 10>
  pigment { green 0.5 }
}
______________________________________________________________

> > In addition, the documentation does not explain height field functions.  I'm
> > having to figure out how it works by experimentation.
> >
> > The 3.6 documentation doesn't even describe the syntax of a height field
> > function.
>
> Maybe adding a link to http://wiki.povray.org/content/Reference:Function
> or one of it's sub-sections might do the trick ... maybe you have
> another section in mind.

No, this needs to be addressed in-place, as the syntax and semantics of the
construction are unique to the height field context.


Post a reply to this message

From: James Holsenback
Subject: Re: Errors in light attenuation and height field documentation
Date: 24 Mar 2013 12:32:02
Message: <514f2a82$1@news.povray.org>
On 03/24/2013 11:08 AM, Cousin Ricky wrote:
>> HF_FUNCTION:
>>     function (FieldResolution_X, FieldResolution_Y) { UserDefined_Function }

> The parentheses are neither necessary nor permitted.

good enough ... done

> No, this needs to be addressed in-place, as the syntax and semantics of the
> construction are unique to the height field context.

since you're actively exploring that topic would you care to make a 
contribution?


Post a reply to this message

From: Cousin Ricky
Subject: Re: Errors in light attenuation and height field documentation
Date: 24 Mar 2013 19:40:01
Message: <web.514f8dd2e64ae1b678641e0c0@news.povray.org>
James Holsenback <nom### [at] nonecom> wrote:
> since you're actively exploring that topic would you care to make a
> contribution?

OK.


Post a reply to this message

From: Kenneth
Subject: Re: Errors in light attenuation and height field documentation
Date: 25 Mar 2013 13:00:00
Message: <web.5150824fe64ae1b6c2d977c20@news.povray.org>
James Holsenback <nom### [at] nonecom> wrote:
> On 03/24/2013 02:01 AM, Cousin Ricky wrote:

> >
> > In addition, the documentation does not explain height field functions.  I'm
> > having to figure out how it works by experimentation.
> >
> > The 3.6 documentation doesn't even describe the syntax of a height field
> > function.
>
> Maybe adding a link to http://wiki.povray.org/content/Reference:Function
> or one of it's sub-sections might do the trick ... maybe you have
> another section in mind.

The only reference I've ever seen in the docs to function use in heightfields is
in "Function Image" (which is section 3.5.11.16 in the v3.62 included
documentation.) Perhaps a link to that section would be helpful. It's kind of
bare-bones, though.

Most of my own knowledge of function HFs has come from sources on the 'net,
outside of POV-Ray. It would be nice to have it more thoroughly explained in the
docs, as it's such a powerful tool.

But there's a long-standing problem in HFs made from functions, that probably
needs a caveat of its own in the documentation: The resulting HF is
'flipped/mirrored' compared to the function; and the function itself is no
longer applied at the standard origin of <0,0,0> but at <0,0,1> (I don't
remember if isosurfaces have this problem or not.) Here are two examples, and
the various ways they can be corrected:

When using a *pre-declared* function...

height_field{
function{
my_function 100,100 (x,-y,z).gray // -Y corrects it
.....
}

When using a function that's constructed within the HF statement itself (like a
pigment or pattern function)...

height_field{
      function 100,100 {pattern{onion frequency 10 triangle_wave}}

      // both of these are needed to correct it...
      scale <1,1,-1> // yes, -Z
      translate 1*z
.....
   }


Post a reply to this message

From: Kenneth
Subject: Re: Errors in light attenuation and height field documentation
Date: 26 Mar 2013 13:55:01
Message: <web.5151e051e64ae1b6c2d977c20@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:

> When using a *pre-declared* function...
>
> height_field{
> function{
> my_function 100,100 (x,-y,z).gray // -Y corrects it
> .....
> }

Oops, that's not the proper syntax for that HF function. It should be...

height_field{
function 100,100 {my_function(x,-y,z).gray}
.......
}

Sorry!


Post a reply to this message

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