Home Technical Talk

Single or Multiple textures and shaders

polycounter lvl 11
Offline / Send Message
jocose polycounter lvl 11
I am making a building with windows. I constructed the walls of the building out of modular square tiles that I can clone to extend the building vertically or horizontally.

Right now I basically have a planar projection on these square tiles with a 512x512 texture applied, I painted the windows right onto this texture along with the texture for the wall.

I now want to put a shader just on the windows to make them shiny. This would involve making an alpha channel to mask the walls so they weren't shiny as well.

Should I instead make a separate 256x256 texture and put all the windows on it, and not use an alpha channel?

This should result in a smaller memory foot print, or am I missing something?

I see many buildings out there that just use a single texture with an alpha channel. I am just wondering if there is any reason why and if the method I described above is significantly better.

In other words does is a 256x256 texture smaller in memory than 512x512 alpha channel, and is there any performance hit caused by using multiple textures on a single object vs 1?

Replies

  • Eric Chadwick
    Options
    Offline / Send Message
    It depends, unfortunately :( Depends on the hardware mostly, whether a PC or a console or a handheld.

    Usually you'll want to limit the reflection pass to just the triangles that need it, so the windows would use a separate shader from the rest of the building. The more passes each surface needs, the slower it renders, and so the framerate suffers.

    As for the texture, it's generally better to pack multiple images into a single bitmap, which reduces the time it takes for the game to grab images off the hard drive (or DVD or whatever) and stuff them into video memory for rendering.

    Unless only one of the images needs alpha and the rest doesn't, in which case you'll probably save video memory if the alpha'd image is its own smaller bitmap, while the rest uses a larger un-alpha'd format. You don't want to store alpha for the large packed texture if its going to be mostly wasted.
  • jocose
    Options
    Offline / Send Message
    jocose polycounter lvl 11
    Thanks for the response Eric that's very helpful.
Sign In or Register to comment.