Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Question PSB slicing problems and skinning questions.

Discussion in 'Formats & External Tools' started by Jamryl, Mar 7, 2021.

  1. Jamryl

    Jamryl

    Joined:
    Mar 9, 2020
    Posts:
    25
    Good evening lads!

    I have a PSB file containg all the assets necessary to generate procedurally a bunch of PNG.
    Canvas size is 1080 * 2500 and it contains everything, from limbs and torso up to underwear, clothes and several haircuts and eye colours. File is 75Mo ish (Takes a while to import into unity).

    The problem is, when I import my file into Unity all the layers of my psd files are slices into different size, to be as "tight" (no transparancy around) as possible, and I enp up with 100 mores different sprite sizes.

    Since some of the sliced assets have different sizes (haircut lenght for example) when I swap them within their category, using the sprite library and the sprite resolver, their placement becomes totally eratic... I tried to fix the problem by moving their pivot one by one, but as I said it takes like 1minutes to actualise any changes I do and my library contains 200+ entries...

    I tried to bypass the problem by exporting this PSB into 100+ different png files that have all the same dimentions and create manually a prefab and sprites libraries and "tadaa" no more WTF placement problems. But I cannot figure how to skin to animate this prefab.

    So finally my questions.
    1. Can I force slice all the sprite to the same dimentions in imported psb files? And have clean 1080*2500 slices? To skin it as you can do with PSB imported files.
    2. Or can I skin a prefab made of sprite renderers controlled by sprite resolvers and libraries as we can do it with PSB files? Like create meshes and bones for the whole prefab at once and not sprites per sprites?
    3. Even if my psb file is 1080*2500, when imported in Unity it looks horrendously pixelated. I have to switch it's mas size up to 8192 to get a clean graphics Can I avoid that? I'm afraid of ressources comsumption haha.
    I hope my explanantions are clear. But don't hesitate to ask any questions.
    Thank!
     
  2. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    921
    Hello @Jamryl,

    So the answer to question 1 and 2 depends on how you would like to use the Sprites. From your post, it seems that you would like to skin all of the Sprites and use them for skeletal animations. If this is the case, there is no going around a tight mesh.

    Skeletal animations work by deforming a sprites vertices according to the transformations of the bones they are skinned to. When using the 2D Animations Geometry tools, Unity generates a (tight) mesh where vertices are placed on the objects outlines, and additional vertices are placed inside the mesh. All these vertices allows the mesh to deform in a smooth way.

    If we instead generated a full rect, the sprite would initially only have 4 vertices to deform, making the default deformation very rough. The user would then have to add additional points themselves in order to make the sprite deform in a smoother way. Using full rects also has the downside of adding fill rate for when the Sprite is being rendered, which would affect the rendering performance in a negative way.

    Right now, the only way to fix your issue is to manually place the pivot points per Sprite in the location it needs to be in. I understand that this is a tedious process, and I will add your post as a feedback point we can use to improve the Sprite Swap experience in future releases.

    For your 3rd question, could you share some more information regarding this issue? Some screenshots of the pixelated end result and the PSB importer settings would be helpful.

    Thanks!
     
  3. Jamryl

    Jamryl

    Joined:
    Mar 9, 2020
    Posts:
    25
    Hello @Ted_Wikman thanks for the kind answer!
    Regarding the meshes size, it makes totally sense... I just realized my question was a bit dumb after reading your explanations :oops:

    Regarding the pivot, a "checkable" option, allowing the pivot to be placed at specific "preset coordinates" would be awesome! The psb file has a canvas size, "reading" the canva size and allowing a pivot not generated at specific coordinates (x, y) in the sprite but at preset coordinates (x, y) of the psb file's canvas size or by layer grouping! (Have no idea if my explanations make any sence :cool:)

    Finally, I uploaded the pixelated image:
    2021-03-19 10_11_16-H.I.G.A.png

    And a scrren of the PSB importer setting.
    2021-03-19 10_12_11-Settings.png
     
  4. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    921
    Thanks for sharing some screenshots. I can't really tell from them though what goes wrong. Would you mind sending me the .psb file in a PM? Then I can have a closer look.
    Thanks!
     
  5. Jamryl

    Jamryl

    Joined:
    Mar 9, 2020
    Posts:
    25
    Not at all! I'll contact you by PM. Thanks again.