POV-Ray : Newsgroups : povray.beta-test : Output Alpha problem when exporting from blender : Re: Output Alpha problem when exporting from blender Server Time
6 Jul 2024 07:36:46 EDT (-0400)
  Re: Output Alpha problem when exporting from blender  
From: clipka
Date: 8 May 2010 05:12:21
Message: <4be52af5$1@news.povray.org>
Am 08.05.2010 10:16, schrieb Warp:
>> I've also found that 3.6 is /not/ doing it right either (at least with
>> regard to PNG), as it premultiplies alpha. Maybe 3.5 had that right, and
>> people complained about /that/ change?
>
>    I don't really understand the difference. It has never come up as any kind
> of problem when I have used POV-Ray 3.6 to render some alpha-channeled images.
>
>    (Is the perceived problem that pre-multiplying means that some color
> accuracy can be lost in the process?)

No, the main problem is that colors simply aren't right.

Compositing images with an alpha channel always works according to the 
formula:

   ResultColor = (R;G;B) * A + Background * (A-1)

The PNG file format specification demands that the file stores the raw 
values ("non-premultiplied alpha"), i.e.:

   (R;G;B;A)

However, POV-Ray - at least at present - internally uses premultiplied 
alpha, i.e. it works with color tuples of the form:

   (R*A; G*A; B*A; 1-A)

For output to PNG files, POV-Ray 3.6 only converts the transparency 
(1-A) to alpha (A), i.e. it writes tuples of the following form to the file:

   (R*A; G*A; B*A; A)
   = (R;G;B;1) * A

Obviously, if you use these values in the above formula, you get:

   ResultColor = (R;G;B) * A^2 + Background * (A-1)

which of course gives a different result color (except for A=0.0 and 
A=1.0). One symptom is that gradients from opacity to transparency, 
while appearing smooth in the preview, will exhibit pretty hard edges in 
the image file.


Post a reply to this message

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