POV-Ray : Newsgroups : povray.advanced-users : L*C*h(uv) color solid Server Time
7 Jul 2024 09:10:14 EDT (-0400)
  L*C*h(uv) color solid (Message 3 to 12 of 82)  
<<< Previous 2 Messages Goto Latest 10 Messages Next 10 Messages >>>
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

From: Le Forgeron
Subject: Re: L*C*h(uv) color solid
Date: 19 Nov 2016 15:25:15
Message: <5830b52b$1@news.povray.org>
Le 19/11/2016 à 19:19, Mike Horvath a écrit :
> 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?

Within the attached include file, you could replace uv_vertex with your
computed position.

The top macro is UVMeshable, first parameter is an object, just
ignore/remove it
The two others are the resolutions... you can simplify too for your
usage (getting ride of uv_min & uv_max).

mesh{
UVMeshable...

then you insert the uv_mapped texture (and I already provided some code
for that part in this thread)

et voila.


Post a reply to this message


Attachments:
Download 'nurbsmesh.inc.txt' (2 KB)

From: Mike Horvath
Subject: Re: L*C*h(uv) color solid
Date: 19 Nov 2016 15:44:06
Message: <5830b996$1@news.povray.org>
On 11/19/2016 3:25 PM, Le_Forgeron wrote:
> Le 19/11/2016 à 19:19, Mike Horvath a écrit :
>> 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?
>
> Within the attached include file, you could replace uv_vertex with your
> computed position.
>
> The top macro is UVMeshable, first parameter is an object, just
> ignore/remove it
> The two others are the resolutions... you can simplify too for your
> usage (getting ride of uv_min & uv_max).
>
> mesh{
> UVMeshable...
>
> then you insert the uv_mapped texture (and I already provided some code
> for that part in this thread)
>
> et voila.
>

I will try to get your method to work. However, it seems like it is more 
effort than simply using an isosurface. I am not worried much about 
performance.

Mike


Post a reply to this message

<<< Previous 2 Messages Goto Latest 10 Messages Next 10 Messages >>>

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