POV-Ray : Newsgroups : povray.advanced-users : L*C*h(uv) color solid Server Time
18 May 2024 12:06:24 EDT (-0400)
  L*C*h(uv) color solid (Message 21 to 30 of 82)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Mike Horvath
Subject: Re: L*C*h(uv) color solid
Date: 19 Nov 2016 18:15:13
Message: <5830dd01$1@news.povray.org>
On 11/19/2016 6:09 PM, Mike Horvath wrote:
> On 11/19/2016 5:40 PM, Le_Forgeron wrote:
>> Le 19/11/2016 à 23:34, Mike Horvath a écrit :
>>> I tried changing Ku to a cylinder. I expected some differences, but in
>>> the output the texture does not seem to be changing direction along with
>>> the rest of the cylinder.
>>>
>>> Mike
>>>
>>>
>>> #declare Ku = cylinder
>>> {
>>>     -y, +y, 0.4
>>>     uv_mapping texture { TM }
>>>     rotate 150*y
>>> }
>>
>> uv mapping of cylinder is not available in 3.70
>>
>
> I am using 3.7.1-alpha.8826150+av273.msvc14 now.
>
> Mike


Oops. I must have downloaded the wrong version.

Mike


Post a reply to this message

From: Mike Horvath
Subject: Re: L*C*h(uv) color solid
Date: 19 Nov 2016 18:30:20
Message: <5830e08c$1@news.povray.org>
On 11/19/2016 4:36 PM, Le_Forgeron wrote:
> Le 19/11/2016 à 22:22, Mike Horvath a écrit :
>> Also, if I wasn't clear before, I only want to render those portions of
>> the HCL cylinder that lie within the sRGB gamut. Thus, the resulting 3D
>> shape will be quite irregular. Can I still generate a mesh this way?
>
> Yes. I do not know your HCL, but as long as you have 2 parameters to
> cover the surface you want, it should be fine.
>
> If you look at the scene with the lemon, I made the exploration (there
> for uv mapping) in 3 "bands", one for each portion of the surface.
> you can use the same approach.
>

I just did a CSG difference of the object, and the interior does not 
look at all like the exterior. Does you method work with CSG?

Mike


Post a reply to this message

From: Le Forgeron
Subject: Re: L*C*h(uv) color solid
Date: 19 Nov 2016 18:56:45
Message: <5830e6bd$1@news.povray.org>
Le 20/11/2016 à 00:30, Mike Horvath a écrit :
> On 11/19/2016 4:36 PM, Le_Forgeron wrote:
>> Le 19/11/2016 à 22:22, Mike Horvath a écrit :
>>> Also, if I wasn't clear before, I only want to render those portions of
>>> the HCL cylinder that lie within the sRGB gamut. Thus, the resulting 3D
>>> shape will be quite irregular. Can I still generate a mesh this way?
>>
>> Yes. I do not know your HCL, but as long as you have 2 parameters to
>> cover the surface you want, it should be fine.
>>
>> If you look at the scene with the lemon, I made the exploration (there
>> for uv mapping) in 3 "bands", one for each portion of the surface.
>> you can use the same approach.
>>
> 
> I just did a CSG difference of the object, and the interior does not
> look at all like the exterior. Does you method work with CSG?
> 

I'm afraid not. A mesh is hollow.

You would need to compute the CSG to get the points of mesh instead.

So far I was assuming your object was to just be alone, and visible
without transparency.

You only talked of making a cylinder so far.


Post a reply to this message

