POV-Ray : Newsgroups : povray.general : subtle color_map problem when fading to transparency Server Time
29 Nov 2024 00:31:09 EST (-0500)
  subtle color_map problem when fading to transparency (Message 1 to 5 of 5)  
From: Kenneth
Subject: subtle color_map problem when fading to transparency
Date: 22 May 2006 04:20:01
Message: <web.447172dfca331edbb96c08840@news.povray.org>
I've just recently noticed a little bit of a visual conundrum in attempting
to fade a color to transparency in a color_map. A seemingly simple
procedure, but the result isn't what I always assumed.  I suppose I wasn't
paying close enough attention to the visual result until now.  :-[  Perhaps
my "discovery" is an "old dog" in the POV world, already thoroughly
explained. But I gamely soldier on...

Looking back through the POV docs, specifically 2.3.4.1.4 and the following
sections, I see that the recommended way of fading a color in a color_map
is to use rgbf 1, basically like this:

 color_map{
 [0.0 rgb <1,.5,.3>] // any color
 [1.0 rgbf 1] // the transparent part
                 }
The trouble is, when this is done, the "fade transition" has WHITE mixed in
with the color, from the rgb components of rgbf 1. So instead of the color
just fading out, it becomes more of a pastel color as it does so. To my
eyes, this doesn't seem right...although that may be an arguable point.
(The only corresponding analogy in the real world that I can think of is a
graduated photographic filter, that transitions from color to clear. But I
don't own one, so I can't say what a real scene looks like when viewed
through it. I imagine the filter simply goes from *color* to *clear*.)

This pastel "addition" can be seen much more clearly if the color at index
0.0 is pure black and the color_map is applied to an object with
finish{ambient 1 diffuse 0}, against a black background. The (unwanted)
effect of the rgb components is very pronounced...the black color actualy
fades up to light gray before going transparent. Using rgbt 1 shows almost
the same effect. Lowering the ambient value improves things somewhat, but
even at ambient 0 the effect is still very visible. Using rgbf (or t)
<.5,.5,.5,1> shows some improvement, but it's just a work-around, with an
unwanted darkening effect.

While I do understand what's going on, it leaves me scratching my head for a
solution. In desperation, I even tried using a pure-alpha-channel png
image_map, in a pigment_list, as the "transparent" color...and the result
was exactly the same, the white "blank" image contributing its whiteness.
PERHAPS such an image_map would work if its blank image were made
*transparent*--but my version of Photoshop can't save such a file in any
file format other than its own...which POV doesn't recognize.

SO... is there some other way in POV to get a "pure" fade-out of a color,
devoid of any color "mixing"?

Ken W.


Post a reply to this message

From: Roman Reiner
Subject: Re: subtle color_map problem when fading to transparency
Date: 22 May 2006 05:05:00
Message: <web.44717d8ec3b02af7f0a20d3f0@news.povray.org>
When i ran into that problem i usually used

color_map {
      [0.0 rgbf 1]
      [0.5 rgbf <1,.5,.3,1>]
      [1.0 rgb  <1,.5,.3>]
    }

instead of

color_map {
      [0.0 rgbf 1]
      [1.0 rgb  <1,.5,.3>]
    }

Hope this helps

Regards Roman


Post a reply to this message

From: Mike Williams
Subject: Re: subtle color_map problem when fading to transparency
Date: 22 May 2006 05:09:16
Message: <$QPsrCAw+XcEFw8Z@econym.demon.co.uk>
Wasn't it Kenneth who wrote:
>I've just recently noticed a little bit of a visual conundrum in attempting
>to fade a color to transparency in a color_map. A seemingly simple
>procedure, but the result isn't what I always assumed.  I suppose I wasn't
>paying close enough attention to the visual result until now.  :-[  Perhaps
>my "discovery" is an "old dog" in the POV world, already thoroughly
>explained. But I gamely soldier on...
>
>Looking back through the POV docs, specifically 2.3.4.1.4 and the following
>sections, I see that the recommended way of fading a color in a color_map
>is to use rgbf 1, basically like this:
>
> color_map{
> [0.0 rgb <1,.5,.3>] // any color
> [1.0 rgbf 1] // the transparent part
>                 }

The white comes from the fact that "rgbf 1" is shorthand for 
"rgbf <1,1,1,1>"

Try
  [0.0 rgb <1,.5,.3>] // any color
  [1.0 rgbf <1,.5,.3,1>] // the same colour but transparent
-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Zeger Knaepen
Subject: Re: subtle color_map problem when fading to transparency
Date: 22 May 2006 08:56:27
Message: <4471b4fb$1@news.povray.org>
"Mike Williams" <nos### [at] econymdemoncouk> wrote in message 
news:$QPsrCAw+XcE### [at] econymdemoncouk...
> The white comes from the fact that "rgbf 1" is shorthand for 
> "rgbf <1,1,1,1>"
> 
> Try
>   [0.0 rgb <1,.5,.3>] // any color
>   [1.0 rgbf <1,.5,.3,1>] // the same colour but transparent

better yet:

    [0 rgb <1,.5,.3>]
    [1 rgbt <1,.5,.3,1>]

because rgbf <1,.5,.3,1> isn't completely transparent because of the 
filter-component

cu!
-- 
#macro G(b,e)b+(e-b)*C/50#end#macro _(b,e,k,l)#local C=0;#while(C<50)
sphere{G(b,e)+3*z.1pigment{rgb G(k,l)}finish{ambient 1}}#local C=C+1;
#end#end _(y-x,y,x,x+y)_(y,-x-y,x+y,y)_(-x-y,-y,y,y+z)_(-y,y,y+z,x+y)
_(0x+y.5+y/2x)_(0x-y.5+y/2x)            // ZK http://www.povplace.com


Post a reply to this message

From: Kenneth
Subject: Re: subtle color_map problem when fading to transparency
Date: 22 May 2006 15:35:00
Message: <web.44721119c3b02af7ba6018cb0@news.povray.org>
"Zeger Knaepen" <zeg### [at] povplacecom> wrote:

> better yet:
>
>     [0 rgb <1,.5,.3>]
>     [1 rgbt <1,.5,.3,1>]
>
> because rgbf <1,.5,.3,1> isn't completely transparent because of the
> filter-component
>

Now why didn't I think of that??! Your solution is "crystal clear."  ;-)

Many thanks.

Ken


Post a reply to this message

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