Search Unity

PSD Importer tool + Sprite atlas

Discussion in '2D' started by Tarodev, Mar 10, 2019.

  1. Tarodev

    Tarodev

    Joined:
    Jul 30, 2015
    Posts:
    190
    I've been using sprite atlas to great effect, keeping my draw calls to a minimum, but I can't seem to find a way to add my characters which I imported using the PSD importer tool to an atlas.

    The result is when lots are on the screen I have upwards of 450+ draw calls as each limb must be it's own call and gives horrid performance on mobile.

    Surely there's a way to do it, right?
     
  2. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    644
    Please try adding the sprites individually to the SpriteAtlas Packable Objects.
    Also if you are referring to this package : com.unity.2d.psdimporter@1.0 you should be able to add the texture object or the folder that contains the psd texture to the Sprite Atlas packables. Please use the latest version of 2019.1 Beta
    (Unity 2019.1.0b6) Let us know if this works.
     
  3. Tarodev

    Tarodev

    Joined:
    Jul 30, 2015
    Posts:
    190
    Trying now, but the PSD Importer does not actually work with 2019.1.0b6.

    Reproduce:
    Create fresh 2019.1.0b6 project
    Import com.unity.2d.psdimporter@1.0 from package manager
     
    Last edited: Mar 10, 2019
  4. Tarodev

    Tarodev

    Joined:
    Jul 30, 2015
    Posts:
    190
    In a new project using 2018.3.5f1, it batches it all together, but in my main project in the same unity version it doesn't... I'm trying to find the delta, but the only thing I can think of is that the main project is rigged with bones and the unity 2d IK. Would that do it?
     
  5. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    644
    In 2018.3 versions animated sprites are not batched. However we have added support for batching of animated sprites (SpriteSkin) in 2019.1 (please test latest beta).
    More info here :
    https://forum.unity.com/threads/2d-animation-v2-preview-packages.599356/

    Will take a look asap.
     
    Lars-Steenhoff likes this.
  6. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    436
    Hi, the PSD Importer should work with 2019.1. What error are you getting?
     
  7. Tarodev

    Tarodev

    Joined:
    Jul 30, 2015
    Posts:
    190
    I'm an idiot. It just required 2d.animation.

    I'm suffering a new problem now.. The PSD imports work with their rigs, but my actual prefabs have lost all linking to their bones, see the video below:

    https://www.dropbox.com/s/ga7gjaaiupi1j2f/Z87Iy6puaw.mp4?dl=0
     
    Last edited: Mar 11, 2019
  8. magnetic_scho

    magnetic_scho

    Joined:
    Feb 2, 2020
    Posts:
    96
    @Tarodev:
    Did you figure out a way to put Sprites from a PSD into a Sprite Atlas so that draw calls for the sprites are batched?
    I put them into the sprite atlas directly (not through a directory), but there are still a lot of draw calls...

    BTW: Great videos on your Youtube channel!
     
    RemDust likes this.
  9. magnetic_scho

    magnetic_scho

    Joined:
    Feb 2, 2020
    Posts:
    96
    I finally figured this out. Sprite atlases work with 2D Animation as expected!

    The issue in my case was, that I highlighted some instances by changing shader properties, which resulted in every sprite getting its own material. Since batching only works with shared materials, I had to reset the materials back to the original one, after highlighting was over.

    Using the FrameDebugger was really helpful btw!
     
    Imaginesto and RemDust like this.
  10. Imaginesto

    Imaginesto

    Joined:
    Apr 15, 2020
    Posts:
    9
    May i ask how you were able to reset the shared materials back to the original one?
     
  11. magnetic_scho

    magnetic_scho

    Joined:
    Feb 2, 2020
    Posts:
    96
    Last edited: Aug 15, 2023
  12. Imaginesto

    Imaginesto

    Joined:
    Apr 15, 2020
    Posts:
    9
    I attempted switching the materials to a new mat, but still having batching issues. It didn't change my draw call count.

    My "Sprite Skin" section in the inspector doesn't have the "Enable Batching" checkbox or even the warning to have burst or collections installed. (which I do have have).


    Any thoughts or other things check?
     
  13. magnetic_scho

    magnetic_scho

    Joined:
    Feb 2, 2020
    Posts:
    96
    Have you put all the sprites into a sprite atlas?
     
  14. Imaginesto

    Imaginesto

    Joined:
    Apr 15, 2020
    Posts:
    9
    The Sprites get generated into a Sprite sheet through the PSD importer from a PSD/PSB File.The issue were having is that all the pieces of the rig get called in (drawn) separately.



    also, appreciate your time and responses!
     
  15. magnetic_scho

    magnetic_scho

    Joined:
    Feb 2, 2020
    Posts:
    96
    What does the frame debugger say why it can't batch it?
     
  16. Imaginesto

    Imaginesto

    Joined:
    Apr 15, 2020
    Posts:
    9
    Hey, we were able to move some of these layers around and adjust some lighting interactions and it seemed to fix the problem!
     
  17. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    436
    Awesome!