|
![](/i/fill.gif) |
On Sat, 30 Sep 2000 13:17:12 +0200, Rune wrote:
>"Peter J. Holzer" wrote:
>> 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)
think we are talking about the same thing (tr is a scalar then).
>> 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
After. The alpha value must affect all three channels alike.
>and before or after it is clipped to the 0 to 1 range.
Not sure about that.
>> 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?
Depends on how you do it.
If you simply compute every ray twice, you can centralize the change at
a single point - just before writing the pixel to the file.
If you want to optimize it, you will have to change a few data
structures and probably lots of code. But then you need to do the
intersection tests only once per ray, and you may save some (or even a
lot) of the color computations, too.
The extra data and checks will probably slow down normal renders down a
bit.
hp
--
|_|_) | Sysadmin WSR | vor dem rechner.
__/ | http://www.hjp.at/ | at.linux, 2000-09-24
Post a reply to this message
|
![](/i/fill.gif) |