glsl shaders vs. uvmapped textures

i am definitely going to uvmap my models for normal mapping details.

However, i have created some nice shaders with geometrically placed details. my computer is top of the line, so i cant feel any performance difference.

the question is which is better/faster for optimization? a combination of gloss and diffuse uvmap images baked to display the diffuse and gloss, or a procedurally generated shader?

for example, i have 10 different models on the map, with different meshes, uvs and normal maps. They all are wearing “bronze plate armor”. this can be done either with 20 different uvmapped 512 x 512 pngs being processed by the graphics card, or one “bronze plate armor” gloss shader (its a custom shader tha works great in glsl, including adding details where i want automatically based on edge detection etc) distributed across all 10 different model types. which would be more resource intensive?

or perhaps there is a tool to show graphics stress beyong a fps counter?

or perhaps there is a tool to show graphics stress beyong a fps counter?

These tools exist. On intel integrated GPU’s it’s intel_grpu_top, and on nvidia there is the visual profiler and so on.

In terms of GPU-land
There isn’t a hard-and-fast rule about this. It’s all a question of trade-offs. If your program isn’t using many other textures, then maybe the vram usage of 20 512x512 pngs won’t be noticed (quick note, 20512512*4 = 2Mb of VRAM - which is quite small). Similarly, if you have mostly simple shaders, then perhaps the extra texture samples used for decaling won’t make much difference.

In general:

  • Don’t use if statements (or min or max functions, because those are ‘ifs’ in disguise) for your decals if you can. Instead use “GL_CLAMP_TO_BORDER” (I don’t think BGE exposes this though)
  • Use as few texture samples as possible.
  • Don’t go crazy on the VRAM. If I recall correctly, current integrated cards choke at about 1Gb.
  • If a texture isn’t used, unload it from vram (in BGE you can use the dynamic texture functionality to load/unload images)

Other factors:

  • One of the advantages of decalling is that it allows different resolution textures. You can have high res decals and low res base materials that result in your model looking really detailed without needing lots of texture space.
  • Purely procedural shaders can be blazingly fast. I haven’t done any benchmarking, but I suspect you can do several dozen operations in the time it takes to sample a texture. So if you’re doing a checkerboard or a gradient - just generate it on the GPU.
  • If all you’re doing is changing colours, don’t change textures, change the colour using a custom uniform, vertex colours, object colour or something else. Store the image in black/white, or with the alpha representing where the colour goes, and substitute it in when rendering.