POV-Ray : Newsgroups : povray.beta-test : skyspheres transmit of color maps not computed last : Re: skyspheres transmit of color maps not computed last Server Time
28 Jun 2024 11:19:00 EDT (-0400)
  Re: skyspheres transmit of color maps not computed last  
From: clipka
Date: 30 Oct 2010 06:11:54
Message: <4ccbef6a$1@news.povray.org>
Am 26.10.2010 23:49, schrieb Mr:
> "Mr"<nomail@nomail>  wrote:
>> If I do that,  only the last entry of color map of my gradient will be used as
>> if the the first entry had never existed. so it seems like the transparency is
>> baked into the color for each entry. could there be an option to make it so that
>> if the first entry has transmit 1 its color is still retained and all
>> transparencies
>> only applied in the alpha layer?
>
> Actually it's not the color of the last entry, it happened to be the color of my
> background too. If I remove the background, I get a completely black skysphere!
> So what is happening, Are spy sphere totally ignoring the separation between
> colors and alpha?

If you're using OpenEXR, there is nothing that can be done about this, 
except for violating the file format specifications. OpenEXR uses what 
is called "premultiplied alpha", i.e. if you take the RGB components by 
themselves, you get the same result as if you'd compose the transparent 
image against a black background. So with 100% transparency you'll 
always get pitch black, no matter what. (This /does/ have some benefits 
of its own.)

With the PNG file format, the story is rather different: PNG is 
specified to use "non-premultiplied alpha", i.e. if you take the RGB 
components by themselves, you get the same result as if you had no 
transparency in the first place. So theoretically, what you're asking 
for should be possible.

However, for internal computations POV-Ray uses "premultiplied 
alpha"-like format as well. With the most recent betas, it /does/ 
"un-premultiply" the values when writing PNG files - but when the 
transparency is 100%, this approach breaks down: Regardless of the 
original color, the premultiplied value will be <0,0,0>, so there's no 
way to tell what the original color might have been. In the absence of 
better information, POV-Ray will resort to guessing that the color may 
have been pitch black.


 From this root cause it is pretty easy to derive a workaround: Just 
never use 100% transparency. If you use e.g. 99.9% and PNG output, you 
should be fine.

That is, provided you use the newest beta. Earlier versions of POV-Ray 
weren't even aware of the premultiplied vs. non-premultiplied alpha 
issue, and erroneously wrote premultiplied alpha data for all file 
formats, even where contrary to specification. (Worse yet, they presumed 
all input files to use /non/-premultiplied alpha, i.e. POV-Ray wasn't 
even self-consistent about it.)


Post a reply to this message

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