Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Controlling the Level Of Detail (LOD) of a model.

Author
Message
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 29th Mar 2003 19:17
Does anyone know how to code a routine that controls the LOD (Level of Detail) of each models in the world? If I am not wrong, I think DBpro doesn't have this feature built-in. I know a few ways to control the LOD of each model theoritically. One way is to decrease the faces of a model by eliminating some vertices. But I am wondering whether this can be done in DBpro as I have no access to the vertex list of each model.

Any advice will be much appreciated!
Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
rapscaLLion
23
Years of Service
User Offline
Joined: 29th Aug 2002
Location: Canada
Posted: 29th Mar 2003 19:20
There is no built in way, you could do it by loading in different models, for instance:

Model 1: High Poly, for up close
Model 2: Med Poly, for med distance
Model 3: Low Poly, for far away

It would cause the "jumping" effect when you replace one model with the next but many professional games have that jumping effect anyway. There are also ways to eliminate this effect, GTA: Vice City for examply fades in/out the LOD changes.

Alex Wanuch
aka rapscaLLion
Kousen Dev Progress >> Currently Working On Editors
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 29th Mar 2003 19:29
" But I am wondering whether this can be done in DBpro as I have no access to the vertex list of each model."

Yes you do. Use MEMBLOCKS for this kind of low-level access.

Current Project: Retro Compo. Entry.
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 29th Mar 2003 20:42
Interesting. Thanks rapscaLLion! But when you mean load different model, do you mean by calling the Load Object with the model that have different poly counts, or do you load all of them prior the game starts and hide all the unused model? As I believe loading model might take some time and will jerk the game for a few seconds, right?

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
rapscaLLion
23
Years of Service
User Offline
Joined: 29th Aug 2002
Location: Canada
Posted: 29th Mar 2003 21:00
Depends on the computer. For max compatibility load em all before hand.

Alex Wanuch
aka rapscaLLion
Kousen Dev Progress >> Currently Working On Editors
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 29th Mar 2003 21:14
"or do you load all of them prior the game starts and hide all the unused model? "

Definately pre-load them if possible. IanM is developing a plugin to load data into memblocks in a separate thread - this would be very handy for this kind of task.

Current Project: Retro Compo. Entry.
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 29th Mar 2003 22:19
Actually, the memblock part of things is done - no further modification required. I was just pausing (for a month or so ) for inspiration to strike on loading into objects and images.

Anyway, I've just recently been playing with meshes, and it seems to me that you could pre-load meshes with your different models, and change the mesh of your objects according to distance. No need to even change the textures, as they should automatically be mipmapped, and far easier to manage than hiding/showing different objects.
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 29th Mar 2003 23:02
Sounds nice to me. IanM, can you provide a short snippet to me to illustrate your idea, i.e. preload the models into memblocks and use it when needed.

Actually, what are the difference between LOAD MESH and LOAD OBJECT commands. It seems to be that MESH only contains the vertices information whereas OBJECT contains additional data like texture maps, bump maps, etc. And if my assumption is true, meaning that if I kept my model preloaded as MESH in memblocks, then I have to manually reapply all the texture maps whenenever I need to show them on screen as OBJECT?

Thanks for all the help!

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 29th Mar 2003 23:29
I don't know anything about bump mapping yet, but texture coordinates *are* retained within meshes - I've just been playing with direct creation of meshes in code

All you need to do to make the meshes is use something like this:



To load back into an object:



The reference manual does seem to imply that you can load .x format files directly into meshes, so you may not need to convert if you already use .x files - you'll just have to try it.

I hope others are checking this - I'm still really a learner at this
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 30th Mar 2003 00:01
Cool. Thanks a lot, IanM! But that does not need any usage of memblock as mentioned by Rob K, right?

So from what I understand, the loaded mesh will sit in the memory, but WILL NOT appear on the screen?

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 30th Mar 2003 00:07
That's right. You only need to use memblocks if you want to modify or create a mesh at run-time.
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 30th Mar 2003 07:31
Modify the meash at run-time, as in modifying the vertices data? Can you really do that? I have no idea about this. To be, DBpro is a high level language that I have way to tweak those low level stuff. It would be nice if you could give me a short example. Thanks in advance!

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 30th Mar 2003 15:50
The basics are covered in 'Code Snippits/Vertex Manipulation' by glenn carter.

The thing is that glenns code is not efficient for manipulation of many points within an object, so I wrote my own that uses a vertex buffer you can change and then commit when all changes are done.

The problem is that I'm getting reports of mixed results from DBDN members under patch 4

When I've got this sorted, I'll release the library source code. But also, I feel there's potential for a DLL here ...
the architect
23
Years of Service
User Offline
Joined: 6th Jan 2003
Location: United Kingdom
Posted: 30th Mar 2003 21:41
if you hide your models this will release the stress on your cpu.
I have experimented with hiding and showing a series of LOD objects. What I found was wilst overall frames were less because of the extra models as I hide and revealed models according to distance it helped maintain a higher frame rate overall. Weird I know, just try it.

Login to post a reply

Server time is: 2026-07-21 20:34:29
Your offset time is: 2026-07-21 20:34:29