POV-Ray : Newsgroups : povray.binaries.images : gradient variations Server Time
1 Nov 2024 20:22:10 EDT (-0400)
  gradient variations (Message 1 to 7 of 7)  
From: clipka
Subject: gradient variations
Date: 17 May 2012 04:48:17
Message: <4fb4bb51@news.povray.org>
Three different ways to compute gradients:

Left: Interpolation in a linear color space (assumed_gamma 1.0); color 
gradients look fine, while greyscale gradients appear to be biased 
towards white (despite being physically linear).

Center: Interpolation in a gamma 2.5 color space; greyscale gradients 
look better (despite being physically non-linear), but color gradients 
have a tendency to look too dark in the transition zone.

Right: Interpolating the R:G:B ratio linearly, then adjusting for a 
brightness interpolated in a gamma 2.5 color space, yields both pleasing 
color and brightness gradients.


Post a reply to this message


Attachments:
Download 'gradients.png' (149 KB)

Preview of image 'gradients.png'
gradients.png


 

From: Le Forgeron
Subject: Re: gradient variations
Date: 17 May 2012 06:24:40
Message: <4fb4d1e8$1@news.povray.org>
Le 17/05/2012 10:48, clipka nous fit lire :
> Three different ways to compute gradients:
> 
> Left: Interpolation in a linear color space (assumed_gamma 1.0); color
> gradients look fine, while greyscale gradients appear to be biased
> towards white (despite being physically linear).
> 
> Center: Interpolation in a gamma 2.5 color space; greyscale gradients
> look better (despite being physically non-linear), but color gradients
> have a tendency to look too dark in the transition zone.
> 
> Right: Interpolating the R:G:B ratio linearly, then adjusting for a
> brightness interpolated in a gamma 2.5 color space, yields both pleasing
> color and brightness gradients.

What about... interpolating in HSV or HSL space ?

any available scene source ?


Post a reply to this message

From: clipka
Subject: Re: gradient variations
Date: 18 May 2012 08:45:01
Message: <4fb6444d$1@news.povray.org>
Am 17.05.2012 12:24, schrieb Le_Forgeron:

> What about... interpolating in HSV or HSL space ?

No, thanks - we certainly don't want to average hues. That would mess up 
every gradient involving some neutral grey and any other color, giving 
the transition an unexpected reddish hue (or whatever hue our algorithm 
would assign to grey).

> any available scene source ?

Nope; the scene relies on a source code patch, which won't make it into 
3.7.0 (it may become part of some future 3.7.1 though).


Post a reply to this message

From: Le Forgeron
Subject: Re: gradient variations
Date: 18 May 2012 12:19:44
Message: <4fb676a0@news.povray.org>
Le 18/05/2012 14:44, clipka nous fit lire :
> Am 17.05.2012 12:24, schrieb Le_Forgeron:
> 
>> What about... interpolating in HSV or HSL space ?
> 
> No, thanks - we certainly don't want to average hues. That would mess up
> every gradient involving some neutral grey and any other color, giving
> the transition an unexpected reddish hue (or whatever hue our algorithm
> would assign to grey).

If you have a neutral grey and another non-neutral, the right hue for
grey is the other hue.

The real non-slope is opposite hue. (yellow & blue... magenta & green..)


> 
>> any available scene source ?
> 
> Nope; the scene relies on a source code patch, which won't make it into
> 3.7.0 (it may become part of some future 3.7.1 though).

My mind with a twist: could you make the same picture, but with the
original colours rotated by about 10° to 15° in the Hue ?

Anyway, waiting for a general coded solution in 3.7.1 then ;)


Post a reply to this message

From: clipka
Subject: Re: gradient variations
Date: 18 May 2012 13:06:36
Message: <4fb6819c$1@news.povray.org>
Am 18.05.2012 18:19, schrieb Le_Forgeron:
> Le 18/05/2012 14:44, clipka nous fit lire :
>> Am 17.05.2012 12:24, schrieb Le_Forgeron:
>>
>>> What about... interpolating in HSV or HSL space ?
>>
>> No, thanks - we certainly don't want to average hues. That would mess up
>> every gradient involving some neutral grey and any other color, giving
>> the transition an unexpected reddish hue (or whatever hue our algorithm
>> would assign to grey).
>
> If you have a neutral grey and another non-neutral, the right hue for
> grey is the other hue.

Yes, but the code to convert between RGB and HSV/HSL doesn't know that. 
Besides, any grey ever so slightly off-neutral - whether intentionally 
or unintentionally - has its own inherent hue.

Oh, and averaging hues would actually not just tint the transition, it 
would make them rainbow-style. For instance, a transition between green 
and an ever so slightly reddish grey would include some pastel yellow. 
Or some blue and pink, depending on which "direction" you choose for 
interpolating hues.

> The real non-slope is opposite hue. (yellow&  blue... magenta&  green..)

When interpolating hues, those would become rainbow-style rather than 
going via neutral grey.


Post a reply to this message

From: Le Forgeron
Subject: Re: gradient variations
Date: 18 May 2012 14:30:20
Message: <4fb6953c$1@news.povray.org>
Le 18/05/2012 19:06, clipka nous fit lire :
> Am 18.05.2012 18:19, schrieb Le_Forgeron:
>> The real non-slope is opposite hue. (yellow&  blue... magenta&  green..)
> 
> When interpolating hues, those would become rainbow-style rather than
> going via neutral grey.

My personal approach on that: hue is a circle, choose whichever section
is smaller for interpolation; if both are equal, just go through the center.


Post a reply to this message

From: Le Forgeron
Subject: Re: gradient variations
Date: 18 May 2012 17:05:23
Message: <4fb6b993@news.povray.org>
Le 18/05/2012 20:30, Le_Forgeron nous fit lire :
> Le 18/05/2012 19:06, clipka nous fit lire :
>> Am 18.05.2012 18:19, schrieb Le_Forgeron:
>>> The real non-slope is opposite hue. (yellow&  blue... magenta&  green..)
>>
>> When interpolating hues, those would become rainbow-style rather than
>> going via neutral grey.
> 
> My personal approach on that: hue is a circle, choose whichever section
> is smaller for interpolation; if both are equal, just go through the center.

Here some illustration of povray rgb interpolation, hsv, hsl and using
linear cartesian interpolation of (h,s) taken as polar coordinate,

The important point in interpolation is at least that (red,red) stay red
all the way.


Post a reply to this message


Attachments:
Download 'pol9.png' (105 KB) Download 'pol6.png' (120 KB) Download 'pol3.png' (123 KB) Download 'pol.png' (146 KB)

Preview of image 'pol9.png'
pol9.png

Preview of image 'pol6.png'
pol6.png

Preview of image 'pol3.png'
pol3.png

Preview of image 'pol.png'
pol.png


 

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