PDA

View Full Version : Reflaction in UT2k/Splinter Cell ...



Luminous Blue
05-14-2003, 09:24 AM
Hello

have you seen the cool looking (reflaction) marble in Splinter Cell or the rusty metal in UT2k ? (reflact more or less from the base texture)
that's what i wanna do i know it's a sort of alpha masking but i don't know how to
setup the texture env comine mode


UT2k3 use

1. base texture with alpha mask
2. env map
3. detail map
and some other

how do they paint them ?

1st solution (my)

TMU 1 base texture
TMU 2 env map
TMU 3 detail map (not important for the effect)

paint the env map only at those pixel where the alpha from TMU 1 are higher ? how ?

2nd solution (my)

TMU 1 base texture
TMU 2 env map
TMU 3 base texture alpha
TNU 4 detail map (not important for the effect)

paint the env map only at those pixel where the alpha from TMU 3 are higher ? how ?

what ist the right way and witch comine mode ?

thx

LB

knackered
05-14-2003, 10:50 AM
Reflaction! I love it! http://www.opengl.org/discussion_boards/ubb/smile.gif

I think it's as simple as this:-



glActiveTexture(GL_TEXTURE0);
glBindTexture(...base texture);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

glActiveTexture(GL_TEXTURE1);
glBindTexture(...env map);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);

Luminous Blue
05-14-2003, 01:01 PM
Hi ->knackered<-

GL_DECAL that's is it ?! (the env map has no alpha)
i don't think it's so simple cos
when you look at the rusty metal (UT2k3 bonus pack -DM_Rustatorium- or -DM_Icetomb- ...)
in the UT Editor you will see something more then an simple base texture and cube map

i try to tell you in a better way:

you can see at full detail level the base texture + cube map + detail map + ?someone other?

the cube map lays not full in front (with tranperency) of the base texture
you can see at some places the material is rusty and it reflect less as on other places
i know they use the base texture alpha channel (again) to combine the cube map and the
base texture


this is my test register combine but it shows the base texture in an gray scale
in front (with holes) of the env map (if i had color it will be perfect)

glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_INTERPOLATE_EXT);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_REPLACE);

glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_EXT, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PRIMARY_COLOR_EXT);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB_EXT, GL_PREVIOUS_EXT);

so what's up ?!!

Thx
LB




[This message has been edited by Luminous Blue (edited 05-14-2003).]

knackered
05-14-2003, 01:13 PM
Mmm, no I think it really is just GL_DECAL. Decal just lerps between the 2 texture stages based on the alpha of the 1st texture stage. Look it up in the red book, or msdn.

Unless what you're observing is perpixel cubemap reflection (environment bump mapping), in which case that has nothing to do with the way it's combined with the base texture...and unless you've seen it all running on something with a geforce3 or above, I doubt that is what you're seeing.

Luminous Blue
05-14-2003, 01:22 PM
Nope
no environment bump mapping !
the env map has no alpha
and UT2k3 run on GF2 like on GF4 (ok no detail map and less quality)

if you have an old car the sun light at some places reflect more or less! (thing you have to clear it up (-; )

something like:
1. draw base texture
2. draw env map at the alpha value from the base texture


Thx

LB

[This message has been edited by Luminous Blue (edited 05-14-2003).]

[This message has been edited by Luminous Blue (edited 05-14-2003).]

Luminous Blue
05-14-2003, 11:11 PM
Ok OK ->knackered<-

after some sleep i test GL_DECAL with alpha testing on and i play around with the
alpha/blend function but the result i see was the base texture as an 1bit mask in black
in front of the env map what happen ?

thing i must drink some more coffee (-: jet


note: some times it is better you sleep some time and let work be work !


Thx

LB

[This message has been edited by Luminous Blue (edited 05-15-2003).]