PDA

View Full Version : Texture Alpha Masking



Luminous Blue
06-28-2003, 11:09 AM
Hi there

some time ago i post this
>>>Reflection in UT2k/Splinter Cell ...<<< http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/009530.html
to the forum but i got no good answers (may be my mistake?!)


after some work and (re)search i found in the DXSDK the following


MODULATEALPHA_ADDCOLOR
Modulate the color of the second argument,
using the alpha of the first argument
then add the result to argument one.

Arg1.RGB + Arg1.A*Arg2.RGB


and thats what i wanna do in OGL

TMU0.RGB + TMU0.Alpha * TMU1.RGB

finaly

PrimaryColor * TMU0.RGB + TMU0.Alpha * TMU1.RGB

On TMU0 i setup a RGBA diffuse texture with GL_MODULATE
On TMU1 i setup a RGB sphere map that is added to the diffuse texture on TMU0 using
the alpha channel from TMU0 as a mask

UT2k call it CombineOperation -> CO_Add_With_Mask_Modulation

but how do i setup the EXT_texture_env_combine/NV_texture_env_combine4 ?
And how can i do it without NV_texture_env_combine4 ?


Can anybody help me?


Thx

LB

Luminous Blue
06-30-2003, 02:39 AM
Yes i made it

gloss mapping NV_texture_env_combine4 version

glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE4_NV);
glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_ADD);

glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_PRIMARY_COLOR_EXT);
glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR);

glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE0_ARB);
glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR);

glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE2_RGB_EXT, GL_TEXTURE1_ARB);
glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND2_RGB_EXT, GL_SRC_COLOR);

glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE3_RGB_NV, GL_TEXTURE0_ARB);
glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND3_RGB_NV, GL_SRC_ALPHA);


but how to do it without NV_texture_env_combine4 ?
ATI_texture_env_combine3 ?
2 pass render ?


LB

tellaman
06-30-2003, 05:57 AM
simply use alpha buffers and do a 2 pass algorithm
second pass uses blending to destination alpha and glequal as depthfunc