|
From: Frank C. <dev...@ch...> - 2004-09-14 19:11:47
|
On 14-Sep-04, at 2:32 PM, James W. Walker wrote: > I was puzzled to observe that an object with an ARGB texture did not > become invisible, except for specular highlights, when the alpha > channel was zero. Apparently this is because Quesa uses > glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA) for transparent textures. > Is there some good reason for this? This blendfunc is used to mimic QD3D's blending. To get a transparent pixel you need to have an alpha of zero as well as RGB values that add up to zero (premultiplied alpha). The idea is that you can get additive blending and normal alpha blending by changing the art, rather than doing it in code. This is one legacy I'd rather do without to be honest... This is the source of many problems, including what you observed above (i.e. you can't fade out an ARGB texture reasonably in code). It also causes the problems with ARGB textures in fog - not that fog works on _any_ transparent triangles at the moment ;) IMHO, Quesa really needs an API that allows you to either explicitly set the blend function for the underling 3D API, or have blend function "aliases" that are translated for each API - kinda moot at this point since OpenGL is the only API involved. Either that, or a new type of Shader that does something similar - I'd love to see a "MultipassShader" object that can reference one or more texture shaders and apply them in layers with different blend functions and UV transformations - that would at least allow Quesa to compete with other scene graphs on the rendering side of things. The one-texture-per-triangle limitation grows stale real fast... Sorry for the rant :) Frank. |