Page 1 of 1

Shaders and memory/CPU

Posted: Mon Sep 05, 2011 9:14 am
by Noruen
Hi!

I want to know how shaders and textures works from cpu usage and memory usage point of view.

Situation: I want to create eg. 4 shaders.

Example:

Code: Select all

textures/noruen/BlickA
{
    {
        map textures/noruen/BASE.tga
    }
    {
        map textures/noruen/blend.tga
        rgbGen wave sin 1 1 0 1
        blendFunc add
    }
}
Just imagine, that I want to create four variations (shaders; BlickA, BlicB, BlickC, BlickD) with use of this two ("BASE.tga" and "blend.tga") textures. These shader differ only in rgbGen parameter. Let's just say, that both textures filesize is 1 MB.

I want to know:
- if the in-game memory usage (hypotetically, without other assets) will be really only 2 MB
- if this way is better than to create four BASE.tga and four blend.tga variations (because of CPU)

Please, I don't understand this background of texture-usage of this engine, so my question may seem to be stupid but I want to make it clear.

Thank you :)

Re: Shaders and memory/CPU

Posted: Mon Sep 05, 2011 2:40 pm
by obsidian
The engine loads the textures into memory and whatever blend functions are applied afterwards, so I believe it is only loaded once with little additional overhead.

Re: Shaders and memory/CPU

Posted: Mon Sep 05, 2011 5:31 pm
by Ouija
It'd be stupid if it didn't reuse textures. These days though, the only thing that can slow this engine down is a huge amount of translucent and masked materials overlapping each other (the number of passes grows exponentially in this case) or huge areas with bad vis (a dirty fix would be distance clipping + fog)
And even then, the above lmits are nearly irrelevant with a post-2006 machine.

Re: Shaders and memory/CPU

Posted: Thu Sep 08, 2011 12:06 pm
by Noruen
Thanks :)