From: Mike Horvath
Subject: Re: L*C*h(uv) color solid
Date: 19 Nov 2016 19:04:31
Message: <5830e88f$1@news.povray.org>
On 11/19/2016 6:56 PM, Le_Forgeron wrote:
> Le 20/11/2016 à 00:30, Mike Horvath a écrit :
>> On 11/19/2016 4:36 PM, Le_Forgeron wrote:
>>> Le 19/11/2016 à 22:22, Mike Horvath a écrit :
>>>> Also, if I wasn't clear before, I only want to render those portions of
>>>> the HCL cylinder that lie within the sRGB gamut. Thus, the resulting 3D
>>>> shape will be quite irregular. Can I still generate a mesh this way?
>>>
>>> Yes. I do not know your HCL, but as long as you have 2 parameters to
>>> cover the surface you want, it should be fine.
>>>
>>> If you look at the scene with the lemon, I made the exploration (there
>>> for uv mapping) in 3 "bands", one for each portion of the surface.
>>> you can use the same approach.
>>>
>>
>> I just did a CSG difference of the object, and the interior does not
>> look at all like the exterior. Does you method work with CSG?
>>
>
> I'm afraid not. A mesh is hollow.
>
> You would need to compute the CSG to get the points of mesh instead.
>
> So far I was assuming your object was to just be alone, and visible
> without transparency.
>
> You only talked of making a cylinder so far.
>

I need to be able to see the inside of the cylinder.

Mike


Post a reply to this message

From: Mike Horvath
Subject: Re: L*C*h(uv) color solid
Date: 19 Nov 2016 20:33:06
Message: <5830fd52$1@news.povray.org>
On 11/18/2016 2:22 AM, 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.
>
> How would I do that?
>
> I may limit myself to colors that also exist in the sRGB color space.
>
> Mike

I guess my only option is to use individually painted voxels, as I don't 
see how you can enter conditional statements into a function declaration.

