Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Distant 3D object rendering [games]

What is the basic premise behind technology such as is found in Oblivion (and other games, I'm sure; haven't played enough to know), wherein objects from afar are vaguely shown when you view them from a distance? For example, a large tower is a mile away and you see the vague rectangle of it sticking up from the horizon... Obviously a giant 3D scene cannot all be rendered, and I know that in the case of heightmaps there are just approximation algorithms that are used to reduce the heightmap quality further away from the camera, but for specific objects, what is the best way to show those?

I was thinking perhaps a pre-rendering technique, wherein you pick specific places around the landscape and then make a program that draws all of the heightmap and 3D models around that spot and takes a picture. It would take several pictures, and then when the player is near that spot, the pictures would be used as a skybox.

Another more obvious technique is to store really rough 3D models, but then how does the 3D rendering system specifically choose to render the rough model of the building and not the rough models of other less significant (and probably not-viewable-from-that-distance) objects? How would you store something like that along with your heightmap? Maybe by design, only have a few such significant landmarks and then just store the list of them in a small file, and on each frame render the ones that are less than x really-far-distance away?

I am aware that the Halo series chooses to divide the game into levels and then each level has a different hand-made skybox. This is kind of what I was going for in the first suggestion, but I'm not sure about it. I guess I'm really just trying to collect other ideas or refinements or issues in my ideas, so that I can choose which ones to prototype with my limited time and knowledge.

Another related topic is how to display mountains at a distance, since they would be part of the heightmap and not 3D models on top of it, so they wouldn't really be able to have a rough version, and the heightmap approximation algorithm might screw up the mountain from a really far distance like that (assuming you would even try to approximate and render such distant geometry, which you probably would not). Bonus points if you cover this in your answer too. :)

Thanks!

P.S. I'm using OpenGL. I am just looking for the basic concepts but if you choose to post example code, please use OpenGL functions and terms! :)

EDIT: Thanks for the answers! For documentation purposes here is another resource I found: Chapter 4.9 in Game Programming Gems 2 covers the concept of rendering distant scenery to a skybox: http://books.google.com/books?id=1-NfBElV97IC&lpg=PA416&ots=SOpnfijZly&dq=render%20distant%20to%20skybox&pg=PA416 (unfortunately that preview is only the first page of the chapter... I'll have to grab that book from my university's library as soon as I get back in August)

Also after reading these things, I am still of the opinion that LOD is for objects that are at a still reasonably close distance. If the objects aren't even one pixel large, but you're still feeding them to the graphics card, you're just wasting power, whether using LOD or not. And that would be the case for everything but the absolute largest distant objects; a few tall buildings and some mountains, in most cases, but the small detail models (bushes, even trees, rocks, whatever other scenery...) would not be visible from such a distance. So I do like the render to skybox technique, and when I get to this bridge, that's how I'll cross it; and I'll make sure to use LOD for all models, I just won't render such a distance.

I am, by the way, thinking more along the lines of an Oblivion game, so the answer may depend on the game genre.

like image 310
Ricket Avatar asked Jun 18 '09 16:06

Ricket


People also ask

What is render distance in video games?

In computer graphics, draw distance (render distance or view distance) is the maximum distance of objects in a three-dimensional scene that are drawn by the rendering engine. Polygons that lie beyond the draw distance will not be drawn to the screen.

What is Prop draw distance in games?

Draw distance is a computer graphics term, defined as the maximum distance of objects in a three dimensional scene that are drawn by the rendering engine. Polygons that lie behind the draw distance won't be drawn to the screen.

Are games rendered in real time?

In real-time rendering, most common in video games or interactive graphics, the 3D images are calculated at a very high speed so that it looks like the scenes, which consist of multitudes of images, occur in real time when players interact with your game.


3 Answers

A few techniques, including the ones you've mentioned:

  • Level of detail. Outlined above.
  • Mipmapping. For textures.
  • Field of view. Restrict how many things your camera can 'see' by picking an appropriate zoom level. See also view frustrum culling.
  • Far-clipping plane. Occlusion of far-off places: most games use fog, mountains, or some other excuse to have a hard cut-off on how far away you can see. This can be implemented using octrees, or some other such technique. This may be based on whole objects, or polygons, or whatever, and is usually set to occur right behind those aforementioned mountains.
  • Arenas/levels/areas/whatever -- again most games artificially restrict you to playing in one arena at a time; the benefit is obvious (you get to ignore objects in all other arenas)
  • Pre-rendering -- this is what you're suggesting above. For static scenes that are far off, render the scene in a 'typical' view and make it a texture on the background, or use it for the skybox / reflection map / etc.

The idea is to throw away as much detail as is possible before users start to notice.

There are a number of pre-existing toolkits that will do these things automatically, but they tend to cost money. If you're looking at a serious app, I would recommend at least researching the solutions they include.

like image 68
Alex Feinman Avatar answered Oct 18 '22 04:10

Alex Feinman


I think this is what your looking for Level of Detail (LOD)

like image 42
AvatarOfChronos Avatar answered Oct 18 '22 04:10

AvatarOfChronos


For 3d models, the technique is called level of detail. Essentially, multiple versions models are kept available the the right one use based on context. It is not always just for distance, it can also be used to maintiain framerate in other situations.

Be careful though, you should have mipmapping enabled or you'll get sparkling on the larger textures on the lower res models, and be careful of animation. Switching the model beneath an animating skeleton is tricky so one technique is to maintain the same skeleton even when LOD-ing the model.

There are dynamic LOD systems for both terrain and for object models, but these can be CPU heavy.

like image 20
sean riley Avatar answered Oct 18 '22 04:10

sean riley