loading a mesh realtime

Blitz3D Forums/Blitz3D Beginners Area/loading a mesh realtime

stayne(Posted 2006) [#1]
While my world editor is running if I load a mesh, there's a signficant pause. I can see the mesh immediately after loading it so why the long pause? Are there any commands I should be calling after loading a mesh?


jfk EO-11110(Posted 2006) [#2]
I think this happens due to directx is managing the Vram after loading something. I guess it's also performing an internal garbage collection and some caching optimations.

This is also why you should render the entire scene one time with a distant camera to cache everything before the game starts, this will prevent those pauses in the beginning of the game.

Not sure if this is a problem in a world editor.

The pauses I'm talking about are like 150 ms or so.


Matty(Posted 2006) [#3]
Loading anything will cause a pause as the pc has to access the hard drive, which is slow.


jfk EO-11110(Posted 2006) [#4]
Well he said he already sees the mesh onscreen, so the pause happens afer the harddrive access.

You may also consider ANY access is cached by both, drive cache and OS reading optimation.


b32(Posted 2006) [#5]
In my programs, I have a delay after loading, too. It is caused by the opendialog. Maybe it is worth a shot: try loading a mesh with a direct filename instead.


stayne(Posted 2006) [#6]
I'm using NGUI, maybe that has something to do with it. I'm accessing the file explorer box via menu (sort of like Windows "open file"). It returns the filename, passes it to LoadMesh, then opens the mesh. NGUI does seem a bit slow. Sometimes the pause is 3 - 5 seconds depending on the polycount of the mesh. If I load the same model again, there is no pause. Only once does it happen per model. I don't want to precache the models since they can be imported from other locations on the hard drive. I might have to change my mind about that though :).


b32(Posted 2006) [#7]
If the model shows allready it would be strange if the delay is caused by loading it. My delay was caused by reading all the files in the directory. That is why it is slow on the first load, and not on the second one. However it could be a lot of things.
What format is the model in ? It could be a text based format. If that is the case, you might better use a binary format, like b3d or .X in bin format.


stayne(Posted 2006) [#8]
Thanks bram. They are all .b3d models. It HAS to be the GUI. I only have one GUI window open most of the time, and when I minimize it my framerate increases from 30-ish to 60. That's a pretty dramatic increas for one window.

Does anyone have any experience with NGUI? I'm thinking about switching to BCF.


Matty(Posted 2006) [#9]
Perhaps the gui uses 2d drawimage commands rather than 3d quads/sprites. This can cause the framerate to drop on many video cards? Although it wouldn't explain the sudden pause of loading the mesh. What sort of polycount do the models you are loading have?


Ricky Smith(Posted 2006) [#10]
With regards to 2d gui vs 3d gui - a 3d gui is not always faster.
I recently "upgraded" a complex gui from a 2d Blitzui one to a fully 3d one using F-ui - the 3d version has a frame rate of only half that of the 2d version !!
Seems there reaches a point where the overhead to create and render the 3d meshes far outstrips any slowness caused by using 2d over 3d.
Depends on how complex the gui is I suppose.

The best solution would be WinBlitz3d - this is incredibly fast as it uses the native windows gui - still a few teething problems with events at the moment - especially with the xp manifest - but works well in most scenarios.


stayne(Posted 2006) [#11]
matty: the meshes are pretty low... around 200 - 300 polys in most instances, if that.

smiff: thanks i'll take a look at winblitz3d. i'll do anything to keep the framerate up heh.


stayne(Posted 2006) [#12]
Smiff... were you ever right. WinBlitz3d is a drastic improvement so far.

What did the hooker say to the leper? "Thanks for the tip."