POV-Ray : Newsgroups : povray.general : image based normal maps? : Re: image based normal maps? Server Time
2 May 2024 04:54:02 EDT (-0400)
  Re: image based normal maps?  
From: Alain
Date: 22 Jan 2019 11:47:30
Message: <5c474922$1@news.povray.org>
Le 19-01-22 à 05:19, Kenneth a écrit :
> ingo <ing### [at] tagpovrayorg> wrote:
>>
>> ...it appears that .hf = (Red + Green/255)*0.996093 not the same as .gray
>> as I thought.
>>
>> http://wiki.povray.org/content/Documentation:Tutorial_Section_3.2
>> #Noise_and_pigment_functions
>> The only appearence of .hf I could find,
> 
> Thomas wrote:
> 
>>   .hf is typically used in height_field functions like, e.g.:
>>   height_field {function HF_res, HF_res {F_HF_01(x,y,z).hf}}
> 
> I knew I had seen  .hf  *somewhere* but didn't know where to look. Thanks, Ingo.
> 
> But it comes as a fascinating surprise (to me) that .gray and .hf use different
> color-to-grayscale formulas...
> 
>     .gray to get the gray value of the color vector:
>      gray value = Red*29.7% + Green*58.9% + Blue*11.4%
> 
>     .hf to get the height_field value of the color vector:
>      hf value = (Red + Green/255)*0.996093
> 
> I don't think I've ever actually used  .hf (in either a height_field OR a
> function)-- but I'm mostly curious as to why they are different. And/or the
> historical significance of the .hf formula. AFAIU, the .gray formula is the de
> facto standard in POV-Ray for internal color conversions; but is there something
> 'special' about height_field/FUNCTION use that requires a different formula?
> 
> 
> 
> 
> 

.hf use the red as the upper, or most significative, 8 bits and green as 
the lower, or least significative, 8 bits of a 16 bits value to be used 
as a height field. The *0.996093 is there as a fudge value to prevent 
clipping at the higher end of the range. The blue channel is ignored.

.grey use a ponderated average to get a grey equivalent of the colour.

Different intent and use, different ways to get the end value.


Post a reply to this message

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