Posted by Frank C. on January 21, 2004 at 15:18:51:
On 21-Jan-04, at 2:36 PM, Joseph J. Strout wrote:>> There's no real way of fixing this without adding some face/vertex
>> attribute extensions that allow you to explicitly assign blend modes.
>
> Extensions to what? You're not proposing that we need new Quesa APIs
> for dealing with this, are you?Maybe I'm misunderstanding the whole 3DMF/QD3D philosophy but I thought
it was standard practice to add extensions to the format to cater to
specific renderers, and that those attributes are simply ignored if a
renderer doesn't support them.I'm suggesting that perhaps Quesa's default interactive renderer could
use some extensions to keep up with the times, (or in this case keep up
with QD3D) though I suppose it could just as easily be done in a
plug-in renderer.> I'll cheerfully expose my OpenGL ignorance here; can you explain in
> more detail why it's difficult to use additive blending for textures
> but not for fog?I won't vouch for my technical accuracy below :) but as far as I
understand, this is how it works:The texture and fog are rendered at the same time, so the current blend
mode affects both. You could blend fog in a separate pass (and many
games do, especially for volumetric effects) but that would incur a
performance hit.The additive-fog problem only occurs when the source fragment doesn't
respect the texture's alpha channel (as in the mode (GL_ONE,
GL_ONE_MINUS_SRC_ALPHA) used by Quesa). The pixels end up being
framebuffercolour+fogcolor where the alpha is transparent. Typically
you would use (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) for normal alpha
blended effects, and (GL_SRC_ALPHA, GL_ONE) for additive effects, and
everything will work just fine in fog, but neither of these will
reproduce QD3D's behaviour on their own.There may be a way to keep the QD3D behaviour and make it work in fog
using vendor extensions, register combiners, or destination alpha, but
I'm just not sure - these aren't standard across hardware so it'll be
messy and may not work at all on some hardware (if it's possible). I'm
not up to speed with Vertex/Pixel shaders, but I suppose anything is
possible with those, but with even less hardware compatibility...Frank.