Home Unity

Photoshop tool for easily exporting texure maps from PSD

GetUpKidAK
polycounter lvl 2
Offline / Send Message
GetUpKidAK polycounter lvl 2
Hi all,

I posted this over at the Unity forums earlier, but realised that I've been registered here for an age without posting, and it'd be an ideal place for it.

So, I like to keep all my texture maps for a model in one file, and after creating and tweaking a lot of them recently I found myself getting a bit annoyed at doing the same task over and over again, especially when the texture needed an alpha channel. Being a lover of useful tools, I decided to make a "quick" Photoshop script to do all the hard work for me.

Days later, I finally finished, and thought I'd share so no one else has to suffer my pain: https://gist.github.com/GetUpKidAK/f3b4c36d7761264255d2

Basically, it scans the top-level Layer Groups of a document and adds them to lists for the default Unity maps (Albedo, Metallic, etc.). You can then choose a folder to export to and a few options related to the exported file and it will save the files out, ready for use in Unity (or whatever engine you want to use, really). It's relatively easy to customise the requirements for each map if you want to change them, too.

Here's a screenshot of the UI at the moment:

wIrGDYj.png

And an example of my PSD Layer hierarchy, so that the exporter can find the right maps by default:

3DeUgwa.png

To install, just put the script in the Presets/Scipts folder under your Photoshop install directory and it will appear in your File/Scripts menu in Photoshop (after an application restart). You can also use Photoshop Actions to set a keyboard shortcut up, too.

I had to rewire my brain to write in Javascript so it's far from perfect, and my knowledge of JS has always been a basic grasp of the syntax at best, but it's working nicely so far. Obviously happy for any suggestions and feedback, just don't tell me if there's a tool that already does *exactly* this, because I didn't bother looking and now I'm too scared to!

Thanks!

Replies

  • Eric Chadwick
  • HAWK12HT
    Options
    Offline / Send Message
    HAWK12HT polycounter lvl 12
    All I can say, THANK YOU!! so much dude.
  • Polynurb
    Options
    Offline / Send Message
    Polynurb polycounter lvl 15
    I do a short tutorial demonstration of how to use a free tool created for Photoshop by Ash Kendall. ash.kendall(at)gmail.com. The tutorial will show you where to find the script, how to install it, and how to use the tool window to streamline your PBR texture export workflow to Unity.

    [ame]http://www.youtube.com/watch?v=5SQvTZ-pFZo[/ame]

    Youtube_Image.png
  • Hyshinara
    Options
    Offline / Send Message
    Thanks for the tutorial! :)

    @mods:
    There already is a thread on this tool (http://www.polycount.com/forum/showthread.php?t=156667), so I suggest you merge this thread with that one.
  • Polynurb
    Options
    Offline / Send Message
    Polynurb polycounter lvl 15
    I wasn't aware there was a thread for this tool, but just yesterday I did a tutorial on using this tool. :) Someone suggesting merging my post into this thread but I haven't a clue how to do that. Anyways, I've been editing the script to suit my project, I'm trying to get the window to stay open after export vs. closing. This way I can just keep the file path and settings the same and when I make changes simply hit the Export button.

    http://www.polycount.com/forum/showthread.php?t=157483
  • Eric Chadwick
  • GetUpKidAK
    Options
    Offline / Send Message
    GetUpKidAK polycounter lvl 2
    Wow, thanks for this! Glad it's getting some use!

    Good to see that leaving some options exposed was worth it, too.
  • GetUpKidAK
    Options
    Offline / Send Message
    GetUpKidAK polycounter lvl 2
    Hi all, just wanted to update anyone that found this useful that it's had some updates recently.

    In summary:

    - The export path is saved between sessions
    - Quickly disable exporting for any maps you don't want
    - It's a little quicker

    Bit more detail: I'm now saving a small file to the Documents folder (defaults to /TextureExporter/settings.cfg) which includes the path you last exported to, so if you're tweaking any textures then you don't need to worry about selecting the path every time.

    There are also checkboxes if you're working on one particular map and don't want to keep exporting the ones you're happy with. These could be disabled before but it involved either changing the dropdowns (if you use the default layer names) or temporarily renaming your layer groups. It's now just a few tickboxes and you're done.

    I've removed the logic that remembers which layers were active before you exported for now, I'll probably add it back when I've improved it a little.

    I've also commented and cleaned up the code if that sort of thing is of any interest to you.

    Apologies for the double post!
  • Ott
    Options
    Offline / Send Message
    Ott polycounter lvl 13
    This tool is great - but I honestly have to set it up every single time I use it? Is there a setting somewhere to keep it open while I'm texturing without having to set it all up again? I'd obviously prefer to keep this open the entire time I am texturing. Am I missing something?
  • Ott
    Options
    Offline / Send Message
    Ott polycounter lvl 13
    Any thoughts anyone?
  • GetUpKidAK
    Options
    Offline / Send Message
    GetUpKidAK polycounter lvl 2
    Ott said:
    This tool is great - but I honestly have to set it up every single time I use it? Is there a setting somewhere to keep it open while I'm texturing without having to set it all up again? I'd obviously prefer to keep this open the entire time I am texturing. Am I missing something?
    Sorry, bit late to this, but how do you have to set it up every time? Do you mean the options for which maps are being exported?

    If that's the case then you can get them to enable by default by using names for your Photoshop groups that are preset in the options ('albedo', 'normal', 'metallic', etc.). This should auto-fill the drop-downs and can be updated if you'd rather use different names. You can obviously adjust the name slightly with an underscore or something if you'd rather leave the map temporarily.

    The export path can be saved on a project basis in the same file, too, and is saved by default in the latest version.

    Hope that helps!
Sign In or Register to comment.