POV-Ray : Newsgroups : povray.advanced-users : L*C*h(uv) color solid Server Time
22 Dec 2024 10:19:49 EST (-0500)
  L*C*h(uv) color solid (Message 1 to 10 of 82)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Mike Horvath
Subject: L*C*h(uv) color solid
Date: 18 Nov 2016 02:22:19
Message: <582eac2b$1@news.povray.org>
I would like to create a three-dimensional representation of the 
L*C*h(uv) color space in the form of a cylinder.

How would I do that?

I may limit myself to colors that also exist in the sRGB color space.

Mike


Post a reply to this message

From: Christian Froeschlin
Subject: Re: L*C*h(uv) color solid
Date: 18 Nov 2016 08:37:57
Message: <582f0435$1@news.povray.org>
On 18.11.2016 8:22, Mike Horvath wrote:

> I would like to create a three-dimensional representation of the
> L*C*h(uv) color space in the form of a cylinder.

I assume you already have a formula to convert the color space to sRGB.

What you need is a function-based pigment that yields appropriate
RGB values based on x,y,z coordinates inside the cylinder. There is
no direct way to define a user-defined color function (unless you
already have a pigment) but you can do it like this:

1. Define three separate float functions yielding R, G, B separately

f_R(x,y,z)
f_B(x,y,z)
f_G(x,y,z)

2. Create red / green / blue pigments from that using function
pattern and red / green / blue color_maps

3. Join the 3 pigments into RGB pigment via "average" pattern.

Regarding implementation of f_R(x,y,z) I was going to suggest
you derive radial distance and angle around y from x-z pair via
(pythagoras / atan2) but as far as I understand LCh(uv) is already
a cylindrical version of Luv so these transformations are
technically part of the color space conversion itself.

Still it would probably be useful to implement the coordinate
transformation (including appropriate scaling of intervals) in
a separate set of functions f_L, f_u, f_v since you need them
multiple times in the definition of f_R, f_G, f_B.


Post a reply to this message

From: Mike Horvath
Subject: Re: L*C*h(uv) color solid
Date: 18 Nov 2016 12:41:48
Message: <582f3d5c$1@news.povray.org>
On 11/18/2016 8:37 AM, Christian Froeschlin wrote:
> I assume you already have a formula to convert the color space to sRGB.
>

Actually, I have a formula to convert a *single* color vector from LCH 
to sRGB.

https://github.com/THEjoezack/ColorMine/blob/master/ColorMine/ColorSpaces/Conversions/LchConverter.cs

But I don't know how to convert this to one of POV-Ray's functions.


Mike


Post a reply to this message

From: Le Forgeron
Subject: Re: L*C*h(uv) color solid
Date: 18 Nov 2016 13:25:03
Message: <582f477f$1@news.povray.org>
Le 18/11/2016 à 08:22, Mike Horvath a écrit :
> I would like to create a three-dimensional representation of the
> L*C*h(uv) color space in the form of a cylinder.
> 
> How would I do that?
> 
> I may limit myself to colors that also exist in the sRGB color space.
> 
> Mike

I would go via the fresh uv-mapping of cylinder, using a gradient map to
other gradient map of orthogonal direction.


Post a reply to this message

From: Le Forgeron
Subject: Re: L*C*h(uv) color solid
Date: 19 Nov 2016 02:53:34
Message: <583004fe@news.povray.org>
Le 18/11/2016 à 19:25, Le_Forgeron a écrit :
> Le 18/11/2016 à 08:22, Mike Horvath a écrit :
>> I would like to create a three-dimensional representation of the
>> L*C*h(uv) color space in the form of a cylinder.
>>
>> How would I do that?
>>
>> I may limit myself to colors that also exist in the sRGB color space.
>>
>> Mike
> 
> I would go via the fresh uv-mapping of cylinder, using a gradient map to
> other gradient map of orthogonal direction.
> 

Here illustrated with a lemon, and HSL2RGB.

The adaptation to a cylinder and L*C*h(uv) is left as an exercise for
the reader.


Post a reply to this message


Attachments:
Download 'lemon.pov.txt' (1 KB) Download 'lemon.png' (74 KB)

Preview of image 'lemon.png'
lemon.png


 

