Trouble with IconTextureAtlases

RenaissanceFan

Warlord
Joined
Mar 15, 2011
Messages
125
Hello again. I'm having some trouble with the icon atlases. Yes, all are marked with VFS=true, but the game always gives a message "error loading texture [Textures(size).dds]".

Here's my code:
Spoiler :
<IconTextureAtlases>
<Row>
<Atlas>TEXTURES</Atlas>
<IconSize>256</IconSize>
<Filename>Textures256.dds</Filename>
<IconsPerRow>8</IconsPerRow>
<IconsPerColumn>4</IconsPerColumn>
</Row>
<Row>
<Atlas>TEXTURES</Atlas>
<IconSize>128</IconSize>
<Filename>Textures128.dds</Filename>
<IconsPerRow>8</IconsPerRow>
<IconsPerColumn>4</IconsPerColumn>
</Row>
<Row>
<Atlas>TEXTURES</Atlas>
<IconSize>64</IconSize>
<Filename>Textures64.dds</Filename>
<IconsPerRow>8</IconsPerRow>
<IconsPerColumn>4</IconsPerColumn>
</Row>
<Row>
<Atlas>TEXTURES</Atlas>
<IconSize>45</IconSize>
<Filename>Textures45.dds</Filename>
<IconsPerRow>8</IconsPerRow>
<IconsPerColumn>4</IconsPerColumn>
</Row>
</IconTextureAtlases>


And my folder hierarchy, in any case:
Spoiler :
Mod
---Art
------Textures256.dds
------Textures128.dds
------Textures64.dds
------Textures45.dds
---Buildings
------BuildingClasses.xml
------Buildings.xml - <IconTextureAtlases> tag and references here
 
Well, it could be the conversion. In GIMP, I exported it as TGA with "combine layers" option, then, on Paint.NET, I saved it as DDS with the "A8R8G8B8" settings. What are the right settings?
 
Well, it could be the conversion. In GIMP, I exported it as TGA with "combine layers" option, then, on Paint.NET, I saved it as DDS with the "A8R8G8B8" settings. What are the right settings?

Just download the DDS plugin for GIMP, there's no need to go through a second program. I've put a couple hundred icons into the game in my own mod, and they all worked fine this way.

And no, A8R8G8B8 isn't the right one. (DXT5 is what you want, I think? I can check when I get home.) It's a bit forgiving, in that I know of at least three formats that work. Also, do not set mipmaps.

Not having your files in front of me, I can't tell if you did anything else wrong, but you're obviously using custom-made files (since they're 8x4) instead of just adding your graphics to the premade 8x8 template files. So it's also possible that you screwed up the alpha channel or something in general. I'd suggest finding those template files and modifying them instead of trying to make your own files. (Suggestion: download the fan-made .xcf templates hosted on this site, NOT the official .dds ones. They're cleaner.)
 
