Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: What is the limit of how many textures you should have ?  (Read 3885 times)

0 Members and 2 Guests are viewing this topic.

lowarago

  • Newbie
  • *
  • Posts: 10
    • View Profile
What is the limit of how many textures you should have ?
« on: March 16, 2017, 05:11:27 pm »
I've read in documentation that I shouldn't use too many textures... but I don't know how many of them do they mean.

I know that it depends on how big texture is as well, but still don't know what number of textures can be ok.

In my game I use around 10-15 Textures that are relatively small, 32x32 pixels and 1 of them is 256x512.
I am expecting answers : "Ohh no that's nothing... 32x32 pfff" but what if I use only big textures, is there anything that I should take care off ?


dabbertorres

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • website/blog
Re: What is the limit of how many textures you should have ?
« Reply #1 on: March 16, 2017, 06:52:44 pm »
It's going to depend on the amount of VRAM available, and supported API levels.

As for maximum texture size, that can be acquired via sf::Texture::getMaximumSize()

lowarago

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: What is the limit of how many textures you should have ?
« Reply #2 on: March 16, 2017, 11:37:58 pm »
Yes. I get the value 16384. That just tells maximum size of the texture, and not how many textures could I use.

I want to know what is okay for project (e.g. you shouldn't use more than 10 textures with size equal to size that I get with sf::Texture::getMaximumSize() ) so I could take care of it in future.
« Last Edit: March 16, 2017, 11:39:30 pm by lowarago »

dabbertorres

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • website/blog
Re: What is the limit of how many textures you should have ?
« Reply #3 on: March 17, 2017, 02:54:29 am »
It's going to depend on the amount of VRAM available, and supported API levels.

So the best solution would be to find numbers on the average amount of VRAM a computer has, and target that with your max.

Based off your numbers (rounding up, and simplifying):
256x512 * 16 * 4                       = 8,388,608 bytes, or ~8 mebibytes. Unless you're targeting hardware from the 90s, you're fine. :)
(size)          (#)   (bytes per pixel)

Tigrou

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: What is the limit of how many textures you should have ?
« Reply #4 on: March 17, 2017, 03:24:55 pm »
In the documentation, they recommand to not have too many textures because of performance, not because of possible hardware limitations. Switching between textures is very expensive, that's why if you have quite a lot of them you better pack them in a texture atlas. A lot of games do that.

 

anything