A Hat in Time

A Hat in Time

49 ratings
How to add textures/patterns to your dyes
By HERO
In this guide I'll teach you how to add textures/patterns to your dyes!
   
Award
Favorite
Favorited
Unfavorite
Intro
First of all, this guide is not going to cover how to make a basic dye. What I teach you is based on the knowledge that you already know how to make a dye. If you don't, start with this guide[gist.github.com].
This guide only covers dyes. DO NOT ask me how to make a costume here.

Here are some important things you need to know first.
  • Each dye can only use 3 different textures. However, they can be used multiple times.
  • Hair, Orange, Zipper, Shoes, and ShoeBottom can not be changed with a texture.
  • The hairtie for her ponytail uses the capes color, and will default to its original color if you give the cape a texture. You can not change this with a texture.

Finally, this guide is written based on Hat Kid, but it applies to any other character/flair that is able to be dyed. I'll provide some more info and resources at the end.

Alright, now that that's out of the way, let's get into making your dye.
Creating your package/Importing your texture
First, you're going to need to make a package in the editor. This is where you'll put your texture, so your class can use it. Any other custom content that you want to use must go in this package as well, like a dye icon, for example.

To launch the editor, use the button in the Mod Manager that says "Launch Editor". When you have the Hat in Time Editor open, you can either drag your file into the Content Browser window, or you can click the "import" button at the very bottom left of the window. This is going to open the "import" window, which is where you'll create your package.



Once you're here, change the first text box labeled "package" to whatever you want your package to be named. Do not leave it as the default. Try to make it something unique so you won't have to worry about running into any errors with duplicate package names.
After that, change the third text box labeled "texture" to what you want the texture to be named. You might not have to mess with this, unless you don't want it to use what the file is currently named.
Keep in mind that you need to reference these multiple times when writing classes, so try not to make it anything wordy or complicated, just to make your life easier.

Once you have those changed, just hit "OK"! This will create your package and the editor should bring you to your package content after. (If it doesn't, you can search for it on the left sidebar.) When you go to import any other images, make sure that the package name you're importing them into is the same. You can also simply drag your images into your package to import them there as well.

When you import your image, you might run into a couple errors. (If you don't, good! Just skip this list.)
  • "Check that the image is a power of 2?"
    This is telling you that your texture file needs to match in width and height. Also, that number needs to be a power of 2. So for example, it could be something like 512x512. If you don't know how to get to a power of 2, heres a couple common ones.128, 256, 512, 1024, and 2048.
  • "Only PNG files with RGB color and RGBA color modes are supported!"
    Saving your image file as a targa (.tga) file instead should fix this issue. You should be able to do this in common image editors. If you absolutely must use a .png file though, you can fix this issue by using an image editor that lets you save in different color/bit depth. Art based programs should have this, and I use Paint Tool Sai for example.
Do note that every time you get an error importing a texture, regardless of what it is, it's going to tell you to check a power of 2. If your image size is a power of 2, then your problem is related to the other error it gave you.

This is all we need the editor for now, but don't close it out just yet, as you'll need to reference it when writing your classes.
Writing your dye class
We're going to edit a basic dye class, so if you don't know how to make one yet, go back and reference the tutorial I linked in the first section.

When you have your class set up, find the line with the part you want to add a texture to. In that line, replace "SkinColor" with "SkinTextureInfo".
Then, replace the entire RGB line in parenthesis with,
(Texture = <path to texture>)
To get the path to your texture, right click it in the editor and select "Copy full name to clipboard".
In the end, it should look something like
SkinTextureInfo[SkinColor_Hat] = (Texture = Texture2D'ModContent.HatTexture')
This is just an example, so it won't look the exact same. ModContent should be your package name, and HatTexture should be your texture name in the editor. Use this in any SkinColor line to apply the texture to it.

  • UVScale
    The texture you imported is going to be mapped based on the characters original UV mapping. This may cause your texture to look too big or even deformed on the character. UVScale is used to adjust this. Any number can be used here. Bigger numbers will make your texture appear smaller, and vice versa.
    SkinTextureInfo[SkinColor_Hat] = (Texture = Texture2D'ModContent.HatTexture', UVScale = 1)
  • Angle
    Angle is used to adjust the angle of the texture. The value used for Angle must be a decimal between 0 and 1. For example, you could use '0.50', but you wouldn't be able to use '2.50'.
    SkinTextureInfo[SkinColor_Hat] = (Texture = Texture2D'ModContent.HatTexture', Angle = 0.50)
  • DisableNormalMap
    This is used to disable the normal map for the SkinColor line you're using it in.
    SkinTextureInfo[SkinColor_Hat] = (Texture = Texture2D'ModContent.HatTexture', DisableNormalMap = true)
    If you don't know what the normal map is, it's what create the extra details and textures on a material. For example,
To use multiple of these, simply add it after the first one with a comma. You can use all of these at once if you'd like. For example,
SkinTextureInfo[SkinColor_Hat] = (Texture = Texture2D'ModContent.HatTexture', UVScale = 1, Angle = 0.50, DisableNormalMap = true)

If you're trying to make a more detailed design, I recommend drawing your texture over the characters original texture file. Do note that this will also be used for any other player that uses the dye, so it may appear wrong on them.
Conclusion
That's it! All you need to do now is compile and cook! Do keep in mind that if you change anything in your classes, or package, you will need to recompile and recook.

If you need help, extra clarification, or just want to provide feedback, leave a comment and I'll try to get back to you! Now go make your dyes, and wreak havoc on the workshop!!

Extra resources
  • Texturing characters other than Hat Kid
    Since Bow Kid is an official playable character, I'm only going to cover her in this guide. Keep in mind that other playable mods may have dyes set up differently, so the areas that I mentioned being unable to be textured may be different.

    The way Bow Kid is dyed directly matches Hat Kid, so any areas that aren't able to be changed with a texture on her, also aren't able to be changed on Bow Kid. The way a dye is mapped on her is also really weird, so here's where everything will appear on her.
    Dress = Skirt, boots buckle
    Cape = Jacket
    Pants = Shirt, collar, cuffs, top of cat pocket, jacket button details
    Shoes = Boots
    ShoeBottom = Band around boots
    Orange = Collar cat button, bottom of cat pocket
    Hat = Bow, jacket buttons
    HatAlt = cat button face, cat pocket details
    Zipper, HatBand = None

  • Previewing your textures on the character
    I personally find this easiest to do with the characters model and a preferred model editor. This method will allow you to see the updates you're making to the texture easier, and some even allow you to draw directly onto the model itself. This is a bit too broad to cover here, so I won't, but if you don't know how to do this, you'll probably want to do it through the editor itself instead.

    To add a texture to a mesh, you need to make it a material first. To do this, right click your texture and select "Create new material". Since you're only using it to preview, you don't need to worry about anything in the material editor. Copy the material by right clicking it and selecting "Copy Full Name to Clipboard".
    Next, you need to find the mesh that you want to preview on. For our purposes, they'll most likely be under "HatInTime_Characters_HatKid" or "HatInTime_Characters_Coop". When you find it, double click it to open it. Find this window in the bottom left of the screen.

    (Your mesh may have more materials, but this one only has one since I'm using Bow Kid for this example)
    Once you're here, find the material slot for the area you want to change (these will become highlighted in yellow when you click on them). When you find it, erase the text in that slot, then paste the path to your material there.
    Anytime you change your texture file, you can right click it and select "reimport". This will automatically update the material, thus updating the model, so you can easily see the updates you made in effect.
    Don't worry about setting the original materials back on the mesh, the editor won't save the changes to a non mod package. Also, don't worry about the material covering areas you don't want it to, as your texture will only cover the area the dye applies to.
113 Comments
Charaster ☺ 23 Feb @ 12:12am 
awesome thanks
HERO  [author] 22 Feb @ 12:53am 
you can export it from the game using a program called umodel! just make sure you uncheck everything except texture or it will crash! also, you can use the editor to find textures before u search for them in umodel :]. tho hat kids should be in HatinTime_Characters_HatKid and bow kid in HatinTime_Characters_Coop
Charaster ☺ 19 Feb @ 5:42pm 
where can you find the original texture file? since you mentioned "I recommend drawing your texture over the characters original texture file"
Soari 14 Apr, 2024 @ 12:10am 
thank you wise wizard of AHIT modding :vlambeerFish:
HERO  [author] 13 Apr, 2024 @ 6:28pm 
i think if u have a github account, u can still view it here (fsr steam broke the other link)
https://gist.github.com/Silverfeelin/8ab21efd3317c519aa5b672a271059a6
Soari 13 Apr, 2024 @ 8:25am 
the link to the "how to make a dye" guide doesn't work, what do i do?
JonyDany12 21 Feb, 2023 @ 12:10pm 
Thanks
HERO  [author] 25 Jan, 2023 @ 12:04pm 
texture dyes will work with anything you can dye as long as they have textures supported
JonyDany12 25 Jan, 2023 @ 11:20am 
will this work with marge simpson?
HERO  [author] 23 Dec, 2022 @ 3:21pm 
GRIEF AND AGONY