POV-Ray : Newsgroups : povray.text.scene-files : L*C*h(uv) functions Server Time
8 Oct 2026 17:40:34 EDT (-0400)
  L*C*h(uv) functions (Message 1 to 26 of 26)  
From: Mike Horvath
Subject: L*C*h(uv) functions
Date: 21 Nov 2016 12:33:04
Message: <58332fd0@news.povray.org>
Here are the L*C*h(uv) functions I created. How do I turn them into 
pigments?

Mike


Post a reply to this message


Attachments:
Download 'cielch_color_solid_cylinder_iso.pov.txt' (5 KB)

From: Bald Eagle
Subject: Re: L*C*h(uv) functions
Date: 21 Nov 2016 15:05:00
Message: <web.583352ca926db0d9c437ac910@news.povray.org>
Mike Horvath <mik### [at] gmailcom> wrote:
> Here are the L*C*h(uv) functions I created. How do I turn them into
> pigments?
>
> Mike

http://www.povray.org/documentation/view/3.6.1/378/
?


Post a reply to this message

From: Mike Horvath
Subject: Re: L*C*h(uv) functions
Date: 21 Nov 2016 15:10:06
Message: <5833549e$1@news.povray.org>
On 11/21/2016 3:02 PM, Bald Eagle wrote:
> Mike Horvath <mik### [at] gmailcom> wrote:
>> Here are the L*C*h(uv) functions I created. How do I turn them into
>> pigments?
>>
>> Mike
>
> http://www.povray.org/documentation/view/3.6.1/378/
> ?
>



I have three separate functions for R, G and B.

