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.
ibax
Posts: 193
Joined: Thu Jun 21, 2007 8:56 am
Location: hungary
Contact:

How to decrease texture loading time?

Post by ibax »

Hi,

I have a house model with three floors. Unfortunately it takes approximately a minute, while the irr file (mesh + more than 100 jpg texture files) is loading.
The textures has a maximum of 1024 x 1024 or smaller resolution. I see in the console, that the textures are loading continuously, but unfortunately because their amount, it takes a minute.

I would like to decrease this loading time. Is it possible somehow? For example
- multithreading somehow? (currently I have 1 irr file with 1 obj + 1 mtl file, + 100 jpg texture files)
- divide the model into three smaller parts, and first load only the first floor, start the scene, and (again multithreading) paralelly load the second/third floor

I have another questions...
(1) Does it matter, which file format is used for textures? It jpg a good choice?
(2) Does it has effect regarding to laod time, whether I use the texture for a small or a big object? Or if the texture file is loaded, it does not matter, which/how big object will be covered by that texture?

Thanks for the answer,
ibax
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: How to decrease texture loading time?

Post by hybrid »

You cannot multithread here, as the major time goes into uploading the textures to the gfx card. You could try to disable mipmapping for some textures, which are not important. And of course a general reduction of the number of files would be good. Putting small textures into one large texture and making the texture mapping accrodingly. The file format is not really important, though it might make a difference with such a large number of images.
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: How to decrease texture loading time?

Post by Mel »

Use the least textures posible. Do you really need 100 textures? Do they display at the same time?
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
ibax
Posts: 193
Joined: Thu Jun 21, 2007 8:56 am
Location: hungary
Contact:

Re: How to decrease texture loading time?

Post by ibax »

Mel wrote:Do they display at the same time?
Hi,

No, they don't display at the same time. The model is a house with three floors, with many objects, furniture, etc... This is the reason, why I have so many texture files.
Currently there is:
- one irr scene file
- one obj and one mtl file
- approx. 100 texture files

The loading of irr file (obj, mtl, textures) requires approximately 60-70 seconds.

How can I decrease this time?
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 »

First step - use a profiler and figure out where all this time is going. Don't start optimizing before you have an idea where the time really is going. On Windows you can for example use verysleepy (http://www.codersnotes.com/sleepy) as a tool for that.
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:First step - use a profiler and figure out where all this time is going. Don't start optimizing before you have an idea where the time really is going. On Windows you can for example use verysleepy (http://www.codersnotes.com/sleepy) as a tool for that.
I see in the console, that the textures are loading continuously, but unfortunately because their amount, it takes a minute. If 2 textures are loaded in each second, than 50 seconds is needed to load 100 texture files. I will also try to disable mipmapping today.
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 »

Hm, it just feels rather long to have 100 textures load a minute. That's why I definitely would profile it first to see where the time really is spend.
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
Abraxas)
Posts: 227
Joined: Sun Oct 18, 2009 7:24 am

Re: How to decrease texture loading time?

Post by Abraxas) »

Personally, I had big 4096x4096 textures load in just under a second each, so it may be your hardware is just not designed for "modern" graphics.
ibax
Posts: 193
Joined: Thu Jun 21, 2007 8:56 am
Location: hungary
Contact:

Re: How to decrease texture loading time?

Post by ibax »

Abraxas) wrote:Personally, I had big 4096x4096 textures load in just under a second each, so it may be your hardware is just not designed for "modern" graphics.
Hmmm, I don't think so...

------------------
System Information
------------------
Operating System: Windows 7 Professional 64-bit (6.1, Build 7601) Service Pack 1 (7601.win7sp1_gdr.130318-1533)
Processor: Intel(R) Core(TM) i5-2320 CPU @ 3.00GHz (4 CPUs), ~3.0GHz
Memory: 8192MB RAM
Available OS Memory: 8174MB RAM
Page File: 2726MB used, 13619MB available
DirectX Version: DirectX 11

---------------
Display Devices
---------------
Card name: NVIDIA GeForce GTX 550 Ti
Manufacturer: NVIDIA
Chip type: GeForce GTX 550 Ti
DAC type: Integrated RAMDAC
Device Key: Enum\PCI\VEN_10DE&DEV_1244&SUBSYS_26121462&REV_A1
Display Memory: 4049 MB
Dedicated Memory: 977 MB
Shared Memory: 3071 MB
Current Mode: 1920 x 1080 (32 bit) (60Hz)
Abraxas)
Posts: 227
Joined: Sun Oct 18, 2009 7:24 am

Re: How to decrease texture loading time?

Post by Abraxas) »

550 Ti is hardly a modern power card but it is comparable to the 5770 I'm using:

http://www.hwcompare.com/9737/geforce-g ... n-hd-5770/

However, where I see "shared memory" makes me think you are using a laptop with an "integrated" video card. Is this the case?
ibax
Posts: 193
Joined: Thu Jun 21, 2007 8:56 am
Location: hungary
Contact:

Re: How to decrease texture loading time?

Post by ibax »

Abraxas) wrote:550 Ti is hardly a modern power card but it is comparable to the 5770 I'm using:

http://www.hwcompare.com/9737/geforce-g ... n-hd-5770/

However, where I see "shared memory" makes me think you are using a laptop with an "integrated" video card. Is this the case?
hmmm, I did not checked the motherboard, whether it has an integrated vga card, or a separate one, but I think (based on the description), that the computer has a separate vga card.
http://www.mediamarkt.at/mcs/product/MI ... 61565.html

I don't know exactly, why directx report file reported that amout of "shared" memory...
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: How to decrease texture loading time?

Post by Mel »

100 textures is still a long amount. What is their resolution, more or less? Also, wouldn't it be posible for Irrlicht to load the textures as mipmapped surfaces, so the texture can be streamed to the videocard in mipmaps, rather than loaded completely at once? or does this only work with DDS textures? Applications now a day seem to use this scheme to load their textures while they are already rendering. I don't know how multithreaded it would be, but definately, it would be interesting to give it at least a try.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
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 tested the "very sleepy" app, what is exactly happening

(1) the "png_set_expand" thread is running on almost 100% while loading the textures...
(2) I realized, that there are two texture files, which are loaded much more time (let's say X seconds), than the others... So I deleted these two files to check, what will be the result BUT the load time was the same!!!!! When irrlicht printed out to the console, that texture not found, it also stopped for X seconds, in case of both missing texture files...

interesting...
ibax
Posts: 193
Joined: Thu Jun 21, 2007 8:56 am
Location: hungary
Contact:

Re: How to decrease texture loading time?

Post by ibax »

disabling the mipmap generation decreased 3-4 secs
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 »

png_set_expand - that's very strange. I thought you have .jpg textures? (png is another format so this shouldn't be called at all)
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
Post Reply