Search Unity

Ferr2D Terrain Tool

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

  1. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Love variation and scale. Always important to add that bit more wow factor.
     
  2. k3pp

    k3pp

    Joined:
    May 2, 2013
    Posts:
    23
    Shure! Just look at the Rayman series (Mostly legends and origins, but also jungle run and fiesta) and you can see the use of this feature... it´s very usefull... in the case of grass, they normally use more than one layer of grass, each one with different scale. That gives a lot of depth, but also introduces more pixels to be drawn, and may result in problems on mobile devices (pixel fill rate not enought becouse of alpha overdraw).
     
  3. Jesse_Pixelsmith

    Jesse_Pixelsmith

    Joined:
    Nov 22, 2009
    Posts:
    296
    Yeah I've been playing Origins a lot lately. Those jungle levels have sometimes like 7 different terrain layers - they look good, but yeah probably wouldn't cut it for mobile. Also when they parallax it kinda looks strange, because the environment looks so good, you almost forget that it is 2d layers, and so when you see 5 layers parallax sliding ever so slightly right next to each other, it looks strange - like a weird 2d terrain uncanny valley.

    I'm testing with just 3 layers , main , background, and occasionally a foreground piece will pop up. Seems to work well for what I'm doing.
     
  4. Kelde

    Kelde

    Joined:
    Feb 28, 2012
    Posts:
    629
    im doing the same thing, using too many layers makes it look so much more fake in a way, like u are trying to make it look 3d even tho its very obvious u just slapped in tons of layers.

    in the BG i use up to 3-4 layers actually, but then again i really like to have stuff far off in Z to create depth. Foreground its enough with 1 or 2 popping up to help the eye focus on the playground.
     
  5. Jesse_Pixelsmith

    Jesse_Pixelsmith

    Joined:
    Nov 22, 2009
    Posts:
    296
    Side note - I'm trying to update the vertex color of my terrains in script according to time of day (and I'm doing this every frame) - I'm able to modify the color, but the terrain doesn't actually pick it up unless I "refresh' in editor. Is there any way that I can get the terrain to update its color every frame without being crazy resource intensive?
     
  6. k3pp

    k3pp

    Joined:
    May 2, 2013
    Posts:
    23
    http://docs.unity3d.com/Documentation/ScriptReference/Mesh-vertices.html
    http://docs.unity3d.com/Documentation/ScriptReference/Mesh-colors.html
     
  7. blueteak

    blueteak

    Joined:
    Feb 19, 2013
    Posts:
    140
    I love the plugin, just bought it and it is working wonderfully. However, I have a bit of a problem, that I can't instantiate terrain objects via script correctly.

    When the object is created, the scripts are all there, and even the collider is present and working, but the texture is invisible, if I change any of the variables (like Vertex Color) manually in the editor, the texture snaps into existence and is great; but I if I do it via script, it doesn't work.

    Anyone else have this problem/found a solution, or am I missing something important?

    EDIT: Seems all I needed to do was call RecreatePath(), added it to the TerrainPath start function, is there any reason this might not be a good idea?
     
    Last edited: Dec 27, 2013
  8. wolflogic

    wolflogic

    Joined:
    Oct 24, 2011
    Posts:
    7
    Hi Koujaku! I'm really liking the plugin. Bought it some time ago, but only just started messing with it this week.

    Query: I'd like to have Fill material work similarly to edges, where you can provide a selection of seamless tiles that will be randomly chosen as the fill is drawn in place. This would allow the addition of some variety to repeating elements.

    How hard do you think this would be? I've had a glance at the code, but I'm a PHP Developer by trade and not yet familiar with Unity's UV/Mesh methods and I got a bit cross eyed while trying to figure it out, lol.

    Thanks for the hard work on this tool, good to see you regularly updating it!
     
  9. stationx

    stationx

    Joined:
    Jul 9, 2012
    Posts:
    251
    Hello koujaku!
    How customizable is this in terms of collisions? I am using my own ported box2d engine and would love to keep using that. (yeah, I know Unity has got 2d physics, but I made the engine long before ;-)
    Would I be able to replace the collision stuff in your code with my own box2d physics?
    regards!
     
  10. bchevalier

    bchevalier

    Joined:
    Feb 13, 2013
    Posts:
    42
    Hi Koujaku,

    I just bought your addon, it's great !

    Would you have a roadmap for the next features and releases, so we'd know what to expect from future releases(ETA, if possible would be awsome as well).

    May I suggest the use of a Trello board so that users could follow the development and even vote for features ?

    Feature suggestions :

    - Auto atlasing would be mindblowing
    - Adding special "control points" that would not create a new "tiling" section but rather just split the quad and help with the smoothing only(maybe that would interfere with the current SmoothPath)


    Keep up the great work !

    Thanks,
    ben
     
  11. Jesse_Pixelsmith

    Jesse_Pixelsmith

    Joined:
    Nov 22, 2009
    Posts:
    296
    Happy new year!

    Second the Trello suggestion

    Also have a question about possible gradient support. Rage spline uses this to pretty cool effect, so if I wanted to do some fake2d lighting effects or just have my terrain blobs get darker towards the bottom, it would help break it out with large terrain pieces

    $RageSpline Gradient.PNG
     
  12. bchevalier

    bchevalier

    Joined:
    Feb 13, 2013
    Posts:
    42
    Hi there,

    I mailed to Ferr2D support, but I though I should post it here as well.

    I am having an issue when creating Prefabs out of Ferr2d Terrain objects. The Ferr2D prefab will show up with no visual. I'd have to edit a point so that the mesh is generated. This is critical, what would be the workaround ??
    I am using Unity 4.3

    Thanks,
    ben

    $ferr2dIssue.jpg
     
  13. gdeglin

    gdeglin

    Joined:
    Mar 7, 2013
    Posts:
    78
    We ran into the same problem. It's due to a limitation in Ferr2D. I reported it to the author a month ago, but unfortunately it looks like he's been too busy to make any updates to Ferr since then.

    Basically, Ferr2D does not save the generated mesh anywhere if you prefab a terrain object. There are 2 possible ways to fix this:

    1. Easy solution: Regenerate the terrain mesh every time the game runs.

    Add this line to Ferr2DT_PathTerrain.cs immediately after line 147 (first line of the Start method):
    if (GetComponent<MeshFilter>().sharedMesh == null) RecreatePath();

    The main drawback of this is that it's slow, especially on mobile and if you have a lot of complex objects.

    2. Hard solution: Write code to save and load the mesh to/from a file.

    This is what we ended up doing, and it works great.

    Unfortunately we've made so many modifications to Ferr at this point that it's hard for me to easily share the exact code used to do this.

    The gist of it is that you should write a function SaveMesh in Ferr2DT_PathTerrain.cs that uses UnityEditor.AssetDatabase.CreateAsset() to save GetComponent<MeshFilter>().sharedMesh to a file.

    Call that function whenever you want to save the path (After the path is modified for instance).

    Then mark that class as ExecuteInEditMode, and create a start method that loads the mesh. Make sure to load it into the collider as well, if there is one (We use a 3D collider, not sure what you would do for a 2d one).
     
  14. bchevalier

    bchevalier

    Joined:
    Feb 13, 2013
    Posts:
    42
    Wow dude, thanks bunch ! I implemented solution 1, because I could, and will see with my programer for implementing solution 2.
    I got a reply from Ferr2D dev as well, he told me he's working on it and he'll get that fixed in the next release.

    ben
     
  15. bchevalier

    bchevalier

    Joined:
    Feb 13, 2013
    Posts:
    42
    Is it possible to have a slightly better "random" for the "sprites" ?
    What I mean is that if I setup a tile texture with my ground using 3 parts + 2 caps, I sometimes have 4 times the same tile one after each other.
    That'd be nice if the randomisation could smartly prevent spawning the same tile more than twice in a row.

    ben
     
  16. Dan_Tsukasa

    Dan_Tsukasa

    Joined:
    Jan 26, 2013
    Posts:
    155
    Hey

    Bit late on this one, but hope you had a great Christmas and new years.

    (I feel bad following up that nice message with some comments/requests for Ferr2D).

    Is there any news at all on the 'lock' feature for the terrain editor, overlapping terrain sections is a real pain sometimes

    Is there anyway to have an optional gradient instead of the current tint? (currently just making gradient versions of my terrains in photoshop).

    Will there be the option for Concave terrains in the next update, often when making concave cliffs the kit goes a little wobbly.

    Still loving this kit, level creation is dramatically easier to make pretty.
     
  17. bchevalier

    bchevalier

    Joined:
    Feb 13, 2013
    Posts:
    42
    Koujaku,

    Could you quickly update us on the dev status ?
    I think there's quite some interest in Ferr2D, but your last post seems to be a month old. Please, no offense, but that'd be good to see some more interventions from you in here and it would make me a bit more confident regarding my recent investment in that tool(which I really like, btw).

    thanks,
    ben
     
  18. Kelde

    Kelde

    Joined:
    Feb 28, 2012
    Posts:
    629
    Koujaku is busy doing ALOT of games with his company, i see him update his FB everyday with 1-2 new games. Ill ask him to come back as people want updates and i will NOT let him abandon this as its the best 2D enviroment tool we have right now
     
  19. Jesse_Pixelsmith

    Jesse_Pixelsmith

    Joined:
    Nov 22, 2009
    Posts:
    296
  20. koujaku

    koujaku

    Joined:
    Aug 28, 2013
    Posts:
    321
    Hey guys! Sorry I haven't been so active on here, been really crammed at work! At Simbryo, we've actually published almost 40 games over the past 2 months~ If you're interested in that at all, you can follow us over on Facebook =D (http://facebook.com/simbryo)

    We have a major deadline on the 15th, so after we hit that, my time should free up a bit, so I'll make sure I do some updates to Ferr2DT~ Here's what I've got planned, I don't promise I'll get all of it in, but I'll try and get most of it!

    -Better smooth terrain, for better physics stuff, or just, less jaggies in general.
    -Random fill texture, pretty sure I can do this one justice pretty quickly.
    -Grid snapping, super important, dunno why I didn't do it earlier.
    -Mesh saving! Some people have had issues with instantiating prefabs, or slow generation on Start.
    -Some other misc. bugs/stuff with the material editor

    Those are my priority items right now, but be assured, there's plenty more! I have a nice list somewhere around my cloud that I add to whenever I see people mention things... I'll get to 'em eventually~

    If you need me right away, I do my best to respond to email ASAP! You can also reach me on Twitter pretty quickly~

    And thanks @Kelde for keeping me up on things =D
     
  21. Kelde

    Kelde

    Joined:
    Feb 28, 2012
    Posts:
    629
    on my way to dayjob, usually im not smiling becasue of it, but this makes my day:)

    Keep it up Nick! Im off to make some Dentures...
     
  22. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    943
    That's great to hear!

    Can you please also add to your to-do list, 2D physics support?
     
  23. Dan_Tsukasa

    Dan_Tsukasa

    Joined:
    Jan 26, 2013
    Posts:
    155
    Ferr2D has supported 2D Physics since the last update in early december, there are some tick boxes on each terrain for 2D or 3D Phyics, has been working well for me since back then.
     
  24. bchevalier

    bchevalier

    Joined:
    Feb 13, 2013
    Posts:
    42
    Hi Koujaku,

    Thanks for the update ! Looking forward the next release and good luck with your deadline.

    Kelde : yep, Ferr2D is definitely a must have 2d tool for Unity.

    To all : I just found out something when using Ferr2D terrains nested in prefabs. Once you drop your prefab, the terrain will not show until you start the engine. A quick workaround is to select the terrain, translate it randomly and then CTRL+Z(undo), the mesh will generate automatically.
    There are other ways, like selecting a point from the terrain and moving it, or selecting any option in the terrain and tweaking it slightly. All these manipulations will force Ferr2D to re-generate the terrains.
    I'm only working with terrains nested within prefabs that I decorate with 2dtk sprites, so the Undo manipulation helps me a bit.

    ben
     
  25. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    Can't wait for this one!
     
  26. Kelde

    Kelde

    Joined:
    Feb 28, 2012
    Posts:
    629
    god i got 4 requests about ferr2d terrain order from people that wants my cartoony/stylised textures for their games, im very tempted to do this...I would if they could get by with just the fill and edge terrain and not an entire scene with bgs and decor.

    If i get more then ill set up a section in our forums, once its up, to let people order custom textures for their games, id love to help out with that, i know artists is a PAIN to get ahold of and they are usually pretty expensive. As for price id want to keep myself at a "indie" level as much as possible, i know most developers cant afford 300 bucks for a single texture, i'd be willing to go all the way down to 30-50 bucks each fill and edge material.

    I spoke to Koujaku about this and he is fine with it, i wanna help him promote this lifesaving tool as much as possible. He is also getting my games textures when its released to use as promotion pieces only (sorry cant sell something i already used in my game), but u can certainly test them out with future Ferr2D updates and see if my style appeals to u.

    btw our game is up at WIP section using Ferr2D for prettymuch everything u see in the screenshots, show it some love please:p
    http://forum.unity3d.com/threads/222525-WIP-Skyjumper-Android-and-iOS

    ok i have a worldmap to paint, im ready to pull my hair out...SO much work....
     
  27. koujaku

    koujaku

    Joined:
    Aug 28, 2013
    Posts:
    321
    Quick update here! Early smoothing stuff is working -quite- well~ A little more work with the colliders and this part will be done. I'll probably have an option to tweak detail level of colliders independently from the visual mesh. For custom optimization, y'know =D

    $Ferr2DTSmoothTest1.png

    I also added in an (optional) extra line of verts down the middle of the edge mesh, which can reduce texture distortion due to bad triangle stretching.

    $MiddleSPlit.gif
    This is actually an asset from Kai's game, and it really illustrated the problems that I was having without the smoothed terrain or the extra line of verts. All fixed now! =D

    Smoothed terrain is still a little slow to generate in the editor, but I'm also adding in proper mesh saving, so instantiating prefabs won't require recalculation and all that. I'll see what I can do in the way of optimizing it more, but I'll knock out the other features and come back to that if I have time, since it doesn't affect runtime performance.

    Either way, it feels good finally having it in =D Gonna try out the random fill stuff after this, I'm hoping to sneak in some performance gains there too!
     
    Last edited: Jan 16, 2014
  28. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    943
    Oh man that's fantastic!! Keep up the great work! :D

    I'm pretty sure this will soon become one of the must-have extensions for 2d game development. I would buy stocks of it if I could! :)
     
  29. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    Awesome! You just made my day! As soon as this new version is out, I'm buying! I hope this asset eventually makes you enough cash to let you spend more time on it. I know what it's like to try and get things done in your spare time. I think your asset could get very popular if you keep the updates flowing.

    -Jeff
     
  30. Kelde

    Kelde

    Joined:
    Feb 28, 2012
    Posts:
    629
    I swear on my right hand, wich i use for painting....that this tool already is a MUST have, period:p
     
  31. k3pp

    k3pp

    Joined:
    May 2, 2013
    Posts:
    23
  32. bchevalier

    bchevalier

    Joined:
    Feb 13, 2013
    Posts:
    42
    this is really sweet...

    +1 for the scale feature.
     
  33. koujaku

    koujaku

    Joined:
    Aug 28, 2013
    Posts:
    321
    I love the size/scale idea, but probably not for this update. I'm considering adding in an overlay UI, or a toolbar at some point, which should allow me to add in slightly more complex interaction like that. It's a later thing, but I definitely want it in! =D

    I believe I mentioned briefly my current priority list here:
    http://forum.unity3d.com/threads/204436-Ferr2D-Terrain-Tool/page11?p=1482111#post1482111

    I thought I had a more detailed one around somewhere, but I can't find it right now. Honestly though, it changes day to day. I can be a little fickle, especially when people present me with cool new ideas~
     
  34. TheValar

    TheValar

    Joined:
    Nov 12, 2012
    Posts:
    760
    Finally got around to buying this today. I stuck my player and camera into one of the test scenes and overall it's looking great. There's just one little problem I'm having. It seems that the transparent parts of the terrain in front of my character are somehow masking him. Screenshot below.

    this is probably just a setting thing that I messed up.
    $Ferr2dMaskGlitch.png
     
  35. Kelde

    Kelde

    Joined:
    Feb 28, 2012
    Posts:
    629
    Its just the shader, sometimes that happens, i think its the ferr2d shader u are using? im not sure Koujaku has been notified to be honest. Set the shaders to anything else that works and it will be fine.
     
  36. koujaku

    koujaku

    Joined:
    Aug 28, 2013
    Posts:
    321
    In this case, it looks like a z-order issue. I've tinkered with the transparency/z-order stuff before, but it's a complicated subject without any terribly great solutions. Or at least, none that have come readily to my attention. Some of the more intricate details of the Unity shaders still elude me.

    You could try moving the object around on the z-axis, or switch the terrain material shader over to Sprites->Default, (or other shader combinations, since it is a shader issue) But one of those things -should- fix it. Lemme know! I'll try and fit in a better default shader at some point.
     
  37. bchevalier

    bchevalier

    Joined:
    Feb 13, 2013
    Posts:
    42
    Btw, Koujaku, is it possible to set manually the z-order for Ferr2D Terrains ?

    Right now I am using a mix of Spine + Ferr2D + 2DTK and have sometimes hard times with z-order.
    2DTK let's me set it per sprite, so it helps. Spine is always at 0, which is usually ok as it is for characters.

    For Ferr2D Terrains, some of them are in the BackGround, some others in the ForeGround. Setting z-order would help.

    ben
     
  38. serpin

    serpin

    Joined:
    Nov 13, 2011
    Posts:
    54
    Guys, this is how I solved these problems:

    Now these are the simplest fixed-function shaders, but they don't have z-order problems (see in play mode).
    They are also a hell of a lot lot faster than the ones from the package. Tested on iPhone 4 and Android.

    Transparent alpha-blend shader for for the edges:

    Code (csharp):
    1.  
    2. Shader "Jessie Mobile/Transparent/Alpha Blend (VertexColor)" {
    3.     Properties {
    4.         _MainTex ("Particle Texture", 2D) = "white" {}
    5.     }
    6.    
    7.     Category {
    8.         Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
    9.         Blend SrcAlpha OneMinusSrcAlpha
    10.         Cull Back
    11.         Lighting Off
    12.         ZWrite Off
    13.         Fog { Color (0,0,0,0) }
    14.        
    15.         BindChannels {
    16.             Bind "Color", color
    17.             Bind "Vertex", vertex
    18.             Bind "TexCoord", texcoord
    19.         }
    20.        
    21.         SubShader {
    22.             Pass {
    23.                 SetTexture [_MainTex] {
    24.                     combine texture * primary
    25.                 }
    26.             }
    27.         }
    28.     }
    29. }
    30.  
    31.  
    And an unlit shader for the fills:

    Code (csharp):
    1.  
    2. Shader "Jessie Mobile/Unlit/Unlit (VertexColor)" {
    3.     Properties {
    4.         _MainTex ("Main Texture", 2D) = "white" {}
    5.     }
    6.    
    7.     Category {
    8.         Tags { "Queue"="Geometry" "IgnoreProjector"="True" "RenderType"="Opaque" }
    9.         Lighting Off
    10.         ZWrite On
    11.         Cull Back
    12.         Fog { Color (0,0,0,0) }
    13.        
    14.         BindChannels {
    15.             Bind "Color", color
    16.             Bind "Vertex", vertex
    17.             Bind "TexCoord", texcoord
    18.         }
    19.        
    20.         SubShader {
    21.             Pass {
    22.                 SetTexture [_MainTex] {
    23.                     combine texture * primary
    24.                 }
    25.             }
    26.         }
    27.     }
    28. }
    29.  
    These behave as expected due to the fact that transparent one doesn't ZWrite and is drawn back to front in correct order.
    Just move your mesh a bit to front to avoid flickering problems if you have any.
     
    Last edited: Jan 18, 2014
  39. Kelde

    Kelde

    Joined:
    Feb 28, 2012
    Posts:
    629
    This seems to be very random for me, i just made another terrain and then i didnt get the masking. Then i tried another one and it started masking like valar shows, all i do is change the shader and its fixed. Sometimes Ferr2D shaders are fine, but sometimes they want to do this.

    Playing with the Z order also seems to work, and once it does they shouldt break again.
     
  40. Dan_Tsukasa

    Dan_Tsukasa

    Joined:
    Jan 26, 2013
    Posts:
    155
    Changing shader works 100% of the time (at least from my experience) however, changing shader brings up another issue, tinting, tinting with the Ferr2D Shader only tints that exact terrain you have selected, won't effect anything else using that shader or material, however if you use another shader then any tinting will effect all instances unfortunately, kinda sucks actually, as unity's 3d lights work well with Sprite- Diffuse shading, but not with Ferr2D currently.
     
  41. serpin

    serpin

    Joined:
    Nov 13, 2011
    Posts:
    54
    You obviously didn't try the shaders I've posted earlier (although they're not lit).
    But pixel shaders are expensive, especially in forward rendering.
     
  42. TheValar

    TheValar

    Joined:
    Nov 12, 2012
    Posts:
    760
    I used a shader from 2dToolkit and it worked great :) Of course when I did I had z ordering issues because my character uses the 2dsprite layers. I just added a very simple component that lets me assign a layer and order in layer for the terrain to get it to work.
     
  43. TheValar

    TheValar

    Joined:
    Nov 12, 2012
    Posts:
    760
    Recently a game called Glitch was axed and all the art was open sourced. http://www.glitchthegame.com/public-domain-game-art/

    I took a few assets and spent several hours getting tweaking them to work well with Ferr2d. Here are the results :)
    Note: The character is not from the Glitch set.
    $FeebleScreenshotCliffs.png
     
  44. k3pp

    k3pp

    Joined:
    May 2, 2013
    Posts:
    23
  45. gdeglin

    gdeglin

    Joined:
    Mar 7, 2013
    Posts:
    78
    I believe this is because the default Ferr shaders have ZWrite On, when they should have it set to off. Here is the documentation on this:

    http://docs.unity3d.com/Documentation/Components/SL-CullAndDepth.html
    The fix is to change the shaders and add "ZWrite Off" before "SrcAlpha OneMinusSrcAlpha".
     
  46. Dan_Tsukasa

    Dan_Tsukasa

    Joined:
    Jan 26, 2013
    Posts:
    155
    Feature request.

    When selecting 'Create terrain' and the list of terrains to chose from pops up, is it possible to organize that into folders or dropdown lists or something similar. A finished game will probably utilize at least 10 terrains for walking, with likely another 20-30 for decoration and overlays, this means with this many terrains to chose from that menu will take a while to load up (it already takes around 10 seconds), folders or tags should make things a lot easier to find.
     
  47. bchevalier

    bchevalier

    Joined:
    Feb 13, 2013
    Posts:
    42
    Koujaku,
    do you think you'll have a moment to improve the random tiling of the terrain for the next update ?
    Even though I have separated my top terrain part into 3 different tiles(in order to get some nice variants), i often get 3,4 times the same tile one after each other, or tile 3 not showing as often as the others.

    thanks,
    ben
     
  48. k3pp

    k3pp

    Joined:
    May 2, 2013
    Posts:
    23
    Second That!

    In my early tests I noticed that my final game will have something between 50 and 100 terrains.... i just tested with 6 or 7 terrains...
     
  49. Kelde

    Kelde

    Joined:
    Feb 28, 2012
    Posts:
    629
    yeah i would also very much want that as i have several terrains within a "enviroment" like Jungle 1, Jungle 2 etc, plus all the decor that uses Ferr2D like roots,vines,treetrunks and plants.

    We all know Nick will get on this as soon as he is free, no worries, he is dishing out games like a madman with his company;)
     
  50. bchevalier

    bchevalier

    Joined:
    Feb 13, 2013
    Posts:
    42
    A release, if not an ETA, would be really, really nice...