Preloading resources into a W3D questions 2004-03-19 - By NoiseCrime
Back
-- -- Original Message -- -- From: "Barry Swan" <gerbil@(protected)>
> I need to have fast access to various human models. > I'm currently cloning all I'll probably need into a W3D, then deleting > the model, shaders (I generate new ones later) etc. > These models have bonesplayer - do I need to switch that off, IE does an > 'animating' resource have overheads, or is that just the models?
Boneplayer motions have an obscene memory overhead IMHO.
On a recent project I tried collapsing almost 60 different w3d files into a single mega file to reduce loading times, memory overhead (as i could ignore the textures) etc. What I ended up with was a 1.4mb file(down from 7mb total for each seperate w3d). Great i thought, that was until I preloaded the w3d where the memory useage jumped up to something like 25mb! (with no textures at all)
As far as I could tell this was due to soley to the use of boneplayer motions (there were no longer any textures stored). I think i even tested removing the bonesplayermotions from all the models and that resulted in going back down to something like the original 1.4mb as there shouldn't have been any actual geomerty compression applied to make a difference.
Of course this could be an extreme case, certainly in the number of models, and possibly the number of bones, but overall it did give me a great deal of concern over how the project could ever work on a min spec machine. In fact it was due to this and several other reasons that i decided to go with my own binary file format instead accessed via an xtra. It moved the overhead out to filesizes (as i had to store the animations at a vertex level), but the beauty of the xtra was it allowed myself to access a specifc animation frame instantly, which was actualy the most important factor of the animations in the first place.
You should be aware that I believe there are some issues with cloning that may well make it non-optimal, possibly increasing memory use. For example I recently reported a bug whereby clone names appear to be storeded for the life of the w3d file and never deleted. Apart from making life awkward this obviously means some extra memory overhead. Combine that with the speed of cloning especially for a lot of models, and its something i've become quite wairy of. I also suspect that many others here will have their own scare stories and bugs with cloning.
Sadly though there is often no alternative.
Yes there is loadfile, but not sure if that works in SW (preloadnetthing?) and have recently experienced some very weird results with a few Maya models (out of a large batch) where the texture corrdinates got completely corrupted, yet the exact same file loaded into the cast worked perfectly! I used to swaer by loadfile, and to a degree still think its the best option, but now I think i'm wairy of almost anything in sw3d ;)
You could try the filesavemode and generate a 'mega W3D', essentialy doing all the cloning in pre-production. However this can have its own issues, and if you have alot of models with boneplayer motions attach you may see the memory usage rocket. That is not a problem with the number of motions, just when a model has bonesplayer and a motion applied the memory jumps up.
In the end I think you'll just have to experriment and keep your eye on the memory inspector.
> Secondly, is the above recommended? Will a resource sitting in memory > doing nothing have much of a resource overhead?
I don't think so, although obviously it will still be taking up memory it really shouldn't amount to that much. So as long as you remove the bonesplayer from all non-used resources that should keep your overall memory costs down.
But like i said i don't think there is a one fit solution you'll just have to experiment and see what works best for you and your project. For example you may find just cloning all your models doesn't put to much strain on memory in which case you'll have little to worry about.
Going back to the project i mention above for simplicity I actualy build all the shaders at runtime (about 150), however i don't generate the textures or apply any. In my mind the overhead for 120 shaders is going to be minimal, maybe a few hundred k tops. I then implemented an 'on demand' texture loading function, so when a shader was needed it checked if it had a texture, if it did but wasn't currently loaded into the projector, it would load it in. Works very well and keeps memory useage to a minimum as it is generally the textures that take up the most space.
-- -- Original Message -- -- From: "Allen Partridge" <partridge@(protected)>
> Props to NoiseCrime really for this one, he showed me the light a few > months ago when I was seeing massive hits in a project that had a very > small world
Damn if i knew it had helpped you that much i would have charged for the advice ;)
Noisecrime 2004
__ ____ ____ ____ ____ ____ ____ ____ ____ ____ Dir3d-l mailing list Dir3d-l@(protected) http://nuttybar.drama.uga.edu/mailman/listinfo/dir3d-l
|
|