How to decrease texture loading time?

Post your questions, suggestions and experiences regarding to Image manipulation, 3d modeling and level editing for the Irrlicht engine here.
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: How to decrease texture loading time?

Post by mongoose7 »

I don't think sscanf has anything to do with it. You should notice that there are no calls to the driver (DirectX?). There are no symbols for these calls so the time is reported under the next symbol above in the symbol table.

The WaitForMultipleObjects seems to suggest multiple threads.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: How to decrease texture loading time?

Post by CuteAlien »

Now that makes more sense. You can't do much to avoid the copy32BitMipMap unless you don't need mipmaps for all materials in which case you could disable them for some materials. I think it's also the one that costs most time in my project right now.

The other one looks like you have really huge mesh in your file (or many small ones - anyway - lots of mesh-loading going on). Which seems to be so big that it costs more time than all the texture-loading. Although it's a little surprising only sscanf shows up that much. Also surprising it's even used at that place - it's certainly not optimal. Still - first take a look at your mesh-sizes, maybe those are not really realtime meshes in which case you will have trouble anyway.

DebugSetLevel is confusing - are you using debug libraries for directX?
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
ibax
Posts: 193
Joined: Thu Jun 21, 2007 8:56 am
Location: hungary
Contact:

Re: How to decrease texture loading time?

Post by ibax »

CuteAlien wrote:The other one looks like you have really huge mesh in your file (or many small ones - anyway - lots of mesh-loading going on). Which seems to be so big that it costs more time than all the texture-loading. Although it's a little surprising only sscanf shows up that much. Also surprising it's even used at that place - it's certainly not optimal. Still - first take a look at your mesh-sizes, maybe those are not really realtime meshes in which case you will have trouble anyway.
I have one obj file, converted to .irrmesh format, this is loaded. But it is loaded only after all the textures are loaded. Only that time irrlicht loads the .irrmesh model. The size of irrmesh file is 57MB.
CuteAlien wrote:DebugSetLevel is confusing - are you using debug libraries for directX?
I didn't set up anythink in directx debugging, I just downloaded the required SDK when setting up the irrlicht development environment. I did not made anything else...
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: How to decrease texture loading time?

Post by CuteAlien »

57 MB sound extremely huge for a model file. I did a quick check and the largest model (obj format) in my current project is 3MB and that has already over 35000 triangles.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Re: How to decrease texture loading time?

Post by ent1ty »

isn't .irrmesh ascii though, that would explain both the size and the loading time
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps

Step back! I have a void pointer, and I'm not afraid to use it!
ibax
Posts: 193
Joined: Thu Jun 21, 2007 8:56 am
Location: hungary
Contact:

Re: How to decrease texture loading time?

Post by ibax »

ent1ty wrote:isn't .irrmesh ascii though, that would explain both the size and the loading time
can somebody explain this please? from the console I see, that first the textures are loading. and the last one, which is loaded, is the .irrmesh file
(of course everything is inside one .irr file)
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: How to decrease texture loading time?

Post by CuteAlien »

ent1ty wrote:isn't .irrmesh ascii though, that would explain both the size and the loading time
So is the .obj format.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
ibax
Posts: 193
Joined: Thu Jun 21, 2007 8:56 am
Location: hungary
Contact:

Re: How to decrease texture loading time?

Post by ibax »

Hi,

I'm still dealing with this stuff...

So the initial conditions are the following: I have an .irr file, an .irrmesh file (size is approx. 50 MB), an .obj file and an .mtl file.

house.irrmesh 58,824,784 bytes
house.obj 23,417,887 bytes
house.irr 1,433,932 bytes
house.mtl 24,396 bytes

The problem is, that the texture loading time of the 154 jpg textures is more than one minute. Size of the directory is 40 MB.

I tried out, what happens, if I load the textures into memory as a very first step in the main() function:

Code: Select all

IImage* ThreadTexture = 0;
device->getVideoDriver()->addTexture ( "pictures\\recorder_texture_512.jpg" ,  ThreadTexture , 0 );
device->getVideoDriver()->addTexture ( "pictures\\bookshelve1.jpg" ,  ThreadTexture , 0 );
device->getVideoDriver()->addTexture ( "pictures\\bookshelve2.jpg" ,  ThreadTexture , 0 );
...(+151 more lines)
 
device->getVideoDriver()->getTexture ( "pictures\\recorder_texture_512.jpg");
device->getVideoDriver()->getTexture ( "pictures\\bookshelve1.jpg");
device->getVideoDriver()->getTexture ( "pictures\\bookshelve2.jpg");
...(+151 more lines)
 
When I execute my app, I can see, that the textures are loading much faster, when loading from the original place (via .irr file). But, when the code reaches the .irr file loading part, my application crashes without any informative window...

I thought, that with this method, I can include some kind of multithreading to this texture loading part, and if the textures will be in memory in the beginning of my application quickly, than the .irr file loading process will not load them once again.

Experts, please comment.

Thanks!
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: How to decrease texture loading time?

Post by mongoose7 »

OpenGL is not thread-safe. You should only use one thread to load textures.
ibax
Posts: 193
Joined: Thu Jun 21, 2007 8:56 am
Location: hungary
Contact:

Re: How to decrease texture loading time?

Post by ibax »

I'm using Direct3D only.
Post Reply