Shaders and memory/CPU

Discussion for Level editing, modeling, programming, or any of the other technical aspects of Quake
Post Reply
Noruen
Posts: 308
Joined: Thu Jan 28, 2010 11:45 pm

Shaders and memory/CPU

Post 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 :)
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Shaders and memory/CPU

Post 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.
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
Ouija
Posts: 55
Joined: Tue Aug 16, 2011 9:11 pm

Re: Shaders and memory/CPU

Post 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.
Noruen
Posts: 308
Joined: Thu Jan 28, 2010 11:45 pm

Re: Shaders and memory/CPU

Post by Noruen »

Thanks :)
Post Reply