POV-Ray : Newsgroups : povray.general : The Alpha Channel : Re: The Alpha Channel Server Time
9 Aug 2024 09:07:04 EDT (-0400)
  Re: The Alpha Channel  
From: Rune
Date: 30 Sep 2000 12:16:18
Message: <39d611d2@news.povray.org>
"Rune" wrote:
> It may be better to weight the colours that way when
> calculating the transparency. I don't know.

I've done some more tests and found out that it's better to evenly weight
the colours when averaging them; that is, red, green, and blue all weight
33%. The reason is that the transparency of an object should not be
dependant on the colour of the object. If I make a red, green and blue
filtering sphere with the same amount of filtering, I want them all to be
equally much transparent in the output-image.

> However, I can't figure out if it is more correct to divide
> by the Alpha before or after Alpha is converted to grey-scale

By doing some more tests I've found out that the image should be divided
with the "alpha-vector" *before* it is converted to a float. That way the
background-colour is correctly removed from the output-colour.

So I think it should go like this:

   white_result: the traced colour when the background is white

   black_result: the traced colour when the background is black

   opacity = 1 - (white_result - black_result)

   output_colour = black_result / opacity

   output_alpha = ( opacity.red/3 + opacity.green/3 + opacity.blue/3 )

   now write output_colour and output_alpha to the PNG file.

Greetings,

Rune
--
\ Include files, tutorials, 3D images, raytracing jokes,
/ The POV Desktop Theme, and The POV-Ray Logo Contest can
\ all be found at http://rsj.mobilixnet.dk (updated September 25)
/ Also visit http://www.povrayusers.org


Post a reply to this message

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