Terrain or 3d model with physics?

Started by
12 comments, last by swiftcoder 10 years, 1 month ago

Hi.I want to know that how game developers create a 3d world?For example Skyim.Are they using terrain algorithms and create a terrain?Or they create a 3d model with 3ds Max/Blender then add physics?I am waiting for your reply smile.png

Advertisement

Skyrim (and Oblivion) are both based on heightmaps made with a heightmap editor. However, only a fairly small area around the player is rendered this way. For more distant terrain they use 3D models derived from the heightmap data, to reduce the number of polygons for different LODs.

If you own a copy of Skyrim (or Oblivion) it's really easy to see how they do it - just open the console and enter:

tcl

twf

The first command allows you to fly around, and the second shows wireframe view.

Thanks a lot.Using 3d models(world mesh) will use a lot of RAM?

"A lot" is very vague. More, for sure.

Height maps allow you to reduce the memory required for each vertex: instead of having xyz vertices you can go along with xy vertices, with z pulled from the heightmap.

On top of that, the same "heightmap sampling" mesh can be reused for each chunk.

As a fact, in many cases it is possible to just build the vertices procedurally so you don't even need xy at all.

Previously "Krohm"

Here's Skyrim showing how it's done (for those that don't own the game)

[attachment=20202:ScreenShot5.jpg]

[attachment=20201:ScreenShot4.jpg]

Whiterun is centre bottom, and is surrounded by a high-res mesh with samples taken from the heightmap. The rest is made from 3D models.

As pointed out, terrain is a fun beast because there is so much of it.

In an open world with somewhat sparse vegetation (eg real life where I live near the edge of a desert on the edge of a mountain range) I can go to one mountain peak that is about 2000 meters above the valley floor nearby. I can look out over the horizon, out over the sand dunes that disappear over the curve of the Earth, or I can look across the city in the valley and see a huge range of mountains that extends off to the distance as far as occlusion allows. I can look to a distant cliff that is almost 200km away, pay attention to a specific tree or rock face, climb down, drive across the valley while still paying attention to the tree and watch as the details and visual quality continually increase until I am standing next to it.

Open world games do all they can to simulate that kind of environment and some of them do an amazing job at it.

Up close many games use a height map. This is just a grayscale image. Darker pixels are lower, brighter pixels are higher. The exact resolution is going to depend on the game, maybe one pixel every 5 meters or so. This is augmented by placing 3D modeled objects on top of the terrain, rocks and boulders and grass and trees, so it doesn't look so flat. This is nice because it limits the terrain complexity to something artists and level designers can easily manipulate, it allows for fairly uniform automatic terrain generation that looks pretty good, and when consistent rules are applied, it looks reasonably natural.

While this works pretty well for nearby data, it doesn't work too well for the distance. Height maps for a small area can be a few kilobytes in size, sometimes a few megabytes, depending on how they map in terms of meters-per-pixel. But going back to the mountain peak example, if you want to store a very large area you are suddenly looking at hundreds of megabytes or gigabytes of heightmap data, plus their splatmaps to figure out what to draw on them.

Because this is basically simple pictures, the size requirements grow by the square. If you want 1 square kilometer say it takes 4KB of data. If you want 2 square kilometers it takes 16KB of data. Those aren't bad. But if you want to see the mountains and foothills in the distance all around you, suddenly your requirements are massive. A good-sized valley (like the one I live near) may be around 1500 square kilometers, and if you want the surrounding mountains to show up you'll need to cover around 3,000 square kilometers, which at that scale is 36 gigabytes of height maps just for the nearby visible terrain. So clearly, while the height map solution saves a lot of space for nearby terrain it is a horrible solution for distant terrain.

So the tradeoff is to use lower resolution data for distant stuff.

Some will trade off precision. You don't need to have a 5-meter-per-pixel (mpp) height map when you are looking it mountains that are 40 kilometers away, instead using a quadtree-style algorithm based on distance to switch from 5mpp, then 10mpp, 20mpp, 40mpp, 80mpp, all based on distance. This is a Google Earth style solution where somewhere in the world there is a massive collection of data, but very few parts of it are loaded on your machine at any time.

Others will use a height map for nearby stuff and use a pre-rendered skybox image for distant items. It allows artists to take artistic liberties with the landscape, because in reality natural landscape become boring very quickly.

Still others will have preprocessed distant zones into simple meshes that are all drawn seamlessly with the local terrain. This is the Skyrim example above. Some zones in the distance will only have sparse peaks to be modeled, some will be completely invisible from the location, some will have quite a lot of information on the side facing your area. Generating this type of map can be an intense pre-processing effort.

Still others will put the player into a bowl so they can't see the edge of the nearby terrain, giving a ring of actual terrain, a ring of models, and a distant skybox.

And others will come up with their own new and creative solutions.

The complexity of data management and the sheer size of the content are two reasons many games shy away from large, continuous, open worlds. Managing the terrain and stationary objects by itself can be a serious exercise in software engineering.

Thanks for all replies

Skyrim (and Oblivion) are both based on heightmaps made with a heightmap editor. However, only a fairly small area around the player is rendered this way. For more distant terrain they use 3D models derived from the heightmap data, to reduce the number of polygons for different LODs.

I thought the map in Skyrim was very clever.

They basically thought "See all the lower level LODs rendered in Oblivion? What if we make a map out of them?". It is just like that, the ingame map just renders the lowest detailed terrain meshes and lays them up so you can get an overview of them.

Compute LOD for the entire game and get a very cool map for free.

One particular thing about Skyrim/Oblivion is that Bethesda pre computed the LOD levels of the terrain, you don't have any fancy algorithm to generate lower detailed meshes at runtime,¡ but it streams the lower LODs from disk as needed. World is divided on squared cells so you have the cell the player is currently on, a few surrounding cells loaded at full detail so the player can see enemies at some distance, and the rest is lower detailed meshes.

Skyrim also caches "interior cells", I think it was the last 2 or 3 that you visited, so you don't hit full reload time if you say, got out of a shop forgot to buy something so you head back again.

While terrain level of detail varies a lot, I think items and actors not. When you see an enemy at 200m, it has fully detailed meshes (armor, weapons, body, etc).

In games like Mount & Blade where having many actors in screen is crucial (ie, 200 vs 200 battle), there are various levels of detail for everything, from landscape rocks, to armor, weapons and body meshes.

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

My journals: dustArtemis ECS framework and Making a Terrain Generator

Skyrim (and Oblivion) are both based on heightmaps made with a heightmap editor. However, only a fairly small area around the player is rendered this way. For more distant terrain they use 3D models derived from the heightmap data, to reduce the number of polygons for different LODs.

If you own a copy of Skyrim (or Oblivion) it's really easy to see how they do it - just open the console and enter:

tcl

twf

The first command allows you to fly around, and the second shows wireframe view.

What would happen if the player arrived at the "once was distant terrain"? Would the level of detail changed relative to where the player is located or if the player is looking at that direction?

This thread is just an "eye-opener"!


In an open world with somewhat sparse vegetation (eg. real life where I live near the edge of a desert on the edge of a mountain range) I can go to one mountain peak that is about 2000 meters above the valley floor nearby. I can look out over the horizon, out over the sand dunes that disappear over the curve of the Earth, or I can look across the city in the valley and see a huge range of mountains that extends off to the distance as far as occlusion allows. I can look to a distant cliff that is almost 200km away, pay attention to a specific tree or rock face, climb down, drive across the valley while still paying attention to the tree and watch as the details and visual quality continually increase until I am standing next to it.


Open world games do all they can to simulate that kind of environment and some of them do an amazing job at it.

Up close many games use a height map. This is just a grayscale image. Darker pixels are lower, brighter pixels are higher. The exact resolution is going to depend on the game, maybe one pixel every 5 meters or so. This is augmented by placing 3D modeled objects on top of the terrain, rocks and boulders and grass and trees, so it doesn't look so flat.
While this works pretty well for nearby data, it doesn't work too well for the distance. Height maps for a small area can be a few kilobytes in size, sometimes a few megabytes, depending on how they map in terms of meters-per-pixel. But going back to the mountain peak example, if you want to store a very large area you are suddenly looking at hundreds of megabytes or gigabytes of heightmap data, plus their splatmaps to figure out what to draw on them.

Because this is basically simple pictures, the size requirements grow by the square. If you want 1 square kilometer say it takes 4KB of data. If you want 2 square kilometers it takes 16KB of data. Those aren't bad. But if you want to see the mountains and foothills in the distance all around you, suddenly your requirements are massive. A good-sized valley (like the one I live near) may be around 1500 square kilometers, and if you want the surrounding mountains to show up you'll need to cover around 3,000 square kilometers, which at that scale is 36 gigabytes of height maps just for the nearby visible terrain . . .
Some will trade off precision . . .
Others will use a height map for nearby stuff and use a pre-rendered skybox image for distant items.
Still others will put the player into a bowl so they can't see the edge of the nearby terrain, giving a ring of actual terrain, a ring of models, and a distant skybox.
The complexity of data management and the sheer size of the content are two reasons many games shy away from large, continuous, open worlds

Very insightful post.
My game interests is basically open world and racing games. Realism is crucial and it'll be mostly PC games.
When playing a gta game and you're riding in a car, for instance. You see another car out your left side. Why is it that the car magically disappears when you look away for a second?
Imagine a 7km * 7km open world game where oceans, lakes, forests, little deserts, a city and a total npc population of 1,000,000+ is present. Isn't it possible to have a system that saves what happens because in all gta games i've played, driving through an area isn't that fun because let's say you could hit down a tree, if you came back after 30seconds - 3minutes later, you won't see a trace of that fallen tree or cars that got hit by the tree or the bodies of the people that died and that isn't realistic.

UNREAL ENGINE 4:
Total LOC: ~3M Lines
Total Languages: ~32

--
GREAT QUOTES:
I can do ALL things through Christ - Jesus Christ
--
Logic will get you from A-Z, imagination gets you everywhere - Albert Einstein
--
The problems of the world cannot be solved by skeptics or cynics whose horizons are limited by the obvious realities. - John F. Kennedy

This topic is closed to new replies.

Advertisement