Texture Size and Using Objects

Modding, Map Editor, IES Scripting and Other Questions
Post Reply
PaulStretch
Posts: 112
Joined: 27 Jun 2021, 16:10
Has thanked: 45 times
Been thanked: 13 times

Texture Size and Using Objects

Post by PaulStretch »

I'm making texture files for the game that are fairly large (1200x600). I realized though that I could make the textures a lot smaller if I turn some elements of the models into objects with their own texture files. Many elements on these texture files are duplicated (they are elements that appear on every texture), so in a sense the textures of these elements are loaded multiple times. Is it worth eh effort to convert these elements into separate objects with their own textures so their textures are only loaded once, instead of every time they appear with a unit?

User avatar
Dr.MonaLisa
High Representative
Posts: 8707
Joined: 17 Jun 2010, 11:21
Location: Poland
Has thanked: 49 times
Been thanked: 108 times

Re: Texture Size and Using Objects

Post by Dr.MonaLisa »

Most likely it's not worth the effort, as the game will load the .tga / .texcache texture to the in-RAM cache anyway, and re-use it every time it's called.

This behavior can be observed for example in the new Advanced Cache Preloading feature in Unofficial Patch 1.5. Every .tga texture is loaded just once on game start, and the game uses it from RAM instead of loading it later. It reduces the mini-freezes, and this memory can be released (freed) by the game process anyway when more memory is needed.

Please use the Questions subforum for modding-related questions: viewforum.php?f=532
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains
These users thanked the author Dr.MonaLisa for the post:
PaulStretch
PaulStretch
Posts: 112
Joined: 27 Jun 2021, 16:10
Has thanked: 45 times
Been thanked: 13 times

Re: Texture Size and Using Objects

Post by PaulStretch »

So If my mod is based on 1.5 developer version would it be worth it? Also, I will use the right subforum next time.
User avatar
Dr.MonaLisa
High Representative
Posts: 8707
Joined: 17 Jun 2010, 11:21
Location: Poland
Has thanked: 49 times
Been thanked: 108 times

Re: Texture Size and Using Objects

Post by Dr.MonaLisa »

I'm not 100% sure what idea you have, because I'm not that good with 3d modelling and texturing.

I only know that if .nif is loading a .tga, then it's done from disk to memory. If the next .nif is loading the same name .tga, then it's loaded from memory instead of disk. So most likely textures aren't duplicated in memory, just loaded once and re-used where needed.
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains
PaulStretch
Posts: 112
Joined: 27 Jun 2021, 16:10
Has thanked: 45 times
Been thanked: 13 times

Re: Texture Size and Using Objects

Post by PaulStretch »

These are the files in question
help2.png
help2.png (903.68 KiB) Viewed 611 times
help.png
help.png (1.14 MiB) Viewed 611 times
These are for two different building units in game, but you can see that some buildings exist in both texture files. My thought is that the textures on the right are effectively being loaded twice since they appear in both texture files. So perhaps I should make a texture file for each building individually and turn them into objects that I add to the nif file later. That way I can reduce the size of the texture files.
User avatar
Dr.MonaLisa
High Representative
Posts: 8707
Joined: 17 Jun 2010, 11:21
Location: Poland
Has thanked: 49 times
Been thanked: 108 times

Re: Texture Size and Using Objects

Post by Dr.MonaLisa »

It can only make sense if you see that the game process memory usage is getting high. But even then, the game would release some of the "cached" textures to free up the RAM. In worst case, it could cause a mini freeze when the same .nif object appears on the screen for the next time. It's because the game would load the big .tga texture from disk again (SSD, HDD, NVMe or so), and store it in the RAM cache. If there was not enough memory available (4GB I think with Large Address Aware enabled in UP1.5 Settings), then the game would free up some of the other cached in RAM texture which isn't currently visible on the screen.

What the new "Advanced Cache Preloading" feature in Unofficial Patch 1.5 is doing (it needs to be enabled manually in UP1.5 Settings, since it's kind of BETA), is loading .tga .nif files from folders "zips\graphics_150", "zips\textures_150", and some of .zip files like textures.zip, graphics.zip, etc. using the existing game caching function, on game start. It doesn't load files from "graphics_loewambientpack_150" or "textures_loewambientpack_150" as these are big folders with scenario-only units and would only increase game start time without giving much benefits.

So, when you enable "Advanced Cache Preloading", you can notice that the game is starting slower and uses 1GB+ of the RAM memory right after start. When ACP is disabled (default), you can see that it only uses ~200MB (maybe even less) after game start. When ACP is enabled, and the game process is minimized for quite a long time, or when you don't use some .nif / .tga in current game (for example playing only in epoch 1), you can actually notice that the RAM used by game process decreases. It shows how the texture / object caching works in game. When more memory is needed, it will free it up automatically.

I wrote about ACP, because I think it explains best how these things are done. I wasn't aware of it until I actually created the ACP feature and tested it myself.

So, to summary. Obviously it's good to optimize things, reduce textures, but in 2022 reality it's not really worth your time. The difference would most likely be not noticeable. You can also break more things than improve by performing such texturing changes, so maybe it's better to leave it as it is?
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains
These users thanked the author Dr.MonaLisa for the post:
PaulStretch
PaulStretch
Posts: 112
Joined: 27 Jun 2021, 16:10
Has thanked: 45 times
Been thanked: 13 times

Re: Texture Size and Using Objects

Post by PaulStretch »

Ok Pretty useful information thanks. I'll try enabling ACP. I'd prefer not to change the way I am doing textures if possible.
User avatar
Dr.MonaLisa
High Representative
Posts: 8707
Joined: 17 Jun 2010, 11:21
Location: Poland
Has thanked: 49 times
Been thanked: 108 times

Re: Texture Size and Using Objects

Post by Dr.MonaLisa »

Just to make clear, I would recommend to keep ACP disabled since you're modding the game. The longer game start times would be too annoying to test any changes.

The game caching will be available even with ACP disabled, just textures will be loaded the first time they're needed. The caching was always available in EE2.
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains
Post Reply

Return to “Questions”