PDA

View Full Version : Multitexture fade



Umora
02-27-2003, 05:23 AM
I need apply two semitransparent texture onto quad but while one must be fade-out with time, second fade-in (just like fire and smoke in sprite explosion). Can you explain how to apply that fade-in/fade-out parameters. They (parameters) are floating point values in range 0..1
Thanks.

Umora
02-27-2003, 05:44 AM
Searcing this forum show that i must use register combiners for achieve desired effect for one pass in multitexture mode.
Is it really the only solution for nv25 hardware? Or this is still possible without extension but just with multitexture?

drewT
02-27-2003, 07:34 AM
You could do this without extensions if you used two polygons. Something like this:

-set alpha for texture0
-disable depth write
-drawPolygon with texture0
-set alpha for texture1
-enable depth write
-drawPolygon with texture1

drew

DFrey
02-27-2003, 08:09 AM
You can also do this simply using the GL_ARB_texenv_combine or GL_EXT_texenv_combine extension. Setup the interpolate combine operation on the second stage. And set your fade parameter to be the interpolation parameter. And of course set your 2 interpolation sources to be the 2 textures.

Umora
02-27-2003, 09:03 AM
2 drewT:
if i understand you correctly, you propose set alpha value for texture - is this mean reloading entire RGBA texture with newly setted alpha value or it is possible to change only alpha portion of color for polygon? I think in case with color i MUST use additive blending. Am i correct?

2 DFrey:
I'm reading now about that extension, but this is only the part of task, I must combine 4 textures (one of which must be used as alpha for combination of other three). And that three blended with weights w1, w2 and w3 -> w1+w2=1 and w2==w3.

It seems like i can't avoid of using the register combiners.
I'm read all what i was able to find about nvparse and register combiners, they still beyond my comprehension. I even cant realize how to pass my fade parameter to the RC program.
Can somebody give me a hint - how can i pass parameter? Is there special registers which is accessible from main program to write, or i may use vertex program and pass parameter via specific register?

DFrey
02-27-2003, 09:25 AM
In that case, perhaps GL_ARB_texenv_crossbar or GL_NV_texenv_combine4 is a better solution.

DFrey
02-27-2003, 09:31 AM
Also, looking at your "weights" there appears to be only one independent weight. And the others are either identical, or 1-weight, which the combine and crossbar extensions can easily handle.