Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Unity 2D Animation v2 - Preview Packages

Discussion in '2D Experimental Preview' started by rustum, Dec 17, 2018.

  1. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    82
    Hi! Yes, it was created on V1 and then upgraded to V2!
    In this case, it is a simple png, there is no separate parts, so I didn't need to use PSD.
     
  2. wolfkillshepard

    wolfkillshepard

    Joined:
    Sep 30, 2016
    Posts:
    12
    Hey I've been trying to get my pixel art character set up with this system but I can't get my pixel art to come out crisp looking like I usually can by changing my compression to none and my filter mode to point no filter. Do you know what I might have to do to keep my PSB looking in sprite editor like it does on photoshop?

    Turning Mip Maps off seemed to fix it for me
     
    Last edited: Jan 11, 2019
  3. Brogan89

    Brogan89

    Joined:
    Jul 10, 2014
    Posts:
    152
    Hey I'm having issues at the moment with shaders and flipping sprites.

    I'm using 2D animation package in conjunction with normal maps for shadowing on the sprites. When I flip the gameobject (localScale.x = -1) the sprites disappear (using the standard shader) when I change the shader to `Sprites/Diffuse` it shows correctly in its flipped state and light is reflected as normal but there is no field for normal maps.

    So pretty much, I want to be able to join both behaviours. I'm looking at the shader code now but my eyes are bleeding. Pretty much want to know how I can properly flip my character or how I can add normal map (like standard shader) to `Sprite/Diffuse` shader code?

    Thanks in advance :)
     
  4. scorp2007

    scorp2007

    Joined:
    Aug 17, 2014
    Posts:
    25
    Hello, please tell me the PSB importer does not support photoshop adjustment layers? I will have to apply it to each layer separately, it's very tedious.
     
    Last edited: Jan 17, 2019
  5. IAnon

    IAnon

    Joined:
    Jul 28, 2017
    Posts:
    1
    Is there a tutorial available for using IK at runtime I cant figure out how to do it.
     
  6. Sergi_Valls

    Sergi_Valls

    Unity Technologies

    Joined:
    Dec 2, 2016
    Posts:
    183
    The problem is that standard shader has back-face culling enabled. After googling a bit I found https://gist.github.com/unitycoder/469118783af9d2fd0e2b36becc7dd347, which might be helpful for your case as a workaround. Adding normalmaps to sprites is complicated right now. If you do, remember not to use SpriteAtlas. We are working internally in providing a solution for this.

    Hi, please take a look at this blog post https://blogs.unity3d.com/2018/12/04/getting-started-with-2d-inverse-kinematics/
    I hope it will be helpful.
     
    Brogan89 likes this.
  7. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    166
    Thanks for the feedback. We will put this onto our backlog for future development. As the importer is still in it's early release stage, telling us what feature you would like and how it is being used is very useful for us to continue improve the importer.
     
    scorp2007 likes this.
  8. Brogan89

    Brogan89

    Joined:
    Jul 10, 2014
    Posts:
    152
    Perfect! Thank you very much @Sergi_Valls :)
     
  9. giorgos_gs

    giorgos_gs

    Joined:
    Apr 23, 2014
    Posts:
    570
    Any updates for V2.1?
     
  10. cybergaston007

    cybergaston007

    Joined:
    Jun 21, 2017
    Posts:
    7
    Hello,

    Will 2.1 be a stable release, or still a preview ?

    Any ETA on when it will leave the preview for verified ?
     
  11. giorgos_gs

    giorgos_gs

    Joined:
    Apr 23, 2014
    Posts:
    570
    I hope it will change to stable.
     
  12. Ktulian

    Ktulian

    Joined:
    Apr 6, 2014
    Posts:
    6
    Is root motion broken? It looks to me like root motion only works when moving the top parent but the root bone is a child of that parent and the root bone doesn't seem to respond to root movement only text original game object. The issue is that by moving that my IK targets also move. I'd like to use root motion by moving the root bone so my IK targets retain their position but it it's not working.
     
  13. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    524
    Hello,

    Quick questions :

    - Do you plan to handle Animate (Flash) files ?
    - What are the main next features you are planning/working on ?
     
  14. wolfkillshepard

    wolfkillshepard

    Joined:
    Sep 30, 2016
    Posts:
    12
    EDIT I didn't have my character centered in my sprite sheet, this seems to be important to get the pivot to play nice (or at least make sure to make a custom pivot before you do all your rigging). I was able to crop my psd file to center my character and then move the bones over to his new position in the sprite editor. It seems like having one sprite sheet per character is probably the best so the pivot is in the right spot for flipping.

    Original Question

    Loving this phase 2 animation preview, it's very powerful and I'm already liking it way more then the other 2d bone options.

    I am having trouble flipping my sprites in order to get my character walking the other direction though. Just flipping the X scale seems like it would work but my character moves way over to the other side of the screen while I flip. Does your character get its pivot from the psd somehow? I type 0,0,0 for the characters position yet he isn't going to where the origin is for all my other objects.
     
    Last edited: Jan 22, 2019
  15. lvkae

    lvkae

    Joined:
    Mar 20, 2014
    Posts:
    8
    Hello community,

    I have an issue with sprite animation and polygon collider 2d. This new animation feature is awesome, but it lack one of key points - it does not affect colliders, which is kind of weird. For example, in case of box or sphere collider it should scale XY to fit sprite bounds, but in case of polygon collider it should apply same animation/bones to it as well. Does anyone have any solution/suggestion for this, except manually animate collider bounds in animation? I was trying to find some work around by re-creating collider on every frame using sprite physical shape, but it didn't help.

    Thanks in advance!
     
  16. Sergi_Valls

    Sergi_Valls

    Unity Technologies

    Joined:
    Dec 2, 2016
    Posts:
    183
    Root-motion affects the GameObject that contains the Animator component. Usually it is convenient that the IK targets stay local to the character (e.g. you can animate the root bone up and down and have the feet planted on the ground, while your character is moving in the scene). If you want your IK targets to stay at world space you will have to move them outside your character hierarchy.

    We are not planning to import Animate files.
    We are working on solving the "Sprite Swap" problem, where a body part can choose between several sprites to display, and replacing character's visuals (or skins) in order to create character variations.

    You can set the character's pivot point in the importer.

    In order to work with physics, you should attach Colliders to the bones and adjust them in order to approximate the shape of your character. We don't have plans to add deformation on PolygonColliders.
     
  17. scorp2007

    scorp2007

    Joined:
    Aug 17, 2014
    Posts:
    25
    Hello, I have such a question. I have bones that are attached to Solver, I also have separate animations associated with these bones, when I put these animations in the animator, the solver stops working for these bones, even when the animation is not playing. How can I combine them? I hope I clearly explained, as I translate through a translator.
     
  18. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    524
    @Sergi_Valls why not planning to handle Animate format ? Animate is a very common and used software in animation and would really make sense to be able to keep working with it and import into Unity.
     
  19. Keppi

    Keppi

    Joined:
    Mar 19, 2018
    Posts:
    5
    Hello,

    I started experimenting with the new 2D Animation preview package today, and I have a couple of questions: I added the 2D animation, 2D IK and 2D PSD importer packages as was instructed. I ran into trouble trying to set up my IK. I followed the youtube tutorial linked here earlier and the documentation alongside with the Unity blog post about the subject. I manage to add the IK Manager 2D component to my character and a Limb solver 2D component and make a target for it, but there is no "Create Effector" button under the Limb Solver options, and the "Create target" and "restore default pose" buttons are both greyed out. Creating an empty transform and setting it as an effector doesn't make it work either. I was wondering if I was missing some components or something else?

    EDIT: Further testing has revealed that I can't get the correct options in the CCD Solver 2D either to appear - there is no "create effector" button and both the "Create target" and "Restore default pose" buttons are greyed out. Manually adding empty transforms and setting them as the Target and Effector enables moving the thingy in the slider for Chain Length, but only 1 gizmo appears at setting 1, no other settings show gizmos and the IK doesn't work in either case.

    Thank you in advance.
     
    Last edited: Jan 25, 2019
  20. giorgos_gs

    giorgos_gs

    Joined:
    Apr 23, 2014
    Posts:
    570
    can you please share the ETA of 2.1 version?
     
  21. SmartMediaNL

    SmartMediaNL

    Joined:
    Sep 29, 2016
    Posts:
    65
    Hi there,
    I do not have adobe photoshop but Affinity designer (vector) It can import PSB but can Export PSD only.
    And the PSD Importer in Unity only can read PSB. (why not call it PSB Importer i wonder ?)
    So my question is: Can the 2d animation packaged be used without PSB files?
    Or are PSB files mandatory ?
     
  22. Sergi_Valls

    Sergi_Valls

    Unity Technologies

    Joined:
    Dec 2, 2016
    Posts:
    183
    Hi, could you share a video so we can help you better? thanks.

    We plan our road-map based on user needs and requests. Based on that, Animate format is not in our priorities right now.

    You need to add the "bone" transform reference into "Effector". That bone transform has to be the tip of your chain, like a hand, foot, etc. The "Target" transform reference can't be related to the chain of bones you are manipulating. Make sure any of the bones is an ancestor of the target. LimbIK will need at least two ancestors to work. In CCD and FABRIK you have to input how many ancestors you want to use, by setting the chain length.

    We are targeting to release next to 2019.1.

    Any PSD renamed to PSB will work. Right now we can't override the default importer of the PSD extension. This might change in the future.
     
  23. SmartMediaNL

    SmartMediaNL

    Joined:
    Sep 29, 2016
    Posts:
    65
    Thanks for the tip!
     
  24. giorgos_gs

    giorgos_gs

    Joined:
    Apr 23, 2014
    Posts:
    570
    Will it be preview or stable?
     
  25. Keppi

    Keppi

    Joined:
    Mar 19, 2018
    Posts:
    5
    Thank you, that solved a lot. The documentation seems to be a bit all over the place at the moment since the package is in development, and it advised you to make the Target a child of the last bone in the chain. (The blog post also instructed you to use the same GameObject for both the effector and target.) Having the Target as a child of the Solver and the Effector a child of the last bone made my Solvers work. Follow-up question: Because the Limb Solver doesn't have a setting for the number of joints for the leg and apparently expects to any Leg to have 2 joints (hip and knee), how would I go about making a leg with three joints, e.g. for an animal character? I kind of achieved this by having another Leg IK solver after the knee joint for the last part of the leg, parented so that moving the upper IK also moves the lower IK. Any "official" or preferred methods for this?
     
    AcademyOfFetishes and EvOne like this.
  26. lvkae

    lvkae

    Joined:
    Mar 20, 2014
    Posts:
    8
    Thanks for reply.

    While colliders attached to bones are OK for broad click detection, but how to proceed if i need to be more precise? For example... is it somehow possible to get pixel color on click for animated sprite? If i will convert collider hit coordinates to sprite texture i will get color of pixel which was there initially and not actual pixel under cursor. Hope this make sense.

    If collider deformation would work, i could use MeshCollider with mesh generated from sprite and RaycastHit.textureCoord for perfect hit. Performance is not a problem in my case and i could regenerate mesh collider every few frames if i would have access to modified sprite mesh. Is it possible? Can you give me any other hint?

    Thanks in advance!
     
    Last edited: Jan 28, 2019
  27. Sergi_Valls

    Sergi_Valls

    Unity Technologies

    Joined:
    Dec 2, 2016
    Posts:
    183
    It would be probably easier to render your Sprite into a RenderTexture and pick the color from there.
     
  28. lvkae

    lvkae

    Joined:
    Mar 20, 2014
    Posts:
    8
    Great idea! Thanks for the hint!
     
  29. Sam_Ooi

    Sam_Ooi

    Unity Technologies

    Joined:
    Mar 5, 2018
    Posts:
    28
    Hi again wagenheimer, apologies for the late response. In the Skinning Editor, bones are shown for the currently selected Sprite, and you can select a Sprite in the Skinning Editor by double-clicking on it. That appears to be why the bones are displayed after you have clicked a lot of times in the Skinning Editor. Could you let me know if you are able to select the Sprite by double-clicking on it in the Skinning Editor window, and that the bones become visible once it is selected?

    Hi Keppi, we are preparing an update to the IK documentation that will become available in the coming weeks. It should provide clearer documentation and steps when using the 2D IK package. Thank you for your feedback!
     
  30. UnityIco

    UnityIco

    Joined:
    Jan 5, 2017
    Posts:
    9
    Does it function properly on Android? I tried rotating some bones and it works in editor, but it doesn't on android build.

    Everything else seems to functional phenomenally.
     
  31. josefgrunig

    josefgrunig

    Joined:
    Jan 23, 2017
    Posts:
    6
    This package is awesome! But how can I achieve eyes blinking? Or even more complex facial expression?
     
    AcademyOfFetishes likes this.
  32. GarbDev

    GarbDev

    Joined:
    May 1, 2016
    Posts:
    1
    Is there a way to copy & paste bones without removing existing bones? I'm working with a symmetrical sprite and need to mirror the bones on each side, but I can't seem to properly do this.
     
  33. Sergi_Valls

    Sergi_Valls

    Unity Technologies

    Joined:
    Dec 2, 2016
    Posts:
    183
    Hi, you are probably using a high code-stripping option. We are working on a fix for that. Until then, please use no code stripping.

    We are working in sprite-swapping workflows which will help you solving that. Feel free to explain all your use-cases!
     
    AcademyOfFetishes likes this.
  34. UnityIco

    UnityIco

    Joined:
    Jan 5, 2017
    Posts:
    9

    You are absolutely right. Code striping was set at medium and animations with rotations didn't work.
    Thanks for a quick response. Now I don't have to change to another tool for animations. You have my gratitude.
     
    Last edited: Feb 18, 2019
  35. scorp2007

    scorp2007

    Joined:
    Aug 17, 2014
    Posts:
    25
    Hello, and if I have a character (with bones) and I have several skins of his head, then each head should be a separate file and have the same bone that has the main character? Can I copy the skeleton from another file absolutely, considering all the rotations and position of the bones? Thanks.
     
    AcademyOfFetishes likes this.
  36. Exsecratus

    Exsecratus

    Joined:
    May 24, 2016
    Posts:
    3
    Hi, first of all the 2D Animation Package ist very very cool! Easy to use and very good to handle.
    Unfortunately i have some trouble with LightSources and Shaders who cast and recieve shadows.

    For testing i use this shader below. (Cutout)

    The sprite gets ugly "highlights" when the bones and sprites overlaped and entered a Light Source (Point/Spotlight). Z-Order in Skinning Editor does not work.

    I attached a image, any solutions for this?
    Thanks in advance and sorry for my english :)
     

    Attached Files:

    Last edited: Feb 20, 2019
  37. xpachin

    xpachin

    Joined:
    Feb 6, 2014
    Posts:
    46
    this are EXACTLY my questions! please help with them!
     
  38. yuanxing_cai

    yuanxing_cai

    Unity Technologies

    Joined:
    Sep 26, 2014
    Posts:
    208
    It would be of great help if you could send us a simple repro project that contain your sprites and shaders.
     
  39. Exsecratus

    Exsecratus

    Joined:
    May 24, 2016
    Posts:
    3
    Thanks for your reply, you can use standart shader or standart sprite diffuse shader (both have the same problem).
    I attached a repro project (open SampleScene).
     

    Attached Files:

    yuanxing_cai likes this.
  40. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    82
    I have upgraded to 2019.1 compatible version, but something is wrong!
    I can edit it, and when editing everything works as expected.

    But when using the SpriteSkin it is not deforming the sprite anymore.

    upload_2019-2-21_7-23-15.png
     
  41. Sergi_Valls

    Sergi_Valls

    Unity Technologies

    Joined:
    Dec 2, 2016
    Posts:
    183
    Hi, thanks for reporting. We know how to reproduce this one. Until the fix lands, a quick disable/enable on the SpriteSkinEntity should do the trick. Also entering playmode will reactivate the deformation.
     
  42. wolfkillshepard

    wolfkillshepard

    Joined:
    Sep 30, 2016
    Posts:
    12
    I am so happy to have this animation solution, having everything integrated in sprite editor and and being able to just use layers straight out of the psd makes putting animations together so much faster.

    Something I was messing around with was trying to have a solver's position moved by code:
    LeftArmSolver.transform.position = LeftHandGrabPoint.transform.position;
    And it works really well, the solver just moves to the defined position.

    After that I tried to create an animation that uses that same solver. Once I create a keyframe with that solver, my code that moves it into the new position just doesn't move it, even if the animation with the keyframe isn't being used anywhere.

    It seems that just the existence of a keyframe using the solver will make changing it's transform.position in code not work. I have been trying both LateUpdate and Update and both have the same effect. Anyone know a way to make the code moving the solver take over the animations use of it so I can switch between the two?
     
    EvOne likes this.
  43. yuanxing_cai

    yuanxing_cai

    Unity Technologies

    Joined:
    Sep 26, 2014
    Posts:
    208
    Unity's Standard Shader uses multiple passes to handle point lights. The lighting of the point lights are rendered in separate passes and then additively blended with directional / environmental lighting. When you have overlapping geometries, the overlapping area will accumulate more lighting than other areas due to the additive blending, and that's reason for the "highlighting" effects.

    If you are willing to switch to Unity's new Scriptable Render Pipeline, then the Lightweight SRP could be a solution for you as it uses a single pass approach to handle lighting and doesn't have this problem.

    If you must stick to the built-in render pipeline, then you can try the attached shader, which is a slightly modified version of the legacy alpha cutoff shader. It doesn't have a forward-add pass and uses vertex lighting for point lights.

    Also, we're working on a 2D lighting system that should better suit your lighting needs in a 2D project than the built-in directional / point / spot lights, but it still has a long way to go.
     

    Attached Files:

    wolfkillshepard likes this.
  44. JPUlisses

    JPUlisses

    Joined:
    Apr 23, 2014
    Posts:
    4
    Why 2D IK package is not integrated with 2D Animation Package?
     
  45. Sergi_Valls

    Sergi_Valls

    Unity Technologies

    Joined:
    Dec 2, 2016
    Posts:
    183
    The 2D-IK package is a temporary solution. Ideally we want a unified solution for 2D and 3D within Unity. The Animation team is working on that. Once released, there will be no need to maintain the 2D-IK package. That was the reasoning behind making it a separate package.
     
    JPUlisses likes this.
  46. m9731526

    m9731526

    Joined:
    Dec 1, 2016
    Posts:
    12
    Hello, I have a question: Is sprite/sheet swaping covered in this package?
    Currently it seems only way to create 2d rig is import a psd/psb, it means bones and textures are couple in one imported file, right? If I want to create one bone and use it with multiple sprites, what should I do? Is there a clean way to achieve this?

    I know we can have the result by messing around with SpriteSkin, but there's no intuitive way to create bone directly, is it?

    And it also bothers me that I have to stick with Adobe without choices.
     
    Last edited: Feb 26, 2019
    AcademyOfFetishes and Betzalel like this.
  47. UnityIco

    UnityIco

    Joined:
    Jan 5, 2017
    Posts:
    9
    Hi. I got a question about sprite mask interactivity with sprites rigged through this awesome tool.

    SpriteSkin moves the sprite rendered a bit, so sprite mask is not at the same position. If I then animate the sprite, sprite mask won't follow the bones.


    upload_2019-2-26_12-16-52.png

    I am currently using a workaround manually setting the sprite mask as a child of the object with sprite renderer and moving it's transform so it fits. Then I parent that sprite/image with the child (that holds the sprite mask) to the bone that i am animating.

    upload_2019-2-26_12-20-44.png

    So this works. Just isn't the most intuitive. Hope I was clear enough. Either way thanks. :)

    And congrats on making an awesome tool. :)
     
  48. Exsecratus

    Exsecratus

    Joined:
    May 24, 2016
    Posts:
    3
    Thanks for your answer and explanation, very helpful.

    Unfortunately i cant use SRP, because it doesnt support realtime shadows for point and spotlights.
    2D Lighting-system would be awesome but i understand it needs time to make it.

    So i testet your posted shader, really thanks for sharing.
    It works great with Anima2D... but with 2D Animation package (sprite renderer) i cant use "flip" or negativ scale to change the direction, the sprite gets transparent (not both sided)

    Could you give me a hint to solve the problem, i really want to use 2D Animation Package instead of Anima2D. Shader Coding ist a kind of black magic for me :-D
     
    EvOne likes this.
  49. Sergi_Valls

    Sergi_Valls

    Unity Technologies

    Joined:
    Dec 2, 2016
    Posts:
    183
    Not yet. We are currently working in sprite swapping workflows.

    That is correct.

    We provide copy and paste features for bones and mesh. We are aware that currently it is hard to use and confusing (and maybe bugged) so we are planning to spend some time fixing it.

    You can use any program that exports to PSD. Afterwards, you can rename to PSB. We are aware that a lot of content out there is already made using png sprite-sheets of body parts. We will take a look at that at some point.

    Hi, you should parent your SpriteMask to the bone instead. The geometry follows the bones not the SpriteRenderer's GameObject.
     
  50. yuanxing_cai

    yuanxing_cai

    Unity Technologies

    Joined:
    Sep 26, 2014
    Posts:
    208
    It's actually quite easy to fix. In the shader I attached to the previous post, add "Cull Off" to a new line after "LOD 200". This will turn off backface culling. See https://docs.unity3d.com/Manual/SL-CullAndDepth.html for more information on how to control backface culling in Unity shaders.