#declare convertLCH2RGB_R = function(L,C,H) 
{correctRGB1(funcXYZ2RGBb1(funcLAB2XYZb1(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb2(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb3(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H))),funcXYZ2RGBb2(funcLAB2XYZb1(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb2(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb3(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H))),funcXYZ2RGBb3(funcLAB2XYZb1(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb2(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb3(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H))))}
#declare convertLCH2RGB_G = function(L,C,H) 
{correctRGB2(funcXYZ2RGBb1(funcLAB2XYZb1(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb2(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb3(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H))),funcXYZ2RGBb2(funcLAB2XYZb1(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb2(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb3(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H))),funcXYZ2RGBb3(funcLAB2XYZb1(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb2(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb3(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H))))}
#declare convertLCH2RGB_B = function(L,C,H) 
{correctRGB3(funcXYZ2RGBb1(funcLAB2XYZb1(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb2(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb3(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H))),funcXYZ2RGBb2(funcLAB2XYZb1(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb2(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb3(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H))),funcXYZ2RGBb3(funcLAB2XYZb1(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb2(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb3(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H))))}

Actually, I can create a pigment already. But I don't know how to use 
the functions in a isosurface or a parametric to make the 3D object the 
pigment gets applied to, if possible.

Mike


Post a reply to this message

From: Bald Eagle
Subject: Re: L*C*h(uv) functions
Date: 21 Nov 2016 15:15:02
Message: <web.58335567926db0d9c437ac910@news.povray.org>
Mike,

FYI:

you define
#local VRGB = <funcXYZ2RGBb1(VXYZ.x,VXYZ.y,VXYZ.z),
funcXYZ2RGBb2(VXYZ.x,VXYZ.y,VXYZ.z), funcXYZ2RGBb3(VXYZ.x,VXYZ.y,VXYZ.z)>;

and then (re)define the same variable in the very next line:
#local VRGB = <funcRGB2RGBa1(VRGB.x,VRGB.y,VRGB.z),
funcRGB2RGBa2(VRGB.x,VRGB.y,VRGB.z), funcRGB2RGBa3(VRGB.x,VRGB.y,VRGB.z)>;


Post a reply to this message

From: Mike Horvath
Subject: Re: L*C*h(uv) functions
Date: 21 Nov 2016 15:28:05
Message: <583358d5$1@news.povray.org>
On 11/21/2016 3:13 PM, Bald Eagle wrote:
> Mike,
>
> FYI:
>
> you define
> #local VRGB = <funcXYZ2RGBb1(VXYZ.x,VXYZ.y,VXYZ.z),
> funcXYZ2RGBb2(VXYZ.x,VXYZ.y,VXYZ.z), funcXYZ2RGBb3(VXYZ.x,VXYZ.y,VXYZ.z)>;
>
> and then (re)define the same variable in the very next line:
> #local VRGB = <funcRGB2RGBa1(VRGB.x,VRGB.y,VRGB.z),
> funcRGB2RGBa2(VRGB.x,VRGB.y,VRGB.z), funcRGB2RGBa3(VRGB.x,VRGB.y,VRGB.z)>;
>
>
>

The second function takes RGB as input and outputs RGB as well, so I 
didn't rename the variable. You can change the variable name if that 
suits you.

Mike


Post a reply to this message

From: Mike Horvath
Subject: Re: L*C*h(uv) functions
Date: 21 Nov 2016 15:29:23
Message: <58335923$1@news.povray.org>
On 11/21/2016 3:10 PM, Mike Horvath wrote:
> On 11/21/2016 3:02 PM, Bald Eagle wrote:
>> Mike Horvath <mik### [at] gmailcom> wrote:
>>> Here are the L*C*h(uv) functions I created. How do I turn them into
>>> pigments?
>>>
>>> Mike
>>
>> http://www.povray.org/documentation/view/3.6.1/378/
>> ?
>>
>
>
>
> I have three separate functions for R, G and B.
>
> #declare convertLCH2RGB_R = function(L,C,H)
>
{correctRGB1(funcXYZ2RGBb1(funcLAB2XYZb1(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb2(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb3(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H))),funcXYZ2RGBb2(funcLAB2XYZb1(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb2(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb3(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H))),funcXYZ2RGBb3(funcLAB2XYZb1(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb2(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb3(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H))))}
>
> #declare convertLCH2RGB_G = function(L,C,H)
>
{correctRGB2(funcXYZ2RGBb1(funcLAB2XYZb1(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb2(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb3(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H))),funcXYZ2RGBb2(funcLAB2XYZb1(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb2(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb3(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H))),funcXYZ2RGBb3(funcLAB2XYZb1(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb2(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb3(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H))))}
>
> #declare convertLCH2RGB_B = function(L,C,H)
>
{correctRGB3(funcXYZ2RGBb1(funcLAB2XYZb1(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb2(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb3(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H))),funcXYZ2RGBb2(funcLAB2XYZb1(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb2(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb3(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H))),funcXYZ2RGBb3(funcLAB2XYZb1(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb2(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb3(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H))))}
>
>
> Actually, I can create a pigment already. But I don't know how to use
> the functions in a isosurface or a parametric to make the 3D object the
> pigment gets applied to, if possible.
>
> Mike

Oops! You'll need to know these as well.

#declare correctRGB1 = function(R,G,B) {min(max(R,0),1)}
#declare correctRGB2 = function(R,G,B) {min(max(G,0),1)}
#declare correctRGB3 = function(R,G,B) {min(max(B,0),1)}


Post a reply to this message

From: Mike Horvath
Subject: Re: L*C*h(uv) functions
Date: 21 Nov 2016 15:57:01
Message: <58335f9d$1@news.povray.org>
On 11/21/2016 3:29 PM, Mike Horvath wrote:
> On 11/21/2016 3:10 PM, Mike Horvath wrote:
>> On 11/21/2016 3:02 PM, Bald Eagle wrote:
>>> Mike Horvath <mik### [at] gmailcom> wrote:
>>>> Here are the L*C*h(uv) functions I created. How do I turn them into
>>>> pigments?
>>>>
>>>> Mike
>>>
>>> http://www.povray.org/documentation/view/3.6.1/378/
>>> ?
>>>
>>
>>
>>
>> I have three separate functions for R, G and B.
>>
>> #declare convertLCH2RGB_R = function(L,C,H)
>>
{correctRGB1(funcXYZ2RGBb1(funcLAB2XYZb1(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb2(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb3(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H))),funcXYZ2RGBb2(funcLAB2XYZb1(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb2(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb3(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H))),funcXYZ2RGBb3(funcLAB2XYZb1(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb2(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb3(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H))))}
>>
>>
>> #declare convertLCH2RGB_G = function(L,C,H)
>>
{correctRGB2(funcXYZ2RGBb1(funcLAB2XYZb1(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb2(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb3(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H))),funcXYZ2RGBb2(funcLAB2XYZb1(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb2(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb3(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H))),funcXYZ2RGBb3(funcLAB2XYZb1(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb2(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb3(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H))))}
>>
>>
>> #declare convertLCH2RGB_B = function(L,C,H)
>>
{correctRGB3(funcXYZ2RGBb1(funcLAB2XYZb1(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb2(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb3(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H))),funcXYZ2RGBb2(funcLAB2XYZb1(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb2(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb3(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H))),funcXYZ2RGBb3(funcLAB2XYZb1(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb2(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H)),funcLAB2XYZb3(funcLCH2LABa1(L,C,H),funcLCH2LABa2(L,C,H),funcLCH2LABa3(L,C,H))))}
>>
>>
>>
>> Actually, I can create a pigment already. But I don't know how to use
>> the functions in a isosurface or a parametric to make the 3D object the
>> pigment gets applied to, if possible.
>>
>> Mike
>
> Oops! You'll need to know these as well.
>
> #declare correctRGB1 = function(R,G,B) {min(max(R,0),1)}
> #declare correctRGB2 = function(R,G,B) {min(max(G,0),1)}
> #declare correctRGB3 = function(R,G,B) {min(max(B,0),1)}
>
>

That is wrong. The RGB values should *not* be corrected. In fact, if any 
of R, G or B are outside the range of 0 to 1, then the coordinate/color 
should be discarded. Sorry!

Mike


Post a reply to this message

From: clipka
Subject: Re: L*C*h(uv) functions
Date: 21 Nov 2016 16:23:44
Message: <583365e0$1@news.povray.org>
Am 21.11.2016 um 21:56 schrieb Mike Horvath:

>>> Actually, I can create a pigment already. But I don't know how to use
>>> the functions in a isosurface or a parametric to make the 3D object the
>>> pigment gets applied to, if possible.
>>>
>>> Mike
>>
>> Oops! You'll need to know these as well.
>>
>> #declare correctRGB1 = function(R,G,B) {min(max(R,0),1)}
>> #declare correctRGB2 = function(R,G,B) {min(max(G,0),1)}
>> #declare correctRGB3 = function(R,G,B) {min(max(B,0),1)}
>>
>>
> 
> That is wrong. The RGB values should *not* be corrected. In fact, if any
> of R, G or B are outside the range of 0 to 1, then the coordinate/color
> should be discarded. Sorry!

So if I understand you correctly, the shape you want is exactly the
volume for which R, G and B are all within the range from 0 to 1.

That sounds like a job for an isosurface to me.

Variant A: Create six isosurfaces, each representing one of the
boundaries (R<0, G<0, B<0, R>1, G>1, B>1), and intersect them.

Variant B: Refactor the functions from variant A, so that they have the
same threshold, combine them using max() or min() to achieve the
intersection effect, and turn that into a single isosurface.


Post a reply to this message

From: Mike Horvath
Subject: Re: L*C*h(uv) functions
Date: 21 Nov 2016 16:33:30
Message: <5833682a$1@news.povray.org>
On 11/21/2016 4:23 PM, clipka wrote:
> Am 21.11.2016 um 21:56 schrieb Mike Horvath:
>
>>>> Actually, I can create a pigment already. But I don't know how to use
>>>> the functions in a isosurface or a parametric to make the 3D object the
>>>> pigment gets applied to, if possible.
>>>>
>>>> Mike
>>>
>>> Oops! You'll need to know these as well.
>>>
>>> #declare correctRGB1 = function(R,G,B) {min(max(R,0),1)}
>>> #declare correctRGB2 = function(R,G,B) {min(max(G,0),1)}
>>> #declare correctRGB3 = function(R,G,B) {min(max(B,0),1)}
>>>
>>>
>>
>> That is wrong. The RGB values should *not* be corrected. In fact, if any
>> of R, G or B are outside the range of 0 to 1, then the coordinate/color
>> should be discarded. Sorry!
>
> So if I understand you correctly, the shape you want is exactly the
> volume for which R, G and B are all within the range from 0 to 1.
>

Yes, exactly!


> That sounds like a job for an isosurface to me.
>
> Variant A: Create six isosurfaces, each representing one of the
> boundaries (R<0, G<0, B<0, R>1, G>1, B>1), and intersect them.
>
> Variant B: Refactor the functions from variant A, so that they have the
> same threshold, combine them using max() or min() to achieve the
> intersection effect, and turn that into a single isosurface.
>

I don't know how to do either variant. :(

Mike


Post a reply to this message

From: Stephen
Subject: Re: L*C*h(uv) functions
Date: 21 Nov 2016 16:49:44
Message: <58336bf8$1@news.povray.org>
On 11/21/2016 9:33 PM, Mike Horvath wrote:
>> Variant B: Refactor the functions from variant A, so that they have the
>> same threshold,

How to cook a haggis:
First catch your Haggis then...


>
> I don't know how to do either variant. :(

Don't ya just love it when someone says "Simply..." ;)

-- 

Regards
     Stephen


Post a reply to this message

From: Mike Horvath
Subject: Re: L*C*h(uv) functions
Date: 21 Nov 2016 18:50:38
Message: <5833884e$1@news.povray.org>
On 11/21/2016 4:33 PM, Mike Horvath wrote:
> On 11/21/2016 4:23 PM, clipka wrote:
>>
>> So if I understand you correctly, the shape you want is exactly the
>> volume for which R, G and B are all within the range from 0 to 1.
>>
>
> Yes, exactly!
>
>
>> That sounds like a job for an isosurface to me.
>>
>> Variant A: Create six isosurfaces, each representing one of the
>> boundaries (R<0, G<0, B<0, R>1, G>1, B>1), and intersect them.
>>
>> Variant B: Refactor the functions from variant A, so that they have the
>> same threshold, combine them using max() or min() to achieve the
>> intersection effect, and turn that into a single isosurface.
>>
>
> I don't know how to do either variant. :(
>
> Mike

Forgot to add that I want to use polar coordinates (if that makes a 
difference).

Mike


Post a reply to this message

From: Mike Horvath
Subject: Re: L*C*h(uv) functions
Date: 21 Nov 2016 19:46:28
Message: <58339564$1@news.povray.org>
On 11/21/2016 4:23 PM, clipka wrote:
> Am 21.11.2016 um 21:56 schrieb Mike Horvath:
>
>>>> Actually, I can create a pigment already. But I don't know how to use
>>>> the functions in a isosurface or a parametric to make the 3D object the
>>>> pigment gets applied to, if possible.
>>>>
>>>> Mike
>>>
>>> Oops! You'll need to know these as well.
>>>
>>> #declare correctRGB1 = function(R,G,B) {min(max(R,0),1)}
>>> #declare correctRGB2 = function(R,G,B) {min(max(G,0),1)}
>>> #declare correctRGB3 = function(R,G,B) {min(max(B,0),1)}
>>>
>>>
>>
>> That is wrong. The RGB values should *not* be corrected. In fact, if any
>> of R, G or B are outside the range of 0 to 1, then the coordinate/color
>> should be discarded. Sorry!
>
> So if I understand you correctly, the shape you want is exactly the
> volume for which R, G and B are all within the range from 0 to 1.
>
> That sounds like a job for an isosurface to me.
>
> Variant A: Create six isosurfaces, each representing one of the
> boundaries (R<0, G<0, B<0, R>1, G>1, B>1), and intersect them.
>
> Variant B: Refactor the functions from variant A, so that they have the
> same threshold, combine them using max() or min() to achieve the
> intersection effect, and turn that into a single isosurface.
>

I am trying random things now.

isosurface
{
	function {max(convertLCH2RGB_R(x,y,z), 1)}
	contained_by
	{
		box {-2,+2}
	}
//	threshold FLOAT_VALUE
	accuracy	0.01
	max_gradient	5
//	[evaluate P0, P1, P2]
//	open
//	[max_trace INTEGER] | [all_intersections]
	pigment {rgb 1}
}

This takes a long time to render, but there's nothing visible happening.

Mike


Post a reply to this message

From: Mike Horvath
Subject: Re: L*C*h(uv) functions
Date: 21 Nov 2016 23:22:15
Message: <5833c7f7$1@news.povray.org>
I tried this as well.

parametric
{
	function { convertLCH2RGB_R(u,100,v) }
	function { convertLCH2RGB_G(u,100,v) }
	function { convertLCH2RGB_B(u,100,v) }
	<0,0>, <100,360>
	contained_by
	{
		box {-2,+2}
	}
	max_gradient	5
	accuracy	0.01
	precompute	10 x,y,z
	pigment {rgb 1}
}

The render is too slow. The pps is below 100 and still dropping.

Mike


Post a reply to this message

From: clipka
Subject: Re: L*C*h(uv) functions
Date: 22 Nov 2016 02:30:45
Message: <5833f425$1@news.povray.org>
Am 22.11.2016 um 01:46 schrieb Mike Horvath:

> I am trying random things now.
> 
> isosurface
> {
>     function {max(convertLCH2RGB_R(x,y,z), 1)}

throw away the max() function, and take care of the polar-ish coordinate
system by replacing:

    convertLCH2RGB_R(x,y,z)

with:

    convertLCH2RGB_R(y*200-100,sqrt(x*x+z*z)*100,atan2(x/z)*pi/180)

(presuming you want L up and I got the math right)

>     contained_by
>     {
>         box {-2,+2}
>     }
> //    threshold FLOAT_VALUE

... and use threshold 1. That should give you something visible.

>     accuracy    0.01
>     max_gradient    5
> //    [evaluate P0, P1, P2]
> //    open
> //    [max_trace INTEGER] | [all_intersections]
>     pigment {rgb 1}
> }
> 
> This takes a long time to render, but there's nothing visible happening.
> 
> Mike


Post a reply to this message

From: Mike Horvath
Subject: Re: L*C*h(uv) functions
Date: 22 Nov 2016 02:33:02
Message: <5833f4ae$1@news.povray.org>
On 11/22/2016 2:30 AM, clipka wrote:
> Am 22.11.2016 um 01:46 schrieb Mike Horvath:
>
>> I am trying random things now.
>>
>> isosurface
>> {
>>     function {max(convertLCH2RGB_R(x,y,z), 1)}
>
> throw away the max() function, and take care of the polar-ish coordinate
> system by replacing:
>
>     convertLCH2RGB_R(x,y,z)
>
> with:
>
>     convertLCH2RGB_R(y*200-100,sqrt(x*x+z*z)*100,atan2(x/z)*pi/180)
>
> (presuming you want L up and I got the math right)
>
>>     contained_by
>>     {
>>         box {-2,+2}
>>     }
>> //    threshold FLOAT_VALUE
>
> ... and use threshold 1. That should give you something visible.
>
>>     accuracy    0.01
>>     max_gradient    5
>> //    [evaluate P0, P1, P2]
>> //    open
>> //    [max_trace INTEGER] | [all_intersections]
>>     pigment {rgb 1}
>> }
>>
>> This takes a long time to render, but there's nothing visible happening.
>>
>> Mike
>

THANK YOU!!

However atan2 requires two parameters and your math only has one.

Mike


Post a reply to this message

From: clipka
Subject: Re: L*C*h(uv) functions
Date: 22 Nov 2016 02:44:13
Message: <5833f74d@news.povray.org>
Am 22.11.2016 um 08:33 schrieb Mike Horvath:

>>     convertLCH2RGB_R(y*200-100,sqrt(x*x+z*z)*100,atan2(x/z)*pi/180)

> THANK YOU!!
> 
> However atan2 requires two parameters and your math only has one.

Sorry, try atan2(x,z).


Post a reply to this message

From: Mike Horvath
Subject: Re: L*C*h(uv) functions
Date: 22 Nov 2016 02:45:52
Message: <5833f7b0$1@news.povray.org>
On 11/22/2016 2:44 AM, clipka wrote:
> Am 22.11.2016 um 08:33 schrieb Mike Horvath:
>
>>>     convertLCH2RGB_R(y*200-100,sqrt(x*x+z*z)*100,atan2(x/z)*pi/180)
>
>> THANK YOU!!
>>
>> However atan2 requires two parameters and your math only has one.
>
> Sorry, try atan2(x,z).
>

Here is the whole file again with your changes. The shape I get when I 
render is that of a pointy cap. I don't know if that's correct or not.


Mike


Post a reply to this message


Attachments:
Download 'utf-8' (7 KB)

From: clipka
Subject: Re: L*C*h(uv) functions
Date: 22 Nov 2016 03:31:26
Message: <5834025e$1@news.povray.org>
Am 22.11.2016 um 08:45 schrieb Mike Horvath:
> On 11/22/2016 2:44 AM, clipka wrote:
>> Am 22.11.2016 um 08:33 schrieb Mike Horvath:
>>
>>>>     convertLCH2RGB_R(y*200-100,sqrt(x*x+z*z)*100,atan2(x/z)*pi/180)
>>
>>> THANK YOU!!
>>>
>>> However atan2 requires two parameters and your math only has one.
>>
>> Sorry, try atan2(x,z).
>>
> 
> Here is the whole file again with your changes. The shape I get when I
> render is that of a pointy cap. I don't know if that's correct or not.

How would I know -- I'm not familiar with that colour model.

Now you need to intersect that shape with the five others -- or use the
combined function:

    min(
      convertLCH2RGB_R(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
      convertLCH2RGB_G(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
      convertLCH2RGB_B(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
      1-convertLCH2RGB_R(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
      1-convertLCH2RGB_G(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
      1-convertLCH2RGB_B(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180)
    )

should do the job, I think.


Post a reply to this message

From: Mike Horvath
Subject: Re: L*C*h(uv) functions
Date: 22 Nov 2016 03:43:51
Message: <58340547$1@news.povray.org>
On 11/22/2016 3:31 AM, clipka wrote:
>     min(
>       convertLCH2RGB_R(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
>       convertLCH2RGB_G(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
>       convertLCH2RGB_B(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
>       1-convertLCH2RGB_R(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
>       1-convertLCH2RGB_G(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
>       1-convertLCH2RGB_B(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180)
>     )

I think the last parameter should be atan2(x,z)*180/pi because atan2 
returns radians and convertLCH2RGB_R expects degrees.

Also, here's a rough approximation of what the surface should look like.

https://commons.wikimedia.org/wiki/File:Cielch_color_solid_cylinder.png

But with smooth curves instead of blocky sections.

Mike


Post a reply to this message

From: Mike Horvath
Subject: Re: L*C*h(uv) functions
Date: 22 Nov 2016 03:44:21
Message: <58340565$1@news.povray.org>
On 11/22/2016 3:31 AM, clipka wrote:
>     min(
>       convertLCH2RGB_R(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
>       convertLCH2RGB_G(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
>       convertLCH2RGB_B(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
>       1-convertLCH2RGB_R(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
>       1-convertLCH2RGB_G(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
>       1-convertLCH2RGB_B(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180)
>     )


Forgot to say that the above just results in a cube.

Mike


Post a reply to this message

From: clipka
Subject: Re: L*C*h(uv) functions
Date: 22 Nov 2016 04:44:39
Message: <58341387$1@news.povray.org>
Am 22.11.2016 um 09:43 schrieb Mike Horvath:
> On 11/22/2016 3:31 AM, clipka wrote:
>>     min(
>>       convertLCH2RGB_R(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
>>       convertLCH2RGB_G(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
>>       convertLCH2RGB_B(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
>>       1-convertLCH2RGB_R(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
>>       1-convertLCH2RGB_G(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
>>       1-convertLCH2RGB_B(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180)
>>     )
> 
> I think the last parameter should be atan2(x,z)*180/pi because atan2
> returns radians and convertLCH2RGB_R expects degrees.

I guess you're right about this one.


Post a reply to this message

From: Mike Horvath
Subject: Re: L*C*h(uv) functions
Date: 22 Nov 2016 19:59:20
Message: <5834e9e8$1@news.povray.org>
On 11/22/2016 4:44 AM, clipka wrote:
> Am 22.11.2016 um 09:43 schrieb Mike Horvath:
>> On 11/22/2016 3:31 AM, clipka wrote:
>>>     min(
>>>       convertLCH2RGB_R(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
>>>       convertLCH2RGB_G(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
>>>       convertLCH2RGB_B(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
>>>       1-convertLCH2RGB_R(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
>>>       1-convertLCH2RGB_G(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
>>>       1-convertLCH2RGB_B(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180)
>>>     )
>>
>> I think the last parameter should be atan2(x,z)*180/pi because atan2
>> returns radians and convertLCH2RGB_R expects degrees.
>
> I guess you're right about this one.
>

I am also not sure if using atan2 is good, since that only covers 90 
degrees, whereas the hue circle must use all 360 degrees.

Mike


Post a reply to this message

From: Mike Horvath
Subject: Re: L*C*h(uv) functions
Date: 22 Nov 2016 20:11:33
Message: <5834ecc5@news.povray.org>
On 11/22/2016 7:59 PM, Mike Horvath wrote:
> On 11/22/2016 4:44 AM, clipka wrote:
>> Am 22.11.2016 um 09:43 schrieb Mike Horvath:
>>> On 11/22/2016 3:31 AM, clipka wrote:
>>>>     min(
>>>>       convertLCH2RGB_R(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
>>>>       convertLCH2RGB_G(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
>>>>       convertLCH2RGB_B(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
>>>>
>>>> 1-convertLCH2RGB_R(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
>>>>
>>>> 1-convertLCH2RGB_G(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
>>>>       1-convertLCH2RGB_B(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180)
>>>>     )
>>>
>>> I think the last parameter should be atan2(x,z)*180/pi because atan2
>>> returns radians and convertLCH2RGB_R expects degrees.
>>
>> I guess you're right about this one.
>>
>
> I am also not sure if using atan2 is good, since that only covers 90
> degrees, whereas the hue circle must use all 360 degrees.
>
> Mike

Sorry. Disregard that. It works.

Mike


Post a reply to this message

From: clipka
Subject: Re: L*C*h(uv) functions
Date: 22 Nov 2016 20:53:03
Message: <5834f67f$1@news.povray.org>
Am 23.11.2016 um 02:11 schrieb Mike Horvath:

>> I am also not sure if using atan2 is good, since that only covers 90
>> degrees, whereas the hue circle must use all 360 degrees.
>>
>> Mike
> 
> Sorry. Disregard that. It works.

That's the fun thing about `atan2(a,b)`: In contrast to `atan(a/b)` it
doesn't lose the information about the quadrant; it also avoids the
singularity at b=0 (provided a<>0).


Post a reply to this message

From: Mike Horvath
Subject: Re: L*C*h(uv) functions
Date: 23 Nov 2016 02:47:09
Message: <5835497d$1@news.povray.org>
On 11/22/2016 3:31 AM, clipka wrote:
>> Here is the whole file again with your changes. The shape I get when I
>> render is that of a pointy cap. I don't know if that's correct or not.
>
> How would I know -- I'm not familiar with that colour model.
>
> Now you need to intersect that shape with the five others -- or use the
> combined function:
>
>     min(
>       convertLCH2RGB_R(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
>       convertLCH2RGB_G(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
>       convertLCH2RGB_B(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
>       1-convertLCH2RGB_R(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
>       1-convertLCH2RGB_G(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180),
>       1-convertLCH2RGB_B(y*200-100,sqrt(x*x+z*z)*100,atan2(x,z)*pi/180)
>     )
>
> should do the job, I think.
>

Using "min" all I got was a cube. Switching to "max" instead, I got a 
shape... of some sort. I'm not sure it's the correct one. Check the 
thread in p.b.i and tell me if the images show the same object.

http://news.povray.org/583548b6%40news.povray.org

Mike


Post a reply to this message

From: Mike Horvath
Subject: Re: L*C*h(uv) functions
Date: 23 Nov 2016 02:48:47
Message: <583549df$1@news.povray.org>
I've attached the latest version of the script.

Mike


Post a reply to this message


Attachments:
Download 'cielch_color_solid_cylinder_isosurface.pov.txt' (9 KB)

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