|
|
"Peter J. Holzer" wrote:
> When converting an RGB value to grey, the components are usually
> weighted <0.59, 0.30, 0.11>.
I thought about that. It may be better to weight the colours that way when
calculating the transparency. I don't know.
> I like it. However, now we have two RGB triplets for every pixel,
> and none of them is the correct value to store in a PNG file.
>
> It is pretty easy to compute however. If pb and pw are the RGB
> colour vectors for black and white background, respectively, we
> can compute:
>
>
> alpha = 1 - tr
Well, that's exactly what I was trying to say in my explanation. :-)
However, I think this would be more correct (because the vector components
are averaged):
tr = (pw-pb) * <0.59, 0.30, 0.11>
alpha = 1 - (tr.red + tr.green + tr.blue)
> p = pb / alpha
I hadn't thought about doing it just that way, but it seems like it creates
the same
result as I was thinking of. 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 and before or after it is clipped to the 0 to 1 range.
I'd like to make some more test, but it's a bit difficult. Does PaintShopPro
5 have a way of dividing one image with another? I can only find out how to
subtract.
> now write p, alpha to the PNG file.
Yes.
> This could even be done now by rendering the scene with a black
> and white background and calculating the final image plus alpha
> from the two results.
I've already tried something like that, and it seems to work.
> Doing it in Povray will shave off the parse time, but every pixel
> will still have to be computed twice.
I don't know the details about the raytracing process, but does the ray
really have to be traced twice just to find the result with two different
BG-colours?
Isn't a ray made up of several steps (several rays) where only one step
would have to be calculated twice?
> I am also a bit worried about reflective surfaces. They may
> erroneously show up as "transparent".
That's something I had planned to talk about after this discussion (instead
of taking it all in one chunk).
I think it would be nice if the user in the global_settings could choose
between 3 solutions.
alpha_behaviour 1: (semi-)transparent and reflective surfaces will show up
as (semi-)transparent in the output-image. This may be useful for some
purposes.
alpha_behaviour 2: (semi-)transparent and reflective surfaces will show up
as solid in the output-image. This is probably useful for many purposes.
alpha_behaviour 3: For transparent objects with an ior of 1, it works like
alpha_behaviour 1. For other transparent objects and reflective objects, it
works like alpha_behaviour 2. This is probably the most useful behaviour.
Another idea would be to turn on or off alpha for individual objects.
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 August 7)
/ Also visit http://www.povrayusers.org
Post a reply to this message
|
|