PDA

View Full Version : possible to use color of first pass in a second pass mtex combine?



CrazyButcher
05-22-2004, 08:19 AM
for ogl 1.3, so no fancy shader stuff available

to make texture masking (using previous tex's alpha) work in a multipass environment, I wonder if its possible to skip a texture unit from being drawn.

We are in a second pass.

The idea is to fake a DST_ALPHA blend (because no alpha buffer is availabe).

now I bind the texture with the mask to the tex0,
and interpolate tex1 using tex0 alpha

the problem is now
how do I make sure that the incoming fragment in this interpolation is actually whatever was drawn in the first pass ?
if I use primary color or texture it would not be what was drawn in first pass, but the object's color.
is there a way to skip object color in a 2nd pass and get the Cf of the first pass ?

thanks in advance :)

jwatte
05-22-2004, 11:21 AM
Framebuffer blending is implemented in the memory controller, not in the fragment processing pipeline, thus the color of the fragment destination pixel is not available until you get to blending.

You can copy the previous frame buffer to a texture, which you apply using camera-space texgen, and use that as input to the next pass.

CrazyButcher
05-23-2004, 01:58 AM
ah rats hehe
okay well I guess I will enforce alpha buffer, or limit the effect to the first pass (when I can still do it sucessfully in combine) cause your idea sounds more complex and slower to do, especially as the engine is supposed to run on older hardware, I guess that copying fbuffer to a texture and all that will be a bigger hit on hardware that likely already is in trouble.
but thanks for your insight.

about the alpha buffer, I saw that I can only use it in GLUT when bpp is 32, and looking into some beefed up quake2 engine, they set bpp to 32/24 bit as well, but do not specify bpp for alpha buffer, however they can actually make use of it, which confused me.
Also how is q3 able to run in 16 bpp and able to get a alpha buffer.