:(

Mike


Post a reply to this message

From: clipka
Subject: Re: L*C*h(uv) color solid
Date: 19 Nov 2016 20:48:42
Message: <583100fa$1@news.povray.org>
Am 20.11.2016 um 02:33 schrieb Mike Horvath:
> On 11/18/2016 2:22 AM, 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.
>>
>> How would I do that?
>>
>> I may limit myself to colors that also exist in the sRGB color space.
>>
>> Mike
> 
> I guess my only option is to use individually painted voxels, as I don't
> see how you can enter conditional statements into a function declaration.

Did you try the `select` function?


Post a reply to this message

From: Mike Horvath
Subject: Re: L*C*h(uv) color solid
Date: 19 Nov 2016 21:03:53
Message: <58310489$1@news.povray.org>
On 11/19/2016 8:48 PM, clipka wrote:
> Am 20.11.2016 um 02:33 schrieb Mike Horvath:
>> On 11/18/2016 2:22 AM, 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.
>>>
>>> How would I do that?
>>>
>>> I may limit myself to colors that also exist in the sRGB color space.
>>>
>>> Mike
>>
>> I guess my only option is to use individually painted voxels, as I don't
>> see how you can enter conditional statements into a function declaration.
>
> Did you try the `select` function?
>

No I didn't!

Can I create and store local variables too?

Mike


Post a reply to this message

From: clipka
Subject: Re: L*C*h(uv) color solid
Date: 19 Nov 2016 21:26:16
Message: <583109c8$1@news.povray.org>
Am 20.11.2016 um 03:04 schrieb Mike Horvath:
> On 11/19/2016 8:48 PM, clipka wrote:
>> Am 20.11.2016 um 02:33 schrieb Mike Horvath:
>>> On 11/18/2016 2:22 AM, 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.
>>>>
>>>> How would I do that?
>>>>
>>>> I may limit myself to colors that also exist in the sRGB color space.
>>>>
>>>> Mike
>>>
>>> I guess my only option is to use individually painted voxels, as I don't
>>> see how you can enter conditional statements into a function
>>> declaration.
>>
>> Did you try the `select` function?
>>
> 
> No I didn't!
> 
> Can I create and store local variables too?

Nope; the virtual machine currently used by POV-Ray to execute
user-defined functions was designed solely for genuine functions; it
doesn't do anything remotely resembling programming.


Post a reply to this message

From: Mike Horvath
Subject: Re: L*C*h(uv) color solid
Date: 19 Nov 2016 22:47:36
Message: <58311cd8$1@news.povray.org>
I'm having a problem converting between units. Here is the code I'm 
trying to adapt to POV-Ray:

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

         internal static IRgb ToColor(ILch item)
         {
             var hRadians = item.H * Math.PI / 180.0;
             var lab = new Lab
                 {
                     L = item.L,
                     A = Math.Cos(hRadians) * item.C,
                     B = Math.Sin(hRadians) * item.C
                 };
             return lab.To<Rgb>();
         }

Here is the POV-Ray version I created:

	// input L = between 0 and 100
	// input C = between 0 and 100
	// input H = between 0 and 360
	// output L = between 0 and 100
	// output A = between -128 and +128
	// output B = between -128 and +128
	#macro CLCH2LAB(Color)
		#local LCHFT = color Color;
		#local L = LCHFT.red;
		#local C = LCHFT.green;
		#local H = LCHFT.blue;
		#local hRadians = radians(H);
		#local A = cos(hRadians) * C;
		#local B = sin(hRadians) * C;
		<L,A,B>
	#end

When I plug the vector <50,50,180> into this function I get 
<50.00000,-50.00000,0.00000> as a result. However, the Web converter 
(http://colormine.org/convert/lch-to-lab) says it should be 
<51.622535970468874,-37.18943330724933,2.558221480506817>

It's a simple function. I don't see anything obvious that is wrong with 
it. Do you?

Mike


Post a reply to this message

From: clipka
Subject: Re: L*C*h(uv) color solid
Date: 20 Nov 2016 00:09:17
Message: <58312ffd$1@news.povray.org>
Am 20.11.2016 um 04:47 schrieb Mike Horvath:
> I'm having a problem converting between units. Here is the code I'm
> trying to adapt to POV-Ray:
> 
>    
https://github.com/THEjoezack/ColorMine/blob/master/ColorMine/ColorSpaces/Conversions/LchConverter.cs
> 
> 
>         internal static IRgb ToColor(ILch item)
>         {
>             var hRadians = item.H * Math.PI / 180.0;
>             var lab = new Lab
>                 {
>                     L = item.L,
>                     A = Math.Cos(hRadians) * item.C,
>                     B = Math.Sin(hRadians) * item.C
>                 };
>             return lab.To<Rgb>();
>         }
...

> 
> Here is the POV-Ray version I created:
> 
>     // input L = between 0 and 100
>     // input C = between 0 and 100
>     // input H = between 0 and 360
>     // output L = between 0 and 100
>     // output A = between -128 and +128
>     // output B = between -128 and +128
>     #macro CLCH2LAB(Color)
>         #local LCHFT = color Color;
>         #local L = LCHFT.red;
>         #local C = LCHFT.green;
>         #local H = LCHFT.blue;
>         #local hRadians = radians(H);
>         #local A = cos(hRadians) * C;
>         #local B = sin(hRadians) * C;
>         <L,A,B>
>     #end
> 
> When I plug the vector <50,50,180> into this function I get
> <50.00000,-50.00000,0.00000> as a result. However, the Web converter
> (http://colormine.org/convert/lch-to-lab) says it should be
> <51.622535970468874,-37.18943330724933,2.558221480506817>
> 
> It's a simple function. I don't see anything obvious that is wrong with
> it. Do you?

I see something obviously wrong with the web converter: the "CIE-L*ab"
(whatever colour space that even is supposed to be; L*a*b, maybe?)
result it computes cannot possibly be the same as the "lab" interim
result computed by the `ToColor` function you've posted, as that leaves
the "L" component entirely untouched, so it should evaluate to 50.

Judging from the results the web converter computes for Lch to XYZ,
which gives out-of-range values for an obviously within-range Lch value
of <50,50,180>, that web converter can't be trusted.

The first other web converter I've tested does convert "Lch" <50,50,180>
to "Lab" <50,-50,0>, matching your implementation.


Post a reply to this message

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

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