Sign in to follow this  

Question about loading models.

This topic is 4517 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, I have a question about loading models into a game. In my game I use 3ds models( low poly ), but it takes alot of time to load let say, 30 diffrent models. so how can I improve the loading speed ? maybe load them as text files or something I dont know. I hope anyone can give me an idea how to do this. thanks.

Share this post


Link to post
Share on other sites
Use a profiler to determine what part of your code takes the most time during loading. Determine if that part could be optimized, and if possible then optimize and check that your optimization has actually resulted in an increase in speed. Repeat until you get acceptable performance.

If optimizing code is not enough, determine what operations which take time during loading must be done at loading time (such as putting the data in memory) and which operations can be done beforehand (such as computing the normals or eliminating useless data from the file). Using your list of precomputable things, create a new file format, a loader that reads this file format (and as such doesn't need to do all the computations that were performed ahead of time, since the results of those computations are in the file), and a compiler that reads the file and precomputes what you decided could be done ahead of time.

Optimize the loading code again. Rinse and repeat until your bottlenecks are the actual reading from disk and putting in memory, at which point you can't solve anything anymore at this level, and have to optimize your game by actually loading less things.

Share this post


Link to post
Share on other sites
I was facing the problem of slow model load and made the simplest optimization in the book : I traded memory for speed.

In the beginning, I parsed and read my .3ds files from the disk at the same time with consecutive calls to fread. What I do now is read the entire file to memory with a single fread call, parse it afterwards from there and then release memory. Considering that the memory consumption peak lasts only as long as the parsing process and therefore happens only once (and not during render-time), it is a winning decision.

A second optimization you might want to try is to use hash-tables for your vertex normal calculations.

Best of luck!

Share this post


Link to post
Share on other sites
Let them be converted.

I don't use 3DS so I don't know what all is in it, but I'm sure it has tons of excess garbage you don't need. Why not make a simple converter that weeds out all that garbage and stuff.

Share this post


Link to post
Share on other sites

This topic is 4517 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this