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. gustavim15

    gustavim15

    Joined:
    Jun 21, 2016
    Posts:
    3
    Hi everyone... Is it possible to increase the size only of the fill material? I'm decreasing the pixel per unit value, but it changes the size of all the terrain.

    Thank you.
     
  2. Android272

    Android272

    Joined:
    Oct 14, 2016
    Posts:
    22
    The larger your tile is the less you will see a pattern in your tiles. I had this idea before as well and someone just told me to make larger tiles. Hope this helps.
     
    ATeam_Production likes this.
  3. Mirgan

    Mirgan

    Joined:
    Feb 2, 2016
    Posts:
    25
    Hi all. Help me plz. I can't create terrain material. I choice "Create Ferr2d terrain material" in GameObject menu and i get scriptable object instead prefab. And this materials doesn't appears in "List of Terrain Material in the project"
    because it not GameObject. Now i can onle dublicate standart terrains for creating new one, or create empty gameObject and add script manually. Sorry for my bad English(
     
  4. Mirgan

    Mirgan

    Joined:
    Feb 2, 2016
    Posts:
    25
    I found the cause of my problem. In file ComponentTracker inside CreateCache function was bug.

    for (int i = 0; i < trackTypes.Count; i++) {
    List<object> coms = GetPrefabsOfTypeSlow(trackTypes);
    for (int t = 0; t < coms.Count; t++) {
    if (coms[t] is ScriptableObject) {
    ScriptableObject so = coms as ScriptableObject;
    AddComponent(trackTypes, AssetDatabase.GetAssetPath(so.GetInstanceID()), so);
    } else {
    Component com = coms[t] as Component;
    if (com != null) {
    AddComponent(trackTypes, AssetDatabase.GetAssetPath(com.gameObject.GetInstanceID()), com.gameObject);
    }
    }
    }
    }

    Just replace i on t and now all work fine!
     
  5. mmassey

    mmassey

    Joined:
    May 11, 2013
    Posts:
    1
    Can Ferr2D's terrain be used in Perspective mode? Using it in Orthographic mode prevents the tops from coming off the terrain but also breaks my parallax scrolling.
     
  6. pro-bchevalier

    pro-bchevalier

    Joined:
    May 30, 2013
    Posts:
    46
    Hello Nick, I've been baking lightmaps but the terrains do not seem to have any UV2 generated. Is Ferr2d supposed to support the UV2 generation for lightmapping or not? If it doesn't, what would you recommend me to do? Thanks!
     
  7. Zehru

    Zehru

    Joined:
    Jun 19, 2015
    Posts:
    84
    Hi @pro-bchevalier
    Everytime I need o deal with lights on Ferr2d, I need to check the bool on the VISUAL tab called "create tangents".
    You should check if it's checked or not ^^
    I hope it helps!
    Cheers
     
  8. pro-bchevalier

    pro-bchevalier

    Joined:
    May 30, 2013
    Posts:
    46
    Hello @Zehru !
    Thanks for the tip, "create tangents" will indeed affect lighting, but won't create/unwrap a secondary UV map for lightmaps.
     
    Zehru likes this.
  9. Zehru

    Zehru

    Joined:
    Jun 19, 2015
    Posts:
    84
    Ooh @pro-bchevalier ,I think I missundestood your question. Sorry about that.
    I reallly don't know how to help you out on this one.
     
    pro-bchevalier likes this.
  10. pro-bchevalier

    pro-bchevalier

    Joined:
    May 30, 2013
    Posts:
    46
    Hey @Zehru , no worries man and thanks for giving it a try :D

    @koujaku I'm using Ferr2d as a way to create nice transitions between textures on a terrain. See the attached picture.

    ferr2d_transitions.png

    So, with this setup, I'd love to get lightmaps working. By default, Unity will not create a secondary and unique UV set for the lightmaps automatically. So when baking, it'll use the first UV, which usually has overlapping UVs and will create glitches.
    BUT, Unity has the "Unwrapping.GenerateSecondaryUVSet()" function that generates a secondary lightmap automatically > https://docs.unity3d.com/ScriptReference/Unwrapping.GenerateSecondaryUVSet.html

    I'm a total hack and my request is an edge case, but do you think you could implement this as an option to generate lightmaps on the Ferr2d meshes?

    Thanks!
    ben
     
  11. pro-bchevalier

    pro-bchevalier

    Joined:
    May 30, 2013
    Posts:
    46
    Actually, something tells me it won't work that simply, even after adding the UV2 unwrapping step into the mesh pre-processing as Ferr2d doesn't seem to write meshes on disk at all. So no persistent mesh with the generated lightmaps UV coordinates that will be kept there.
    @koujaku Could you please confirm if Ferr2d supports writing meshes on disk or not? Thanks.
     
  12. Zehru

    Zehru

    Joined:
    Jun 19, 2015
    Posts:
    84
    Hello again @pro-bchevalier , as you noticed, it's quite rare to see him over there. Maybe he is a really busy person. However, you can send a message on his twitter. I think the answer willl be a lot faster.

    https://twitter.com/koujaku
     
    pro-bchevalier likes this.
  13. vivalavida

    vivalavida

    Joined:
    Feb 26, 2014
    Posts:
    85
    Hi guys,
    Are there any optimisations that can be done to the ferr2d system?
    Our game runs with Vsync on, game runs at 60fps, but when ferr is present in the scene it drops to 30fps (not that ferr takes up that much, just that with Vsync if the framrate drops even a bit below 60 the system will cap to to 30 fps)

    I'm the programmer one the project and admittedly do not have much hands on experience with ferr2d, but any tips will be highly appreciated.
     
  14. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    @vivalavida You might want to check the shaders. If you don't want to fade your terrains in any way, you might want to set the Shaders of your Fill-Texture to a Non-Transparent-Shader.
     
    vivalavida likes this.
  15. pro-bchevalier

    pro-bchevalier

    Joined:
    May 30, 2013
    Posts:
    46
    Hey @Zehru thanks for the suggestion!
     
    Zehru likes this.
  16. Zehru

    Zehru

    Joined:
    Jun 19, 2015
    Posts:
    84
    Hi @koujaku
    Recently Unity updated to a new version, and in this version, there is a very nice new feature called "Composite Collider".
    It would be awesome if Ferr2d could have composite colliders too, as it would help not breaking some uncommon collider positioning on the scene.
    Can you add it to the asset? :)
    Thank you
    PS: I didn't send it on your twitter, because I can't figure out how to enter on it anymore hahahah. Lost my password
     
  17. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    @Zehru
    I don't think this feature will be added, Ferr2D doesn't seem to be supported since a while :/
     
    Zehru likes this.
  18. Zehru

    Zehru

    Joined:
    Jun 19, 2015
    Posts:
    84
    @BTStone I see.
    Please, can you send him a message on twitter showing my message on the forum?
    Maybe it will be as easy as we think for him doing it, and that would really help.
     
  19. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    You need to make the inner material that isn't transparent, a very lightweight opaque shader. The outer transparent material can then be a fill rate hit.

    This will mostly solve it. Ferr itself is very low footprint, depending on how many verts you have going. The shader is not low footprint though.
     
  20. AlcyonGames

    AlcyonGames

    Joined:
    Sep 16, 2016
    Posts:
    39
    Hi!, first of all THANKS for this amazing tool. We really love Ferr2d and has optimized our pipeline/workflow!

    I have one suggestion don't know if you can implement it or if someone in the forums might help to add this feature.
    It would be nice if you could set "weights" for different tiles on the edge terrains! like for example, set the probability for the tiles to be used along the edge. So that way you have more control over what tile appears more likely in the edge over some that you might want to appear less.

    Here are some screenshots of our game if you're interested in. It's called Elyra: Echoes from the Void, a metroidvania inspired obviously by Super Metroid.


    You cand find us on Facebook and Twitter
     
    Zehru likes this.
  21. Ferofax

    Ferofax

    Joined:
    Nov 18, 2015
    Posts:
    2
    Hi everybody! I reached out to dev 5 days ago but I haven't heard a response- hoping you guys could help me while he's busy =D

    Long story short, I'm trying to access the coordinates of each of the vertices of a ferr2d terrain object via script.

    This is so I can calculate the area of the terrain, and perhaps, even move the vertices during runtime.

    Any tips?

    Ferofax
     
  22. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    789
    What you need to do is grab the Shared Mesh of the Mesh Filter component on your Ferr2D object.

    Code (CSharp):
    1. MeshFilter filter  = GetComponent<MeshFilter>();
    2. Mesh mesh  = filter.sharedMesh;
    Then you can loop through the vertices and do what you want to them.

    https://docs.unity3d.com/ScriptReference/Mesh.html
    https://docs.unity3d.com/ScriptReference/Mesh-vertices.html

    We do something similar to change the vertex colours to create baked lighting on our terrains.
     
    CHEMAX3X and Zehru like this.
  23. Zehru

    Zehru

    Joined:
    Jun 19, 2015
    Posts:
    84
    that's a very nice way to create baked lighting on the terrains. I never thought on that way ^^
     
    flashframe likes this.
  24. PixlShrk

    PixlShrk

    Joined:
    Apr 20, 2017
    Posts:
    1
    Hi there! Does Ferr2d only render the parts that are on screen? If not how can i make a script to do that? Im trying to build a physics car game with big levels and don't know if this is the right terrain tool for me.
    Thanks for any answer!
     
  25. robymv

    robymv

    Joined:
    Oct 28, 2013
    Posts:
    74
    Hi all, somebody found a solution for make bomb with collision like Josessito write in page 9? Thank you
     
  26. Zehru

    Zehru

    Joined:
    Jun 19, 2015
    Posts:
    84
    Hi @robymv
    I haven't tried this yet, because my laptop is so close to stop working(it's a really old one :( ), and I think that, if I open Unity, it will explode hahaha. However you should think about:
    1- Getting data from the mesh vertices like mentioned some comments above;
    2- After getting each of the vertices, instead of destroying and creating new ones, just repositioning them and maybe changing the top material to the bottom one, which normally looks closer to what would happen if a bomb explodes close to the ground.

    Maybe analysing this will also help you.
    http://quantumyeti.com/blog/destructible-terrain-in-ferr2d

    I hope it helps.
    Cheers
     
    robymv likes this.
  27. robymv

    robymv

    Joined:
    Oct 28, 2013
    Posts:
    74
    Thank you Zehru, I has read your link but is too hard for me.
    For now I have used :
    Code (CSharp):
    1. //if (p.Raycast (r, out dist)) {
    2.             Vector3 intersection = r.GetPoint (dist) - terrain.transform.position;
    3.             terrain.AddAutoPoint (new Vector2 (intersection.x-8, intersection.y-13.2f));
    But I don't understand how i can know "the vertex" i need remove with RemovePoint().
    How can I know what is vertex collided with my bomb?
    Thank you
     
  28. treborjones81

    treborjones81

    Joined:
    Jan 4, 2017
    Posts:
    2
    Hi there!

    I'm using Ferr2d and playmaker and wondered if I could use the 'GetdistanceFromPath' functionality. Basically, I want to slow the player down the further away from the spline they are, so need to measure that distance. It might be a playmaker question, so will post there as well!

    Any help much appreciated!

    Cheers,

    Bob.
     
  29. treborjones81

    treborjones81

    Joined:
    Jan 4, 2017
    Posts:
    2
    A codey chum resolved this for me.

    First I learnt about Methods and Static Methods, and that Playmaker appeared to only show Methods as an option from it's Call Method functionality.

    My coder chum then resolved a couple more issues related to World space/Local space.

    Here's the snippet just in case anyone else is ever trying to do the same thing.

    Code (CSharp):
    1. /// <summary>
    2.     /// Gets the smallest distance to the provided path
    3.     /// </summary>
    4.     /// <param name="aPoint">The point to check from.</param>
    5.     /// <returns>Smallest distance! float.MaxValue if none found</returns>
    6.     public float GetDistanceFromPathDynamic(Vector3 point) {
    7.         if (pathVerts.Count <= 1) return float.MaxValue;
    8.  
    9.         Vector3 localPoint = transform.InverseTransformPoint(point);
    10.         Vector2 aPoint = new Vector2( localPoint.x, localPoint.y );
    11.  
    12.         float dist  = float.MaxValue;
    13.         int   count = closed ? pathVerts.Count : pathVerts.Count-1;
    14.         for (int i = 0; i < count; i++)
    15.         {
    16.             int     next  = (i+1) % pathVerts.Count;
    17.             Vector2 pt    = GetClosetPointOnLine(pathVerts[i], pathVerts[next], aPoint, true);
    18.             float   tDist = (aPoint - pt).SqrMagnitude();
    19.             if (tDist < dist)
    20.                 dist = tDist;
    21.         }
    22.         return Mathf.Sqrt(dist);
    23.     }
     
  30. iano7

    iano7

    Joined:
    May 9, 2017
    Posts:
    2
    how to make whole environment darker?
    direction light has no affect on ferr2D terrain
     
  31. Gisle

    Gisle

    Joined:
    Mar 25, 2014
    Posts:
    27
    Hello
    I have a question about edge terrains. Is it possible to flip the uvs so that shadows/highlights point the correct direction?
    The branch on the right side should ideally have its shadow side pointing down like the branch on the left. Since the left and right caps of this terrain looks different, I cant just make the path go in the same direction unfortunately.

    Loving the tool btw :)

    ferr edge case.png
     
  32. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    789
    Could you just set the y scale to -1 for the second branch?
     
  33. Gisle

    Gisle

    Joined:
    Mar 25, 2014
    Posts:
    27
    I tried that, but the path gizmos disappears and the collider generation seems to be slightly off when I do that. Thanks for the input tho :)
     
  34. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,967
    @koujaku when are the multiple material painting features coming? very poor support of this asset and its users, I currently cannot recommend this to anyone due to your awful support.
     
  35. koujaku

    koujaku

    Joined:
    Aug 28, 2013
    Posts:
    321
    Hey guys! Sorry for not being on this page much for the last while. I recently quit my day job, and have been building some new cool stuff, including the most recent update to Ferr2D. I've got a lot of nice stuff planned for the future, and you'll likely be seeing more features coming in!

    For those of you asking for support, I always track my Twitter and the support email quite closely, those are the best ways to reach me, and I do get back quickly there! I'll try and keep more tabs on this thread now that I have more time :)

    If you missed the most recent update, I wrote about it in depth on my blog. There's some good stuff in it! http://playdeck.net/blog/ferr2d-terrain-v111-release

    My favorite is probably this feature, texture segments are no longer locked between path points! So you should see a lot less stretching, and way more control for curved paths :)
    Ferr2DSmooth.gif

    And a feature I've seen requested a lot, being able to choose texture segments along the path!
    FerrCutOverrides.gif

    I should be seeing you guys around a lot more! I'm excited to be back in the game again :)
     
  36. xpachin

    xpachin

    Joined:
    Feb 6, 2014
    Posts:
    62
    wel... glad to see you back!
    still waiting perfect corners tho...
     
    koujaku likes this.
  37. cdy_unity

    cdy_unity

    Joined:
    Jul 28, 2017
    Posts:
    9
    I need help,only in IOS,look the terrain。
     

    Attached Files:

  38. koujaku

    koujaku

    Joined:
    Aug 28, 2013
    Posts:
    321
    Looks like it might be a UV precision issue, I've seen similar happen before on really large maps. Try this out!

    In Ferr2DTCommon.cginc, should be Line #27, change this:

    half2 uv : TEXCOORD0;

    To this:

    float2 uv : TEXCOORD0;

    See if that works! I'm pretty sure the half2 is a debatable or overoptimization at this point, so I'll probably include that change in the next release too.
     
  39. cdy_unity

    cdy_unity

    Joined:
    Jul 28, 2017
    Posts:
    9
    it's OK ,Thank you。
     
  40. JiMMaR

    JiMMaR

    Joined:
    Aug 4, 2012
    Posts:
    12
    Might be very late for this, but the solution I found was to press the "prebuild collider" button and setting the "used by effector" on the generated collider
     
  41. felixwcf

    felixwcf

    Joined:
    May 22, 2012
    Posts:
    16
    Hi I'm a beginner of Unity and Ferr2D.

    There's a isTrigger variable of terrain for me to turn it on and off when I try to achieve collision between the player and the terrain.

    I would like to make my terrain to interact with the character like this:


    Any good pseudo suggestion to turn the isTrigger on and off?.. instead of making transparent long collider on top and bottom of my character to detect the terrain and turn isTrigger on and off...

    Thank you for any suggestion and reply.
     
    Last edited: Aug 24, 2017
  42. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    Well, what you could do is make two terrains out of the above terrainobject, one gameobject for the Edge-Terrain which is a physical terrain and the other one is just a decorative one, without a collider.
     
    felixwcf likes this.
  43. felixwcf

    felixwcf

    Joined:
    May 22, 2012
    Posts:
    16
    Hi I can't get what you mean. The decorative one is in front of the one with edge collider? Does it make any difference?
     
  44. kemnet

    kemnet

    Joined:
    Dec 20, 2015
    Posts:
    47

    Use Platform Effector 2D, it does exactly that
     
    felixwcf likes this.
  45. felixwcf

    felixwcf

    Joined:
    May 22, 2012
    Posts:
    16
    Thank you so much for both of your replies. Yea I figured it out.

    i. Create the terrain with decorative mode.
    ii. Added Edge Collider 2D. Edit the collider along the surface of the decorative terrain.
    iii. Added platform effector and bind to the edge collider.
    iv. It works.

    Again, thank you.
     
    ATeam_Production likes this.
  46. DanaLoud

    DanaLoud

    Joined:
    Jul 20, 2017
    Posts:
    1
    I noticed that version 1.12 was released in the asset store. Where can I go to see release notes for it?
     
  47. koujaku

    koujaku

    Joined:
    Aug 28, 2013
    Posts:
    321
    It's a pretty small update, nothing terribly big! The changelog is visible on the asset store page, under the version number, as well as in the readme file in the asset itself. But here's a quick copy of it as well :)

    Ferr2D Terrain v1.12
    • Terrain
      • Fixed UV glitch on extremely large or distant terrains
      • Improvements to scene GUI rendering
      • Fixed bug with colliders not obeying the Inverted Fill Border settings
      • Fixed issue with colliders on unsmoothed terrains warping on extreme corners
    • General
      • Updated FerrCommon, added namespaces for name collision protection
      • Added hooks for Ferr2D to behave nicely with the upcoming Ferr vertex painting tool
     
  48. AlcyonGames

    AlcyonGames

    Joined:
    Sep 16, 2016
    Posts:
    39
    Hi!, thanks for the updates on segment locked! It's amazing that we can choose now what we want on the terrain! :)
    I would like to do a request. Could you please add the possibility so we can overlay a color on top of the terrain?, but not in vertex color way, instead a simple color overlay. So if we choose an orange color and then lower the opacity/alpha of it we can simulate fog. For example if I have 4 terrains I would love to overlay a color (apart from the vertex color/tint) in normal mode (not additive, overlay, multiply) and then change it's opacity so it would be like this:
    - terrain01 orange 0% alpha
    - terrain02 orange 15% alpha
    - terrain03 orange 30% alpha
    - terrain04 orange 50% alpha
    So that way I can simulate fog :)
    THANKS!
     
  49. koujaku

    koujaku

    Joined:
    Aug 28, 2013
    Posts:
    321
    As of 1.10, Ferr2D's shaders should support Unity's built-in fog! That would be the easiest option, especially since then it should work with everything else.

    If you're doing something different, and can't work with Unity's fog, it's not a tough step to modify the shaders to do this. In Ferr2DTCommon.cginc, line #109, change this:

    color = color * inp.color;

    to this:

    color.rgb = lerp(color.rgb, inp.color.rgb, inp.color.a);

    I haven't tested this, but I think that should approximately work!
     
    AlcyonGames likes this.
  50. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,521
    When I duplicate a ferr object I get issues with z-order of the material, it flickers.

    Any way I could duplicate ferr objects without this problem?