Jump to content

  • Log In with Google      Sign In   
  • Create Account


Terrain or 3d model with physics?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
13 replies to this topic

#1 oenda   Members   -  Reputation: 136

Like
1Likes
Like

Posted 03 March 2014 - 05:37 AM

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

 



Sponsor:

#2 mark ds   Members   -  Reputation: 1118

Like
1Likes
Like

Posted 03 March 2014 - 07:45 AM

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.


Edited by mark ds, 03 March 2014 - 07:53 AM.


#3 oenda   Members   -  Reputation: 136

Like
0Likes
Like

Posted 03 March 2014 - 11:06 AM

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



#4 Krohm   Crossbones+   -  Reputation: 3015

Like
0Likes
Like

Posted 03 March 2014 - 11:11 AM

"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.



#5 mark ds   Members   -  Reputation: 1118

Like
4Likes
Like

Posted 03 March 2014 - 12:46 PM

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

 

ScreenShot5.jpg

 

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.



#6 frob   Moderators   -  Reputation: 19628

Like
6Likes
Like

Posted 03 March 2014 - 01:32 PM

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.


Check out my personal indie blog at bryanwagstaff.com.

#7 oenda   Members   -  Reputation: 136

Like
0Likes
Like

Posted 04 March 2014 - 03:33 AM

Thanks for all replies



#8 TheChubu   Crossbones+   -  Reputation: 3951

Like
1Likes
Like

Posted 04 March 2014 - 06:55 AM

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


#9 warnexus   Prime Members   -  Reputation: 1394

Like
0Likes
Like

Posted 04 March 2014 - 02:34 PM

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"!


Edited by warnexus, 04 March 2014 - 02:36 PM.


#10 Nathan2222_old   Members   -  Reputation: -400

Like
0Likes
Like

Posted 04 March 2014 - 05:42 PM

 
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
smile.png
--
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


#11 frob   Moderators   -  Reputation: 19628

Like
1Likes
Like

Posted 04 March 2014 - 06:48 PM


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.

Think about that for a minute.

 

About 50 -- The number of characters on screen at any time for most games.

About 5,000 -- the maximum number of characters allowed on a single server in many MMO games (which are optimized for that sort of thing, and usually involve multiple computer boxes as part of a server cluster).

About 1,000,000 -- The number of characters you are asking to simulate on the player's PC.

 

Being "realistic" is an interesting goal. The more data you keep around the more processing you need to do. 

 
 

Consider that fairly complex games like The Sims actually do simulate every person who is active in the world, although they do their best to kick people out of the world when possible. In The Sims 3 you can get around 150 people to arrive in your lot using cheats, and there are also game mods that remove the limits. Getting a few hundred sims active in the same area is enough to bring most machines to their knees.

 

 

If you are spending all your time simulating what a million other city residents are doing, and simulating millions of televisions being on or off, cell phones being used, broken and unbroken windows, millions of vehicles with potentially broken windows flat tires and gunshot damage and more ... well, I'm not sure the common home computer has that kind of processing power for an interactive simulation.


Check out my personal indie blog at bryanwagstaff.com.

#12 mark ds   Members   -  Reputation: 1118

Like
0Likes
Like

Posted 04 March 2014 - 07:30 PM

 

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"!

 

 

Here's a video of it in action - the higher detailed terrain 'follows' the player around. If you download the video, it will play at a much better quality - skydrive seems to be obliterating the pixels!

 

https://onedrive.live.com/?gologin=1&mkt=en-GB#cid=A1E3EF8FE4E65918&id=A1E3EF8FE4E65918%2111295&v=3

 

Under the cursor (centre screen) you can just about see the small dense area which is the relatively high-res mesh using the heightmap.


Edited by mark ds, 04 March 2014 - 07:32 PM.


#13 Nathan2222_old   Members   -  Reputation: -400

Like
0Likes
Like

Posted 05 March 2014 - 08:46 AM

@frob: i didn't mean simulating every npc's action.
For example, if the pc throws a grenade into a building and it explodes thereby destroying it, the rubble from the explosion should still be there even if the player never comes back there until after 30 missions.

UNREAL ENGINE 4:
Total LOC: ~3M Lines
Total Languages: ~32
smile.png
--
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


#14 swiftcoder   Senior Moderators   -  Reputation: 9731

Like
0Likes
Like

Posted 05 March 2014 - 11:44 AM


For example, if the pc throws a grenade into a building and it explodes thereby destroying it, the rubble from the explosion should still be there even if the player never comes back there until after 30 missions.

You still may run into issues of storage space. It's an interesting problem to represent a world that supports permanent changes - what happens if the user chops down every second tree across the entire continent?

 

It's not insoluble, of course, and if your world is all pre-created, then the storage requirements for state changes shouldn't drastically exceed the storage requirements for the original world. Procedurally generated games like minecraft suffer much more badly, because may be arbitrarily large, and have very low intrinsic storage requirements.


Tristam MacDonald - Software Engineer @Amazon - [swiftcoding]





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS