The Size of ITexture is too big
The Size of ITexture is too big
I noticed that the memory size of an ITexture object which loaded a 800KByte png image is about 32MByte.
That's too much for me! What if I want to load hundreds of images to show the dynamic animation.
Should I load the image frame by frame, and drop the memory frame by frame? What's the best solution?
Thanks!
That's too much for me! What if I want to load hundreds of images to show the dynamic animation.
Should I load the image frame by frame, and drop the memory frame by frame? What's the best solution?
Thanks!
Re: The Size of ITexture is too big
Use smaller resolution :-)
If you are using irrlicht trunk you can also try the dds loader (there is also one in Irrlicht 1.8, but that one had several problems and did not keep images compressed anyway). The DDS format allows keeping imaged compressed at least up to the graphic-card.
If you are using irrlicht trunk you can also try the dds loader (there is also one in Irrlicht 1.8, but that one had several problems and did not keep images compressed anyway). The DDS format allows keeping imaged compressed at least up to the graphic-card.
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
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: The Size of ITexture is too big
Thanks for your reply! I'm working on a 4k resolution project ,I have to use this size of image. How about the dynamic loading method? Does irrlicht support loading and drop textures frame by frame?CuteAlien wrote:Use smaller resolution
If you are using irrlicht trunk you can also try the dds loader (there is also one in Irrlicht 1.8, but that one had several problems and did not keep images compressed anyway). The DDS format allows keeping imaged compressed at least up to the graphic-card.
Re: The Size of ITexture is too big
Yeah - you can drop textures (IVideoDriver::removeTexture to get it out of the texture-cache). But you talk about a dynamic animation and I'm not sure if loading from disk each frame is fast enough for that. DDS should be faster (as it's smaller).
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
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
-
- Competition winner
- Posts: 189
- Joined: Tue Oct 16, 2007 3:53 am
- Location: Indonesia
- Contact:
Re: The Size of ITexture is too big
correct me if i'm wrong, addition to texture resolution is the color format, like a simple alpha channel is 25% of the texture size (A8R8G8B8). these two determines the memory usage.
-
- Posts: 1010
- Joined: Mon Oct 24, 2011 10:03 pm
- Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d
Re: The Size of ITexture is too big
If you want better than that you'd have to use DXT compressed textures or some other compression that the GPU can decode directly (there are a few different ones), I don't think irrlicht supports these directly - I know PNG will get you uncompressed image data in memory.
"this is not the bottleneck you are looking for"
Re: The Size of ITexture is too big
Thank you! I have tried that method. I remove the previous texture before I load the new Texture. And it doesn't make my system significantly slow.CuteAlien wrote:Yeah - you can drop textures (IVideoDriver::removeTexture to get it out of the texture-cache). But you talk about a dynamic animation and I'm not sure if loading from disk each frame is fast enough for that. DDS should be faster (as it's smaller).
I will also try DDS later.
Re: The Size of ITexture is too big
I implemented image blending with alpha channel in Opencv once. The addition memory is far smaller than the memory of Irrlicht. That makes me confused most.kornwaretm wrote:correct me if i'm wrong, addition to texture resolution is the color format, like a simple alpha channel is 25% of the texture size (A8R8G8B8). these two determines the memory usage.
Re: The Size of ITexture is too big
Thanks for you suggestion! That's a different viewport to this problem.Cube_ wrote:If you want better than that you'd have to use DXT compressed textures or some other compression that the GPU can decode directly (there are a few different ones), I don't think irrlicht supports these directly - I know PNG will get you uncompressed image data in memory.
Re: The Size of ITexture is too big
The dds format is using dxt - and it's supported in the Irrlicht trunk version (I never worked with it myself - so not sure how well the support works with different drivers).
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
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: The Size of ITexture is too big
You can cut some memory consumption by disabling the mipmap generation if memory is a concern, the renders will slow a bit, but you will have more free memory. The older API used to "shadow" texture resources with system resources so updating them was easier, thus it is most likely the memory the texture is using is actually duplicated, that is API design, and there is no workaround.
When it comes to textures, the file size does not matter, what is important is the resolution and the format. Would be nice that Irrlicht could convert between texture formats, for instance, convert from a RGBA8 texture into a RGBA4 or the like. There is quality loss, i am aware of that, but to what extent? or perhaps, what if a dither pattern could be applied? Before generating a texture, an IImage is entirely in system memory, so it is easier to handle, the hard part would be to bring the texture back from the GPU memory, so it should be done before the texture upload
When it comes to textures, the file size does not matter, what is important is the resolution and the format. Would be nice that Irrlicht could convert between texture formats, for instance, convert from a RGBA8 texture into a RGBA4 or the like. There is quality loss, i am aware of that, but to what extent? or perhaps, what if a dither pattern could be applied? Before generating a texture, an IImage is entirely in system memory, so it is easier to handle, the hard part would be to bring the texture back from the GPU memory, so it should be done before the texture upload
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
-
- Posts: 1010
- Joined: Mon Oct 24, 2011 10:03 pm
- Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d
Re: The Size of ITexture is too big
RGB8 to DXT5 would be more interesting since GPU can take compressed DXT - for OGL 4.3+ ETC2 format is also available.
Another compression scheme that would be interesting to support would be ASTC, any of these with RGBA8 or SRGB (where applicable) is orders of magnitude smaller and supported directly on GPU so compressed texture data in VRAM.
the only problem with ASTC is it isn't mandated by standard so only some gpus support it (all recent mali, nvidia, and intel (skylake+) - AMD and ARM invented the thing so their gpus probably also support it)
Another compression scheme that would be interesting to support would be ASTC, any of these with RGBA8 or SRGB (where applicable) is orders of magnitude smaller and supported directly on GPU so compressed texture data in VRAM.
the only problem with ASTC is it isn't mandated by standard so only some gpus support it (all recent mali, nvidia, and intel (skylake+) - AMD and ARM invented the thing so their gpus probably also support it)
"this is not the bottleneck you are looking for"
Re: The Size of ITexture is too big
It would be interesting if Irrlicht supported the KTX image files, they support a full range of block compression systems in hardware (i.e. the file is almost a "DDS" like but written by Khronos, although it also supports uncompressed and probably floating point formats, so eventhough the texture compression could remain GL only, there is no reason to not to support these files on DirectX as well )
https://www.khronos.org/opengles/sdk/to ... at_spec/#3
https://www.khronos.org/opengles/sdk/to ... at_spec/#3
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
-
- Posts: 1010
- Joined: Mon Oct 24, 2011 10:03 pm
- Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d
Re: The Size of ITexture is too big
The problem with the format is the compression is GL only so we get a feature disparity where the memory usage becomes unpredictable, unless it runtime rebuilds the texture to something supported like S3TC which is probably above and beyond the scope of any reasonable driver, and since it's technically a container (much like MKV for videos) the specific compression is not guaranteed - for OGL 4.3+ and GLES3+ it's pretty much guaranteed to be ETC2, or possibly (but unlikely) DXT5
"this is not the bottleneck you are looking for"