Not having your files in front of me, I can't tell if you did anything else wrong, but you're obviously using custom-made files (since they're 8x4) instead of just adding your graphics to the premade 8x8 template files.

What I screwed up wasn't the alpha channel. The files ARE the premade 8x8, but, since the 4 last rows are unused, I simply ignored them.


DXT5 is what you want, I think? I can check when I get home.

After I converted in DXT5 settings, it worked, but the alpha channel doesn't seem to be working. The icon is surrounded by a black square.
 
Well then, it's your "Transparency Alpha Layer".
The easiest way to deal with such files is (normally) to use PNG_24b and then convert it to DDS within Gimp. Btw, the only thing that DXT5 does is "compressing" already detailed images on a 4x4 pixels wide grid that creates blocks of indexed colors. 95% of the time you'd lose huge quality. Texturing is more about mapping on polygon models... while Icons are flat 2D. It's just that the DDS format is more portable (or effective) across the rendering engine and basic functions.
I'd recommend the "No-Compression" option.
Files may get a lot bigger, but at least there's no artifacts -- it's specifically more apparent when masking must be used to blend edges of Icons.

PS; Some type of files require DXT3 compression, btw. But these are mostly found in UI assets, IIRC.
 
I have the same problem, but not the same exactly... look like.
There is always "error loading texture [Textures(size).dds]" then I'm trying to load my custom icons to the game, I had a hundreds of tries, but all was nothing. Then, I tried to modify some already done .dds atlas. So, I had done this and ran it with the mod from where this .dds file was, and my icon appeared in the game! I was so happy, so I copied that file and added it to my mod. I was so excited but when it ran it was the same "error loading texture [Textures(size).dds]"!
My .sql code:
Spoiler :
Code:
INSERT INTO IconTextureAtlases (Atlas, IconSize, Filename, IconsPerRow, IconsPerColumn) VALUES ('CIV_COLOR_ATLAS_EPHIOPIA', 256, 'EphiopianAtlas256.dds', 8,8);
INSERT INTO IconTextureAtlases (Atlas, IconSize, Filename, IconsPerRow, IconsPerColumn) VALUES ('CIV_COLOR_ATLAS_EPHIOPIA', 128, 'EphiopianAtlas128.dds', 8,8); 
INSERT INTO IconTextureAtlases (Atlas, IconSize, Filename, IconsPerRow, IconsPerColumn) VALUES ('CIV_COLOR_ATLAS_EPHIOPIA', 80, 'EphiopianAtlas80.dds', 8,8); 
INSERT INTO IconTextureAtlases (Atlas, IconSize, Filename, IconsPerRow, IconsPerColumn) VALUES ('CIV_COLOR_ATLAS_EPHIOPIA', 64, 'EphiopianAtlas64.dds', 8,8); 
INSERT INTO IconTextureAtlases (Atlas, IconSize, Filename, IconsPerRow, IconsPerColumn) VALUES ('CIV_COLOR_ATLAS_EPHIOPIA', 45, 'EphiopianAtlas45.dds', 8,8);  
INSERT INTO IconTextureAtlases (Atlas, IconSize, Filename, IconsPerRow, IconsPerColumn) VALUES ('CIV_COLOR_ATLAS_EPHIOPIA', 32, 'EphiopianAtlas32.dds', 8,8);
I don't know what to do really but I think solve was always in a plain view.
 
First of all, why use SQL for this instead of just XML? There's no functional difference, and the XML's a bit easier to debug since you can go line-by-line.

Second, check the VFS on the .dds files. They need to be TRUE.
 
In detail from this place, please ;)

Maybe that could help you.
31188838.jpg
 
I'm thinking you have an error in your code somewhere.

You're going to need to do some trial and error bug testing. Replace all your .DDS files with known working .DDS files and see if you get the same error. I bet you do. That would indicate that your error is not in the .DDS file, but in your code.
 
In detail from this place, please ;)

Optik's picture should help you with this. You have to go into the Properties for the files and change "Import into VFS" to TRUE. Before the December patch the default was true, now the default is false.

VFS must be True for the following:
> New art assets of any kind (.dds files, .mp3 files)
> New versions of existing Lua files (AssignStartingPlots.lua)
> New versions of existing non-gamedata XML files (generally UI-related things like TechTree.xml or the files that control the unit models)

VFS must be False for the following:
> Newly-made Lua files that you load through either InGame.xml or the InGameUIAddin option in the content tab. If you set these to true then, depending on the function, it might execute twice; if it does so, then invariably the second time will have an incorrect argument list and cause it to crash.
> GameData XML files (anything you use the <Update> syntax for), although setting this one to true might not break anything. Effectively, anything that uses the OnModActivated/UpdateDatabase loading method.

So if you're not setting your DDS files' VFS to "true", then the game isn't actually loading them when you start up the mod, and it won't be able to find them when it needs them.
 
Optik's picture should help you with this. You have to go into the Properties for the files and change "Import into VFS" to TRUE. Before the December patch the default was true, now the default is false.

VFS must be True for the following:
> New art assets of any kind (.dds files, .mp3 files)
> New versions of existing Lua files (AssignStartingPlots.lua)
> New versions of existing non-gamedata XML files (generally UI-related things like TechTree.xml or the files that control the unit models)

VFS must be False for the following:
> Newly-made Lua files that you load through either InGame.xml or the InGameUIAddin option in the content tab. If you set these to true then, depending on the function, it might execute twice; if it does so, then invariably the second time will have an incorrect argument list and cause it to crash.
> GameData XML files (anything you use the <Update> syntax for), although setting this one to true might not break anything. Effectively, anything that uses the OnModActivated/UpdateDatabase loading method.

So if you're not setting your DDS files' VFS to "true", then the game isn't actually loading them when you start up the mod, and it won't be able to find them when it needs them.
Oh my god, you are awesome, let's make children :crazyeye:! It works! But almost in every tutorial there is no word about this...
 
Back
Top Bottom