Efficiency of texture atlases in GZDoom?

Ask about editing graphics, sounds, models, music, etc here!
Shaders (GLSL) and SNDINFO questions also go here!

Moderators: GZDoom Developers, Raze Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
User avatar
TDRR
Posts: 825
Joined: Sun Mar 11, 2018 4:15 pm
Location: Venezuela

Efficiency of texture atlases in GZDoom?

Post by TDRR »

So i have been investigating various techniques that normally increase performance in games, and one that called my attention was texture atlases.

My question is, is it actually efficient at all with models? So i have various models all getting their textures from a 8192x8192 texture atlas (Or whatever size the OpenGL 1.4/2.x/3.x render paths on Zandro supports) is this at all faster than one separate texture for each model? The reason i ask, is because GZDoom usually handles models in quite the special way so i'm not sure if these kind of tricks work with it.

And with maps, is it at all worth doing this? I'm already finding a big hole in that, and that is having to subdivide walls to make textures tile properly. I'm guessing the answer is a big fat NO, except maybe for ceiling and floor textures?
User avatar
Kinsie
Posts: 7402
Joined: Fri Oct 22, 2004 9:22 am
Graphics Processor: nVidia with Vulkan support
Location: MAP33

Re: Efficiency of texture atlases in GZDoom?

Post by Kinsie »

1.) No.
2.) No.

GZDoom handles such things itself under the hood. Attempting to do it yourself just makes matters worse.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49211
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Efficiency of texture atlases in GZDoom?

Post by Graf Zahl »

Texture atlases are only efficient if you can batch-draw multiple polygons from it that you couldn't without. In all other cases the added complication for calculating the proper coordinates will be enough to nullify all advantages, especially when targeting a low level API like Vulkan.

For models in particular the gains do not add up, because normally you have to set up new matrices for each model so a separate draw call is unavoidable. And in that case cache locality of smaller textures alone will probably be enough to make the texture atlas the worse choice.

Consider this: In the menus each single character is a separate texture. And they are all relatively small.
User avatar
TDRR
Posts: 825
Joined: Sun Mar 11, 2018 4:15 pm
Location: Venezuela

Re: Efficiency of texture atlases in GZDoom?

Post by TDRR »

Graf Zahl wrote:Texture atlases are only efficient if you can batch-draw multiple polygons from it that you couldn't without. In all other cases the added complication for calculating the proper coordinates will be enough to nullify all advantages, especially when targeting a low level API like Vulkan.
I assume this also applies in a similar way to the OpenGL renderer, right? Either way, thanks for the explanation.
Graf Zahl wrote:For models in particular the gains do not add up, because normally you have to set up new matrices for each model so a separate draw call is unavoidable. And in that case cache locality of smaller textures alone will probably be enough to make the texture atlas the worse choice.
Which brings me to the next question: What about floors and ceilings? Let's assume i have another material i apply to them, but it's something i'd have to apply separately to every flat of the map and a lot of the time, differently even for flats that would be otherwise identical. In this case, is it better to use one big texture (or various fairly large ones) for these cases? I'm aiming for 4096x4096 but of course 2048x2048 or 1024x1024 might be good enough for most cases.
Graf Zahl wrote:Consider this: In the menus each single character is a separate texture. And they are all relatively small.
Yeah, but i'm talking about models with large-ish textures, like 512x512 for the most common ones (I'm currently precaching them via a small trick on map-start so there's usually no lag when seeing the models again) as well as 256x256 and lower for most other things. Does this have any real difference compared to the menu example?

EDIT: Forgot to mention, this is on Zandronum, no Vulkan at all. OpenGL 3.0 is my full-featured target but i assume most advice will apply to OpenGL 2.0 as well as 1.4. (The game will run on 1.4 minimum but there will be missing graphical effects, lightmapping is one of them. Do models even work in 1.4?)

Return to “Assets (and other stuff)”