Search code examples
opengldirectxtexturesshaderterrain

3D maps rendering in games


I have some questions about maps in 3D games (i.e. World of Warcraft) and how programmers render them:

  1. Is it possible to "smooth" the edges of mountains via some technique, or the only possible solution would be to use more vertices in a heightmap?

    enter image description here

    Am I wrong and to think that they use some kind of technique for this, as they just render a fair amount of vertices for each mountain?

  2. Take a look at this image:

    enter image description here
    (source: gamona.de)

    Some questions about how the render this kind of scene:

    1. As I've been told that open-world games like WoW use heightmaps for terrain rendering, how do they know where to draw all the other stuff? (trees, houses, fences, water etc.).
    2. How do they render underground areas? (There's a huge castle inside the mountain)
    3. Notice that every bump uses about 2 textures for its display (snow and rock). What could be the algorithm they use to know when to sample each texture? It doesn't look like it depends on normals. (I don't think they even generate normals for their terrains.)
    4. It also doesn't look like they use a skybox for the horizon. What technique could it be?
    5. Could you name other interesting techniques you noticed that I could explore?

I'm currently learning OpenGL but I tagged DirectX too as these questions aren't really API specific.


Solution

  • It is quite hard to tell from your height map (primarily because you haven't got any lighting on it) but I'd say its near definite that in your examples they are using high resolution base height maps than you are.

    Now unlike what some of the other posters suggest it is highly unlikely the landscape is being modelled in a 3D modelling package. It is also highly unlikely they are using B-splines to render the landscape.

    The big problem with using a higher resolution height map is the memory requirements. To this end there are multiple different solutions that "optimise" the height map data that is stored in memory. Nearby landscape does not need as much details as the landscape far away.

    A really good technique for rendering VAST amounts of highly detailed landscape geometry is geometry clipmaps. It's quite complicated though. Another scheme I have used to great success in the past is Geo-Mipmapping. It's very simple and very fast. It produces excellent results, too, if you apply trilinear filtering techniques to your Geo-mipmaps. It is also fairly trivial to write an asynchronous chunk loader for such a landscape to provide good streaming performance of huge landscapes.

    Anyway I'll answer your other questions.

    1. As suggested by hbdavehb they will have an editor that loads the landscape and they can then place items on the map (as well, most probably, as editing the landscape). The models will be created in 3DS Max or Maya and then loaded into the editor for placing.

    2. They are rendered with some other form of renderer. Often a portal renderer or maybe a BSP renderer.

    3. This technique is known as texture splatting.

    4. Looks like a skybox to me. It could I guess be a dynamic rendering ONTO a skybox.

    5. The list is huge. But I would suggest looking into various image mapping techniques such as bump mapping (Especially normal mapping), cube mapping, Parallax mapping, Displacement mapping. Then there would be the lighting techniques such as global illumination, the Phong illumination (not the same as Phong shading), bidirectional reflectance distribution functions and precomputed radiance transfer. That's only scratching the surface. I highly recommend having a good read around. Computer Graphics: Principles and Practice by Foley et al. is an excellent book on rendering. The GPU Gems series is very good too. For a history of 3D rendering techniques and, in my opinion, still a very useful book its worth looking at Michael Abrash's Black Book as well.

    Good luck!