Search Unity

2D Animation package - PSB workaround?

Discussion in 'Animation' started by redstripeart, Jan 26, 2019.

Thread Status:
Not open for further replies.
  1. redstripeart

    redstripeart

    Joined:
    Jan 26, 2019
    Posts:
    2
    Hey there,

    I am new to 2D rig and animation in Unity and I am kind of confused with the new skinning editor. I was able to do some basic rigs and animations in the previous version of 2D animation package (late 2018) but with the new version, I can't even set up bones and weights. From checking youtube tutorial (afaik there is only one for the current version) and official documentation, I need the character exported in PSB file from Photoshop, but I draw everything in Krita and I don't feel like getting photoshop only for the sole purpose of this (I love the idea of putting in the whole character with bits and pieces already split as sprites, but why would this be only photoshop-exclusive when every graphic editor has layers nowadays?). When I tried doing it the old way, importing the png file with all pieces separated, I was able to put bones to secific sprites but I couldn't find way to parent these bones and found that whole "pose preview" function is totally useless that way.

    Is there a solution for non-photoshop users or something that I missed while rigging character through classic png map? Thank you for your answer,
     
    Last edited: Jan 26, 2019
    jlittle489 likes this.
  2. InfiniteDesign8

    InfiniteDesign8

    Joined:
    Aug 22, 2017
    Posts:
    38
    its by design that you must pay for PS..could you imagine if we let you set your rig up easy without someone getting paid?
     
    awsapps likes this.
  3. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    AFAIK, krita can export to .PSD -- Do those krita-exported .psd files not work with your version of Unity or something?
     
  4. InfiniteDesign8

    InfiniteDesign8

    Joined:
    Aug 22, 2017
    Posts:
    38
    no PSB only ...hence my salty reply
     
  5. apapryk

    apapryk

    Joined:
    Sep 21, 2019
    Posts:
    1
    same problem here.. keep it bumped
     
  6. gavinjboyd

    gavinjboyd

    Joined:
    Jan 29, 2019
    Posts:
    6
    I'm glad it's not just me with this issue, I would gladly pay for ps or ai if it wasn't priced so high, I will give KRITA a go to see if it works as a workaround
     
  7. kuro_sk

    kuro_sk

    Joined:
    Dec 10, 2014
    Posts:
    3
    I spent last four hours trying to find any solution, and actually did. Yay!

    https://imagemagick.org/script/download.php

    Use from command line like this:

    magick convert base.psd base.psb
    (replace 'base.psd' with the name of your psd file, obviously)

    Worked for image exported as .psd from Gimp 2.10.8

    Hope this helps. GLHF
     
  8. Arnklit

    Arnklit

    Joined:
    May 18, 2015
    Posts:
    48
    I've been banging my head against this for the last hour. I cannot fathom how you rearrange your sprites if they are imported as a normal multiple sprite instead of a PSB. People say in the documentation that it's supported to use normal files, but there are no examples of it being done. This is really frustrating.

    EDIT: My sprite doesn't even turn into a prefab that I can drag into the scene, even though I've added bones and geometry. Hmmm. I'll try with 2019.3 beta instead and see if that makes any difference.

    EDIT 2: Gave renaming my PSD file from Krita to PDB a go as someone mentioned that working and that works, but what a crappy solution. You should be able to use a normal flat file and they should definitely make the "PSD Importer" support more layered file types if they aren't going to support flat files.
     
    Last edited: Nov 1, 2019
    facundoreno likes this.
  9. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    Crazy how much simply renaming a file can kick you in the teeth when iterating on your artwork, isn't it?
     
  10. fsena

    fsena

    Joined:
    Dec 11, 2018
    Posts:
    1
    Thhhhaaannnkksss!!!
     
  11. FlavrTown

    FlavrTown

    Joined:
    Dec 19, 2016
    Posts:
    4
    You can do it with flattened pngs. Watch the first half or so of this video
     
    Rany_AN likes this.
  12. RandomComm3nt

    RandomComm3nt

    Joined:
    Feb 2, 2016
    Posts:
    6
    Last edited: Jun 10, 2020
  13. jay3sh

    jay3sh

    Joined:
    Dec 30, 2013
    Posts:
    19
    Thanks a bunch for this video. This solution should work without PS.
     
  14. ManieBesselaar

    ManieBesselaar

    Joined:
    Nov 1, 2018
    Posts:
    30
    This it what works for me at the moment. Create character in krita with layers. Export to psd. Open psd in gimp. Export to psd from gimp. Rename resulting psd to psb. Import into unity. I knownthat the psd importer for unity is on github. Inhave thought of maybe taking a look at the source code and creating a fork . Any one game to try and fix this? I may be in over my head but maybe some team work will get us there. Beats just complaining about it
     
    MortuaryWax2003 likes this.
  15. ManieBesselaar

    ManieBesselaar

    Joined:
    Nov 1, 2018
    Posts:
    30
    Here is something else that works for me in a pinch.


    This involves using a flat png ( just put arms , legs head etc away from body. Import sprite as single not multiple.
    Rest of the video explains everything clearly. Setup is about the same amount of work as psb import.
    Hope someone finds this useful.
     
  16. Jarestrepogu

    Jarestrepogu

    Joined:
    Feb 18, 2018
    Posts:
    9
    Just tried with a file created in Krita and exported to .PSD

    I simply changed the file extension to .PSB and it worked just fine... Which leads me to a cuestion, why would Unity "not support" .PSD files in first place?

    I might be mistaken but, from what I've read on the web, the only difference between the two formats is the file size they can handle... And is not a good enough reason to use it for 2D projects in any case (seriously, when/why will anyone need to handle a sprite heavier than a few MB's?)

    They also have a script to allow the use os .PSD files (the override mentioned above). That's not supporting a thing, why would an artist require a script to import a file? It should be supported by default (not to mention that the package, as pointed several times in the forums, is called "PSD importer").

    The features and the workflow allowed by the package are great, but this silly limitation makes no sense.
    Do review the way you are delivering packages, Unity, or make a clear statement on your support for creation software... But, please, stop making us waste time looking for tricky workarounds to access the funtionality of your packages.
     
  17. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    The only point I _might_ disagree with is this one -- at least where texture atlases are concerned (mainly UDIMS -- but really nowhere else). Outside of that (super-tiny!) nitpick -- I agree wholeheartedly.


    The PSB workflow should be the exception -- not the rule.


    No idea why the heck Unity doesn't just acknowledge this whole workflow is great -- but backwards. :p
     
  18. Th0re

    Th0re

    Joined:
    Sep 4, 2015
    Posts:
    39
    Here is what I learned:
    1. It is reportedly possible to directly open a PSB, make changes and save, and the rig will remain intact. Alas, this requires specifically Photoshop (or programs that support it sufficiently).
    2. It is currently not entirely possible to do this with other programs using the "rename trick" -- but somewhat with a few workarounds.
    3. The scary sounding "Reslice" option in the Sprite Sheet preserves the information.
    4. You can import to Unity using the "rename trick". This works for Affinity Designer and Affinity Photo and possibly other programs. You would export to PSD, and then rename the file, then drag it into Unity.
    5. If you want to update the file, you must use a workaround and there are some limitations. Many Bothan spies died to obtain this information. The general workflow is to save it to desktop, change the ending, open the location of the Unity file to overwrite in finder/explorer and replace it. There is a catch.
    6. You can open the file out of Unity and make changes, but you can not save it straight away. Since you must export via PSD and rename, it somehow messes with hidden information Unity uses. This seems to cause no issue when you stay within the layers, layer names, and general size of the sprites already created. If you add/remove anything, it will break your rig. Then it will break your will after it happened for the ninth time.
    7. However, it's often possible to repair the rig by redoing the geometry, rather than doing it all again.
    8. It worked for me to add elements by placing them above all other layers, and in an extra group. Might also work below or without the group, however it clearly doesn't work between existing layers.
    9. You absolutely must use versioning, like GitHub or something or you will lose your mind. Commit your good version that works. Then replace the file, observe the damage and if the adding-layers-on-top trick and such work, or you can salvage the rig, go ahead, else find the "discard" option.
    10. It's a cool package nonetheless, and not their fault that other programs don't preserve esoteric hidden data inside PSBs.
    Hope that helps.
     
    Last edited: Apr 28, 2022
  19. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    That is great information. Thanks.
    Working this way would make me lose my mind though. :(

    It kinda is their fault they didn't just make a PSD exporter plugin for a free (well-supported) drawing application like Krita that appends data or creates a JSON or XML file to use alongside as more modular "esoteric data" -- which is kinda an industry-standard way to solve this problem.

    They could still keep the PSB as a "premium" feature, but open up the bread-and-butter stuff in a more modular format. Doing otherwise is just an asshat way of designing a feature-set. I mean, c'mon -- these are just images with sizes. In the end -- data is just data. :(
     
  20. Unrighteouss

    Unrighteouss

    Joined:
    Apr 24, 2018
    Posts:
    599
    For anyone looking for a Photoshop alternative, I've been using Clip Studio Paint for years and it works fine. It can export PSB's and edit/save PSB files in Unity. The only limitation I've seen is that it doesn't have layer IDs, so instead Unity will automatically match layers by name (I actually prefer this anyway).

    The $50 Pro version has everything you'll need for image editing, no need to get the more expensive EX version (it has extra features for comics and animation).
     
  21. Th0re

    Th0re

    Joined:
    Sep 4, 2015
    Posts:
    39
    I agree, there should be a way. For example expose the layer/id/name to Unity “translation” so you can also fix it, assign it in the sprite editor. Maybe just an array of all layers detected and the corresponding sprite that Unity would make of it.
     
    awesomedata likes this.
  22. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    I very much enjoy Clip Studio Paint (more than PS actually) -- but my point is that Unity should not make this so limited.

    This is just bad design for a tool.

    Have we not learned _anything_ from the 90's software/tooling?? -- Tools must be flexible and cover as many unforeseen (by the tool developer) environments and use-cases as possible -- while still fulfilling its main functionality (in this case importing layers, etc, in-tact).
    Modularity is critical in tools because it easily extends the use-cases (and environments) in which a tool can be used and reused (and not need to be rewritten each time).

    Unity itself follows this philosophy, so why shouldn't its tools?
     
    Last edited: Apr 29, 2022
  23. Unrighteouss

    Unrighteouss

    Joined:
    Apr 24, 2018
    Posts:
    599
    Yeah, I 100% agree. I just wanted to make the recommendation for anyone that feels they need an expensive Photoshop subscription to make this workflow convenient.

    I've always thought it was unintuitive that the "PSD Importer" only takes PSB files. Improving this is definitely something Unity should be considering for the future.
     
    superkerokero and awesomedata like this.
  24. superkerokero

    superkerokero

    Joined:
    Dec 9, 2015
    Posts:
    8
    > I've always thought it was unintuitive that the "PSD Importer" only takes PSB files. Improving this is definitely something Unity should be considering for the future.

    Yeah, at least they should call it "PSB Importer" at the current stage to avoid confusion. A "PSD Importer" that can not import PSD files is very unprofessional.
     
    awesomedata and Unrighteouss like this.
  25. hellemia

    hellemia

    Joined:
    Jan 23, 2023
    Posts:
    1
    3 years later, the 2D animation package is still borderline useless without Photoshop.

    If we can't properly arrange the character parts into a default pose, the pose preview and more importantly the auto-generated weights don't work properly.

    Just let us arrange the rig from regular sprites exported as "Multiple". Requiring Photoshop for this is at best incompetent, and at worst malicious
     
  26. ManieBesselaar

    ManieBesselaar

    Joined:
    Nov 1, 2018
    Posts:
    30
    Hi Hellemia.
    This is not ideal as you have said, but I use The Gimp and Krita daily for my 2d character design needs. The workaround that works for me is to create my character with limbs on seperate layers (all correctly arranged) and then export to a .psd file.
    Counterintuitively Unity PSD importer only imports PSB files, so I pop into explorer and rename the file extension to PSB and import.
    There are also 2 scripts at https://docs.unity3d.com/Packages/com.unity.2d.psdimporter@2.1/manual/index.html which solve the file extension issue which you could add to your project. Just remember to put the editor script under a folder called Editor . Unity will find the folder and use that as an editor script.

    Feel free if you need help implementing this. I will answer as many questions as I can.

    I also saw someone in this thread mention ClipStudio which is available as a one time purchase and has a free trial for you to try and see if it works for your needs. Just checked, it is on special offer for $19 at the moment.Tried for free. Exported to Photoshop Big format. Imported rigged. No issues. Could be a good option for you as well.

    Hope this helps.
     
  27. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    916
    Just to chime in here, PSD Importer supports .psd files, and has been supporting them for a while.
    In Unity 2022.2 and onwards, the PSD Importer package contains the override files, so you do not need to add the additional scripts in those versions.

    In PSD Importer 9.x (2023.1), we added it to the front page of the documentation (link), as we noticed that we haven't been telling users this enough. But this thread makes it even more apparent that we should talk about it more.

    Do note that we do not test with all kinds of .psd generating DCC tools, so you might experience different results depending on the editor you use. That said, do file bug reports if you come across strange behavours.
     
    Unrighteouss likes this.
  28. ManieBesselaar

    ManieBesselaar

    Joined:
    Nov 1, 2018
    Posts:
    30
    Thank you for this. I've known about this script for a while, but renaming has just been simpler and faster for me. Still it is good to know that the Unity team are listening and responding to the community. Thank you guys and girls for making an awesome tool available to us (Unity 3d editor of course ), even though we do grumble sometimes.

    Just tested the newest psd importer on 2023.1.0.a21 and it definitely works as advertised. Yay my life is complete! No more renaming, no more extra scripts to set up before I start.

    Quick note for anyone with the same issue, when exporting from Krita to psd for Unity , the imported sprite is sometimes darker than intended. If I go to the platform settings under the properties for my sprite, then setting the (color ?) format to RGBA half solves it. I don't know enough about color formats and standards to give an intelligent explanation as to why or how this works. Feel free anyone to school me on this.

    Do you know if Unity has any plans to support some open graphics formats for importing layered 2d sprites for character rigs? That would be a definitive wishlist item for me. More open standard mean more choice for devs.

    Either way for now the "new " psd importer does it for me.
    Thanks again Unity.
     
    Ted_Wikman likes this.
  29. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    916
    Thanks for testing and reporting back, I'm happy to hear that everything works as intended!

    We are always interested to hear what we can do improve the editor (and runtime), and that also goes for supporting new file formats. We collect feature requests on our roadmap pages. Also note that you can create your own importer for any kind of file format, by making use of the Scripted Importers API. This is the backbone of the PSD Importer, for instance.

    Speaking of file formats used for 2d projects, we have recently added support for Aseprites .ase/.aseprite file format. Aseprite is primarily used for Pixel Art, frame by frame animations. You can read about it here.
     
    ManieBesselaar likes this.
  30. ManieBesselaar

    ManieBesselaar

    Joined:
    Nov 1, 2018
    Posts:
    30
    Awesome, worth checking out. Would love to create an importer for Krita.
    Thanks!
     
    Ted_Wikman likes this.
  31. DarshGupta

    DarshGupta

    Joined:
    Oct 7, 2020
    Posts:
    2
    OH MY GOD THANK YOU SO MUCH I CANNOT TELL YOU HOW MUCH I NEEDED THAT
     
  32. SpottedMagpie

    SpottedMagpie

    Joined:
    Apr 30, 2017
    Posts:
    6
    If you are using GIMP here are some steps that might save you some time. Note you're going to lose the rig if you're editing in GIMP 100% but these steps are the fastest way I've found to get them back. These steps are assuming that you are not adding or removing layers, just updating existing ones. It might work OK for adding/removing layers but I'm keeping it simple here.

    (I think I'll have to update these steps for actually reconnecting the PSB to a character model but I'm still working it out. I'll leave these steps for others because it does work for the rigging. However, after doing these steps I ended up with 2 copies of the PSB with rigging/weights in Unity - and I was able to open my character model prefab, and just update the sprite I had modified on the individual part. I am using a SpriteLibrary and SpriteResolver, so I just added the PSB Copy alterations from the steps below, into the SpriteLibrary for the body part I changed, and switched the SpriteResolver Label to the new sprite and the rigging/weights worked OK. Since not everyone is using SpriteLibraries necessarily I won't include all this detail)

    To Export your PSB, edit, reimport, and get your skeleton and rig + weights back...

    1. Copy your PSB and paste it as a 2nd copy of it in your Unity sprites folder (or wherever it is)
    2. Export your PSB file COPY not the original (you can also export the original if you want but don't edit it)
    3. Open the copy of it that you exported in GIMP make your changes
    4. From GIMP export it to the PSD file that GIMP allows you to
    5. Rename the file to .PSB
    6. Delete the COPY you created in step 1
    7. Import the .PSB you just created from GIMP - you DONT want to overwrite your ORIGINAL (if you do you'll lose your skeleton and rig/weights which we need to re-use)
    8. Open the original PSB in unity which you used to make the copy in Step 1
    9. Open the Visibility -> Bones tab
    10. Click the root bone, copy it CTRL+C
    (* Update on step 10, it might be better to just "Copy rig" (a button in the lower-left corner of your sprite editor in unity, then at step 13, "Paste rig") I have had to tweak my approach a few times, not sure why maybe updates from unity.
    11. Open the copy PSB
    12. Goto Visibility -> Bones tab. Click into the empty bones panel or the paste won't work

    Note: if your new PSB doesn't have the same number of sprites, this approach won't work, you'll get an error in the console about the number of sprites

    13. Paste the bones, the vertexes and weights will also paste over (if you try to rotate a limb and the entire rig just starts spinning, don't worry, you have all the bones selected since you pasted them, just make sure you click an individual bone in the Bones list and rotate it, you'll see it works OK)


    Note: if the size of your new sprite layer is larger, you will have to edit the geometry and increase the vertex distances to accomodate the larger layer, or it will look like you didn't increase anything

    There you go, now all your weights are back.

    Use the new PSB copy you imported as your character model. Keep the original in your project to use it for skeleton/weight restoration.

    There may be a better way to do this but after like 20 hours of re-rigging, bashing my keyboard and wanting to throw my laptop out the window this is the best steps I got for y'all. Correct me if you see something that can be improved, thank you.
     
    Last edited: Jul 26, 2023
  33. SpottedMagpie

    SpottedMagpie

    Joined:
    Apr 30, 2017
    Posts:
    6
    This could be improved by allowing the skeleton/rig/weights to be exported from the object within unity (PSB sprite object containing the weights/rig) and stored separately to the PSB sprite (which already has a field to allow us to specify a skeleton/rig externally from anther PSB anyways). But for the moment it looks like it's hard-coded into that file so basically we need to treat the original PSB import+rigging as the skeleton and use it as a template to import other PSBs we may want to use for the character. Particularly with sprite-swapping using SpriteLibrary and SpriteResolver for clothing types.

    It is probably challenging to do so though, because what is the skeleton/rigging without the PSB layers and sprites anyways? So maybe best practice is to first create a "plain" PSB of your character in their tighty-whiteys with all the rigging, then create a 2nd for clothing_set_1, and specify the plain PSB as the source of the rig/weights. 3rd clothing_set_2, _set_3, etc.
     
  34. Rudraksha

    Rudraksha

    Joined:
    Dec 31, 2017
    Posts:
    4
    For anyone still searching for any alternative answer if the above didnt worked. I exported psd from krita and in photopea online i imported that psd and there is an option to save psb that can further be used with unity.
     
  35. Rudraksha

    Rudraksha

    Joined:
    Dec 31, 2017
    Posts:
    4
    must be the weights not distributed properly. In Sprite Editor, make sure bone weights are distributed properly. The sprites might be having influence from other bones as well. Apart from that check in the inspector for each sprite incase the sprite skin component may have the wrong bones reassigned just in case.
     
Thread Status:
Not open for further replies.