|
From: Roger H. <rog...@mi...> - 2009-08-22 09:22:05
|
On 22 Aug 2009, at 01:25, James Walker wrote: > I thought I was correctly handling transparency with multiple lighting > passes in QORenderer::Renderer::RenderTransparent, but it turns out > that > in some cases it can be visibly incorrect. I'll try to explain a > simplified scenario. > > Suppose we have an nearly-opaque object with color A, and in front of > that there is a transparent object with color B. There are 2 lighting > passes, contributing brightnesses L and M respectively. Then the > resulting color value ought to be B*(L+M) + (1-alpha)*A*(L+M). For the diffuse component of the lighting, shouldn't that be alpha*B*(L +M) + (1-alpha)*A*(L+M) ? As my renderers are pure software ones, I'm not familiar with glBlendFunc so cannot comment on that but maybe it supports my version of the formula. The specular component is just added on, not being affected by the alpha. Roger |