Unity3D – A free script to convert a splatmap to a PNG

Spent a good bit of the night (and morning) on this, so here goes:

I was looking for a way to pull a splatmap from a Unity3D Terrain and stick it in a PNG to use with another tool. I needed the splatmap to be rotated 90˚. Unfortunately, once it was actually out and in a PNG, it was transparant. More code so that I could edit it. And then once saved, the new properly-rotated version wouldn’t work. More code.

Eventually I got it all working. In an effort to hopefully save someone else many hours of muddling through the same way I did, I’ve cleaned it up a little and hopefully made it easy (enough) to use.

Splatmap Helper


Splatmap Helper

(link is at the end)

…a small tool to help you export Unity3D splat maps, converting them to PNG.

Here’s what it can do:

  1. Converts a Unity Terrain Splatmap to a PNG that can be edited with your favorite image editing program.
  2. Takes your new PNG and converts it back into a “splatmap-friendly format”.
  3. Inserts that new PNG into the splatmap of one of your Unity Terrains.

Important to note that these are all separate functions. So if you just need #1, great. Or if you’ve hand-made a splatmap, aren’t using Unity’s Terrains, and just need #2, fantastic. Hopefully if you’re here, it’ll help you do whatever it is you need to do.

There’s info that shows up with each option so that you’re hopefully able to get things working.

Before you get too excited though, here are some caveats:

    1. It’s not heavily tested. I’ve destroyed a few PNG’s/splats along the way. MAKE SURE YOU BACK UP YOUR PROJECT BEFOREHAND!!!
    2. The workflow is quite short but is VERY specific which is really annoying (sorry). For example, #3 requires you to select the splatmap from within the Terrain within your Asset folder, then run the tool and from there, select the PNG which may have to be marked read/write. If you select the game object instead of the terrain/splatmap, it won’t work. If you do it in reverse, it will do the reverse. If the PNG isn’t read/write, it might not work. It’s really not flexible/robust.
    3. To pull the splatmap into an editable PNG, it has to basically drop the alpha channel that stores the splat for the 4th texture, and doesn’t re-add it until the 2nd step, which means if you were hoping to edit the splat for the 4th texture in photoshop, you’re out of luck.
    4. When it does re-add the alpha channel in the 2nd step to restore the 4th texture’s splat, it does so by subtracting the R+G+B channels from 1.0. Usually this should give you the original 4th texture again, but no promises. YMMV. Note that if you’ve got an image editor that WILL handle a splat with the alpha intact and you find you’re losing info about the 4th texture, you can comment out lines #69-74 and you’ll get the splatmap intact.
    5. After you use the 2nd tool (readding the “A” channel), the image might look totally transparant when it comes time for #3. Don’t panic – as long as it works when applied back to the terrain, you’re good.
    6. Any time you want to read from an existing PNG or write to an existing PNG, you will likely have to select it beforehand, and set it’s Texture Type to Advanced, and then add the Read/Write flag.
    7. You’ll want to keep an eye on the Debug log for anything that goes wrong.



Usage (assuming you’ve backed up already!):

(you will need to put the script in an Editor folder, such as “Assets/Editor”)




It’s 1 tiny script (this writeup is longer than the code). It’s in .js simply because the first code snippet I’d come across was js so I figured I’d get a little practice in some non-C#.

Few options depending on your preference (they’re all the same):

Unity Package (it’s just the script which puts itself in in Assets/Editor, no extras):

JS file (MUST place in an Editor folder – you may have to right-click/download):

Zipped (MUST place in an Editor folder after unzipping):


Credit/Thanks to:


If you run into any issues, please leave a comment below. Otherwise, hopefully it helps someone else out there!

9 Comments | Leave a Comment

 Sort by Oldest | Sort by Newest
  1. Anonymous on September 10, 2015 - click here to reply

    Thank you so much!!! :)

  2. Hello, Thank you very much for this script. It’s documented perfectly, but I had a problem with it, and have found a workaround.

    After step1, generated png file doesn’t have an alpha. It imports as DXT1(or RGB when truecolor) on windows platform. When doing step 2 on that file, output file doesn’t create an alpha.

    But if I switch the texture to RGBA 32bit from import settings before step 2, file automatically has a blank alpha, and step 2’s output is correct.

    (Unity 5.3, PC&Mac Standalone, Windows 10)

  3. Brent Batas on November 18, 2016 - click here to reply

    I followed the instructions exactly, including with Mehmet’s fix, but the colors appear very washed out (overexposed). (Unity 5.3, PC & Mac Standalone, Windows 10)

  4. Adam Smith on December 20, 2016 - click here to reply

    I am unable to select any texture as a child under my terrain, even though it shows grass on my terrain in the editor. Basically, my terrain object in the Assets folder has nothing to select underneath it. How do I fix that?

    • polygosh on October 6, 2017 - click here to reply

      Zoom out your Assets browser until they display as a list

  5. 辛昌城 on May 5, 2017 - click here to reply

    Splat Channel 5 Turn PNG Back Into Splatmap Format will be wrong.How do I fix that?

  6. Tom on December 30, 2017 - click here to reply

    Very helpful! It just saved me from drawing a line all the way around a race track! :D

  7. Hayk on May 23, 2019 - click here to reply

    after importing this asset, I dont see the tool under the “Terrain” section of my editor. still works in unity 2018.3.8?

    • Unsure. Haven’t used Unity since version 5. Probably worth checking the editor log to see if there is something depreciated or otherwise not loading when it attempts to load the script.

Leave a Comment

You can use an alias and fake email. However, if you choose to use a real email, "gravatars" are supported. You can check the privacy policy for more details.