Tool DyeLab - A Shader Development Tool for Terraria/tModLoader

Kazzymodus

Moderator
Staff member
Moderator
1705511950595.png


Current version: 1.0

DyeLab is a shader development tool specifically written for Terraria. You can use it to write, test and compile Terraria/tModLoader compatible shaders, or use it to play around with the existing vanilla shaders.

Features​

  • A basic text editor allowing you to directly edit .fx files and see your changes in real-time. Supports basic cursor functionality, vertical scrolling and... well, that's about it, really. Too limited for your tastes? No problem! Edit your files in any editor of your choice and DyeLab will automatically sync up! The handy console will inform you of any syntax or compile errors, so you'll know straight away when you've made a mistake, and when you've finished you can compile your shaders to a .fxc file ready to be used in tModLoader with a single press of a button!
DyeLabRealtime.gif
  • Fully customisable player sprites that you can dress up in any way you like, so you can test your shaders with any piece of armor in the game (or just discover cursed fashion combinations). Want to see what your shader looks like in a walk cycle? You can! Want to see a specific frame? You can as well! And if you want to get methodical, you can switch to the solid gallery where you can see how exactly your shader affects specific colours!​
DyeLabDressUp.gif
  • A whole range of controls to modify shader parameters in real time, so you can easily find combinations that look good! You can also switch between different passes, and you can even switch to Terraria's vanilla shader and play around with those!​
DyeLabControls.gif
  • You can assign images using a handy menu that also allows you to inspect your selected image. You can easily add your own images, and DyeLab will automatically register them! No need to restart!​
DyeLabImagePreview.gif

How to install​


NOTE:
  • You must have Terraria installed on your system for DyeLab to run.
  • DyeLab will almost certainly not work on non-Windows platforms (but I haven't tried so who knows?).
  1. Download DyeLab.zip here.​
  2. Unzip to your desired installation instructions.​
  3. (GOG only) Open config.json in a text editor of your choice and change the value of TerrariaInstallationPath to your Terraria installation directory.​
  4. (Optional) To add custom images, add them to the Content/Images folder. Currently, only PNG files are supported.​

Q: Can I use DyeLab for non-Terraria shader development?

Technically, yes, but there are (most likely) better solutions out there. DyeLab has controls for the specific parameters that Terraria (already) uses, and it compiles shaders to a very old and outdated shader version to be compatible with Terraria and tModLoader. DyeLab is just fine for experimenting or playing around, but if you want to develop for an actual product, I'd advise to use something else.

Q: I've written and compiled a shader. How do I use it in tModLoader?

See this guide, though it might be out of date. If you get stuck, ask around in the tModLoader Discord.

Q: I've found an issue not listed beneath!

Oops, sorry about that! Please post it here, along with as many details as you can. Reproduction steps are a huge help in tracking down bugs!

Q: The editor is fairly basic. Any plans to improve on it?

Ideally, the editor would have dedicated HLSL support, but implementing that is a ton of work that right now I don't think is worth the effort. The main reason the editor automatically syncs changes to the input file is so that you can use a (more) dedicated text editor for the larger changes.

One thing I am considering to add is a drag select, but autocomplete or error highlighting is definitely not on the cards right now.

Q: I can't scroll horizontally in the editor!

Unfortunately this is a FNA limitation. If this proves to be too much of a problem I'll look into it, but for now you should be able to make due with the arrow keys.

Q: Nothing happens when I press the compile button!

Make sure you don't have any syntax errors in your code. DyeLab can only export your shader when it passes compilation.

Q: DyeLab will sometimes close unexpectedly when I tab in after editing my input file externally!

This is a known issue I'm looking into, one that I unfortunately can't reliably reproduce. This seems to occur most commonly with applications that continuously autosave (e.g. Rider), so turning that off or switching to an application that requires manually saving may help.

Q: Rotation is acting really weird with the vanilla dyes (e.g. ArmorHades, ArmorGel)!

This is also a known issue I'm looking into, and a fairly confusing one at that. It's not high on my priority list, however.

Q: Is DyeLab open source?

Yes, it is!

Q: What features are planned for the future?

In no particular order:
  • Fixing the known issues listed above.
  • Screen shader support.
  • VertexStrip support.
  • Saving armor setups to the config so you don't have to start from scratch every time your restart.
  • Controls for editing the config within DyeLab itself.
  • Something to use up that unused space beneath the gallery.

  • v1.0 - Initial Release

Disclaimer​

  • Use of this software is entirely at your own risk. By downloading and/or using this software you agree I'm not responsible for anything that happens to your or your computer while you do so.
  • Due to the nature of the editor and the compiler it can and will overwrite existing files, which is perfectly safe and fine as long as those files are in fact shader files. By default (i.e. using the default config), this is the case, and I've built in a fair amount of safeguards to ensure this is the case even if you start messing with the config beyond what is reasonable, but I can't give complete assurances on this point. Just don't try and point the config at important DLLs is all I'm saying.
  • PHOTOSENSITIVITY WARNING: certain shader code can result - either by accident or intentionally - in visuals that can trigger seizures for people with photosensitive epilepsy. Please be mindful of each other!

That's it! Let me know what you think down below!
 
Last edited:
Actually sick, writing shaders for dyes has been such a pain especially with modder's toolkit not having full proper support. Thank you for making this!!!
 
Back
Top Bottom