Search Unity

Unity SpriteShape Preview Package

Discussion in '2D Experimental Preview' started by rustum, Mar 19, 2018.

  1. a3dline

    a3dline

    Joined:
    Dec 28, 2013
    Posts:
    11
    upload_2019-7-5_14-49-31.png
    Please fix this line.
     
  2. unity_2JZVVIhvhCNpzQ

    unity_2JZVVIhvhCNpzQ

    Joined:
    Jul 6, 2019
    Posts:
    1
    I installed package 2D Sprite Shape, but when I went to Sprite Shape Profile I didn't find three types of Profiles: Empty, Strip, and Shape. Three are only two types Open Shape and Close Shape. What should I do to add three types of Profiles: Empty, Strip, and Shape?
     

    Attached Files:

    • 2.png
      2.png
      File size:
      170.2 KB
      Views:
      129
  3. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    206
    In recent versions we have renamed the Asset Profiles.
    Open Shape is same as Strip
    Close Shape is same as Shape.
    Empty simply does not have any Angle Range defined. So just create a profile and remove Angle Ranges if you would like to have one. More info here :
    https://docs.unity3d.com/Packages/com.unity.2d.spriteshape@2.1/manual/SSProfile.html

    Thanks. This has been fixed in 2.0.0-preview.8 (2019.1) and 2.1.0-preview.10 (2019.2) versions of the Package.
     
  4. yuanxing_cai

    yuanxing_cai

    Unity Technologies

    Joined:
    Sep 26, 2014
    Posts:
    208
    We've fixed this sorting issue internally, but it needs time before you can have the fix. For now a workaround is to use two different materials for the fill part and the edge part. They can use the same shader, but they have to be two distinct asset files.
     
    Venkify and jbarba109 like this.
  5. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,070
    When using SpriteShape v2.1.0 with Unity 2019.2.0b9 I get tons of errors when installing the package AFTER I installed the LWRP package like this:

    Library/PackageCache/com.unity.2d.spriteshape@2.1.0-preview.10/Editor/SpriteShapeControllerEditor.cs(9,23): error CS0234: The type or namespace name 'Path' does not exist in the namespace 'UnityEditor.U2D' (are you missing an assembly reference?)

    Or this:

    Library/PackageCache/com.unity.2d.spriteshape@2.1.0-preview.10/Editor/SpriteShapeControllerEditor.cs(16,50): error CS0246: The type or namespace name 'PathComponentEditor<>' could not be found (are you missing a using directive or an assembly reference?)

    I removed the package and LWRP and then installed SpriteShape again. Worked.
    Just letting you know :)
     
  6. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    206
    BTStone likes this.
  7. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,070
    @Venkify Alright, great! :)

    Question:
    When working with the SpriteShapeProfile, we can set the Offset of the Fill-Texture. Is there a reason it's an "universal" offset in x AND y? Can't they be seperate?
    Also an X/Y-Offset for each Sprite-Variant in a SpriteShapeProfile would be great.
    I'd like to offset those sprite-variants in relation to the fill texture since they are positioned below they edge of the fill which let's the edge of the fill look through at some points. I know I can change the pivot point of the sprite but I'd would be more flexibel to have the option with the offsets.

    I made a quick video demonstrating how it looks when I set the sprite and how I want to it to look like placing the sprite directly on top:
     
    EvOne likes this.
  8. pastaluego

    pastaluego

    Joined:
    Mar 30, 2017
    Posts:
    51
    Can you clarify this? You say you can use two different materials for the fill and edges, but isn't that not possible since the spriteshaperenderer only takes 1 mat? Or is it possible in 2019.2 version and not 2019.1 (the one I'm using right now).
     
  9. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    206
    Its available for 2019.2 since 2019.2.0b7 Please get the latest beta and 2019.3 as well.

    Thanks. Will take a look.
     
    yuanxing_cai likes this.
  10. Pebbl3s

    Pebbl3s

    Joined:
    Apr 13, 2013
    Posts:
    5
    Has anyone else been getting the issue where corners just don't show up? (Confirmed all points in the SpriteShape are in Linear Point Mode as per the docs). No matter what I can't seem to get them to show up. Any help is appreciated :)
     
  11. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    206
    @Pebbl3s
    For a point to be considered to be a corner the following condition should hold:
    1. A valid Corner Sprite is set in the SpriteShape Profile.
    2. The corner point and neighbor points should be in Linear Tangent mode (Straight line from point to point).
    3. The height of the Point and neighbor points should be same too.
     
  12. Pebbl3s

    Pebbl3s

    Joined:
    Apr 13, 2013
    Posts:
    5
    @Venkify So these are the corner sprite import settings
    Screen Shot 2019-08-02 at 2.46.56 PM.png

    And they're added to the SpriteShape. (I added the same sprite to all corners just for good measure)
    Screen Shot 2019-08-02 at 2.47.11 PM.png

    And these are the 3 adjacent points, all with matching height and linear point mode
    ALL.png

    Yet this is the result...
    Screen Shot 2019-08-02 at 2.49.05 PM.png

    Is there something I'm missing here? It seems like they should be showing up
     
  13. rustum

    rustum

    Unity Technologies

    Joined:
    Feb 14, 2015
    Posts:
    49
    SpriteShape 2.1.0.preview.11 for 2019.2 is now available!

    This version adds a back-port that ensures that the SpriteShape object generates geometry even if not visible in the Camera.
     
    Last edited: Aug 4, 2019
  14. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    206
    Please set Pivot to center for corner sprites. Could you please submit a bug report if the issue persist?
     
  15. Milten2222

    Milten2222

    Joined:
    Nov 14, 2017
    Posts:
    7
    Is it possible to use 2D shapes together with 2D isometric tilemaps to create curvy pathes?
    I have tried but I have no idea how the sprite for the road should look like. Using isometric image leads to this result.
     

    Attached Files:

  16. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    4,286
    I've got some sprite shapes that are printing the error "Dimensions of color surface does not match dimensions of depth surface" to the console every time I select them or enter play mode. There's no stack trace. Any idea what I'm doing wrong, and could you perhaps improve that error message?
     
  17. MrZzzero

    MrZzzero

    Joined:
    Dec 9, 2016
    Posts:
    57
    plz help i used the first version of sprite shape in my game and after updating unity i got some errors about sprite shape and i downloaded the latest version errors disappeared but everything ruined in my game levels, also when i tried the new sprite shape i found that there is 2 options open and closed not like the first version where u have 3 options when i do open sprite shape profile it gives me a closed shape is it a bug ? i mean i can't do the same as i did before with the one called strip from the first version, and how to fix my ruined levels sprites shapes ??
    image 1 : ruined strip sprite shape


    images 2 : sprite shape option open



    result : as u see here the open one has 4 parts is it a bug or just need some configuration ?



    image 3 : sprite shape option close (looks like the old one , no problem with it)



    result :

     
  18. MrZzzero

    MrZzzero

    Joined:
    Dec 9, 2016
    Posts:
    57
    please help , its hard for me to redo all levels it takes time and effort
     
  19. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    206
    SpriteShape just follows the path of the spline tiling the sprites defined in the angle-ranges along the way. Could you please be more specific with the use-case, perhaps an image describing it ?
    I believe this issue may not be related to Spriteshape. Looks like a RenderTexture issue. Could you kindly submit a bug report so we can take a look ?
     
  20. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    206
    In recent versions we simplified SpriteShape profiles:
    Strip is now Open Shape
    and Shape is Close Shape. Empty no longer exists.

    There are no functional changes otherwise. Could you please post a sample scene/project so we could help as soon as possible ? That would help us investigate the issue.
     
  21. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    4,286
    The reason why I'm pretty sure that it's the sprite shapes is that it instantly disappears the second I remove the sprite shapes from the scene ;)

    I'll try to remember to send a bug report once I get back to work on Monday.
     
  22. MrZzzero

    MrZzzero

    Joined:
    Dec 9, 2016
    Posts:
    57
    thank you i sent to you a package of a level look ur inbox , ill wait ur help
     
  23. Enixus

    Enixus

    Joined:
    Jul 13, 2019
    Posts:
    5
    Spriteshapes are amazing. It's kind of tricky to draw seamless textures for them, but I'm getting used to it. :)

    One short question:
    I want to manipulate the position of the splines with the animator. Is there a way to access them? Perhaps they could become visible in a list, like the "polygon collider 2d" shows them?
    2019-08-15 21_42_37-Window.png
     
  24. Pebbl3s

    Pebbl3s

    Joined:
    Apr 13, 2013
    Posts:
    5
    Setting the edge pivot to center fixed the issue. Would this be a bug? I don't see anything in the docs that says you need to have the pivot centered in order to use corners
     
  25. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    206
    Thanks for the update. We will update the manual/documentation to reflect this requirement.
    This is something we are planning to add support for. Will keep this thread updated regarding this. Thanks for the feedback.
     
    alisia and EvOne like this.
  26. kyuskoj

    kyuskoj

    Joined:
    Aug 28, 2013
    Posts:
    19
    It doesn't work for me. 2019.2.0 / spriteshape preview.11.

    ps. Fixed the problem by changing all of sprite's pivot to center. It's a bit complicated.
     
    Last edited: Aug 23, 2019
  27. pastaluego

    pastaluego

    Joined:
    Mar 30, 2017
    Posts:
    51
    After using it a lot more, I can fully narrow down all my wishes for the tool to just three main ones:

    1. Not sure how possible this one is, but if edge mesh generation could be improved at nodes so they don't warp the texture as much when combining its two adjacent edges and make it as seamless as possible for a wider range of angles, this tool would reach another level.

    2. An auto-corner generation in linear-point-mode by merging the 2 adjacent edges like it does for continuous-mode except make it bend at a right angle (or whatever angle the two adjacent edges intersect at) would be unbelievable. Dedicated corner sprites just don't work for most types of terrain and environment styles because they're virtually impossible to seamlessly blend with adjacent edge textures as well as the fill texture except for a very very limited amount of environment styles. Not to mention dedicated corner sprites still break way too easily and are overall just unreliable except for a very specific and basic situation. Auto-generated corners would break only at incredibly extreme angles, if even then.

    3. A very basic set of automatic curve-generation tools. Think of a Sonic the Hedgehog quarterpipe. There's no easy way to do a perfect quarter or half circle with this tool, and I think a basic set of node tools that instantly calculates and adjusts the selected tangent to become a pixel-perfect curve isn't that unreasonable. Ferr2D manages it and it's incredibly useful. Not only would it be functionally useful, it would streamline the levelmaking process by saving so much time.

    Those three things would put this tool on the map as one of if not the most useful 2D game tools in Unity that would help 2D indie developers feel like they aren't limited to pixel art and tilemaps.
     
    Last edited: Aug 25, 2019
    EvOne and alisia like this.
  28. rushk1

    rushk1

    Joined:
    Sep 24, 2017
    Posts:
    39
    Can Spriteshape be used to make an animated stream of water , waterfalls , waves etc . Can someone point me in the right direction to go about this ..
     
  29. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    206
    Thanks for the update. We will try to simplify the requirements in upcoming versions.
     
  30. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    206
    rushk1 likes this.
  31. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    206
    Thanks for the feedback. We will try to improve tessellation further in upcoming versions.

    We will consider this use-case.

    Agreed. We will consider this as well.
    Will post this thread once we have an update on these. Thanks.
     
    Lars-Steenhoff, alisia and pastaluego like this.
  32. BStheOne

    BStheOne

    Joined:
    Mar 10, 2015
    Posts:
    5
    Is there be an option to use 3d model to extrude along the spline?
    Spriteshape is very useful and easy to use, I wonder if I can have this tool to use in my 2.5D game?
    I extended it myself to generate 3d mesh but I think it's not optimized and texturing it is another problem of mine.
     
  33. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    555
    In the attached image, is it possible to have a smooth transition between the Snow and the Rock?

    What I would like is for the "Corner" sprites to become active for more "shallow" angles but I do not see where I have any control over that.

    SnowRock.JPG

    -Jeff
     
  34. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    4,286
    That was a major issue we also ran into. We didn't find a way to not have those kinds of gaps in the shape. They make sense when you're creating the kind of outdoors walking path/underground that's shown on the first page, but not when you're creating something that needs to be connected (like walls).
     
  35. Wadoren

    Wadoren

    Joined:
    Mar 13, 2016
    Posts:
    9
    Hello.
    I recently started using this tool and I want to thank you for developing it, it's been very helpful!
    However, I'm confused about the change in behaviour of edge colliders.
    In version 1.0.12 if you added an edge collider and set some offset, it created a spline with width.
    post_0001.png
    Image taken from MAKE ORGANIC LEVELS!! Unity Sprite Shape - Brakeys.
    But in 2.1.0 edge colliders just generate a spline without any width.
    post_0002.png post_0003.png
    Adding a polygon collider created a shape which closed the hole in the middle.
    post_0004.png
    Is there any way to reproduce the old behaviour?
     
  36. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    206
    Understood. Will take a look at this and update the thread.
     
  37. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    206
  38. AnalogUniverse

    AnalogUniverse

    Joined:
    Aug 10, 2018
    Posts:
    59
    Ive just started using Sprite Shape is there any way to have sharp corners with a continuous spline, currently when I click the edit spline button in the inspector I get three options linear, continuous and broken, linear and broken have two separate edges which overlap which is not the look I want, continuous is closest but both sides of the control point are curved, I want both sides of the control point to be straight lines say 0 degrees one side 45 degrees the other, with a sharp corner / bevel between the two, is this possible ?
     
  39. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    206
  40. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    555
    One unfortunate caveat to this though is the corner sprite will only show up if the angle is greater than some value... around 45 degrees or so. Less than that and the corner sprite won't show. Deal breaker for my stuff. Posted about it above somewhere.
     
    AnalogUniverse likes this.
  41. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    206
    Yes, there is currently a threshold angle for corners. We are currently working on relaxing this requirement and make it easier for such use-cases. Will post here as soon as we have an update.
     
    AnalogUniverse and jeffweber like this.
  42. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    555
    Moving this from the SpriteShape 3.0.4 thread because this thread seems more active...

    Kind of an odd question here.

    Below is a view of a SpriteShape with only a single white fill texture set in the SpriteShapeProfile.

    I noticed, when editing a SpriteShape (top image is editor view), the sides become very smooth and anti-aliased.

    However, when rendering in the camera view, or when not actively editing the sprite shape, the jaggies come back (bottom image)

    I assume some sort of anti-aliasing/blurring is happening when editing and my question is whether or not it's possible to do something like that when rendering "for real" in the camera view? Are there some API or Shader tricks I could use?

    I know I can set the MSAA level in my quality settings, but I'd prefer not to have to bump that up just to get smooth edges..

    Thanks.

    Screen Shot 2019-09-19 at 6.37.37 AM.png
     
    Last edited: Sep 20, 2019
  43. AnalogUniverse

    AnalogUniverse

    Joined:
    Aug 10, 2018
    Posts:
    59
    Is there any chance of having an extra spline edit option which allows continuous spines with straight edges with sharp or subtly curved corners ? The game Im currently doing has a very Mario esque style, so straight but connecting edges are a must for me, and I can see many other styles of game which would benefit from this
     
  44. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    206
    The anti-aliasing in Editor windows is due to use of Handles.DrawAAPolyLine for drawing the Splines outline.
    Check IDrawer.DrawBezier function in file :
    Library\PackageCache\com.unity.2d.spriteshape@3.0.5\Editor\SpriteShapeEditorTool.cs
     
  45. kyuskoj

    kyuskoj

    Joined:
    Aug 28, 2013
    Posts:
    19
    When I change the height with Edit Spline mode, it doesn't consider my sprite's border.
    Is it intended?
     
  46. Discipol

    Discipol

    Joined:
    May 6, 2015
    Posts:
    52
    Hi Venkify! So my SpriteShapeController won't render the SpriteShape if the Camera is not looking at it. It means that inside SpriteShapeController, OnWillRenderObject is not triggered.

    I have tried to use BakeMesh() but it does nothing. I tried calling every public method inside of it, nothing works.

    I need it because my racing tracks get built with the preloader in front of it and the camera focused somewhere else, and the race tracks (spriteshapecontrolers) are 100% not in the camera view.

    Can you please instruct me what internal methods I need to trigger to force a draw? I tried making a custom method inside SpriteShapeController but I get a lot of nativearray exceptions thrown :/
     
  47. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    206
    To force generate SpriteShape, please take a look at the following function :
    OnDrawGizmos in SpriteShapeController.cs


    void OnDrawGizmos()
    {
    var sr = GetComponent<SpriteShapeRenderer>();
    if (sr != null)
    {
    var hasSplineChanged = HasSplineChanged();
    if (!sr.isVisible && hasSplineChanged)
    {
    BakeMesh();
    Rendering.CommandBuffer rc = new Rendering.CommandBuffer();
    var rt = RenderTexture.GetTemporary(256, 256, 0, RenderTextureFormat.ARGB32);
    Graphics.SetRenderTarget(rt);
    rc.DrawRenderer(sr, sr.sharedMaterial);
    Graphics.ExecuteCommandBuffer(rc);
    }
    }
    }


    The above works for Editor. For runtime, simply add a Monobehavior script to the required object and copy the above code in function void OnGUI() Let me know if this helps.
     
  48. pastaluego

    pastaluego

    Joined:
    Mar 30, 2017
    Posts:
    51
    Speaking of the mesh being baked at runtime, is there a way to pre-bake the mesh data before the scene starts so there's little runtime loading to do? Or wait, actually I guess it'd be the same as just baking the mesh on Awake for each shape, I think. So nevermind unless I'm wrong.
     
    Last edited: Sep 30, 2019
    Discipol likes this.
  49. diliupg

    diliupg

    Joined:
    Jan 23, 2018
    Posts:
    14
    That is now available with Anima2D and Unity's own 2D animation system,.
     
  50. Discipol

    Discipol

    Joined:
    May 6, 2015
    Posts:
    52
    The method you describe needs to be INSIDE the original SpriteShapeController. I can't copy and use the internals of SpriteShapeController because it's internal methods require SpriteShapeController 's type.