🔒 Locked
Texturing Techniques
Advertisement
Original Post
Hi Everyone, I'm looking for advice on rendering objects with many textures or a scene with many objects with different textures. glBindTexture is very slow if you need to bind too many textures every frame. What is the best technique to render all of these textures, or what tricks exist out there that can be used to make rendering more efficient (FAST)? I know I could combine some textures into a larger texture image so that it can reduce the amount of glBindTexture calls but I'm interested in learning other tricks. I am using VBOs with interleaved arrays and they improved performance tremendously, but binding those darned textures get me every time! Thanks in advance
I have a model with 31 textures bound to it. Some textures are small and some are larger. I know that I can (and should) combine as many as possible but that made me ask the question..."How do professionally made 3D games deal with this situation?"
The games appear to have hundreds of textures drawn each frame, even if textures are combined into one image, there must be multiple texture images being bound per frame.
I have several computers testing my code and the 2 windows machines with 512 MB and 1 GB of ram respectively get bottlenecked during the texture binds.
The games appear to have hundreds of textures drawn each frame, even if textures are combined into one image, there must be multiple texture images being bound per frame.
I have several computers testing my code and the 2 windows machines with 512 MB and 1 GB of ram respectively get bottlenecked during the texture binds.
The quantity of RAM a computer has is not important.
While glBindTexture is expensive, have you determined that it is the number of binds that is causing the slowness? Have you tried a tool like gDebugger
http://www.opengl.org/wiki/Debugging_Tools
also, you need to pay more attention to what graphics card a system has and if the drivers are up to date, as oppose to just consider RAM. VRAM is far more imporant than RAM for 3D graphics.
While glBindTexture is expensive, have you determined that it is the number of binds that is causing the slowness? Have you tried a tool like gDebugger
http://www.opengl.org/wiki/Debugging_Tools
also, you need to pay more attention to what graphics card a system has and if the drivers are up to date, as oppose to just consider RAM. VRAM is far more imporant than RAM for 3D graphics.
Thanks for bringing that to my attention.
The machines that I mentioned above are very old (5+years each), so the graphics cards on them probably can't handle the large amount of texture binds.
I have a new windows box with a heavy duty graphics card on it and it runs fine.
Would you say that it would be safe to disregard machines as old or older than the ones I mentioned above? Or should I aim to support them?
I would really appreciate your thoughts. As you can tell I'm trying to formulate some sort of bench mark for me to aim for.
The machines that I mentioned above are very old (5+years each), so the graphics cards on them probably can't handle the large amount of texture binds.
I have a new windows box with a heavy duty graphics card on it and it runs fine.
Would you say that it would be safe to disregard machines as old or older than the ones I mentioned above? Or should I aim to support them?
I would really appreciate your thoughts. As you can tell I'm trying to formulate some sort of bench mark for me to aim for.
Texture binds are "slow" only relative to other gl calls. While 31 textures is a lot for one model it doesn't sound like it should be causing the problems you describe. It sounds like you're doing something else wrong, how exactly have you decided that the glBindTexture call is what's causing the slowness?
Things to check/do:
- make sure you're not accidentally re-uploading the raw texture data every time you bind.
- what size are those textures? Make sure they're not stupidly big like 1024x1024 if they only cover a fraction of the screen.
- Post code so we can see what you're doing.
- Why exactly do you need 31 textures per model?
- See what effect changing the resolution (but keeping the same poly counts and textures) has on your framerate. Try the same thing for lower poly counts but same resolution and textures as well. That'll help narrow down what's actually causing the slowdown.
In general, vauge questions like "Is this too slow" when we don't know anything about your application, scene or the hardware you're testing on can't be answered. [razz]
Things to check/do:
- make sure you're not accidentally re-uploading the raw texture data every time you bind.
- what size are those textures? Make sure they're not stupidly big like 1024x1024 if they only cover a fraction of the screen.
- Post code so we can see what you're doing.
- Why exactly do you need 31 textures per model?
- See what effect changing the resolution (but keeping the same poly counts and textures) has on your framerate. Try the same thing for lower poly counts but same resolution and textures as well. That'll help narrow down what's actually causing the slowdown.
In general, vauge questions like "Is this too slow" when we don't know anything about your application, scene or the hardware you're testing on can't be answered. [razz]
Quote:What is your target market? If you game is meant for hardcore PC gamers, then most of them will have a pretty decent machine already. If your game is aimed at kids/educational or the casual/lunch break markets, then you want it to run on underpowered work PCs. These are of course only general guidelines, but your intended users are the deciding factor in determining minimum specs.
Original post by mudrugger
Would you say that it would be safe to disregard machines as old or older than the ones I mentioned above? Or should I aim to support them?
Quote:
- make sure you're not accidentally re-uploading the raw texture data every time you bind.
I have ensured that I am only loading the textures once into memory during initialization. I simply used printf commands to test this out and they only printed once.
Quote:
- what size are those textures? Make sure they're not stupidly big like 1024x1024 if they only cover a fraction of the screen.
Yes! Some of those textures are too large.
Quote:
- Why exactly do you need 31 textures per model?
You're right, I don't need 31 textures for the model. I created a generic model and mapped a bunch of textures to it from different sources. I agree there various things I can do to speed things up.
My intention of posting this thread was to see how others in the community optimized their code and to see how I should proceed. All of your answers enlightened me. As you could probably tell, I'm a beginner. I have a solid grip on programming but not so much in game design.
Thanks a lot
Quote:
what size are those textures? Make sure they're not stupidly big like 1024x1024 if they only cover a fraction of the screen.
OrangyTang's point about the textures being too large was the main culprit of my problem. His point about the numerous textures for one model was helpful too, but for my purposes, it was not necessary to address this at this time.
For future implementations I will ensure that the number of textures are kept to a minimum
Thanks to everyone who helped and provided insight
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement