Search Unity

Assets [FREE] Foliage 2D - Create foliage animation and regions of foliage along a path

Discussion in 'Works In Progress - Archive' started by Nicrom, Jun 30, 2015.

  1. Nicrom

    Nicrom

    Joined:
    Nov 17, 2013
    Posts:
    421

    Asset Store - Free
    Hello everyone. Foliage2D is a Unity editor extension that allows you to create simple foliage animations and regions of foliage like grass and flowers, along a path.

    Currently implemented features:
    • Foliage animation.
    • The possibility to create regions of foliage along a path.
    • The path can use multiple prefabs.
    • Path smoothing.

    Foliage animation


    Region of grass.






    Video tutorial
     
    Last edited: Feb 1, 2019
  2. Nicrom

    Nicrom

    Joined:
    Nov 17, 2013
    Posts:
    421
    Added the ability to smooth the foliage path.

     
    Last edited: Jul 13, 2015
    MarcusWatson likes this.
  3. Haagndaaz

    Haagndaaz

    Joined:
    Feb 20, 2013
    Posts:
    232
    Dang, this is such an excellent looking tool! Very useful
     
    Nicrom likes this.
  4. Nicrom

    Nicrom

    Joined:
    Nov 17, 2013
    Posts:
    421
    Implemented a new feature for the smoothed path. Now you can change the tension and bias of individual path nodes. Previously the tension and bias was the same for all nodes.

     
    Last edited: Jul 13, 2015
  5. Nicrom

    Nicrom

    Joined:
    Nov 17, 2013
    Posts:
    421
    Added a WebGL demo scene that showcases the foliage animation. WebGL Link.
     
    Last edited: Jul 15, 2015
  6. Nicrom

    Nicrom

    Joined:
    Nov 17, 2013
    Posts:
    421
    Added a new feature in Foliage2D that simulates a more realistic foliage bending.

     
  7. Bruno2Silva2

    Bruno2Silva2

    Joined:
    Mar 26, 2015
    Posts:
    17
    Good Works ;)
     
  8. Nicrom

    Nicrom

    Joined:
    Nov 17, 2013
    Posts:
    421
    Thanks. I hope to finish the tool by the end of the next week and publish it to the Unity Asset Store.
     
  9. Bruno2Silva2

    Bruno2Silva2

    Joined:
    Mar 26, 2015
    Posts:
    17
    I wish you much luck :)
     
  10. sluice

    sluice

    Joined:
    Jan 31, 2014
    Posts:
    416
    Cool stuff!

    How easy is it to implement? Curious to see a "How to" video once the asset is ready.
    What will be your asking price?
     
  11. Nicrom

    Nicrom

    Joined:
    Nov 17, 2013
    Posts:
    421
    Its very simple to implement in a scene. You just place a prefab in the inspector of the path object and it will automatically instantiate new objects along this path. The animation is done using an animator. The path object and foliage object can be created from the GameObject menu. I am thinking of 5$ for the price.
     
    sluice and Manny Calavera like this.
  12. Bruno2Silva2

    Bruno2Silva2

    Joined:
    Mar 26, 2015
    Posts:
    17
    I would buy your asset. If the banking agencies had not stopped with the currency conversion (Exchange) in my country (Brazil)
     
  13. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    It lacks features and terrain compared to Ferr2D.
     
  14. Nicrom

    Nicrom

    Joined:
    Nov 17, 2013
    Posts:
    421
    Foliage2D is not meant to be used for creating terrain, but simple foliage animations and regions of foliage along a path. That's why it will cost only 5$. It may not be obvious from the GIF's, but the grass on the path is composed of a number o individual objects, each with it's own mesh.
     
    Last edited: Jul 9, 2015
  15. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    You should at least propose some option, to have the foliage automatically adapt and follow some terrain sprites layer , using raycast functions or clicking the foliage would raycast below and would be placed above terrain 2D collision tiles.
    Without needing us to tweak it as it can become a borring and painfull workflow.
     
  16. Nicrom

    Nicrom

    Joined:
    Nov 17, 2013
    Posts:
    421
    That'a a good idea, though I don't think I will implement it in the initial version. I'll add it to my to do list for the updates after the version 1.0
     
  17. rxmarccall

    rxmarccall

    Joined:
    Oct 13, 2011
    Posts:
    353
    This looks awesome, should be the perfect companion for Ferr 2D. Will be a buy from me as soon as it is released.
     
    Nicrom likes this.
  18. Nicrom

    Nicrom

    Joined:
    Nov 17, 2013
    Posts:
    421
    Updated the WebGL demo scene to showcase the new foliage bending option and added a WebPlayer demo scene.
     
  19. Nicrom

    Nicrom

    Joined:
    Nov 17, 2013
    Posts:
    421
    Made a video tutorial showing how to use Foliage2D. Just a little more and it will be ready for publishing to the Asset Store.

     
    Last edited: Jul 14, 2015
    gwubgwub and rxmarccall like this.
  20. gwubgwub

    gwubgwub

    Joined:
    Oct 14, 2013
    Posts:
    68
    This looks awesome!
     
  21. Nicrom

    Nicrom

    Joined:
    Nov 17, 2013
    Posts:
    421
    Thanks. I'm glad you like it. Today I will submit the asset for review. It may be available on the Asset Store at the end of this week.
     
  22. rxmarccall

    rxmarccall

    Joined:
    Oct 13, 2011
    Posts:
    353
    Any news on this hitting the app store? Or still just waiting?
     
  23. Nicrom

    Nicrom

    Joined:
    Nov 17, 2013
    Posts:
    421
    I sent Foliage2D for review the previous wednesday. It takes around 5 to 6 working days for the Asset Store team to review an asset, so if it is accepted it should be available on the Asset Store around wednesday or thursday this week.
     
    Last edited: Jul 21, 2015
    rxmarccall likes this.
  24. Nicrom

    Nicrom

    Joined:
    Nov 17, 2013
    Posts:
    421
    Foliage2D just went live on the Asset Store Link.
     
    theANMATOR2b and Manny Calavera like this.
  25. Manny Calavera

    Manny Calavera

    Joined:
    Oct 19, 2011
    Posts:
    205
    Instant grab.. Thanks for the accessible price.
     
    theANMATOR2b likes this.
  26. Nicrom

    Nicrom

    Joined:
    Nov 17, 2013
    Posts:
    421
    You welcome.
     
  27. rxmarccall

    rxmarccall

    Joined:
    Oct 13, 2011
    Posts:
    353
    Hurray! Congrats and thank you as well for such a great price.
     
    Nicrom likes this.
  28. Nicrom

    Nicrom

    Joined:
    Nov 17, 2013
    Posts:
    421
    Thanks
     
  29. Too-Nerd-To-Die

    Too-Nerd-To-Die

    Joined:
    Apr 28, 2014
    Posts:
    44
    Mobile ready?
     
  30. Nicrom

    Nicrom

    Joined:
    Nov 17, 2013
    Posts:
    421
    I tested the demo scene on a Galaxy S4. Below are the results.
    The scene has 173 grass objects and 31 flower objects, all continuously animated.
    I got between 50 fps and 60 fps.

    You could obtain a better performance by disabling the foliage objects that are not visible to the player or by lowering the foliage density.
     
    Too-Nerd-To-Die likes this.
  31. Velcrohead

    Velcrohead

    Joined:
    Apr 26, 2014
    Posts:
    78
    Hi Nicrom,
    Just bought the asset. Can't tell if I'm being paerticularly dense or not (been a long day!).

    I'm trying to use the normal foliage 2d gameObject, and have played with all the settings trying to get it to animate. Am I missing something vital here?

    Thanks, really excited to be able to start using this!

    EDIT : I am a dumbass. Thanks anyway.
     
    Last edited: Sep 7, 2015
  32. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Good job.
    If you add later some option to have your foliage align with collision 2D shapes under it (or above for some games); and the ability to choose :
    - Distance at witch it will snap to other collision terrain shapes
    - Amount of offset in Y when you align it
    I will buy it to support you (even if i' not making a 2D game todday).
     
  33. Nicrom

    Nicrom

    Joined:
    Nov 17, 2013
    Posts:
    421
    I'll take your advice in consideration and see what I can do.
     
  34. Velcrohead

    Velcrohead

    Joined:
    Apr 26, 2014
    Posts:
    78
    Hi Nicrom, back again with what is most likely another stupid question.

    First off, I've implemented the Foliage2D system in my game and it is absolutely fantastic. It makes such an unbelievable difference and helps the world not look so stagnant / static!

    I am having a slight issue however. I am instantiating new versions of the Foliage2D objects at run time, and it's causing the animations of all the ones already in the game to pull to one side. I can provide pictures if you feel they would help.

    Also the asynchronous start doesn't seem to be working for me, once again, with instantiated ones.

    Thanks in advance.

    (And to everyone else reading this, it is a fantastic asset to use!)
     
    Too-Nerd-To-Die likes this.
  35. Nicrom

    Nicrom

    Joined:
    Nov 17, 2013
    Posts:
    421
    I'm glad you like it and it was useful to you.

    I think I know what the problem is. When you instantiate new foliage objects using a prefab, all the objects end up with the same mesh instance. To fix this, get the Foliage2D component of the foliage object and call the function RebuildMesh() like in the example below. instantiatedObject is the new instantiated foliage object.
    Code (CSharp):
    1. Foliage2D foliage2D = instantiatedObject.GetComponent<Foliage2D>();
    2. // The object mesh is recreated so that we don't have 2 objects with the same mesh instance.
    3. foliage2D.RebuildMesh();
    Let me know if this fixes the asynchronous start also.
     
    Last edited: Sep 12, 2015
  36. Velcrohead

    Velcrohead

    Joined:
    Apr 26, 2014
    Posts:
    78
    Yeah that has fixed it, thank you!
     
    Nicrom likes this.
  37. Nicrom

    Nicrom

    Joined:
    Nov 17, 2013
    Posts:
    421
    Those that use Unity 5.2.1 may encounter a problem when trying to animate a foliage object. For some reason in Unity 5.2.1, the Add Property menu in the animation windows shows only the first script. I assume this is some kind of Unity bug, as the previous versions do not have this behaviour. If you encounter this problem, move up the Foliage2D_Animation script, so it is the first in the inspector.
     
    Too-Nerd-To-Die likes this.
  38. sevensails

    sevensails

    Joined:
    Aug 22, 2013
    Posts:
    483
    Is it not possible to preview the offset animation while animating it? It will only works on runtime?

    Is it possible to animate the material texture? I want to use a sequence of textures.
     
    Last edited: Nov 27, 2015
  39. Nicrom

    Nicrom

    Joined:
    Nov 17, 2013
    Posts:
    421
    Editor preview is not implemented yet, I'll try to think of something for the future updates.

    Animation by using a sequence of textures is not included as an option at the moment. I think it would be possible to do this, but it would require some modifications of the code. Do you have some code of this animation. Maybe I can modify the tool for you?
     
  40. Manny Calavera

    Manny Calavera

    Joined:
    Oct 19, 2011
    Posts:
    205
    @Nicrom,

    Any ideas on how to animate the grass when a player/object falls on it?

    I'm thinking of maybe adding an extra trigger just above the grass and trigger 'tLeft' and 'tRight' on the nearby bushes. But maybe you have a better idea or something else planned?
     
  41. Manny Calavera

    Manny Calavera

    Joined:
    Oct 19, 2011
    Posts:
    205
    Or, if an object enters the existing trigger with a velocity.y < -1f (or some threshold) then trigger 'tLeft' and 'tRight' on the nearby bushes.
     
  42. Nicrom

    Nicrom

    Joined:
    Nov 17, 2013
    Posts:
    421
    Sorry for the late reply. Different time zone.

    Do you want this feature for the player only or for every object that interacts with the foliage? If only for the player that is not hard to achieve. Place the below code inside the for loop of the Update method in the Foliage2D_Animation script. Depending which character controller you are using you will have to change the instructions in the first if statement and in particular the segment that checks if the player is currently grounded.

    Code (CSharp):
    1. if (collider2DObject[i].tag == "Player" && !collider2DObject[i].GetComponent<PlatformerCharacter2D>().grounded)
    2. {
    3.     if (collider2DObject[i].GetComponent<Rigidbody2D>().velocity.y < 0 && !isBending && animator != null)
    4.     {
    5.         if (collider2DObject[i].transform.position.x > transform.position.x)
    6.             animator.SetTrigger("tLeft");
    7.         else
    8.             animator.SetTrigger("tRight");
    9.  
    10.         // We set "isBending" to true so that on the next frame the animators trigger is not set again.
    11.         isBending = true;
    12.     }
    13. }
     
    overthere and Manny Calavera like this.
  43. AMO_Noot

    AMO_Noot

    Joined:
    Aug 14, 2012
    Posts:
    433
    @Nicrom Thanks, just snagged this! Is there any way to add Unity Sprite support, rather than being confined to material? Comparability with 2DTK would be the most ideal but sprite support would be nice. I also second the animation preview request!
     
    Last edited: Mar 5, 2016
  44. Nicrom

    Nicrom

    Joined:
    Nov 17, 2013
    Posts:
    421
    Support for sprites as well as animation preview is something I plan to add in a future update. At the moment can't say for sure when that will be as I am working on other projects.
     
    AMO_Noot and Too-Nerd-To-Die like this.
  45. AMO_Noot

    AMO_Noot

    Joined:
    Aug 14, 2012
    Posts:
    433
    @Nicrom Any chance of Sprite support?
     
  46. Nicrom

    Nicrom

    Joined:
    Nov 17, 2013
    Posts:
    421
    Hi. It is something I plan to implement, but can't say for sure when that will be. Right now I am working on a major update for Water 2D Tool.
     
    Lars-Steenhoff likes this.
  47. sergioschiavo

    sergioschiavo

    Joined:
    Feb 11, 2014
    Posts:
    28
    This asset could be perfect if:

    1 - Would be possible to set the offset without the need to create animation
    -> also with the tleft/tright modifiers, also without the need to create animation
    2 - Support Sprite (instead of just texture)
    + bonus if supports spritesheet.
     
  48. Nicrom

    Nicrom

    Joined:
    Nov 17, 2013
    Posts:
    421
    These features are something I eventually want to add to Foliage 2D. Currently I am busy with other projects so I am not sure when I'll start working on them.
     
  49. sergioschiavo

    sergioschiavo

    Joined:
    Feb 11, 2014
    Posts:
    28
    I think I will do the tweak myself to use a tween function to offset (instead of using an animation). I still haven't checked your code, but would you have an advise on best the approach I could take?

    I have quite a lot of different foliage, and this update would be great for my project.
     
  50. Nicrom

    Nicrom

    Joined:
    Nov 17, 2013
    Posts:
    421
    Foliage 2D animations works by changing the value of the field "offset". This field can be found in the Foliage2D_Animation script. This is the field you should focus on if you want to implement another foliage animation system.