Jump to content
  • Advertisement
Sign in to follow this  
billconan

what is the secret of rendering a large number of identical objects

This topic is 4280 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

hello guys, i'm wondering, what is the secret behind rendering a large number of identical objects, such as, millions of balls or cubes. they are identical in size and shape, but different in color, for example, a system to render molecule structures? also is there something called "model database", i want to know how to manage the model data in an online large walkthrough system. it would make sense to only give users the "scene" that they could currently view. thank you very much.

Share this post


Link to post
Share on other sites
Advertisement
I just wanted to say that I'm also very curious about how to render a very large number of identical objects in a single scene. At the moment I'm stuck at about 5-10fps with 20k 209 poly models using an amd xp 2800+ w/radeon 9600. I'm currently using directx, so if anyone has an answer more precise than batching or instancing, I'd be really really interested.

Share this post


Link to post
Share on other sites
The way we've done it is by useing imposters. The idea is that you really only draw the front couple of objects, and for anything further away all you draw are particles, textured to look like the object. So you render your oject to a texture, then for anything too far away, or after say the firstly 100 objects then you just render quads with the texture. It'll break any fancy shadow algorithms or special shaders, but if they're far away then they probably don't need that stuff to begin with. If you have animating objects then you can have a couple of different frames rendered out, then pick the closest one. As long as you update the objects closer to the camera properly, you can get away with only updating the objects far away pretty rarly! Like once or twice a second. If you have 20k objects update say 1k per frame. The closest 500 objects every frame, then the next 500 objects out of the queue based on how close they are and how long since last update. Everyone gets updated sometime, but the further away they are the less it happens.

Edit: Its important to note that if you impliment this, the objects that don't update often will stand out to *YOU* really badly. Ask someone else to look at it and they won't notice a thing ... we wasted alot of time worrying about the back objects only updating once/twice a second when nobody but us ever even looked at them!

Share this post


Link to post
Share on other sites
use some backface culling that would speed it up some also hidding objects not being put in the vertex buffer or being rendered would help

Share this post


Link to post
Share on other sites
Shared data. A mesh has data/attributes/properties that are common to all instances of the mesh. For example, geometry is almost always shared. Textures as well.

Batch processing. This is a no brainer really. If you can send and process data in batches, then do it.

Continuous Level of Detail (CLOD). As a mesh moves away from the eye-point, it's geometry is simplified to a degree. Eventually a very distant mesh will turn into a simple shape such as a pyramid.

Discrete Level of Detail (DLOD). Each mesh has several different representations: hi-res, mid-res, lo-res, etc. As the distance between the eye-point and the mesh reaches a certain range, the appropriate representation is selected and displayed.

Frustum culling. Culls away any meshes (and/or mesh-faces) that aren't within the current viewing pyramid.

Backface culling. Culls away any mesh-faces that aren't visible to the viewer from the current viewing angle.

Occlusion culling. Culls away meshes (and/or mesh-faces) that are blocked from view by other meshes.

Impostor Billboards. Essentially, a hi-res mesh is replaced with a semi-real-time 'portrait' of itself - reducing the number of triangles from N-thousand to just 2.

Texture Atlases. A list of large texture maps is used to store the various smaller textures required for a scene, greatly reducing the number of texture binds needed.

The exact optimizations you need all depend on your content. All of these methods can be combined in many creative ways to suit your needs.

For a molecular scene...I'd probably go with DLOD. As the 'balls' move beyond a certain threshold, the mesh changes from a sphere to a cube. The next threshold, the mesh changes from a cube to a pyramid. Impostor Billboards probably wouldn't be ideal in this situation. Frustum/backface/occlusion culling can definitely help.

Share this post


Link to post
Share on other sites
As Morpheus011 pointed out, 'instancing' is the way to go. There are several techniques to instanece both static and dynamic geometry, both on CPU and GPU. The easiest being static instancing, in which all static geometry is intanced offline and stored in memory. This is a classic sample of memory vs. processing power tradeoff. There are other more advanced techniques that take advantage of GPUs/shadres and the instancing API. GPU Gems 2 has a great article on the subject that shows how Black & White 2 tackled this problem, which you might find useful.

Share this post


Link to post
Share on other sites
Quote:
Original post by swordfish
For a molecular scene...I'd probably go with DLOD. As the 'balls' move beyond a certain threshold, the mesh changes from a sphere to a cube. The next threshold, the mesh changes from a cube to a pyramid. Impostor Billboards probably wouldn't be ideal in this situation. Frustum/backface/occlusion culling can definitely help.


Impostor billboards seem to me as ideal for molecular scene, because atoms (balls) are indefferent to viewing angle. Of course, complex lighting situations makes their use a little harder, but even then impostors could be used in combination with normal maps.

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!