Search Unity

afs Advanced Foliage Package [released]

Discussion in 'Assets and Asset Store' started by larsbertram1, May 23, 2012.

  1. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    Version 2.0 now available

    Including the latest version of the advanced foliage shader v. 2.02 bringing multi touch bending and advanced ground lighting Find out more!

    $01_image.jpg


    Watch the package in action!
    http://bit.ly/LlRwvU (Demo of v1.0)

    Get it here:
    http://u3d.as/content/forst/afs-foliage-package/2Yv

    Simply paint your plants on top of the terrain or any arbitrary geometry
    Make sure you get the free "Geometry Brush AFS" tool: a very nice and handy tool that will help you to manually place any game object onto any terrain or geometry – originally posted by Matt McDonald, Owner, Chief Creative Officer and President of Heavy Water, www.heavyh2o.com, but optimized for the use with the advanced terrain shaders.
    http://dl.dropboxusercontent.com/u/2322017/GeometryBrushAFS.v1.unitypackage

    Main Features
    The package will bring advanced foliage to your terrains supporting wind, bump mapping, specular lighting, translucency and ambient occlusion

    • Use all the features mentioned above on any model – be it placed within the terrain engine or as a single game object.
    • Take advantage of batching, occlusion culling and even mesh combining to get the best performance for your game.
    • Includes version 2.02 of the afs Advanced foliage shaders which enhance the rendering of your foliage and grass.
    • Demo terrain (without trees…) is included showing how to get the best out of the models and shaders.
    • Full documentation on the shaders, how to set up your own models and how to speed up rendering is included.

    New in version 2.0
    • Improved normal maps
    • Minor fixes on the vertex colors

    $02_image.jpg

    $03_image.jpg

    $04_image.jpg

    $06_image.jpg
     
    Last edited: Sep 24, 2013
  2. Naison

    Naison

    Joined:
    Feb 21, 2010
    Posts:
    386
    Your demo is pretty nice but cut back on the bloom. :)

    I feel like it has too much exposure which is washing out the colors but that's just me.

    Good work!
     
  3. Avanger

    Avanger

    Joined:
    Aug 26, 2011
    Posts:
    258
    Good work man
     
  4. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    thanks a lot.
    and i will have a look at the bloom if i get some time... ;-)

    lars
     
  5. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
  6. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    hmm – any comments on the package?

    lars
     
  7. Daniel-Talis

    Daniel-Talis

    Joined:
    Dec 10, 2011
    Posts:
    425
    The framerate looks to be a concern. 10fps on such a small scene, is this correct?
     
  8. hjupter

    hjupter

    Joined:
    Dec 23, 2011
    Posts:
    628
    this support SM2?
     
  9. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    the framerate depends on your hardware – mine is pretty weak and the package was designed to be used on rather fast mashines.
    anyway: have a look at all other specs like number of draw calls, tris and vertices and the vram usage – then you will see that all those numbers are quite moderate which should give you a decent framerate on modern hardware.

    or just have a look at the demo to see how it performes on your computer: http://bit.ly/LlRwvU

    lars
     
    Last edited: Jun 12, 2012
  10. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    i guess it should – as i haven’t assigned any "#pragma target 3.0"

    lars
     
  11. mark24

    mark24

    Joined:
    Jul 3, 2012
    Posts:
    1
    I just bought this package and its great, but it looks like there is a white stripe down the stem of the nettle plant. Any idea what setting might need adjusting to fix this. The "CombineChildren" script didn't import because it conflicted with existing unity sources. I decided to just ignore it and it mostly works. I will just not use the nettle plant for now, but it would be nice to get it working. The rest of the package is great though!
     
  12. SevenBits

    SevenBits

    Joined:
    Dec 26, 2011
    Posts:
    1,953
    Very nice package. Runs a little poorly on my Win7 PC, but hopefully I'll get better performance on my Mac. Maybe cut down on the bloom effect, or add an option to change it? Also, are you using SSAO?
     
  13. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    thanks mark, but i can’t find the white stripe you talk about… it should be a texture problem, but my texture looks alright and so does the rendering of both nettle prefabs.

    lars
     
  14. Legacy

    Legacy

    Joined:
    Oct 11, 2011
    Posts:
    651
  15. Legacy

    Legacy

    Joined:
    Oct 11, 2011
    Posts:
    651
    any reason why it would cause those plants to look extremely bright like that? as i said we dont have access to any color properties so i cannot change it o_O
     
  16. 3dDude

    3dDude

    Joined:
    Jul 4, 2010
    Posts:
    1,067
    Nice, looks good
     
  17. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    hi Legacy,
    i am sorry that the package does not do what you would expect, but i am pretty sure that it exactly does what it was made for.
    please not: the advanced foliage shader needs carefully adjusted models with vertex colors assigned which control the bending and a special setup of the used texture-atlas. you will find further information in the documentation: http://bit.ly/JkLwD1.

    in case you want to use the shader within the terrain engine you will loose the built in "Hidden/TerrainEngine/Details/Vertexlit" shader or any hack of it as the "advancedFoliageShader for Terrainengine.shader" just overwrites it.
    next to that you will have to create a texture atlas including all meshes you would like to use within the terrain engine and map your models to this atlas. but using a manually generated atlas won’t let you use any grass rendered as billboard or simple texture, as adding this kind of grass would add a second texture to the internal texture atlas of the terrain engine and corrupt the texture lookup within the manually setup atlas.

    in case you do not want to use the shader within the terrain engine but only on manually added plants just rename the shader "advancedFoliageShader for Terrainengine.shader" to "advancedFoliageShader for Terrainengine.__shader" so it will not get compiled.

    As far as colors are concerned: all models should share the same material. this is the reason why you can’t change the color on any individual plant/model. colors assigned in the "edit detail mesh"-dialog of the terrain engine are used to control bending as they are added to the manually assigned vertex colors of your models by the terrain engine. but there is one exclusion which is red/vertex color red which controls the bending phase and also adds different shades of the main texture in the surf function of the shaders which might lead to very bright results:
    Code (csharp):
    1.  o.Albedo = c.rgb * IN.color.a * (IN.color.r + 0.6);
    if you do not want this just replace the line by:
    Code (csharp):
    1.  o.Albedo = c.rgb;
    but the brightness you have mentioned just could be caused by the fact that the shaders support specular lighting... and to be honest: assuming that the 2 plants next to your character are some kind of "agave" they look pretty cool to me and much better than all other plants.

    i hope this helps. otherwise do not stop to ask,


    lars


    btw: your scene looks pretty cool. i hope we will see a webplayer soon…
     
    Last edited: Jul 12, 2012
  18. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    Update
    Bugfix in order to make foliage placed within the terrain engine bend correctly on windows.
     
  19. Hynopsis

    Hynopsis

    Joined:
    Oct 25, 2012
    Posts:
    60
    Strange...the shaders work fine inside the "Play Mode" but when I build the game it doesn't work...any ideas?
     
  20. napster

    napster

    Joined:
    Jun 15, 2012
    Posts:
    313
    Looks realistic and beautiful !
     
  21. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    hi hypnosis,

    i haven’t had this kind of problem in unity 3.x – but in 2.x you had to assign any hacked terrain shader to a game object within your scene (like a simple cube) in order to get the shader exported. may be this helps.
    but as i have written before: i never had to do so in 3.x – pretty strange.

    lars
     
  22. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    thanks. i hope you enjoy it.

    lars
     
  23. DesertRaven

    DesertRaven

    Joined:
    Jul 15, 2012
    Posts:
    137
    Looks realistic, though a bit thin, can you make a more lush package with some bushes and larger clusters of the nettles? Also while you are at it add some lupines and more verities of flowers. More different fern types with rolled leaves and unrolled leaves.

    Thanks
     
  24. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    hi raven,

    more plants might come in another release – but it would be very difficult to combine them with other models as the terrain engine needs a manually combined texture atlas…
    larger clusters of nettles would not be a good idea as they would produce a lot of floating nettles on slopes. so simply add more and more nettles manually.

    lars
     
  25. oddbody1

    oddbody1

    Joined:
    May 14, 2013
    Posts:
    5
    Hi Lars,

    Is it possible to apply the shader to a character or a skinned mesh.
    If so, I'm definitely buying it.

    thanks,

    e1
     
  26. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    hi e1,

    i do not see any reason to use the shader on a character or skinned mesh.
    you already have shaders for bumped specular lighting, so you want wind animation on a character?
    i guess not.
    so you want translucency? well, if so there are other shaders that offer this feature which probably fit much better to your needs.
    this shader has been made to work on foliage within the terrain engine or placed as independent game object.


    lars
     
  27. oddbody1

    oddbody1

    Joined:
    May 14, 2013
    Posts:
    5
    HI,

    Thanks for the answer.
    Actually I do want foliage/simple moving elements on a creature :
    For example moving leaves on a faerie or small tentacles on a sea monster

    In blender I can do this using hair particles, but in unity there is nothing similar,
    except the terrain foliage shader. I don't need the moving elements to be complicated
    geometry, just a billboard/plane with a texture on it would be enough.

    e1

     
    Last edited: May 15, 2013
  28. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    then i guess you will have to assign a second material (shader uses a alpha cut out and the forward pass due to lighting and translucency) and apply vertex colors to the parts that should be rendered using the foliage shader in order to control bending.
    so theoretically it should work.

    lars
     
  29. EhsanNeo

    EhsanNeo

    Joined:
    Aug 22, 2012
    Posts:
    17
    Hi.

    I have a problem with the shader and global fog image effect. the leafs does not render with global fog. O change the global fog script according to this page http://forum.unity3d.com/threads/123803-Global-fog-and-transparent-shaders

    It works with natural unity foliage shader but not with ats

    I tryed to fix it and figured out the problem is with "RenderType"="AtsFoliage"

    can you plz help

    thx
     
  30. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    hi EhsanNeo,

    i do not know anything about the modifications of the global fog script – but i have just tested the latest version (v.2) of the foliage package which is coming soon incl. the afs advanced foliage shaders v.2 and it works right out of the box with global fog.
    so may be you will just have to wait for some days…

    lars


    afp v2 / gloabl fog / deferred rendering / unity 3.5
    $globalFog.jpg
     
  31. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    hi there,

    version 2.0 is online!
    next to some improvements on the textures it ships with version 2.02 of the advanced foliage shaders giving you:

    * advanced multi touch bending
    * advanced grass shader which lets you place grass like objects simply anywhere – always lit properly according to the underlaying geometry
    * advanced foliage shader supporting ground based lighting

    Find out more following the official thread:
    http://forum.unity3d.com/threads/133398-Advanced-foliage-shader-released


    Simply paint your plants on top of the terrain or any arbitrary geometry
    Make sure you get the free "Geometry Brush AFS" tool: a very nice and handy tool that will help you to manually place any game object onto any terrain or geometry – originally posted by Matt McDonald, Owner, Chief Creative Officer and President of Heavy Water, www.heavyh2o.com, but optimized for the use with the advanced terrain shaders.
    https://dl.dropboxusercontent.com/u/...1.unitypackage

    lars
     
  32. Reigner

    Reigner

    Joined:
    Sep 24, 2013
    Posts:
    3
    It appears that the link is broken. Is there another?
     
  33. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
  34. Robert-Briscoe

    Robert-Briscoe

    Joined:
    Jul 4, 2013
    Posts:
    19
    I just bought this package so that I could paint foliage on meshes other than terrain, however when attempting to add my FBX to the Geometry Brush tool the button "Add Selections to Brush" stays disabled no matter which mesh/fbx I try to select in my project:



    In fact the only meshes I was able to add were the ones that came with the tool!

    Can you give me any insight as to what is going wrong here? I bought this package specifically for this function and am stuck without it!

    Thanks,
    Rob
     
  35. Robert-Briscoe

    Robert-Briscoe

    Joined:
    Jul 4, 2013
    Posts:
    19
    Ok what the Geometry Brush Tool Documentation failed to include is that the foliage object must be a prefab! Im now able to add my foliage to the tool but when I paint the object it is rotated onto it's side ugg! I think this has something to do with the fact Unity converts the FBX from Max's Z up to Unity's Y up axis, rotating it by -90. I guess I will have to manually rotate my models in max...
     
  36. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    hi robert, i can’t tell you anything about max.
    but i have tested the geometry brush with fbx written in modo and maya. both worked perfectly.
    same with prefabs…
    so i do not really know what causes your problems.

    lars
     
  37. David-Lindsay

    David-Lindsay

    Joined:
    May 20, 2009
    Posts:
    121
    Dear Lars,

    I am creating a scene for mobile and run into a problem with AFS. Maybe you can offer advice or a solution?

    For performance reasons, I have lightmapped my scene and removed all the lights, and are using light probes to light characters or dynamic objects instead of real time lights. There are no real time lights in the scene and I can achieve very high FPS. The camera mode is vertex lit. In other words, everything in this scene is self-lit.

    AFS doesn't have an option to be self-lit. It requires a real time light. Also, beast won't allow me to lightmap the objects, which is somewhat noted in your documentation -beast refuses to accept the static tag of AFS shader objects.

    The benefit of not using real-time lights for mobile devices is staggering -the performance boost is huge. So I want to hold onto this advantage and would like to have a work around to keep my nice AFS plants, grass and foliage.

    I had a look at the shader code and it's rather beyond me.

    Is it possible to remove lighting calculations from the shader and have a base light value? RGB (0.5, 0.5, 0.5) or (128, 128, 128)
    Or is there some other easy solution I am overlooking?
     
  38. David-Lindsay

    David-Lindsay

    Joined:
    May 20, 2009
    Posts:
    121
    Just an update to my previous post:

    The animation is beautiful on the shader.

    Is it possible to have a version of the AFS shader that has no cast or receive shadows and is self lit by emissive color?

    Basically a stripped down, minimum performance-hit version?
     
    Last edited: Feb 18, 2014
  39. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902

    hi david,

    i might have a look into this.
    however this will take a while. and which shader do you exactly mean? there is a whole bunch of shaders in the afs package…

    lars
     
  40. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    hi david,

    and the shaders already work with vertex lighting… which should at least be pretty cheap to rener.
    have you tested this?

    lars
     
  41. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    oh sorry – i have just noticed that i am in the wrong thread.
    you need the advanced foliage shaders > version 2.? i don’t know right now to use vertex lighting.

    lars
     
  42. David-Lindsay

    David-Lindsay

    Joined:
    May 20, 2009
    Posts:
    121
    Okay, I tested again to make sure with the profiler.

    The standard AFS shader is pretty good as is right now as long as the camera is forward/vertexlit and the light source has no shadows. So, no need to emissive shader addition. Thanks for the suggestion.

    However, for mobile devices (and when not particularly close to the camera), the bump-spec-trans is something that could be removed for performance in situations where it doesn't add value to the visual impact of a scene. If the material was one texture only, this could improve the shader efficiency in dense foliage areas.

    Basically, if there was a version of the basic foliage shader specifically for ultra performance, usable only with non-touchbending, non-terrain compatible plants, this could improve performance on lower end mobile devices. Shadow casting, shadow receiving, bump, specular, translucency are just possibilities of what could be stripped to make an excellent mobile device version that has excellent performance.

    In other words, a simplified (albeit uglier) shader version certainly does have its uses on certain platforms and devices. I can only speculate as to what changes would enhance performance -you would know much better.

    Anyway, that's basically the suggestion. We will use AFS in our next mobile game anyway. But if there was an even higher efficiency shader option, we'd switch to that in a second. :) Thanks for listening!
     
    Last edited: Feb 19, 2014
  43. David-Lindsay

    David-Lindsay

    Joined:
    May 20, 2009
    Posts:
    121
    I have version 2.042

    The ATS mobile package is nice, but the shader animation nowhere near as cool as the AFS package
     
    Last edited: Feb 19, 2014
  44. botumys

    botumys

    Joined:
    Apr 16, 2009
    Posts:
    707
    Hi Lars,

    I have a problem with billboards when I use global fog camera fx.
    Here's an image:

    $zbilb.jpg

    Billboards seem to be placed behind the fog and not into it. It occure only on the skybox, if there is a mesh behind, it's ok.
     
  45. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    hi botumys,

    that is a common problem with the global fog fx and any transparent shader. it is and not related to the billboard shader.
    sorry but there is nothing i can do about this,

    lars
     
  46. David-Lindsay

    David-Lindsay

    Joined:
    May 20, 2009
    Posts:
    121
    Hi Lars, sorry about the late reply.

    Cutting to the very core of the problem. When I use the mobile shaders, the animation is different, not as attractive, less realistic. This might be something I'm doing. But I'm not sure why. It seems like the vertical vertex displacement is much greater with the mobile shaders, and the phase modification seems different too.

    Should I reapply the AFS plant tool again and increase types of bending? Or should I re-paint the vertices? How can I improve the animation effect for the models with mobile shader (models which I originally created for the advanced shaders).
     
  47. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902

    hi david,

    i have spent a lot of time on the animation function of the advanced foliage shader so i doubt that you can achieve anything similar using the mobile shaders by just reworking your vertex colors.
    porting advanced bending from afs to the mobile shaders would be the right way i think.

    lars
     
  48. David-Lindsay

    David-Lindsay

    Joined:
    May 20, 2009
    Posts:
    121
    Okay, i see.

    Depending on the scale of the scene and the LoD solutions and camera angle and so on, I think I can make the advanced shader work for me on mobile if everything is cleverly atlased. It doesn't have any compatibility issues so far on 5 android devices or iPhone 4 and 5, so that's fine for me.

    For my lightmapping issues, since lightmaps are not supported, I will use duplicates (a light version and dark version of the each plant), as suggested for grass in the mobile foliage shader documentation.

    For my asset size considerations, I will attempt to remove the need for a second texture in the advanced foliage shader so that only diffuse is necessary (don't need bumps, gloss, spec). If I run into any problems, I'll let you know by PM.
     
  49. SuperNewbee

    SuperNewbee

    Joined:
    Jun 2, 2012
    Posts:
    196
    Hi

    Does anyone know if AFS 3 will be a free upgrade from AFS 2? Should I use AFS2 (which I already own) or should I wait for AFS 3 ? Thanks
     
  50. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    hi there,

    afs 3 will be a free update to afs 2 but this is the thread of afp ;-).
    so if you own the advanced foliage package (not the shaders) you won’t get the update.
    afs however is on sale today...

    lars