Skip to main content
GameDev.net gamedev.net
🔒 Locked

Displaylists & performance

Started by genesys May 16, 2006 at 5:30 AM 7 replies 750+ views
Original Post
genesys
genesys
Hi! I'd like to know about displaylists... i know that they are quite fast and i used them in my last openGL game to render the models... However - in my new project i have a LOT of static models (they don't morph nor rotate nor translate or so... they're only rotatet and translatet once at the initialisation and stand then still - but the camera moves) However - they use Level Of Detail for each model (Level Of Detail for mesh, Level Of Detail for Textures and Level Of Detail for shaders) Now i'd like to know how to optimize my performance (i have to because i'm going to have a lot of polygons and Textures!!) shall i put every LOD of every model in a seperate displaylist and then call them to render? Or do you have any other suggenstions or hints about displaylists or optimizing performance in such a project? Thank you!
Kalasjniekof
Kalasjniekof
Quote:
shall i put every LOD of every model in a seperate displaylist and then call them to render?

Yes, make a displaylist for each model/texture/shader combination you'll be using for your objects. Then, when you render an object, determine the distance to the camera and choose the appropriate LOD for the object.
Btw, distance checking can be optimized so you don't have to call sqrt for every calculation. Just use squared distances in your LOD calculation:

dx = model.x - camera.x
dy = model.y - camera.y //only if objects or camera can move along the y-axis
dz = model.z - camera.z

squaredDistance = dx*dx + dy*dy + dz*dz

Good luck!
genesys
genesys
hi! thanks for the fast reply!

but isn't that bad for memory? unfortunately i don't really know where displaylists get stored - but i thought that they are uploaded into graphicscard memory and then called from there or so... is this wrong?

And should i create all the displaylists when the scene gets initialized or when a certain LOD is needed the first time?
deavik
deavik
For LOD schemes, I'll suggest (not telling you to abandon what you have already though) using indexed VBOs. If you use an indexed data array, you can upload the data once, and have a separate index array for each LOD.

More details can be found in Nvidia's VBO white paper (look in page 6).
genesys
genesys
hi!

Thanks for that hint!

i read throught the whole paper and it sounds quite interesting - but i must admit that i didn't really understand it (my openGL knowledge seems to be unsufficient).

Could you perhaps shortly outline the concept of VBO? and what are the benefits and drawbacks (compared to displaylists)? for example i read that the array buffers only store vertexpositions, texcoords, vertexcolors and normals. What if i need binormals and tangents too to use normalmapping?
If these questions are naive please don't mind :)

Does anyone know a tutorial or an example that helps implementing VBO?

thanks :)
deavik
deavik
Glad to see you're interested! [smile]

I actually said "use VBO" because of the description of how to do LOD in that paper. For starters, you can use OpenGL 1.1 vertex arrays and get your engine up and running. Once you get to that stage, porting the code to use VBO shouldn't be a problem at all.

If you are new to vertex arrays:

Step 1: Read the relevant portion of the the red book - here's a link to Chaper 2 where the section on vertex arrays is (scroll down 2/3rds of the page).

Pay particular note to the examples using glDrawElements because we are interested in indexed vertex arrays. MOst model formats I know store vertex data in the form of indices - when you load the model just make sure you get both the data array and the index array, and after that you should be able to use indexed arrays very well.

Coming back to the main point of indexed arrays for LOD schemes - it may actually be a bit harder to write a routine that can generate the different index arrays after LOD 0.

I'm sorry, but personally I don't have experience with this matter. I have some ideas, however I'm sure there are already established algorithms which can accomplish this ... when you're ready post in the Graphics Theory forum, the whizzes there will probably be able to give you something.

Hope that helped
genesys
genesys
hey! thanks again!

i'll check out that...

But just for my understanding: what kind of LOD are we talking about? if it's only about the indices, then i think you mean some kind of dynamic LOD where unnecessarry vertices disappear in a certain distance (but the ones that stay are still the same as in the previous LOD level?) do you?

For my LOD i'm going to create for each objects 3 independant meshes (even with independant textures)... so i don't know wether this will help me with that (if i didn't understand wrong), no?

thx!
deavik
deavik
Quote:
Original post by genesys
hey! thanks again!

i'll check out that...

But just for my understanding: what kind of LOD are we talking about? if it's only about the indices, then i think you mean some kind of dynamic LOD where unnecessarry vertices disappear in a certain distance (but the ones that stay are still the same as in the previous LOD level?) do you?

For my LOD i'm going to create for each objects 3 independant meshes (even with independant textures)... so i don't know wether this will help me with that (if i didn't understand wrong), no?

thx!

You understood perfectly [smile]! This system's main advantage would be the memory savings - that can be a huge issue with things like terrain, for example. The LOD generation scheme can be dynamic, or pre-calculated (think of it like mipmaps for textures).

If you are making independent meshes with different textures, there are no such particular advantages.

On a side-note, Vertex Arrays are very fun to learn and powerful and convenient to use, so I'd recommend you to learn them anyway. I'm not sure but I think they are the only (?) way to supply vertices in Direct3D (please correct me if wrong).
rohde
rohde
I just want to mention that if you're using buffer objects (which you should if you can sinces it ups the performance) you should /not/ use display lists because it will tank your performance (buffer objects and display lists aren't meant to work together, but buffer objects improve your performance quite a bit compared to using old vertex arrays with display lists).
"We confess our little faults to persuade people that we have no large ones." -Francois de La Rochefoucauld (1613 - 1680). | My blog

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.