Maximum atlas texture size & number

Maximum atlas texture size & number

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
Master-Athmos
Posts: 916
Joined: 27 Jun 2009, 01:32

Maximum atlas texture size & number

Post by Master-Athmos »

I have a question which came up during my work to get my old mod Maximum Annihilation running with the latest engine version again. Back then there was a limit of a 2048x2048 texture for the bitmap atlas which stopped me from importing some more extensive sprite animation sequences. I did a search if something has changed about this and was happy to see this:

https://springrts.com/mantis/view.php?id=6414

So I have some questions now: I saw the maximumValue(32768) change so I guess that is the upper limit for the texture dimension now (coming with 105 I guess)? At least if the GPU is able to handle such sizes that is. So the texture atlas still is restricted to just one atlas texture? I'm asking this to be sure about the total space that now is used for the bitmap atlas. It once was possible to run Spring.exe with the /t command to export the texture atlases but it seems that this doesn't work anymore. Knowing about the atlas sizes used has some importance for compatibility in my opinion. I'd be rather cautious to use anything bigger 8192x8192 as iirc 16k texture support came with the DX11 feature set which would be the HD5000 and GTX 400 series. While that's already pretty old I think this is something to keep in mind if there is the wish for support of older graphics cards. So if a game developer wants to check the atlas size used what would be the recent command / way to do this?
ivand
Posts: 310
Joined: 27 Jun 2007, 17:05

Re: Maximum atlas texture size & number

Post by ivand »

https://feedback.wildfiregames.com/repo ... XTURE_SIZE

Therefore you likely would want to stay at 4k or 8k per dimension.

Something like the following should output the GL_MAX_TEXTURE_SIZE value of your local GPU driver.

Code: Select all

local GL_MAX_TEXTURE_SIZE = 0x0D33
Spring.Echo(gl.GetNumber(GL_MAX_TEXTURE_SIZE ))
Master-Athmos
Posts: 916
Joined: 27 Jun 2009, 01:32

Re: Maximum atlas texture size & number

Post by Master-Athmos »

Thanks - that's an interesting survey. What I wanted to be able to check though is the actual size of the atlas in terms of my bitmaps on it. I just realized that this might not be possible anymore though. The question is what decides the texture size chosen for the atlas. Is it just the maximum the GPU can provide now? I still know that back in the days of like engine version 82 you could run Spring.exe with I think a /t command and this would save two atlas images: The 3do atlas on the one hand and the bitmap atlas on the other hand. Right now the /t command only gives me an error that the "setup script does not exist at the current location".

This was handy because you could see how much space on that 2048x2048 texture was still blank so you had an idea if certain bitmaps would still fit on it or not. Being able to have a look at that is what I am asking for now because if you - as you said - want to keep everything in e.g. a 4096x4096 budget you have to check if you still do or if you'd already be in the range that needs additional space i.e. that would need a 8192x8192 texture. As mentioned before this of course only would work when there is some kind of evaluation which texture size is appropiate. I didn't go through the entire code behind that - I just saw a min value of 512 and a max value of 32768 for the bitmap atlas.

So my question now is if it still is possible to find out how much space the bitmaps use in order to check if e.g. everything will fit into an atlas of a 4096x4096 resolution (this way making sure everything is fine for users with a GPU restricted to that texture resolution limit)? When it was fixed to a 2k size you could just export the atlas bitmap and have a look how much space is left. Is there a way to accomplish this now?
ivand
Posts: 310
Joined: 27 Jun 2007, 17:05

Re: Maximum atlas texture size & number

Post by ivand »

You'll need to fast-forward into "new" spring. I suggest you join one of the active Discord channels. I'm aware of two: ZK or BAR. Also I think most of us on Discord read official Spring Discord (though it's quite empty as far as new content).

As for the units, models, textures, etc. I suggest to forget 3do ever existed. It's still supported, but you'll find yourself handicapped.

Next you have few options and levels:

BASELINE LEVEL
1) Upload a model in s3o or in one of the assimp formats (COLLADA/.dae is the most common one I have seen).
2) Reference model name in your unitdef file. Example.)
3) Upload "diffuse" color texture for the model (Zero-K way) or faction (atlas texture in fact, BAR way) or per whole game (again atlas).
4) s3o files have texture filenames embedded into them, assimp assets require small auxiliary lua file defining texture filenames(Example.).

ADVANCED LEVEL
5) Upload "tex2". By default R and G define "emissivity" and "specularity/reflectivity" of a certain surface fragment.
6) Leverage Lua custom unit shaders framework with predefined "materials". Materials give you flexibility how your units/features look and enable capabilities missing in the engine, such as normal mapping.

In https://www.beyondallreason.info/ we have gone farthest and rewrote lots of stuff related to Custom Unit Shaders, Materials System and GLSL shaders to enable physically based rendering, damage based shading, etc...
Master-Athmos
Posts: 916
Joined: 27 Jun 2009, 01:32

Re: Maximum atlas texture size & number

Post by Master-Athmos »

This discussion was continued in Discord. For the record:
  • A command line to save the atlas textures into a file to have a look at probably doesn't exist anymore
  • There is a LUA access to an atlas but it's just the 3do atlas
  • When there is the wish to keep the atlas texture size to a certain limit you just go for it and add your sprites while watching out for error messages in the log and either missing effects or black textures - without having a look at the atlas itself there is no real planning ahead
  • Technically it of course is possible to extract the atlas texture from the glDrawArrays but I guess that's not an option to consider as the average game developer
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Maximum atlas texture size & number

Post by Beherith »

For the record, in the past I have use gDEBugger https://www.opengl.org/sdk/tools/gDEBugger/ to see the texture atlases (and other magical stuff) in Spring.
Post Reply

Return to “Game Development”