Modding:Creating Item Icons: Difference between revisions

From Baldur's Gate 3 Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 35: Line 35:
== Sample Code ==
== Sample Code ==
If your mod uses only one icon and has a 64x64 atlas, you can use this:
If your mod uses only one icon and has a 64x64 atlas, you can use this:
 
<node id="TextureAtlasIconSize">
               <node id="IconUV">
                    <attribute id="Height" type="int64" value="64"/>
 
                    <attribute id="Width" type="int64" value="64"/>
                   <attribute id="MapKey" type="FixedString" value="CSS_SharArmory_SharLogo"/> 1
                </node>
 
                <node id="TextureAtlasPath">
                   <attribute id="U1" type="float" value="0.0"/> Left side of icon
                    <attribute id="Path" type="LSString" value="Assets/Textures/Icons/MySweetMod_Icons.dds"/>
 
                    <attribute id="UUID" type="FixedString" value="''GENERATE NEW UUID HERE''"/>
                   <attribute id="U2" type="float" value="1.0"/> Right side of icon
                </node>
 
              <node id="TextureAtlasTextureSize">
                   <attribute id="V1" type="float" value="0.0"/> Top side of icon
                    <attribute id="Height" type="int64" value="64"/>
 
                    <attribute id="Width" type="int64" value="64"/>
                   <attribute id="V2" type="float" value="1.0"/> Bottom side of icon
                </node>
 
<node id="IconUV">
                   </node>  
<attribute id="MapKey" type="FixedString" value="MySweetMod_Item_Icon"/> 1
<attribute id="U1" type="float" value="0.0"/> Left side of icon
<attribute id="U2" type="float" value="1.0"/> Right side of icon
<attribute id="V1" type="float" value="0.0"/> Top side of icon
<attribute id="V2" type="float" value="1.0"/> Bottom side of icon
</node>  


== Tools to Create Icons ==
== Tools to Create Icons ==

Revision as of 14:02, 26 February 2024

Dimensions

An item Icon has 3 dds parts, all perfect squares.

Tooltip Icon

This is 380x380px icon in the best quality it will be seen, when you hover over the item in the inventory.

It has a fade gradient from the bottom.

Controller Icon

This is a 144x144px icon. It will be seen by people who play the game with a game controller.

It is the same as the above, but it has no fade gradient.

Icon Atlas

This is a 64x64px square tile that will be seen in the inventory and hotbar.

It is part of an atlas. The atlas requires code to register in the game(see below).

Folder Structure of Icons

MySweetMod>Public>Game>Assets>ControllerUIicons>items_png 144px icons for your items

MySweetMod>Public>Game>Assets>ControllerUIicons>skills_png 144px icons for your spells and ability icons

MySweetMod>Public>Game>Assets>Tooltips>Icons 380px spell icons

MySweetMod>Public>Game>Assets>Tooltips>ItemIcons 380px item icons


MySweetMod\Public\MySweetMod\Assets\Textures\Icons 'MySweetMod_Icons.dds' Icon atlas dds goes here.

MySweetMod\Public\MySweetMod\Content\UI\[PAK]_UI Your _merged.lsx goes here. This tells the game where the atlas is. (and has its own UUID)

MySweetMod\Public\MySweetMod\GUI Icons_Items.lsx goes here. This tells the game what size the atlas is, where the image is on the atlas and what name the icon has to link it all up.

Sample Code

If your mod uses only one icon and has a 64x64 atlas, you can use this:

<node id="TextureAtlasIconSize">
                   <attribute id="Height" type="int64" value="64"/>
                   <attribute id="Width" type="int64" value="64"/>
               </node>
               <node id="TextureAtlasPath">
                   <attribute id="Path" type="LSString" value="Assets/Textures/Icons/MySweetMod_Icons.dds"/>
                   <attribute id="UUID" type="FixedString" value="GENERATE NEW UUID HERE"/>
               </node>
             <node id="TextureAtlasTextureSize">
                   <attribute id="Height" type="int64" value="64"/>
                   <attribute id="Width" type="int64" value="64"/>
               </node>
<node id="IconUV">
<attribute id="MapKey" type="FixedString" value="MySweetMod_Item_Icon"/> 1
<attribute id="U1" type="float" value="0.0"/> Left side of icon
<attribute id="U2" type="float" value="1.0"/> Right side of icon
<attribute id="V1" type="float" value="0.0"/> Top side of icon
<attribute id="V2" type="float" value="1.0"/> Bottom side of icon
</node> 

Tools to Create Icons

- The Modder's Multitool has an atlas converter.

- Invisible Head and Body

- Custom Backgrounds

- Chroma Key Droppable Object

- Visible Shields - if you have made a shield, this will make it visible in the respec screen.

- Sample Equipment Mod has a template for icons that still works.

- Mod Builder will generate LSX code and folder structure for you. It is recommended you use this over the sample equipment one, as its atlas is more compact, and few mods add 54+ icons.

Basic image editing guide to create icons

  • Install the Custom Backgrounds background mod
  • Put the clothes or the weapon on your character, and enter the respec screen via Withers.
  • Alternately, you can edit the equipment.txt of a class to have your outfit as its starting equipment, and start a new game to look at the character in the CC
  • Screenshot
  • Paste your screenshot into your image editing program.
  • Select and Remove background
  • Create border around object (edit > stroke) > (still selected) Gaussian blur. You can also experiment with colour layers.
  • Add the fade gradient. You should have 2 different .PNG versions of the icon, one with the fade out and one without.
  • Size correctly, and save as .DDS

Compression

Save your icons in .DDS DTX5, No Mipmaps. (Mipmaps are only needed for things that move closer and further to the camera, they will only make your icons blurry)

Notably you will need to name your atlas .dds NOT .DDS. (or to match whatever you have written in your .lsx code)