What would be the most efficient way to load 3d models?

Started by
5 comments, last by Bytenjoy 9 years, 1 month ago

To load models such as characters and buildings into memory, I placed the model file in certain format such as .dae and had the program parse it before entering the main loop. I think it might be not the fastest way. What's the most efficient way to do that generally?

Advertisement

Convert to your own format and load that.

L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid


What's the most efficient way to do that generally?

The most efficient way is to store the model is a file format, which more or less represents your internal structure which holds your model data. One way is to write a converter from a common model format (dae,fbx) to your internal format.

Ninja'd ph34r.png

It depends on what you want to achieve. If you want to develop a "full blown" engine or a game with lots of 3D models, then I agree with the above, too make some sort of pipeline towards the ideal format for your own engine/ game. Ideally the processing is done outside/separated to decrease in game load times. If you just want to play around then your current approach is also valid, just load anything that works, maybe even directly (through assimp, d3dx etc)

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me

If you are interested I am working on a desktop app that can let you do that quite easily - at least that is the idea.

It uses assimp under the hood and will allow the user to customize the export to hook in to their engines using as3.

You can of course do the same thing yourself, it only took me a few hours to get it up and running.

The idea being you can just write the raw data into a bytearray so you can just copy it right into your own data structures with no need to process it or create anything... very compact and very fast.

What's the most efficient way to do that generally?

A custom format which is a literal byte dump of your in-memory representation. This of course requires that you architect your in-memory representation to be flat chunks of memory, with no pointers (which would need to be fixed up on load).

Then you load your file full of chunks into memory (likely via mmap), and transfer any relevant chunks to the GPU as needed.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

You could take a look at http://google.github.io/flatbuffers. It's a library that could help to implement what switfcoder said.

http://www.bytenjoy.com | [twitter]Bytenjoy[/twitter]

This topic is closed to new replies.

Advertisement