in the warcraft 3 engine, the terrain is broken up into tiles. these tiles are square and are textured. here is where the question comes in. in the game’s map editor, it is possible for one tile to have FOUR different textures…for example, one corner is grass, one corner rock, one corner dirt, one corner dark grass. usually the “base” texture is dirt, and the grass/rock textures are textures with alpha channels. my first thought was that this was done via multitexturing…but with four textures on one tile, this would not be viable for older video cards. so my question is, how is the texturing done in warcraft 3?
There are two basic ways:
- generate unique textures per tile
For help on 1), look up glEnable(GL_BLEND) and glBlendFunc(…).
Multi-passing is a time-honored tradition. I think even Quake 1 did it…
this is also possible with multitexture though of course earlier cards will handle less textures at a time
forgot to add u will need to use a more powerfuil texture combining method eg tex_combine_arb (
[This message has been edited by zed (edited 09-15-2002).]
You could store all the possible graphic quads in a single texture, and use sub-part of it as the texture for your quads. You would end up with more vertexes, but only one pass. Should be faster.
It’s very interesting all your opinion, but I would like to know what exactly means “MultiPass”.
That means the tile is drawn with the 1st texture, then a second processing drawn again the 2nd texture with blending?? etc…?
The tile is computed several time per frame?
I would like to know what is the “MultiPass” process.
I don’t think there’s any multipass going on, I think they just use unique tile textures just like in the good old 2d days. Since there only are a limited number of transition patterns available I really don’t see the point in using multi pass. If you want high detail texture transitions on hardware with few tex units, use splatting.
Each time you render your scene, or even part of the scene, this is a pass. So like for example, lets say you want to apply a lightmap to a surface that has some texture. Well first you draw the surface with its base texture, beit bricks, rocks, whatever, and then you enable blending, set the blending mode and render the surface AGAIN with the lightmap set as the active texture. Now this operation was two passes. Of course before the second pass you will have needed to enable the correct blending mode which is to multiply the second pass with whats already in the framebuffer (stuff from the first pass). I dont have my RedBook with me but I think the blending mode for this would be GL_DST_COLOR, GL_ZERO. I hope that helps in understanding what multipass rendering means. It can sometimes get pretty tricky getting it to work correctly if you havn’t been doing it for a while. I still have trouble sometimes.
[This message has been edited by SirKnight (edited 09-16-2002).]
harsman: Splatting is a multi-pass technique. In fact, pretty extremely multi-pass.
zed: Agreed that you should combine as many passes as possible into texture stages, and thus only need ceil( N/M ) actual passes where N == total layers, and M == available texture units.
antorian: Anytime you glEnable( GL_BLEND ) and draw “the same” geometry again, you’re doing multi-pass rendering.
Jwatte, I know splatting is multipass (depending on the amount of texunits and groundtextures you have of course). It was just a suggestion for a good way to get nice terrain texturing. I don’t think Warcraft III uses splatting, I think it uses unique tile textures with pre defined transition patterns. However, if you don’t want that and want higher quality, I think splatting is a reasonable muli pass approach.
Just another point:
When you’re doing multi-pass rendering with tiles, must you compute vertices for each pass or only for the first (if the land doesn’t move)??
Are the Draw List useful for that?
If you are drawing the same geometry again, there shouldn’t be any need for you to recompute a vertex yourself (if you’ve stored them
somewhere, of course).
However, the graphics card might have to go through transformation and lighting.
You could use the compiled vertex arrays extension which might help out there as the graphics card can see you aren’t changing the geometry each time.
Only use display lists if you want zero flexibility with whatever you are drawing - i.e. you know you’ll always draw it that way all the time.
Of course, that could be useful if you put each tile in a single display list and called the list for each individual tile, but since you’d only be pushing a few vertices around it might be quite inefficient in those terms.