From: Mike Horvath
Subject: Re: L*C*h(uv) color solid
Date: 19 Nov 2016 12:43:02
Message: <58308f26$1@news.povray.org>
On 11/19/2016 2:53 AM, Le_Forgeron wrote:
> Le 18/11/2016 à 19:25, Le_Forgeron a écrit :
>> I would go via the fresh uv-mapping of cylinder, using a gradient map to
>> other gradient map of orthogonal direction.
>>
>
> Here illustrated with a lemon, and HSL2RGB.
>
> The adaptation to a cylinder and L*C*h(uv) is left as an exercise for
> the reader.
>

I want to model the 3D shape of the color solid, too. This is a very 
irregular shape, and I believe I will need to create an isosurface.

Mike


Post a reply to this message

From: Mike Horvath
Subject: Re: L*C*h(uv) color solid
Date: 19 Nov 2016 12:47:19
Message: <58309027$1@news.povray.org>
Let's start with a relatively simpler example of converting CIE XYZ to 
sRGB. The following function is copied from here:

https://github.com/THEjoezack/ColorMine/blob/master/ColorMine/ColorSpaces/Conversions/XyzConverter.cs



         internal static IRgb ToColor(IXyz item)
         {
             // (Observer = 2°, Illuminant = D65)
             var x = item.X / 100.0;
             var y = item.Y / 100.0;
             var z = item.Z / 100.0;

             var r = x * 3.2406 + y * -1.5372 + z * -0.4986;
             var g = x * -0.9689 + y * 1.8758 + z * 0.0415;
             var b = x * 0.0557 + y * -0.2040 + z * 1.0570;

             r = r > 0.0031308 ? 1.055 * Math.Pow(r, 1 / 2.4) - 0.055 : 
12.92 * r;
             g = g > 0.0031308 ? 1.055 * Math.Pow(g, 1 / 2.4) - 0.055 : 
12.92 * g;
             b = b > 0.0031308 ? 1.055 * Math.Pow(b, 1 / 2.4) - 0.055 : 
12.92 * b;

             return new Rgb
             {
                 R = ToRgb(r),
                 G = ToRgb(g),
                 B = ToRgb(b)
             };
         }



I think it would be pretty easy to produce a macro that does all of the 
above. But how do I turn that into a POV-Ray function? The function 
needs to work as a color as well as an isosurface I think.

Mike


Post a reply to this message

From: Le Forgeron
Subject: Re: L*C*h(uv) color solid
Date: 19 Nov 2016 12:55:07
Message: <583091fb$1@news.povray.org>
Le 19/11/2016 à 18:43, Mike Horvath a écrit :
> On 11/19/2016 2:53 AM, Le_Forgeron wrote:
>> Le 18/11/2016 à 19:25, Le_Forgeron a écrit :
>>> I would go via the fresh uv-mapping of cylinder, using a gradient map to
>>> other gradient map of orthogonal direction.
>>>
>>
>> Here illustrated with a lemon, and HSL2RGB.
>>
>> The adaptation to a cylinder and L*C*h(uv) is left as an exercise for
>> the reader.
>>
> 
> I want to model the 3D shape of the color solid, too. This is a very
> irregular shape, and I believe I will need to create an isosurface.

for once, I would go for mesh


Post a reply to this message

From: Le Forgeron
Subject: Re: L*C*h(uv) color solid
Date: 19 Nov 2016 12:59:16
Message: <583092f4@news.povray.org>
Le 19/11/2016 à 18:47, Mike Horvath a écrit :
> 
> I think it would be pretty easy to produce a macro that does all of the
> above. But how do I turn that into a POV-Ray function? The function
> needs to work as a color as well as an isosurface I think.


Basic of povray: the shape is not bound to the texture (excepted for
uv_mapping).

Make the work for the shape, and separately the work to map 3D
coordinates to colour.


Post a reply to this message

From: Mike Horvath
Subject: Re: L*C*h(uv) color solid
Date: 19 Nov 2016 13:18:57
Message: <58309791$1@news.povray.org>
On 11/19/2016 12:59 PM, Le_Forgeron wrote:
> Le 19/11/2016 à 18:47, Mike Horvath a écrit :
>>
>> I think it would be pretty easy to produce a macro that does all of the
>> above. But how do I turn that into a POV-Ray function? The function
>> needs to work as a color as well as an isosurface I think.
>
>
> Basic of povray: the shape is not bound to the texture (excepted for
> uv_mapping).
>
> Make the work for the shape, and separately the work to map 3D
> coordinates to colour.
>

Okay. But how?


Mike


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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