memory reduction....

Discussion about everything. New games, 3d math, development tips...
Post Reply
skumar
Posts: 201
Joined: Thu Feb 14, 2008 6:24 pm
Location: kerala state india
Contact:

memory reduction....

Post by skumar »

hi,
I have asked similar questions before but this is a final one...i am doing a virtual walkthrough and i use lightmaps. What im facing is the huge memory needs of my app..

I am disabling mipmaps....for gettting some relief..

My question is if i use jpeg or such 24bit formats...will the texture made will also be 24 bit....or they reserve something for alpha??
skumar
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

It can happen that 24bit images turn into 32bit textures. You can check the color format. You can enforce 16bit textures with the texture creation parameters, but it's also not necessarily created as 16bit then - depends on the driver and hardware.
Nox
Posts: 304
Joined: Wed Jan 14, 2009 6:23 pm

Post by Nox »

Maybe removing the texture using removeTexture could help you. But in fact a "clearup" methode which removes unused meshes, materials and textures would be really nice :) . May be something for the requesttracker?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Not possible, because materials are vital part of meshes, and textures are not reference counted.
Nox
Posts: 304
Joined: Wed Jan 14, 2009 6:23 pm

Post by Nox »

And why are not they refcounted? Is there a good reason? Or just because? (Should not be respectless or an attack. It is just a question).
skumar
Posts: 201
Joined: Thu Feb 14, 2008 6:24 pm
Location: kerala state india
Contact:

Post by skumar »

Thanx for the help....

I am using Lightmaps....i dont need any alpha information in that anyway.So if i can represent it as 24bit information i can save a lot of memory. One arch model may contain more than 10 1024x1024 textures...

16bits will surely degrade the quality...so what i want is ...i want my tex to represented as RGB and no A :)
skumar
skumar
Posts: 201
Joined: Thu Feb 14, 2008 6:24 pm
Location: kerala state india
Contact:

Post by skumar »

I have done a small test ....

I made a simple plane(2 triangle) textured it using a 104*1024 tex(jpg) and loaded into the mesh viewer....

Empty meshviewer meme = 4520k
Untexture plane loaded = 4568k
Textured plane = 13256k
****************************

On paper the 1024 x 1024 tex need 4 MB and after mipmapping....

~5.33MB

What is this 8716k footprint....???

:x :x

Or im i doing a bad experiment....?????
skumar
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Depends on the driver and the way you check for free memory. But it's mostly due to the video mem being mapped into the application, hence you get almost double the amount of mem. But you should notice that it's not all CPU memory.
skumar
Posts: 201
Joined: Thu Feb 14, 2008 6:24 pm
Location: kerala state india
Contact:

Post by skumar »

:D So my tests were a bit wrong....

thanx hybrid...

can you suggest a way i can test how much mem my app occupies in runtime...with precision.
skumar
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You can use a memory profiler or memory debugger. I guess once you track all allocations you can easily get the maount of memory allocated and deallocated, and then check for maximum values. But I never did this.
Nox
Posts: 304
Joined: Wed Jan 14, 2009 6:23 pm

Post by Nox »

Hmm what is about deactiveting mipmapping and using the software renderer? Should be more accurate.

But why are the Textures not refcounted?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

The software renderer has completely different memory usage than the other drivers. And I don't think that it will work without GPU mem.
Textures are not refcounted because you can assign them manually to the materials (using assignment to the pointer member). So you'd have to do the refcounting on your own. Which makes it somewhat absurd.
Nox
Posts: 304
Joined: Wed Jan 14, 2009 6:23 pm

Post by Nox »

Hmm you are right but ressourcemanagment is a important for apps which change their drawn content permanently. Killing everything results often in crashes and/or long reloadtimes. May be the materials could be changed to class (or a struct with private ITexture) using a set for textures? Or do you have a good idea how to deal with unused ressources?
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

We could add a setTexture method to SMaterial struct, but we'd also have to eliminate any material copying within the engine.

Thinking about it, we could use a setTexture method to abstract away the stage numbers and replace them with an enumeration. This may increase the size of material struct but it would allow Irrlicht to understand the meaning of a texture slot and choose from a number of internal renderers.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Nox
Posts: 304
Joined: Wed Jan 14, 2009 6:23 pm

Post by Nox »

We could add a setTexture method to SMaterial struct, but we'd also have to eliminate any material copying within the engine.
May be copyc'tor+ = operator overloading is an other solution?
Post Reply