Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Official SpriteShape Preview Package

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

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

    RainbowDRGN

    Joined:
    Mar 27, 2017
    Posts:
    3
    Can we render the edited shapes down to PNG?

    2.)Can I somehow use sprite masks with them? Wanting layered shapes, and when I change alpha in Sprite Shape Renderer color settings, I can see the background layers through the foregrounds. [pic attached] snip.PNG
     
  2. Cooler88

    Cooler88

    Joined:
    May 25, 2013
    Posts:
    2
    Tested in Unity 2018.2.8f1

    I just added all my ideas about the feature that could be improving. There may be some that not relevant already.

    - Point Mode should be independent from corner generation behavior
    Currently only Tangent mirrored created corner mesh if I can understand well.
    - Click Edit Spline moved the scene camera into not center of mesh, rather some other position
    - Selected more nodes can not change Point Mode for multiple nodes
    - Adjusting node height corners randomly disappear
    - There could be node tangent adjuster parameters like angle and strength also maybe some presets like on animation curves
    - ShapeProfile:
    - It would be much better to show result on shapes like in the material view circle, box, ...
    1.png 2.png
    - Adjustable angle rage for corners to be used
    - It would be nice if not only the outer circle is part of the angle rage rather it could be a pizza slice, and also if a sprites could be dragged on a slice to add it.
    3.png
    - This UI element is annoying to use. For every AngleRange I have to click + then add a sprite.
    It could work like arrays if you drop a sprite on it it will be added. It could be the same for all similar UI elements that want an asset.

    The feature is great keep up the amazing work!

    1.png
    - Also found that the collider is not properly created on the ends if use sprite borders is on.
    2.png
    - If there is a tiny-tiny edge between 2 Sprite Shape colliders than the physics engine randomly pushes away the ball or other object if it was calculated at the sensitive position. This is maybe off topic.
    - Node snapping have to be re enabled all the time.
     
    Last edited: Oct 24, 2018
  3. ryanzec

    ryanzec

    Joined:
    Jun 10, 2008
    Posts:
    696
    So I was giving this package a try as it will probably save me many many many hours in generating smooth colliders from a platform game that I am prototyping howrever one weird thing I noticed is that I get a weird icon in the scene view even though I selected no icon for the sprite shape:

    2018-10-24 19_33_42-Unity 2018.3.0b6.png

    If I selected an icon, that shows up fine:

    2018-10-24 19_37_35-Unity 2018.3.0b6.png

    I assume the first screenshot is not the expected behaviour.

    I am using this with the latest beta of 2018.3
     
  4. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    644
    @Krucho Thanks for the feedback.

     
  5. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    644
    @Cooler88 Thanks for the feedback.

    For a point to be considered to be a corner the following condition should hold:
    1. A valid Corner Sprite is set
    2. The point and the 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.

    This is being fixed and will be available in an upcoming release.

    Yes, as of now when multiple points are selected Mode selection is disabled.

    You can drag and drop a Sprite Object (Not parent texture object) to the Reorderable list (specifically the Titlebar of the list with "Sprite" text).

    Thanks for the suggestions. We will consider these for the future updates.
     
    Cooler88 likes this.
  6. Tortuap

    Tortuap

    Joined:
    Dec 4, 2013
    Posts:
    137
    Hi,
    I'm wondering if you have planned to integrate a Width parameter on points, just like you did the Height. Variation on width would give more control on visual variety.

    For now, I'm duplicating points to work around this (this force insertion of a full sprite between two points) but it makes it very tedious to maintain or to make changes.
     
  7. Quantum_Recursion

    Quantum_Recursion

    Joined:
    Oct 28, 2015
    Posts:
    1
    Could the auto-generated collider update itself in proportion to the "Height" value of the control points as well as the "Offset" value so that the collider matches the sprite shape as it appears with different widths?

    Also, can the "Offset" values range be increased above 1 as this doesn't seem to fit the entire sprite shape sometimes, I had to write another script to get around it since the files are read-only.

    Other than that I think the tool is really cool so far.
     
  8. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    644
    @Tortuap @Quantimax Thanks for the feedback.
    By design width is kept as it is so that UVs can be generated seamlessly for multiple scenarios like Adaptive, Non-Adaptive, Corners etc.. I would suggest using multiple variants with different widths and set them at the control points. Please let us know if this helps.

    For 2019.1 we are adding some major improvements and simplification. We will update this thread once we have an official release .
     
  9. alanmthomas

    alanmthomas

    Joined:
    Sep 7, 2015
    Posts:
    197
    I'm looking to be able to move a sprite along the spline that a sprite shape is using. Any ideas on how I could go about something like this?

    Also, if I have a shape with a collider and am changing the shape during the game, is this something that would be considered too expensive?
     
  10. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    644
  11. alanmthomas

    alanmthomas

    Joined:
    Sep 7, 2015
    Posts:
    197
    Thanks, @Venkify! The sprinkler example is interesting but, if I'm not mistaken, only places objects at the curve points of the spline. I was looking (and managed to figure using bezier tools) placing along the spline as well.

    Good to know about the colliders. Do I need to rebake the colliders if I manipulate the spline programmatically?

    Also wondering if the is a way that I can calculate the normal for a point along the curve. Is this something that is part of the BezierUtilities?
     
    Last edited: Nov 1, 2018
  12. Willkuerlich

    Willkuerlich

    Joined:
    Sep 23, 2014
    Posts:
    15
    I have the issue that my point mode settings are greyed out on the shape controller and the edit spline button isn't triggering the point edit mode in the editor window, am I missing somewhat obvious? I have created some spriteshape prefabs a few days ago and now I can't edit them anymore, but my collab colleagues can. Seems like my UnityEditor is broken in that regard. I'm using 2018.2.14f1 and have reinstalled the package. In the next step I will reinstall Unity and report after that again.

    Unity reinstall fixed that
     
    Last edited: Nov 1, 2018
  13. Qzia

    Qzia

    Joined:
    Jan 25, 2015
    Posts:
    138
    Hey,
    since I've been asked, I did my assert support for SpriteShape.
    Small bonus is that SmartDestruction2D exports SpriteShape into traditional SpriteRenderer, so it is being drawn way more efficient in real time.

    SmartDestruction2D Thread

    Destructible SpriteShape Terrain:


     
    Last edited: Nov 20, 2018
    nosajtevol and Lars-Steenhoff like this.
  14. Qzia

    Qzia

    Joined:
    Jan 25, 2015
    Posts:
    138
    I have a question, is there any efficient way of getting bounds from SpriteShapeRenderer?
    At the moment I'm using generated edge/polygon collider boundaries, but I believe that's not the most efficient way, therefore it works only when there is collider attached.
     
    Last edited: Nov 3, 2018
  15. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    644
    You could calculate the nearest neigbor points along the bezier spline (left and right) and generate the normal for the point.

    There is a known issue which may require resetting the layout to default layout. We are trying to reproduce the issue and will fix it as soon as we find the root cause.

    Good stuff.

    Have you tried using the bounds property of SpriteShapeRenderer ?
    https://docs.unity3d.com/ScriptReference/Experimental.U2D.SpriteShapeRenderer.html
     
  16. Qzia

    Qzia

    Joined:
    Jan 25, 2015
    Posts:
    138
    @Venkify, I was trying out the same field, perhaps I had outdated preview version.
    After re-importing SpriteShape from Built-In packages, it worked out.
     
  17. alanmthomas

    alanmthomas

    Joined:
    Sep 7, 2015
    Posts:
    197
    Thanks, Venkify! That's precisely what I did!
     
  18. alanmthomas

    alanmthomas

    Joined:
    Sep 7, 2015
    Posts:
    197
    I have a question regarding the ConformingSpline script included in the examples files. It looks like the code that does the actual conforming is all wrapped in a UnityEditor conditional. Does this mean that conforming won't happen at runtime, for example, if used in an actual game?
     
  19. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    644
    @alanmthomas The example uses SerializedObject/SerializedProperty, hence its Editor only. Its definitely doable in the runtime, just that you need to do the copy data from one spline to another using Runtime API instead.
     
  20. alanmthomas

    alanmthomas

    Joined:
    Sep 7, 2015
    Posts:
    197
    Thanks again, Venkify!

    One more question. I am adding to points to a spline in a script and sometimes get an error that the point is too close to a neighbor. I wrote some code to compensate for that, but I am now encountering that same error when creating a spline in the editor. Is this something to be concerned with?
     
  21. slembcke2

    slembcke2

    Joined:
    Jun 26, 2013
    Posts:
    270
  22. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    644
    There is a minimum distance to be had with neighbor points when adding a new point to prevent render artifacts. The message is just warning and can be ignored.

    Yes, this indeed seems to be bug. Thanks for the bug report, we will fix it at the earliest.
     
    Last edited: Nov 14, 2018
  23. qcha0s

    qcha0s

    Joined:
    Sep 20, 2013
    Posts:
    4

    Pressing W so your move tool is selected should fix it as well
     
  24. MadPropz101

    MadPropz101

    Joined:
    Aug 29, 2018
    Posts:
    13
    I noticed that Spriteshape forces each side to be the same length, and the depth order of the corners can't be changed. You can't do something like this:
    https://ferrlib.com/demos/Ferr2DTRuntimeEdit2/index.html

    Here the top side and the corners go over the left and ride side of the terrain, but in Spriteshape the corner is forced to align to adjacent sides and thus gets deformed and looks weird.
    For now i have only found it to work well for simpler stuff that uses the Strip profile with only one sprite for all the angle ranges.
     
  25. rushk1

    rushk1

    Joined:
    Sep 24, 2017
    Posts:
    39
    Has anyone been able to use this with a drawing tablet? I tried it with a wacom and it's not working...
     
    Lars-Steenhoff likes this.
  26. pastaluego

    pastaluego

    Joined:
    Mar 30, 2017
    Posts:
    196
    If Sprite Shape had these features, it would instantly be better than Ferr2D:

    1. An option to fit the collider to the fill mesh. This lets the generated polygoncollider be much less complex and have perfect accuracy unlike the way it is now which understandably is specifically for fitting the collider to the edges rather than the fill. However, this feature requires #2.
    2. More control of the edges themselves:
    --a. Vertical offset of the edge sprites (similar to the current offset of the fill, which itself seems pointless to me). This is necessary for #1
    --b. Pixels Per Unit affecting edges as well as fill (or an option to)
    -- c. Maybe a sceneview handle to swap which edge sprite segment to use, rather than having to set the index in the inspector
    3. An algorithm that guesses what a corner would look like based on the adjacent edge sprites. This is specifically for two adjacent edges that use identical sprites, because I understand it's not physically possible to be able to accurately merge 2 completely different edge sprites together and have it look good. Ferr2D has it working though for adjacent edges set to the same texture, and it manages to generate a great corner that is much more functional and dynamic than manually set SpriteShape corners.
    4. An option to have the ability to snap points of the shape to the x or y coordinate of the nearest point on the shape itself, rather than the Unity Grid. This for my project is crucial due to the need for pixel perfect collider angles in very obscure shapes that can't possibly match the grids.
    5. The ability to select and move multiple points at once.

    SpriteShape has much better mesh triangulator than Ferr2D and takes up so much less space. A single Ferr2D scene object can increase scene size by over 200KB depending on its shape/complexity/PPU, which is absolutely ridiculous. Whereas a single SpriteShape object only takes 3-8KB regardless of how complex it is, which is awesome. And it can use sprites rather than texture + material, which is very convenient. Also the ability to easily make the shape path points scriptable is a huge advantage.
    Until the above changes happen, I'm still going to use it for non-terrain foreground/close-middleground and for decorations over Ferr2D, since they don't require a collider, because the tool now is still incredibly useful.
     
    Lars-Steenhoff likes this.
  27. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    644
    Thanks for the feedback. Corners can be added in multiple ways with SpriteShapes:
    1) Use Left and Right border for where corner sprites are needed. (
    ). This is flexible and does not force any constraints.
    2) Use Sprite Variants. For each angle range you can have multiple sprites and use one of them as Corner sprite. (You probably need an additional point near to the corner though). This is less flexible but could be perfect for certain use-cases where you need to decorate corner with a dedicated sprite.
    3) Use Corner Sprite. This could be a good fit when you want the corner sprite to perfectly align with neighbor strips.

    We will consider adding support to specify custom order for corners.

    Thanks for the feedback.

    1) We are trying to simplify collider generation for 2019.1 (also match the generated geometry better) andwill update this thread soon.
    2) a. You can already do this by adjusting the Sprite's pivot.
    b. As Texture2D for Fill you need to explicitly specify Pixel Per Units in SpriteShape Profile. As Edges use Sprites, Pixel Per Units is obtained from Sprites. We dont see a need to duplicate this as you can already specify it in TextureImporter.
    c. We will consider this.
    5) Its already possible by pressing Shift + Move.

    We will look into other stuff and will update this thread. Thanks.
     
  28. pastaluego

    pastaluego

    Joined:
    Mar 30, 2017
    Posts:
    196
    Thanks for the response, I had a feeling you could move multiple points at once since you could select multiple at once, but couldn't figure out how to do it.

    Regarding the Pixels Per unit for edges, by relying on the PPU setting from the textureimporter it means you can't change the PPU per spriteshape instance like you can with the fill unless I'm missing something.

    So if you have 2 spriteshapes with the same fill texture, you can set one to 100 PPU and the other to 200 PPU, but you can't do the same for edges. You'd need to duplicate the edge sprite with 100 PPU, set the PPU of the duplicated sprite to 200, and then assign it to the new spriteshape. Which isn't very convenient. And I'd imagine easily modifying PPU per SpriteShape instance on the fly would be very useful in 2D especially for parallaxing foregrounds where the texture becomes slightly smaller the 'further' away it is or bigger the closer it is.

    I really have no idea what I'm talking about, but is it possible to make the sprite containing the edges/corners a Texture2D on the spriteshape just like the fill, and then use the textureRects of each sprite defined in the sprite editor to grab the right edges/corners? This way you can set the PPU for the Texture2D of the edges per spriteshape instance rather than the textureImporter, just like the fill? I don't know enough about it to know if what I just said was nonsense or not.

    If it's not possible I completely understand, it's just inconvenient to not be able to change the PPU of the edges per spriteshape instance, since often times the edge sprites are created to match the default PPU of the fill, and changing the PPU of the fill on the spriteshape instance will cause the edge sprites to no longer match it.
     
  29. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    606
    @Venkify
    I'm falling through the floor :(

    My character is using a RigidBody2d and CircleCollider2D to detect the ground. You can see the character "kind of detect\ clip" the Sprite Shader edge collider before he plummets to his death.

    Would making the Edge Collider2D "thicker" give the colliders more space to detect the edges? I'm just speculating here. :eek:

    01:18 is when you see the rigidbody fall through the floor.


    Any idea why this is happening?
    Thanks!
     

    Attached Files:

    Last edited: Nov 24, 2018
  30. pastaluego

    pastaluego

    Joined:
    Mar 30, 2017
    Posts:
    196
    Is there a reason why for each spriteshape visible to camera, SpriteShapeController.NeedUpdateSpriteArrays() gets called every frame? Because it's calling CornerSprite.Equals() and generates 320 bytes of garbage every frame per spriteshape object.
    Unity 2018.2.15
    upload_2018-11-25_12-54-15.png
     
    Last edited: Nov 26, 2018
  31. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    644
    @indieDoroid Thanks for reporting the issue. It does look like a bug if it it happens consistently. Could you please file a bug report with a simple repro project please ? We will try to take a look asap.

    Since we wouldn't want to generate spriteshape geometry everyframe we check for any changes and only generate if there are changes. But yes, we would want to improve this. Will take a look. Thanks for the feedback.
     
  32. pastaluego

    pastaluego

    Joined:
    Mar 30, 2017
    Posts:
    196
    Sorry so does that mean it's normal for static spriteshapes generate 320 bytes of garbage every frame or is it something I'm doing wrong? If it helps, after a little more testing I found that an empty spriteshape profile with no fill texture assigned yet (which means the 8 object fields under Corners in the inspector haven't even appeared yet), no garbage is being created. But once I assign a fill, the 8 object fields under Corners appear and the 320 bytes of garbage start appearing, even if I then remove the fill texture I just added. So it must have something to do with the corners check when it checks if anything in the spriteshape has changed every frame. I thought maybe it was because none were assigned (similar to how a failed GetComponent generates garbage in the editor but not build), but I tried both assigning the corners and tested in build and it was still creating garbage.

    If there's a way to make the corners fields disappear like they are in a completely new empty spriteshape profile, that would work too. Or a possibility to be able to set a flag on a spriteshapecontroller telling it that it is static so it will opt out of haschanged checks?

    Is it possible to view any part of the source code for the spriteshapecontroller or the spriteshape itself or at least the editor scripts for them?
     
    Last edited: Nov 26, 2018
  33. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    644
    @pastaluego When checking if the Sprites have changed, we do check if the Sprites are valid for Angle Range sprites before actual check for changes but for Corner Sprites we don't do this pre-check (See UpdateSpriteArrays in SpriteShapeController.cs). We will be fixing this in the next version.

    The package code usually resides in (ProjectRoot)/Library/PackageCache/com.unity.2d.spriteshape@1.0.12-preview.1
    Thanks again for the feedback.
     
  34. shieldgenerator7

    shieldgenerator7

    Joined:
    Dec 20, 2015
    Posts:
    39
    First of all, I love this new feature.
    But I'm afraid I'm having a problem accessing the scripting part of it.
    upload_2018-11-26_14-31-52.png

    It tells me that the SpriteShapeController class doesn't exist, even when I say "using UnityEngine.U2D".
    Did I import it wrong or use the wrong version of SpriteShape?

    I'm using Unity 2018.2.17f1 and Sprite Shape 1.0.12
    upload_2018-11-26_14-44-10.png


    EDIT: I copied the install folder for SpriteShape in the AppData folder into my project's install folder for SpriteShape and it worked.
     
    Last edited: Nov 27, 2018
  35. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    606
    [ edit nov 27 ]
    The solution is not good. Other game objects with smaller colliders still fall through the sprite shape collider. May I ask how I can send a project repo directly to your team? Thanks.


    Poor workaround....

    @Venkify Ok I found out the problem this weekend. It had to do with the physics overlap radius size. If I was using something lower than 0.5, the edge collider or the sprite shape wasn't able to 100% of the time detect the circle collider 2d on my hero character.

    Code (CSharp):
    1.  
    2. //Smaller radius values with a smaller circle collider 2D shape has inconsistent sprite shape collision detection rate
    3. checkGrounded = Physics2D.OverlapCircle(gameObject.transform.position, 0.5f, whatIsTheGround);
    4.  
    Code (CSharp):
    1.  
    2. //Larger radius size with increased circle collider 2D shape, so far, has a 100% sprite shape collision detection rate
    3. checkGrounded = Physics2D.OverlapCircle(gameObject.transform.position, 1, whatIsTheGround);
    4.  
    There is the inconvenience of the Circle Collider 2D being larger with potential collision issues of other kinds, but for now it works for me.

    I'll keep you posted as I further play around with Sprite Shape. So far I'm loving the potential, keep up the great work.
     

    Attached Files:

    Last edited: Nov 27, 2018
  36. Frolky

    Frolky

    Joined:
    Feb 17, 2017
    Posts:
    9
    Bug: Shape without Profile with FillTexture is not rendered in build
     
  37. shieldgenerator7

    shieldgenerator7

    Joined:
    Dec 20, 2015
    Posts:
    39
    About not being able to access the classes, it turns out the Sprite Shape package install for my project was completely empty, and Unity was using the package files from the AppData folder, which Visual Studio didn't know about.

    I copied the files from AppData into my project's package folder and it worked.
     
  38. shieldgenerator7

    shieldgenerator7

    Joined:
    Dec 20, 2015
    Posts:
    39
    Here's my feedback from using SpriteShape:

    1. alt+LMB should move camera, not box select (just LMB for box select is good tho)
    2. ctrl+LMB or someother quick way to delete a vertex without having to select then press DEL
    3. Copy+Past Vertices between sprite shapes, or even the same shape but on different parts of it
    4. Someway of programmatically getting and setting all the points at once like you can with PolygonCollider.GetPath(0)
    5. SpriteShapeRenderer.color = Color.blue; I need someway to programmatically set the color property that shows up in the editor
     
    Last edited: Nov 30, 2018
  39. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    606
    @Venkify I uploaded a bug report via Unity, did you guys get it? I submitted a scene with 7-9 rocks that had rigid bodies attached to them. You can see that maybe 40% of them fall through the edge collider.

    Pls let me know if you need anything else. Would love to hear progress updates. :)
     
    GluedPixel likes this.
  40. GluedPixel

    GluedPixel

    Joined:
    Nov 26, 2018
    Posts:
    11
    Is there a way to change the color of the Sprite Shape Renderer? As shieldgenerator7 already pointed out, we need a way to set the color property.
     
  41. JeremieGagne

    JeremieGagne

    Joined:
    May 13, 2016
    Posts:
    1
    About setting the color of the renderer, it would be even better if we could set a color property for each control points of the spline in the same way that we are allowed to set a sprite for a specific index (with something in the API for it). Something like multiplying the color of the renderer with the color of the control point for the actual shown color would be perfect.

    On another note, for the generated colliders, there seem to be an unnecessary amount of points generated even on low quality. It generates multiple points on a straight line if there are multiple control points on that line and there's always a pair of points that are super close to each other at control points
     
    Last edited: Dec 7, 2018
  42. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    644
    Could you please post the Fogbugz Case ID ? Will take a look, Thanks.

    @shieldgenerator7, @gluedpixel

    This should already be available in the latest 2019.1 alpha

    Thanks for the feedback. Will look into these.

    Thanks for the feedback. We are indeed working on simplifying collider generator for 2019.1. Will post an update once we have a release.
     
  43. GluedPixel

    GluedPixel

    Joined:
    Nov 26, 2018
    Posts:
    11
    Also, It would be awesome to have the option to choose a separate color for fill texture. :)
     
  44. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    606
    @Venkify

    1104919 <- it should be this one? The title is [ SpriteShape Preview Package ]

    Please let me know if you found it or not. I'm not sure if that's the ID.

    Thanks!
     
  45. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    644
    Found it. Thanks for the bug report. We will take a look at it.
     
  46. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    606
    Great! Hope you guys can figure out what I'm doing wrong. I'd love to use sprite shapes!
     
  47. pastaluego

    pastaluego

    Joined:
    Mar 30, 2017
    Posts:
    196
  48. Wahooney

    Wahooney

    Joined:
    Mar 8, 2010
    Posts:
    281
    I'm running the latest preview and my handles aren't showing. Am I the only one getting this?

    Running 2018.3f1.
     
  49. pastaluego

    pastaluego

    Joined:
    Mar 30, 2017
    Posts:
    196
    Not sure what changes 2018.3 made that affected SpriteShape, but here's an issue that occurred:

    In my fragment shader I have a color array. If I have an object at transform z = 0, the shader will blend with ColorArray[0]. If the object is at z = 1, it will blend it with ColorArray[1], etc.
    Example calculation:
    blendResult = lerp(texcolor, _BlendColorArray[z], _BlendAmountArray[z]);

    This worked great in 2018.2, but now it seems in 2018.3 the edges of spriteshape are positioned slightly in front of the fill in the Z direction. So a Z of 1 will blend the fill with the array[1] color, but the edges still use the array[0] color. So for this object, if Z=0 blends with black and Z=1 blends with nothing, and it's positioned at Z=1, this is the result in 2018.3.

    upload_2018-12-14_14-38-5.png
    Whereas in 2018.2, both the edge and the fill seemed to share the same Z because they both picked the proper color. If I set the Z to 1.01, it picked the appropriate color, so it must be a Z-related issue based on the edges needing to render over the fill. I'm just not sure why it exists in 2018.3 and didn't in 2018.2 despite the SpriteShape package being the same.
    upload_2018-12-14_14-41-5.png

    I can theoretically work around it by just adding .01f in the shader to the z value before it's used to access the array, but I'd rather know the exact cause behind it.

    I'm retrieving the Z through:
    vert function:
    OUT.world = mul(unity_ObjectToWorld, IN.vertex).xyz;

    frag function
    z = IN.world.z;
     
    Last edited: Dec 14, 2018
  50. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    644
    Thanks for the suggestion. We will take a look and consider them for future versions.

    We had fixed an issue related Z overlaps between geometries (fill and strip etc..) within a SpriteShape ion 2018.3.

    Please try restoring Unity to default layout. If problem persist please submit a bug report and we will take a look asap.
     
Thread Status:
Not open for further replies.