Jump to content
  • Advertisement
Sign in to follow this  

Terrain rendering, Age of Empires 3?

This topic is 4760 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, Does someone have an idea how Age Of Empires 3 does the terrain rendering? It looks great and sharp. I guess they aren't just using a large bitmaps, there's too much detail for that. Maybe blending textures per vertex(or via a image) like Farcry does? The colors also look warm and cozy, I don't know how to describe it. In many cases, textures look cold and dark but not in AOE3. Is this just a very talented artist or are there also techniques for that. Greetings, Rick

Share this post

Link to post
Share on other sites
Hey spek,

If you have the connection for it, I'd recommend going along to http://www.pqhp.com/cmp/gdctv/ and watching the talk Dave Pottinger and Michael Bean gave about the AOE3 engine at GDC2005. Being the lead programmer and senior graphics programmer respectively, they gave out plenty of cool info, including how they obtained that warm, sunshiney look. :)


Share this post

Link to post
Share on other sites
Thanks for that link, fun to watch and its nice to hear that my ideas about making a RTS game don't differ too much with those of the pro's :) Although I still don't really know how to create a nice terrain. I guess HDR and Tonemapping is used for the sunny effect but now that terrain remains.

Currently I'm using a technique like Farcry, I think at least. For testing purposes, I borrowed some detail textures from Farcry and did something like this:
1- Render the terrain with a 'colormap'. This is just a large bitmap with colors and a lightmap in it (so no real lighting is done, although its not a problem to include some 'dot(L,N)' stuff). Green parts are grass, brown are paths etc.
2- Render a second layer with mixed tiles. A terrain part can use 2,3 or 4 different detailed tileable textures. The blending factors are stored per vertex (60% grass, 10% rock etc.). This second layer is rendered with this pseudo shader:

color = grasstexture * factor1 + rocktexture * factor2 + ...

3- Blend the 2 layers like this:

< render the colormap layer >
glEnable( GL_BLEND );
glEnable( GL_ALPHA_TEST );
// glBlendFunc( GL_SRC_COLOR, GL_DST_COLOR );
< render the detailed layer >

It works but I'm not really satisfied. Althoug I'm using the same textures as Farcry, the result doesn't look the same. Farcry looks sharp and bright, my terrain is quite dark and the contrast is pretty high (grass is way to green etc.). I think the blending is done different in Farcry but I don't know how. I also tried the commented rule in the code above but that makes things worse. The beaches are almost 100% white (although the Farcry beaches seems to be overbrighted as well) and the contrast seems even higher. Does someone know what's wrong or how to improve it?

Another thing that bothers me a little bit are the limitations of this tile approach. For example, what to do if I want to make a sandpath with tracks in it? The colormap simply isn't detailed enough. The detailmaps are but they if I need to create hundreds of path textures if I want the path to have some curves. Maybe changing the UV coordinates might help though... Anyway, I think Age Of Empires 3 is doing it different, but I really don't know how.

Greetings and thanks for helping!
BTW, I'm sorry if I can't react, my internet connection is down in a few days for a while.

Share this post

Link to post
Share on other sites
as for the paths

if you create the terrain out of a heightmap
- create a octree
- pass the terrain down to the nodes
- use some triangle strip generation algorithms to merge terrain patches with the same shaders
- to implement the path you need to know which triangles lie on the path

so you could represent all vertex data of your node in a single vertex buffer
and work with indexed arrays

calculate the path with quadratic bezier curves and retrieve the vertex indices from your heightmap

now all you need to do to render your node including paths is

set shaders
render triangle strips
set pathtexture
render path

maybe create a trianglestrip for your path, although this might be a little bit expensive but your can merge several triangle strips easily so just make sure each strip your merge has a minimum of triangles

this of course requires a dynamic array for indices so deviding the paths up into little portions might be one solution so you can use a pool allocator to avoid memory fragmentation

i plan to use a similar approach in my engine but thats still a long time until i implement it

Share this post

Link to post
Share on other sites

So you basically seperate the path from the rest so that a different material can be used? Sounds logical but I wonder how to combine that with stuff like LOD or smooth transitions between the path and the tiles surrounding them. I'm currently doing something similiar, although its easier in my case as the terrain is a mesh instead of a heightmap. So making surves isn't a problem.

But what bothers me more is the coloring of my current terrain. Blending detailed textures with a colormap (see previous post) just doesn't give the result for some reason. Way to much contrast, grass is far too green for example. I think games like Farcry blend different or something. Also the terrain at a distance looks very... how do you call that in english... crunchy/pixelated. As far as I know, Farcry solves that with mipmaps but that didn't really work for me, or am I doing somethin wrong in this code:
gluBuild2DMipmaps( GL_TEXTURE_2D, GL_RGB8, width, height, GL_RGB, GL_UNSIGNED_BYTE, data )
Maybe usage of a shader kills the mipmap effect? Anyway, it just doesn't look very well. Could somebody tell what's the difference in the Farcry approach and mine(see previous post)? I already saw a post here where someone made a nice terrain using that technique. He also explained how, except for the blending stuff if I was right.

Another little question. AOE3 seems to use bumpmapping for the terrain as well. Cool but why? If the lightsource(sun) and object(terain) don't move (much), and you'll see that terrain from quite a distance, this bumpmap effect isn't really noticable right? Of course you see a difference but this extra shadow or specular highlight could as well be drawn onto the terrain textures as its pretty static anyway, the difference might only be noticable a little bit on a surface with hills. As far as I know, normal bumpmap shaders depend on the lightVector and the normals, not on the cameraVector. Or am I wrong? Or maybe they are using more advanced bumpmapping where the camera position actually matters?

Thanks for helping!

Share this post

Link to post
Share on other sites
i d say they useas

aka as trilinear filtering "see redbook(third edition) page 394"

and yes it affects LOD but in my case a strategy game with fixed direction camera this doesnt matter

as for the blending part:

fragmentcolor = layer 0
fragmentcolor = fragmentcolor(1-factor1)+layer1*factor1
fragmentcolor = fragmentcolor(1-factor2)+layer2*factor2

with alpha blending


and the alpha func to 10 oder 15% to avoid reduce the number of fragmentoperations that hardly have a affect

bumpmapping is a easy way to add additional detail without much of an effort
you dont haveto rework tons of textures you just create a shader description file and specify all the parameters and the renderer does the rest

this allows you to switch the bumpmaps without reworking your textures
in general its not very difficult to impement especially when you work with vertex/pixelshaders anyways

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!