[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: landscape and footsteps
On Fri, Apr 27, 2001 at 11:09:07AM -0500, Steve Baker wrote:
> TuxRacer has regularly gridded terrain - and for them they just overlay
> the two textures on different polygons and have one fade out to transparent
> as it crosses the other. It looks *great* - but only on a dense, regular
> triangle mesh.
As an aside, you can also use multitexturing to control the blend
between the two terrain textures. Instead of fading gradually from one
to the other, you use an alpha texture to modulate the second terrain
texture. That way you can make snow get patchy in the transition to
rock, etc. We're doing this in Tux Racer now and it works quite well.
Here's a rough outline of how this works. For each of the blended
- Draw the triangles with the first terrain texture
- Prepare for a second pass as follows:
- Bind the second terrain texture to the first texture unit
- Bind the alpha map texture to the second texture unit
- Set up the texture combiners to use the colour (RGB) from the first
texture unit and the alpha channel from the second texture unit.
- Draw the triangles again
There are some tricky issues involved, especially in arranging your
alpha maps so that they match up at triangle boundaries. How this is
done will depend on how your terrain is triangulated. In tuxracer we
need four different alpha maps for all of the different blending cases;
the texture memory requirements aren't too bad though since the alpha
maps can be very low-res, and only the alpha channel is needed.
Obviously, this will only work on cards with at least two texture units.
I'm currently using the GL_EXT_texture_env_combine extension to do this,
which is supported on most nVidia cards (TNT and beyond), but I'm not
sure about others (most likely the Radeon, definitely not the Voodoo3,
not sure about the Voodoo4/5).
Jasmin Patry Lead Programmer, Tux Racer
To unsubscribe, e-mail: firstname.lastname@example.org
For additional commands, e-mail: email@example.com