PDA

View Full Version : tuxracer ice reflection



IronRaph
07-11-2002, 08:05 AM
I just want to know how ice reflection works in tuxracer
(he uses a env map ) but I don't know how ...
because :
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
is not so good as in tuxracer
thanks

knackered
07-11-2002, 09:17 AM
This is going to be some kind of arctic stategy game, I take it? http://www.opengl.org/discussion_boards/ubb/smile.gif

IronRaph
07-11-2002, 09:22 AM
go to www.Mountain-tycoon.fr.st (http://www.Mountain-tycoon.fr.st)

ScottManDeath
07-11-2002, 09:54 AM
Hi

The terrain looks nice. http://www.opengl.org/discussion_boards/ubb/smile.gif
On one of your screenshoots ( http://raphael.siryani.free.fr/mountain/publique/mountaintycoon/screen/images/shoot030.jpg ) I see that there is some kind of atmoshperic effect in the backgrounds mountains. How do you do this? Is that fog or something special?

Bye
ScottManDeath

Mezz
07-11-2002, 09:59 AM
It looks more like snow to me ScottManDeath http://www.opengl.org/discussion_boards/ubb/smile.gif

(You can see it blend to it on the left hand side of the image)

But I could be wrong...

jwatte
07-11-2002, 11:37 AM
I don't know how Tux Racer does it.

However, I do know that Sphere Maps don't look very good, and can't be updated dynamically because of the warping needed.

I suggest using cubic environment maps, which are a standard part of OpenGL 1.3, and an ARB extension that everyone supports before that.

If all you want is a reflection in a plane (like ice) then you can also look into various mirroring portal techniques, like virtually reflecting the camera position in the ice, and putting a clipping plane along the mirror plane, and re-rendering the scene in additive mode. (Stencil helps here, too) You can also render-to-texture using the same mirrored camera set-up, and put that texture on the ice.

Hope these ideas give you something to go on. Google should be full of hits if you plug in some of these words.

IronRaph
07-11-2002, 11:59 AM
thanks but such techniques is too expensive I just want to do a fake effect (like in tuxracer)
and the atmospheric is just some quad with a texture with a variant alpha channel (like in fs2002 )

knackered
07-11-2002, 12:30 PM
Just use eye linear automatic texture coordinate generation.

IronRaph
07-11-2002, 12:57 PM
ok I will try thanks

IronRaph
07-11-2002, 01:01 PM
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
float eye_plane[4]={0.1f,0.1f,0.1f,0.1f};
glTexGenfv(GL_S,GL_EYE_PLANE,eye_plane);
glTexGenfv(GL_T,GL_EYE_PLANE,eye_plane);

I don't know how I can use the eye_plane params ... wich value and why thanks

[This message has been edited by IronRaph (edited 07-11-2002).]

knackered
07-11-2002, 01:27 PM
Just try this, and let me know what it looks like...
It should just look like the ice polys are like a mirror, reflecting whatver texture you use for them.




glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
float s[4]={1.0f,0.0f,0.0f,0.0f};
glTexGenfv(GL_S,GL_OBJECT_PLANE,s);

glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
float t[4]={0.0f,0.0f,1.0f,0.0f};
glTexGenfv(GL_T,GL_OBJECT_PLANE,t);


I'm assuming your terrain is in the XZ plane, with Y being 'up'.


[This message has been edited by knackered (edited 07-11-2002).]

dorbie
07-11-2002, 09:28 PM
No this will look awfull.

knackered
07-11-2002, 11:47 PM
Nah, it'll look alright. Cartoon stylee!

dorbie
07-12-2002, 05:49 AM
Texgen linear will not look like a reflection ESPECIALLY in object space as your sample code does.

Look at what you're suggesting, you just get an incrementing s coordinate along the x axis and t along the z axis.

In otherwords you've mapped a texture flat over a horizontal plane. Congratulations, but it won't look like a reflection, cartoon or no.

Eye linear won't be much better. It'll just swim a bit in z as the modelview changes.

knackered
07-12-2002, 08:34 AM
Oh yes, sorry IronRaph, I meant EYE not OBJECT. Just replace the word OBJECT with the word EYE in my code snippet.
Dorbie, it will look ok - it won't be 'correct', but it will look ok. Tuxracer is meant to run on really old cards - even ones with only a gl subset, such as voodoo2's.