POV-Ray : Newsgroups : povray.binaries.scene-files : Dakota Red Granite macro - beta #1 : Re: Dakota Red Granite macro - beta #1.1 Server Time
25 Jul 2021 11:19:34 EDT (-0400)
  Re: Dakota Red Granite macro - beta #1.1  
From: Thomas de Groot
Date: 17 May 2021 08:49:34
Message: <60a2665e$1@news.povray.org>
Op 17-5-2021 om 00:00 schreef Bald Eagle:
> For your consideration:
> 
> #macro Convert (Csc, SatBoost, BrightBoost, Color)
>   #switch (Csc)
>   #case (1)
>    #local MyColour   = srgb Color;
>   #break
>   #case (2)
>    #local sRGB_Gamma = function(C) {select(C-0.0031308, C*12.92, 1.055*pow(C,
> 1/2.4)-0.055)}
> 
>    #local SB         = SatBoost; // Saturation boost
>    #local VB         = BrightBoost; // Brightness ("volume") boost
>    #local RawColour  = srgb <sRGB_Gamma(Color.red), sRGB_Gamma(Color.green),
> sRGB_Gamma(Color.blue)>;
>    #local SatColour  = RawColour-SB;
>    #local MyColour   = SatColour*(1+VB)*RawColour.gray/SatColour.gray;
>   #break
>   #else
>    #local MyColour   = Color;
>   #end
> 
>   MyColour
> 
> #end
> 
Yes. Smart indeed.

> #declare CSC = 1;
> 
>   #local CM = array {
>      <0.00, not_0, not_0, not_0>,
>      <0.25, 0.059, 0.059, 0.059>,
> 
>      <0.25, 0.086, 0.027, 0.059>,
>      <0.35, 0.086, 0.027, 0.059>,
> 
>      <0.35, 0.118, 0.118, 0.078>,
>      <0.45, 0.118, 0.118, 0.078>,
> 
>      <0.45, 0.200, 0.137, 0.110>,
>      <0.50, 0.150, 0.087, 0.060>,
>      <0.57, 0.200, 0.137, 0.110>,
> 
>      <0.57, 0.400, 0.337, 0.310>,
>      <0.60, 0.350, 0.287, 0.260>,
>      <0.63, 0.400, 0.337, 0.310>,
> 
>      <0.63, 0.769, 0.329, 0.298>,
>      <0.70, 0.669, 0.229, 0.198>,
>      <0.75, 0.769, 0.329, 0.298>,
> 
>      <0.75, 0.600, 0.600, 0.600>,
>      <0.85, 0.550, 0.550, 0.550>,
>      <1.00, 0.650, 0.650, 0.650>
>   }
>
You make an error here I believe. The first expression is /not/ the 
x-value but the *color_map entry*! And so the last one is /not/ a filter 
value. Below, this gets wrong as a consequence:

> #local C_gr21_DakotaRed_map1 = //the granite colour_map proper
> color_map {
>    #if (version >= 3.8)
>      blend_mode 2
>    #end
>    #local Entries = dimension_size (CM, 1)-1;
>    #for (E, 0, Entries)
>    [CM[E].x rgb <CM[E].y, CM[E].z, CM[E].filter>]
This line is confusing. How would you write the line above? Like this? 
(? used for unknown expression):
      [CM[E].? rgb <CM[E].x, CM[E].y, CM[E].z>]

>    #end
> }
> 

Also, in the above example with CSC=1 ('raw' srgb option) should 'rgb' 
not be 'srgb'? I am getting ab bit lost here.

-- 
Thomas


Post a reply to this message

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