POV-Ray : Newsgroups : povray.binaries.images : Colour Interpolation in various colour spaces Server Time
2 Nov 2024 12:22:33 EDT (-0400)
  Colour Interpolation in various colour spaces (Message 1 to 8 of 8)  
From: Le Forgeron
Subject: Colour Interpolation in various colour spaces
Date: 4 Jan 2011 13:22:12
Message: <4d236554@news.povray.org>
To illustrate an actual discussion in p.beta-test
(Gamma of interpolated colors in color maps)

Done with custom code in traditional mesh with texture_list. (5 mesh, 1
triangle each)

#default { texture { pigment { rgb 0 }finish { ambient 1.0} } }

#declare colo1=texture { pigment {color rgb<0.35,1,0>}};
#declare colo2=texture { pigment {color rgb<1,0.,1>}};
#declare colo3=texture { pigment {color rgb<0.,1.,1>}};


Post a reply to this message


Attachments:
Download 'mesh.jpg' (40 KB)

Preview of image 'mesh.jpg'
mesh.jpg


 

From: clipka
Subject: Re: Colour Interpolation in various colour spaces
Date: 4 Jan 2011 14:50:07
Message: <4d2379ef$1@news.povray.org>
Am 04.01.2011 19:22, schrieb Le_Forgeron:
> To illustrate an actual discussion in p.beta-test
> (Gamma of interpolated colors in color maps)
>
> Done with custom code in traditional mesh with texture_list. (5 mesh, 1
> triangle each)
>
> #default { texture { pigment { rgb 0 }finish { ambient 1.0} } }
>
> #declare colo1=texture { pigment {color rgb<0.35,1,0>}};
> #declare colo2=texture { pigment {color rgb<1,0.,1>}};
> #declare colo3=texture { pigment {color rgb<0.,1.,1>}};

Thanks for that illustration.

My personal impression is that HSL and HSV are completely unfit, as they 
both give pretty sudden transitions in the blue and orange regions; XYL 
seems to be suffering from a similar problem, though not as obvious. I 
personally find the gradients for XYV and RGB (POV) to give the most 
pleasing results.

Reminds me that color interpolation is used in multiple places, not just 
color gradients. I'm not sure how to go about this with texture 
interpolation though: While it may be as easy as a pigment 
interpolation, it may just as well be a transition from transparent to 
opaque, from dull to shiny, from non-reflective to reflective, from flat 
to bumpy - or any combination of those, plus possibly a different number 
of layers for each texture. POV-Ray interpolates between textures by 
first computing the results per texture (including reflections, 
refractions, highlights and what-have-you), and then  averaging the 
results. The user's intention may be to have a perceptually pleasing 
transition between the pigments, yet a physically linear transition 
between reflectivity or some such; but I guess only in very rare cases 
will he want a perceptually pleasing transition between the /results/ of 
the textures.


Post a reply to this message

From: Le Forgeron
Subject: Re: Colour Interpolation in various colour spaces
Date: 4 Jan 2011 16:21:52
Message: <4d238f70@news.povray.org>
Le 04/01/2011 20:49, clipka nous fit lire :
> My personal impression is that HSL and HSV are completely unfit, as they
> both give pretty sudden transitions in the blue and orange regions;

Keep in mind that the interpolation was done with nearly primary colors,
distributed far far away on the colour disk.

HS* might be nicer when dealing with shades of the same tinctures (at
least in the same tincture)

And as always, YMMV.

#declare colo1=texture { pigment {color rgb<4/5,0,1/8>}};
#declare colo2=texture { pigment {color rgb<1/8,0.,4/5>}};
#declare colo3=texture { pigment {color rgb 0*<1.,1,1>/8}};

Thanks for the polygon/mod. Looks like pi need more precision for cos &
sin to be happy!


Post a reply to this message


Attachments:
Download 'mesh2.jpg' (84 KB)

Preview of image 'mesh2.jpg'
mesh2.jpg


 

