Archived

This topic is now archived and is closed to further replies.

Ranger_One

Model LOD?

Recommended Posts

Would using a Level Of Detail (LOD) setup for regular game models improve speed when drawing many distant models and onlly a few local ones? I''m thinking of making two or more levels of detail of each model. Each would have progressively less faces than the last. Then draw the degraded versions at distances where the model would take only 64x64 pixel screen area for instance. Would this be worth the effort? and if so- can anyone point me to good code that can decimate vertices from a surface? Ranger

Share this post


Link to post
Share on other sites
Many sport games do this with their player models. If you look for it in replay (zoom in and out), the change from one level to another is usually very obvious. But, that''s only if you look for it. It is generally a good thing to do. Whether they do it on the fly or not, I don''t know, and it probably would depend on the game. Ie, either have your artists do a 4000, 2000 and 1000 poly version for every model, or do it programmatically. I don''t have any code for it though.

Share this post


Link to post
Share on other sites
Heh, if you REALLY want to do LOD, you can look into a game called Messiah, it explains how they accomplished. Basically, it stores information pre vertex on which vertex to break down next (by seeing the angle of the edges, less defining polygons are "merged" before more defining ones, and in real time). I forget what the method is called, but it''s pretty cool. The characters in Messiah where over 200,000 polys a piece (with a bunch of them on screen at once) and was targetted at TNT/Voodoo2/400-500 mhz machines and worked great on them.

Billy - BillyB@mrsnj.com
(Hey, I''''m no longer anonymous!)

Share this post


Link to post
Share on other sites
http://www.messiah.com/Html/technology.html
quote:

200,000 polys a piece (with a bunch of them on screen at once)


200,000 in 3ds max, not on the screen. He mentions 2000 for a reasonable amount (with a few+ on screen). All those tools would be sweet to have...

Share this post


Link to post
Share on other sites
Ready4Dis:

That''s called a progressive mesh. Unfortunately, it isn''t so attractive anymore as it used to be in the days of Voodoo2/3. Modern 3D cards expect a static vertex / index data stream to operate at maximum speed. The less the data changes, the better and the higher the framerate. Prgressive meshes change every frame, so the 3D card can''t cache anything.

The best thing to do today is used selected LOD versions of your model, and switch between them depending on distance. To make the transition less noticable, you can use vertex shaders to interpolate between vertices (geomorphing).

/ Yann

Share this post


Link to post
Share on other sites
How in the world can u have 2 models with different vertex/triangle counts, stored I assume in different streams and have a vertex shader interpolate between them? I think this is a stupid idea but if u can enlighten me more, perhaps I could be persuaded to consider myself stupid instead.

Share this post


Link to post
Share on other sites
quote:

How in the world can u have 2 models with different vertex/triangle counts, stored I assume in different streams and have a vertex shader interpolate between them? I think this is a stupid idea but if u can enlighten me more, perhaps I could be persuaded to consider myself stupid instead.



Hehe.. OK, here we go: of course you can't have two different streams with different vertex counts processed on a single vshader. So what you do is the following: normally, the phase of transition is rather short compared to the period a full LOD model is displayed.

So say you want to blend between a 3000 vertex and a 1000 vertex model. You first create a temporary model where you take your 3000 vertex model and apply all the optimizations you applied to get the 1000 vertex one. But *without* removing faces or changing the mesh topology, only vertices are repositioned. This will create lots of 0 area triangles, but that's no problem, 3D hardware will cull them. This can be done as a preprocess and stored along with the model.

Now, you feed your original full blown 3000 vertex model data into the vertex data stream, as usual. And in parallel (since topology is the same, there is a 1:1 vertex match), you feed your faked 1000 vertex model (that still has 3000 vertices, it just looks like the 1000 one) into a user attribute channel (in OGL that's glVertexAttribPointerNV(), not sure about D3D). You put your global interpolation factor (between 1 and 0) into a constant register.

In your vertex shader, you simply perform the following equation: Final Vertex Position = Vertex Stream * factor + Attribute Stream * (1-factor).

Here you go, perfect geomeorphing on the GPU in one stream. Once your reach a factor of 0, the model will look like the 1000 vertex one, and you can safely switch LODs, no change will be noticeable.

Edit: of course, in real world application, you would also need to interpolate between texcoords, normals, whatever else you need.

/ Yann

[edited by - Yann L on May 1, 2002 3:07:33 PM]

Share this post


Link to post
Share on other sites
except that now u have 2 3000-vertex models instead of 1. That 6000 vertices used to make a smooth transition from 3000 to 1000. I guess since it''s used for hardware, that isn''t a concern but as far as LOD methods go, this kinda sucks.

Share this post


Link to post
Share on other sites
quote:

except that now u have 2 3000-vertex models instead of 1



Only if you precalc it. You could also generate the second transition model on the fly and discard it as soon as the transition is over. OK, you''ll temporarily need some more vertex stream cache, but in the days of 128MB 3D boards, that shouldn''t really be a problem...

Share this post


Link to post
Share on other sites
Sorry for, that I brought up this old topic, but I just wanted some extra info. Yann describes a technique here, which I very much like. But how should I see this reducing of a hi poly model into a low poly model? Should this be done by hand or by some plugin (are there any plugins for this)?
I have looked for some plugins, but every plugin deletes the vertices: they don''t, as Yann said, only move the vertices.
About the vertex shader:
From when do the graphic cards support vertex shaders?
Not every graphic card support them right?
So I thought, If the card doesn''t support them then I would just not do any lod: I would draw the low poly model.
Is this good thinking or are there better ways of dealing with model lod ?

TIA,

Michel

Share this post


Link to post
Share on other sites