Page 1 of 3

What are the exact export settings for a texture atlas?

Posted: Mon Oct 22, 2012 7:40 am
by Isaac
I've been trying to get a custom icon for a knife to display in the game. What I get is either a black square as an icon, or nothing as an icon.

Now if I look at my atlas.dds and the default items.dds, there is seemingly no difference aside from the artwork itself. If I rename a copy of the default items.dds, then I get an icon; but if I load the items.dds into either Photoshop or Gimp, and then save it as a DDS... using it results in invisible icons.
IE. nothing; when placed in the PC's hand, the hand disappears and no icon [visibly] replaces it.

So I'd dearly like to know what the precise export settings are, and why neither tool produces a compatible dds file.

** Edit:
Yes, I have an alpha layer that defines the visible portions of the icons as mostly white. ;)

Seriously... looking at these files, I don't see any difference. They are both uncompressed, both have an alpha to mask the background.

Something is different, I know. I just haven't noticed what it is yet.

Re: What are the exact export settings for a texture atlas?

Posted: Mon Oct 22, 2012 11:20 am
by Edsploration
Did you catch this paragraph discussing DDS formats? It saved me when I was learning how to texture (albeit poorly).
http://www.grimrock.net/modding/creating-custom-assets/ wrote: 2D graphics in Legend of Grimrock use DDS (DirectDraw Surface) format which can be saved from Photoshop and GIMP by using 3rd party plug-ins. Standalone converters are available as well. DDS supports compression which is recommended for textures that will be used on 3D models (use D3DFMT_DXT1 for textures without alpha and D3DFMT_DXT5 for textures with alpha) but user interface graphics, such as item icons, should be left uncompressed (use D3DFMT_A8R8G8B8). Mipmaps should be used with all textures and the dimensions of the textures should be to the power of two (16, 32, 64 …) to ensure compatibility.

Re: What are the exact export settings for a texture atlas?

Posted: Mon Oct 22, 2012 2:07 pm
by Phitt
Possibly a problem with the gfxIndex and not with the texture? The index starts with 0, not with 1 (I did that wrong the first time I added an item and also had an invisible icon). Other than that all I can say is to make sure your icon is 75x75, starting in the upper left corner. And what do you mean by 'mostly' white? Make sure the visible part is all white (RGB 255/255/255) and the rest is all black (RGB 0/0/0).

Re: What are the exact export settings for a texture atlas?

Posted: Mon Oct 22, 2012 4:01 pm
by Batty
I've been using GIMP and can't make the .dds export alpha channel work, it either goes all black or all white in-game. Did exhaustive net searches to find the exact settings I need but gave up.

So, I do all work in GIMP, export it as a .png, then open said .png in Paint.net and save as .dds and the alpha channel works fine. This works for gfxAtlas and all texture maps (dif, spec, normal). Conclusion: The GIMP .dds plugin is garbage.

Re: What are the exact export settings for a texture atlas?

Posted: Mon Oct 22, 2012 4:35 pm
by Isaac
Edsploration wrote:Did you catch this paragraph discussing DDS formats? It saved me when I was learning how to texture (albeit poorly).
...
At some point I had read that ~but forgotten it. I knew it had to be uncompressed, but not which format; and although it makes sense in hindsight, the need for MIPs seemed odd.

** That solved it; my icons work fine now. Thank you. 8-)
For reference (to anyone that needs it), the DDS format settings in the Nvidia exporter for Photoshop are
'8.8.8.8 ARGB 32 bpp unsigned' image; images should have an alpha layer mask.
Phitt wrote:Possibly a problem with the gfxIndex and not with the texture? ...
I think Edsploration nailed it. It's not an index problem, because when I use an official gfxAtlas, the icon shows fine.
Batty wrote:So, I do all work in GIMP, export it as a .png, then open said .png in Paint.net and save as .dds and the alpha channel works fine. This works for gfxAtlas and all texture maps (dif, spec, normal). Conclusion: The GIMP .dds plugin is garbage.
Gimp's handling of Alpha channels is bizarre to me; but I've saved a usable atlas with it.
Here is what worked for me: Create your 1024x1024 image, place your icons and create a new channel; use it for your alpha. When you are ready to export the image, select the Background layer, and delete it.
(It's crazy, I know; but this removes the uneditable all white alpha layer and seems to replace it with the one you created.)

Export using RBGA8; with Mips, and it should work.
Image Image
____________________________________________________________________________________________________

For Photoshop users I have a template set to make Icon editing easy:
https://docs.google.com/open?id=0B2XjRU ... U9ZX2Z5ZnM

For Gimp 2.8 users: Gimp will open a photoshop file. 'The grid method' mentioned in the template file should work with Gimp. The tool names are different, but the functions are similar, and should work.

We can put this on the Wiki after a few members try using it with success. After any feedback and changes (if needed), I will make a page for it in the Resource section.

Re: What are the exact export settings for a texture atlas?

Posted: Sun Oct 28, 2012 1:08 pm
by Fhizban
hmm, hey guys - maybe you can help me with something:

im working on my new mod that contains many additional items with brand new icons

now - i did icons for LoG before (the wizardry 8 ones) and they are just working fine (transparency and everything). I did never bother defining an alpha channel, it worked all "out of the box".

but, with my new icons i get weird results and i cannot understand what i am doing wrong: 1. icons either appear white or black, okay thats the transparency issue that has to do with the alpha channel, i guess i can fix that.

2. all icons are aligned correctly in photoshop (im using the numerated item atlas from the modding section as a pattern) but in the game they are "cut in half" or completely mis-placed (like a sword i perfectly aligned into the middle of a cell now shows up far to much on the left or right side of an item slot).

3. i have 12 icons in an atlas, the rest is transparent. then when i use gfxIndex = 11 (or something) it shows absolutely nothing. i have checked and double checked the DDS file and everyhing is OK. but in the game it shows up nothing?

did i miss an important point here? has anyone an idea?

PS: I attached a picture to clarify the weirdness

Image

Re: What are the exact export settings for a texture atlas?

Posted: Sun Oct 28, 2012 1:14 pm
by Skuggasveinn
@Fhizban

In Photoshop go to Channels (next to layers) and look only at the alpha channel, is it possible that the alpha mask is not aligning up with your current items, or that the alpha mask is the mask of another item that was there before ??

just a guess

Skuggasveinn.

Re: What are the exact export settings for a texture atlas?

Posted: Sun Oct 28, 2012 1:20 pm
by Fhizban
@Skuggasveinn Okay im checking this out now! thanks

PS: take a look at the picture i added (does not show alpha channells though - there could be the error!)

Re: What are the exact export settings for a texture atlas?

Posted: Sun Oct 28, 2012 1:50 pm
by Skuggasveinn
The icons should be 75x75 pixels, and you should have 13 icons in the first row (index 0 - 12)
The next line should start on the icon with the index 13 and so on. (at least thats how it is in the assets pack)

you need a have a alpha channel, if you don't have one create it (a small button in the channel tap in photoshop)

Re: What are the exact export settings for a texture atlas?

Posted: Sun Oct 28, 2012 3:03 pm
by Isaac
Fhizban wrote:...
Perhaps it would be quickest to remake an example atlas ~(using either placeholder art or some of the ones in your atlas), and firstly.. see if it still shows the same symptoms; and if it does, upload it for others to examine closely.

**Or/ also... Did you use the template from this thread?