From: scott
Subject: Re: Colour Interpolation in various colour spaces
Date: 6 Jan 2011 06:50:41
Message: <4d25ac91$1@news.povray.org>
> To illustrate an actual discussion in p.beta-test
> (Gamma of interpolated colors in color maps)
>
> Done with custom code in traditional mesh with texture_list. (5 mesh, 1
> triangle each)
>
> #default { texture { pigment { rgb 0 }finish { ambient 1.0} } }
>
> #declare colo1=texture { pigment {color rgb<0.35,1,0>}};
> #declare colo2=texture { pigment {color rgb<1,0.,1>}};
> #declare colo3=texture { pigment {color rgb<0.,1.,1>}};

What is xyl and xyv in this case?

Here are my own tests (only in 2D), comparing raw sRGB pixel value 
interpolation (3.6 method), linear RGB interpolation (3.7 method) and in 
a colour space designed to be perceptually linear (CIELAB).

You can easily see the problem with greyscale gradients in linear RGB 
space, but with colours I think the linear RGB space gradient looks 
better than sRGB (the 3.6 method).


Post a reply to this message

From: scott
Subject: Re: Colour Interpolation in various colour spaces
Date: 6 Jan 2011 06:52:06
Message: <4d25ace6@news.povray.org>
> Here are my own tests (only in 2D),

And of course the attachment!


Post a reply to this message


Attachments:
Download 'image5.png' (23 KB)

Preview of image 'image5.png'
image5.png


 

From: Le Forgeron
Subject: Re: Colour Interpolation in various colour spaces
Date: 6 Jan 2011 12:39:33
Message: <4d25fe55@news.povray.org>
Le 06/01/2011 12:50, scott nous fit lire :
> 
> What is xyl and xyv in this case?

Hue Saturation are polar coordinates where XY are Cartesian ones.
(Hue is Theta, Saturation is the length)
One version is with light (L), other with value (V).

No connection to any CIExy*, sorry for the confusion.


Post a reply to this message

From: Le Forgeron
Subject: Re: Colour Interpolation in various colour spaces
Date: 6 Jan 2011 15:23:48
Message: <4d2624d4@news.povray.org>
Experimental code... Do not expect it

Texture map interpolation

#default{ finish { ambient 1 } }
#declare C_STRAND = color rgb <1/2,1/2,1>;

#declare C_CLEAR  = color red 1;
#declare C_GREEN  = color green 1;

#declare T_STRAND = texture { pigment {color C_STRAND} }

#declare T_CLEAR = texture { pigment {color C_CLEAR} }
#declare T_GREEN = texture { pigment {color C_GREEN} }

#declare T1=texture{
	onion texture_map
	{
		colour_space pov
			[0.0 T_STRAND]
			[0.5 T_CLEAR]
			[1.0 T_GREEN]
	}
}


Post a reply to this message


Attachments:
Download 'ci.png' (289 KB)

Preview of image 'ci.png'
ci.png


 

From: clipka
Subject: Re: Colour Interpolation in various colour spaces
Date: 19 Jan 2011 03:23:18
Message: <4d369f76$1@news.povray.org>
After a long, long time of toying around with various colour spaces 
(even including Munsell), I've come to the conclusion that none of them 
really fit the needs for creation of perceptually uniform gradients: 
Those which are ok for brightness gradients invariably seem to be 
problematic with gradients between different colours (sometimes for 
particular combos, sometimes in general), and vice versa.

So far the best interpolation method I've been able to come up with (and 
one which I think does give sufficiently good results for all gradients) 
is as follows:

- Interpolate colors in linear RGB color space

- Independently, interpolate brightness (Y) in non-linear space, e.g.

   Y_interpolated = [ ( Y_1 ^0.4 ) + ( Y_2 ^0.4 ) ] ^2.5

- In linear RGB color space, brightness-adjust interpolated color to 
match the interpolated brightness, i.e.

   (R',G',B') = (R,G,B) * ( Y_interpolated / Y(R,G,B) )


Post a reply to this message

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