Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Ferr2D Terrain Tool

Discussion in 'Assets and Asset Store' started by koujaku, Oct 9, 2013.

  1. Deleted User

    Deleted User

    Guest

    Okay, so here's what I've got so far. First we need to resolve some errors and update our references to the prefab utility.

    First task, open Ferr\2D\Editor\Ferr2D_PathEditor.cs
    Update line 175 to the following:
    Code (CSharp):
    1.             if (PrefabUtility.GetCorrespondingObjectFromSource(target) != null) {
    2.  
    Update lines 212-214 to the following:
    Code (CSharp):
    1.         if (EditorGUI.EndChangeCheck() && PrefabUtility.GetCorrespondingObjectFromSource(target) != null) {
    2.             NudgeArray(pathVerts);
    3.         }
    Next, open ferr\2DTerrain\Editor\Ferr2DT_Builder.cs
    Replace lines 23-30 with
    Code (CSharp):
    1.                     if (Selection.activeGameObject != null)
    2.                     {
    3.                         if (PrefabUtility.GetCorrespondingObjectFromSource(Selection.activeGameObject) == o)
    4.                             sceneTerrains = Selection.activeGameObject.GetComponentsInChildren<Ferr2DT_PathTerrain>();
    5.  
    6.                         if (sceneTerrains != null)
    7.                         {
    8.                             for (int t = 0; t < sceneTerrains.Length; t++)
    9.                             {
    10.                                 PrefabUtility.GetCorrespondingObjectFromSource(sceneTerrains[t].GetComponent<MeshFilter>());
    11.                             }
    12.                         }
    13.                     }
    Next, open Ferr\2DTerrain\Scripts\Ferr2DT_PathTerrain.cs
    Replace lines 391-394 with:
    Code (CSharp):
    1.         UnityEditor.PrefabInstanceStatus status = UnityEditor.PrefabUtility.GetPrefabInstanceStatus(gameObject);
    2.         isPrefab = status != UnityEditor.PrefabInstanceStatus.NotAPrefab &&
    3.                    status != UnityEditor.PrefabInstanceStatus.Disconnected &&
    4.                    status != UnityEditor.PrefabInstanceStatus.Connected;
    The last change is in Ferr\Common\Scripts\EditInIsolation.cs
    Replace lines 65-66 with:
    Code (CSharp):
    1.             PrefabInstanceStatus t = PrefabUtility.GetPrefabInstanceStatus(objs[i]);
    2.             if (t == PrefabInstanceStatus.NotAPrefab|| t  == PrefabInstanceStatus.Disconnected || t == PrefabInstanceStatus.MissingAsset)
    That should get the nested prefabs working for you.

    There are many warnings being thrown by WebMessager.cs. I found that nothing in the actual Terrain tool seemed to be calling it, so I removed file completely. Warnings went away, no errors. That being said, since I'm not sure what uses it I don't know if its worth the effort, but my OCD gets set off by a bunch of stuff in the console.
     
    Shodan0101 likes this.
  2. Shodan0101

    Shodan0101

    Joined:
    Mar 18, 2013
    Posts:
    141
    Thank you oik976!!
     
  3. Shodan0101

    Shodan0101

    Joined:
    Mar 18, 2013
    Posts:
    141
    Update!!! v2.0.3 2019-2 +Bug fixes -Updated for 2018.3, 2019.1, and 2019.2 -Removed a number of default value warnings -Numerous fixes for prefab related bugs.

    Thank you koujaku!!
     
    wedgiebee likes this.
  4. Npicouet

    Npicouet

    Joined:
    May 17, 2018
    Posts:
    28
    Hello!
    Is there a way to get just a specific edge spline of a terrain?

    I wanted to use the spline to make some "paths" for a character, just curious if I can re-use what the terrain is building already somehow.

    EDIT: I was able to get what I need by duplicating the terrain and setting everything to Null. That allows me to make just a spline path to use as a guide for my character.
     
    Last edited: Apr 18, 2019
  5. Tycellent

    Tycellent

    Joined:
    Nov 7, 2014
    Posts:
    27
    If i wanted to adjust each collider's side what is the best approach to do so? I understand you can offset an entire collider by prebuilding the collider and subsequently offsetting the entire collider in the x and y positions and also we can fine-tune each "Points"in the polygon collider (but it's pretty hard and messy trying to find the correct "line") but was wondering is there an easy way to adjust each individual side of a terrain's collider?
     
  6. Mirgan

    Mirgan

    Joined:
    Feb 2, 2016
    Posts:
    25
    Hello!

    I waited a long time for the new version of Ferr2D to work with prefabs without crutches.
    And so she came out and now even that which worked before (
    What am I doing:
    1. I need to create a prefab variant of an existing prefab.
    2. After I create it, I change the Ferr2DT_PathTerrain in it.
    3. Before version 2.0.3, in order for Mesh to be preserved in the MeshFilter you need
    It was after I changed terrain to change any field in Terrain Data,
    for example, set Use Skirt, and then remove again, then save the prefab, and then save the scene (it will not work without it).

    With the release of the new version, it stopped working and now when I enter the newly created Prefab Variant everything is empty until I go through all the objects in the hierarchy.
    When will this hell end?
     
  7. shindig82

    shindig82

    Joined:
    Dec 30, 2015
    Posts:
    5
    I cant seem to see the Edge Override buttons in the scene view, i think they are behind the add segment button. anyone ever hear of this?
    Edit: It was a scaling issue, make sure everything in the terrain is scaled to 1 if you run into this issue
     
    Last edited: Apr 30, 2019
  8. tripplejaz

    tripplejaz

    Joined:
    May 11, 2019
    Posts:
    3
    Is there a way to fix this scaling issue I frequently run into with edges?
    https://gyazo.com/f0f630f129cbe6760d9cf1979da9854d

    Also, a feature request would be to add a drop shadow shader to edges, similar to other fill options. Wonder how doable this would be?
     
  9. PedroSchabib

    PedroSchabib

    Joined:
    Oct 2, 2015
    Posts:
    10
    Hi, @maltakereuz
    Change the value of Render Queue in the material to stop the Z-fighting. I changed the Fill material value to 2500 and relsolve the problem.

    ------------
    3) Z-fighting/edge cropping in editor and game mode:

    As you can see fill is drawn over the edges. The legacy Z-Offset is now converted to drawOrder in material editor and multiplied by 1000. Setting it to another value does not seems to resolve flickering and cropping.
     
  10. Broghain

    Broghain

    Joined:
    Aug 31, 2013
    Posts:
    3
    After updating my project from 5.5 to 2018 I've been having the same z-fighting issue with FERR. Changing the fill material's render queue doesn't really seem like a satisfactory solution for me, however.

    ferr_jitter_1.JPG
    This is how it should look (minus the obvious z-fighting between fill and edge on the upper platform).

    ferr_jitter_2.JPG
    This is how it looks after changing the render queue. Notice the fill disappearing behind the background assets.

    Does anyone have a suggestion on how I might solve this (either with an alternative to render queue, or in a way that does not cause the fill's render order to change in relation to every other object in the scene)?
     
  11. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    789
    The only solution we've found is to ensure that each separate terrain has a different sorting order. Not necessarily every terrain, but certainly ones that are on screen at the same time.

    I know that the problem is on the individual terrain, so this solution is counter intuitive, but it works for us.
     
  12. profcwalker

    profcwalker

    Joined:
    May 3, 2009
    Posts:
    243
    Quick question (hopefully). :) What's the best approach (code) for swapping the textures for the fill and edge at runtime on a terrain? Thank you!
     
  13. Vildas

    Vildas

    Joined:
    Dec 18, 2016
    Posts:
    1

    https://imgur.com/a/zrrHkgY

    Have anyone encountered this issue and fixed it? Basically I have several bodies on the top and bottom of my material. These bodies are matching perfectly in Photoshop and has the same dimensions and are made using the jungle demo material as reference. When making a terrain material and applying it - the sequential segments seems to have some kind of different y-offset and/or different scales as the height seems to differ from one segment to another when inspecting it. When I attempt to move the rectangle on the body in question the issue is fixed but then the opposite side of the bodies are having the same issue (it's always one side and fixing one side creates issues with the opposite side).

    I have tried using only one body but that issue also appears when the body are tiled to each other in the segments. And once again, the body are matching perfectly in Photoshop. If I replace the material of the object to the jungle demo material there is no issues so there isn't any problem with the object. I don't know if there is any hidden requirements of the edges and bodies that I'm not aware of or if it doesn't handle high resolutions or details well.
     
  14. camtronius

    camtronius

    Joined:
    Apr 22, 2014
    Posts:
    7
    Hey guys,
    Was wondering if anyone could help me find more textures like the ones the Ferr2D asset comes with? I am trying to match the style for my next game. Let me know if you can help. Thanks,
     
  15. PhantomFox128

    PhantomFox128

    Joined:
    May 22, 2019
    Posts:
    157
    Hello! Just had a quick question.
    Is there a particular size my textures should be at that works best with this asset?

    Edit: I should reiterate. I've been told to make all my sprites double my target resolution (in this case I'm aiming for a 1080p resolution) so I've been doing all my art at least 2160x2160, expanding that as needed and then scaling it down in the engine.
    The problem I'm having is that, when I make the terrain, it comes in HUGE, and I'm not sure how to scale it.



    Edit 2: Nevermind. I more or less figured it out, but now I have another problem.
    One of my edge textures was made with some transparency, but that's not showing on the terrain. Instead, it seems to be repeating itself to give a filled rectangle.
    Does what I just said make sense and how do I fix that?
     
    Last edited: Aug 29, 2019
  16. instruct9r

    instruct9r

    Joined:
    Aug 1, 2012
    Posts:
    148
    Heya devs.

    Is there a way to make a point of the terrain to follow an object, but without calling Build() every frame, as this rebuilds the terrain and adjusts the tiling. I want it to simply stretch, when the point is pulled away...
     
    Last edited: Nov 21, 2019
  17. Spiderwork

    Spiderwork

    Joined:
    Feb 1, 2018
    Posts:
    32
  18. FrozenBotsStudio

    FrozenBotsStudio

    Joined:
    Jun 27, 2016
    Posts:
    10
    I'd like to know about this as well...
     
    Kruemelkatze and Shodan0101 like this.
  19. instruct9r

    instruct9r

    Joined:
    Aug 1, 2012
    Posts:
    148
    I think this tool is not supported anymore. Wrote few times to the developer, but he is not responding...
     
  20. Spiderwork

    Spiderwork

    Joined:
    Feb 1, 2018
    Posts:
    32
    Yes , I made the same experience… Very sad.
     
  21. VektaCo

    VektaCo

    Joined:
    Sep 30, 2019
    Posts:
    31
    I used Ferr2d for my game Stomped! Last year



    I'm switching over to the new Unity Spriteshape tool because it is better integrated into the Editor and URP pipeline, but it lacks a bunch of the cool features of Ferr2d.

    Hoping @koujaku gets employed by Unity to help improve it and bring it to the level of Ferr2D
     
    indie6, Shodan0101 and CrowbarSka like this.
  22. BusterTheWizard

    BusterTheWizard

    Joined:
    Jul 2, 2012
    Posts:
    55
    Is there a way to have overrides for the end caps? I'd like to change the end cap as needed for different perspectives.
     
  23. PhantomFox128

    PhantomFox128

    Joined:
    May 22, 2019
    Posts:
    157
    Hey everyone. I've noticed an issue that seems to be tough to replicate but still possible nonetheless. In spaces where colliders tend to "overlap," like the sides and the top for instance, with enough effort, it's possible for the player to glitch through and get stuck inside the terrain. Does anyone know of a fix for this?
     
  24. zero_equals_zero

    zero_equals_zero

    Joined:
    Jun 7, 2014
    Posts:
    89
    It has been ages since I worked with ferr2d, so please only try this is in a safe haven ;)
    I recognize the issue and these two things helped for me back in the days.

    Try to set your players' rigidbody detection to constant checking.

    There is also a method in ferr2d to offset the colliders -> this helped me te most to create good angles. However, you might need to alter your colliders in the level due to the offset.

    I wish to be able better but maybe, just maybe this gives some ideas.
    Good Luck
     
  25. PhantomFox128

    PhantomFox128

    Joined:
    May 22, 2019
    Posts:
    157
    So, is this tool no longer supported anymore? I'm looking to upgrade everything to URP shaders, but it looks like Ferr isn't capable of that. Are there any alternatives?
     
  26. chrisMary

    chrisMary

    Joined:
    Nov 27, 2013
    Posts:
    16
    I asked the dev that very same question on Twitter, this was his response :
    "I don't have any really immediate plans for Ferr2D! I've been really busy with my work for Microsoft lately.(...)

    So no, it doesn't look good...
    URP should be a priority to support for a 2D asset these days...


    I followed this talk to start converting some of the shaders (the LitColoredTintTransparent and LitColoredTint I believe, the others I used (unlit) behaved like sprite shaders anyway), but I don't think I'm allowed to share them here, PM me if you want the modified versions...
     
    Last edited: Jun 23, 2020
    sergioschiavo likes this.
  27. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,307
    PhantomFox128 likes this.
  28. OscarLeif

    OscarLeif

    Joined:
    Jul 17, 2016
    Posts:
    69
    Wait this tool is not supported ?
     
  29. cparki3

    cparki3

    Joined:
    Jan 13, 2014
    Posts:
    41
    I'm hoping there is a workaround to this. I've been duplicating my ferr2d platforms for use in different "rooms" what seems to be happening is that they all end up sharing the same mesh. When I modify one platform it will modify all of the others. Is there a way to reset a mesh from a duplicated object or do I truly have to create a fresh ferr2d platform every time?
     
  30. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    789
    You should be able to just delete the mesh from the mesh filter and then adjust a point / setting to make it rebuild a unique copy.
     
  31. BusterTheWizard

    BusterTheWizard

    Joined:
    Jul 2, 2012
    Posts:
    55
    Just wanted to chime in that Sprite Shape has gotten pretty good. Originally went with Ferr2D because we weren't impressed with the early versions of it, but after finding Ferr2D was missing the level of customization we needed and wasn't supported anymore (my unanswered post from Jan is just a few posts above) we decided to give a newer Sprite Shape version a try. It's gotten a lot better and we haven't had a reason to use Ferr2D now. Disappointing, because Ferr2D is still better in some areas, but the bugs will not be fixed and the features Sprite Shape has will not be added.
     
    PhantomFox128 likes this.
  32. PhantomFox128

    PhantomFox128

    Joined:
    May 22, 2019
    Posts:
    157
    I think the main problem I've read about SpriteShape is that it seems to have an issue with memory allocation or something along those lines, and it's crashed Unity the few times I used it. Do you know if that's been fixed/is fixable? Ferr's great, but there are couple of major issues I've found that make me want to look elsewhere (wonky edge colliders, disappearing mesh when it gets too big, etc.) and it looks like those problems are here to stay for the foreseeable future.
     
  33. Creta_Park

    Creta_Park

    Joined:
    Mar 11, 2016
    Posts:
    76
    I just got Ferr2D editor is not showing in scene view after updating my project to 2020.1 and here's how to resolve it.



    Just reset your editor layout to anything (i.e. Default, 4 by 3, etc...)
    Then Ferr2D editor tool will appears well.

     
    wedgiebee likes this.
  34. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    789
    This sometimes happens when you have 2 or more inspector windows open (like your first screenshot). It's not limited to Ferr2D.

    If you make the other inspector active, then the tools will appear again in the scene view.
     
    Creta_Park likes this.
  35. cficara

    cficara

    Joined:
    Sep 27, 2017
    Posts:
    35
    Hmmm wait guys. I actually replaced the shaders on the materials and Ferr2D looks like it's working on URP?



    Is there something I am missing? What is the feature that is not working?
     
    Kruemelkatze likes this.
  36. countfts

    countfts

    Joined:
    Sep 19, 2015
    Posts:
    3
    Suddenly No handles ! edge colliders etch. Reinstalled re imported nothing . Works when started another project but why suddenly stop showing visuals in this one ? Screen Shot 09-13-20 at 01.48 PM.PNG
     
  37. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    789

    Do you have multiple inspector tabs open? Unity sometimes has a quirk where it only shows colliders and handles properly in the original inspector tab.
     
  38. sergioschiavo

    sergioschiavo

    Joined:
    Feb 11, 2014
    Posts:
    28
    That's super cool, Chris could you send me? (sergio@electronicmotiongames.com) Thanks a lot! :)
     
  39. BACALL

    BACALL

    Joined:
    Feb 21, 2017
    Posts:
    87
    Have you had any issues or is everything working fine?
     
  40. Kruemelkatze

    Kruemelkatze

    Joined:
    Sep 5, 2014
    Posts:
    10
    I also got the rendering of Ferr2D terrain to work on URP (see attached example). For this, I made two simple shaders (for lit and unlit terrain) that multiply the sprite and vertex color. This seems to be the way the original Ferr2D shaders did it in the built-in render pipeline.

    As they do not disclose any Ferr2D content, I attached them to this post. To try it in your project, simply add them to your assets, and assign them in your Ferr2D terrain materials. See attached example of this setup in the inspector using the default Jungle terrain. If you do not want to have the vertex colors affect the edge (looks sometimes weird with distance gradient), simply uncheck the "Effected By Vertex Color" (sorry for typo :) ) material setting.
     

    Attached Files:

    katopan and Haraigoshi like this.
  41. PhantomFox128

    PhantomFox128

    Joined:
    May 22, 2019
    Posts:
    157
    If I'm understanding this right, does this mean that Ferr is capable of utilizing URP lighting?
     
  42. Kruemelkatze

    Kruemelkatze

    Joined:
    Sep 5, 2014
    Posts:
    10
    I think so! I bought the asset just recently and did not have time to test out all the features, but so far everything looks good. I did not encounter any rendering glitches and all Vertex Color options work too.

    One downside to Sprite Shape that I found is that the Ferr2D terrain renderings are not batched, adding two batches per visible terrain. Maybe I'll find a way to fix that. But if not, that should not be a big problem performance-wise.
     
    PhantomFox128 likes this.
  43. Kruemelkatze

    Kruemelkatze

    Joined:
    Sep 5, 2014
    Posts:
    10
    Also, if someone has the same problem as me and cannot remove points by pressing the alt key and selecting them:

    It seems like by pressing the alt key, clicks on handles in the game view are not registered. I fixed it by switching the key combination from ALT to CTRL+SHIFT by changing following code lines (in the latest version of Ferr2D):

    Code (CSharp):
    1. // file: Ferr/Path/EditorPathEditorUtil.cs, line 111
    2. // before: bool deleteMode = Event.current.alt;
    3. // now:
    4. bool deleteMode = Event.current.shift && Event.current.control;
    5.  
    6. // optionally, change the label
    7. // file: Ferr/2DTerrain/Editor/Ferr2DT_SceneOverlay.cs, line 98
    8. // before: EditorGUILayout.LabelField("\u2022 ALT to delete or reset", HelpLabelStyle);
    9. // now:
    10. EditorGUILayout.LabelField("\u2022 CTRL+SHIFT to delete or reset", HelpLabelStyle);
     
    wedgiebee and katopan like this.
  44. sergioschiavo

    sergioschiavo

    Joined:
    Feb 11, 2014
    Posts:
    28
    Super cool @Kruemelkatze thanks.

    What I really wanted to be able to do was to have a continuous all connected terrain (like it is when you select "Use Only Top Edge), but with different sprites for walls and ground. Cracking my head to make this possible but so far, no luck. :(

    Any ideas?
     
  45. OscarLeif

    OscarLeif

    Joined:
    Jul 17, 2016
    Posts:
    69

    But to do that we only need one material that support both edges and fill material.
    Also the edges, corner and fill texture should be all inside one texture file.
     
  46. Kruemelkatze

    Kruemelkatze

    Joined:
    Sep 5, 2014
    Posts:
    10
    Two materials per "terrain type" (combination of edge and fill materials) is the minimum, I think. Sprite Shape also uses two materials, therefore two draw calls, per terrain. The "problem" I described is that Ferr2D adds two draw calls for each terrain game object.

    But it looks like I was mistaken, Sprite Shapes are also not batched. I just tested it in an empty scene and it was mentioned here: https://forum.unity.com/threads/spriteshapes-dont-batch.886309/

    Still, maybe there's a way to batch these calls. But I'm still new to this rendering stuff, so don't take my word on it! :D
     
  47. PhantomFox128

    PhantomFox128

    Joined:
    May 22, 2019
    Posts:
    157
    Has anyone figured out a possible fix to an issue regarding a vertex limit or something along those lines? Back when the developer was taking questions, I mentioned that if you make a terrain really big, the sprite won't render (colliders will still be there). The response I got was:

    "If you're using smoothing, you could easily be running out of vertices! When using 16bit indices, which Ferr2D does, there's a limit of around 64k verts per mesh. If it's -really- big, it could be floating point precision issues, or depth buffer culling too! But regardless of that, it actually is much better to have many smaller terrain chunks! When they're small, then Unity can discard items that aren't visible when rendering, and objects that are distant when doing collision. This can have a pretty big impact on performance, so I'd recommend it whenever possible :)"

    I don't think this is an issue that Sprite Shape has, but I'd still prefer to use Ferr since I feel it makes the whole process easier in general.
     
  48. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    789
    The vertex limit is set by Unity. But they did add the option to use a 32bit index buffer.

    https://docs.unity3d.com/ScriptRefe...6.1173308912.1605450126-2033081237.1605283763

    So you could add that to Ferr2D to allow for a higher vertex count.

    But the original advice is still good - you're better off using smaller meshes for performance and to ensure compatibility on all devices.

    Are your terrains massive? Can you split them up?
     
  49. PhantomFox128

    PhantomFox128

    Joined:
    May 22, 2019
    Posts:
    157
    I'm still testing out some things, but some of them are. I just don't know if having a bunch of of pieces strung together to make one big platform would have some issues with the colliders or something else. Also, I'm focusing on a PC release and have no plans for mobile, so I don't know if performance would be that much of an issue.
     
  50. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    789
    Ok well good luck! If you want to try out the Mesh IndexFormat, you probably want to add to the GetMesh() method in Ferr2DT_PathTerrain.cs, where the mesh is set up.
     
    PhantomFox128 likes this.