Search Unity

Assets Critias Vegetation System [Asset Store]

Discussion in 'Works In Progress - Archive' started by Assembler-Maze, Sep 14, 2017.

  1. SirTwistedStorm

    SirTwistedStorm

    Joined:
    Sep 20, 2015
    Posts:
    192
    I'm stumped trying to figure out how you get 500 fps, any tips?
     
  2. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    When I've developed my system I had the luck to ask an expert graphic programmer that worked on Ubisoft's Anvil engine (for Ghost Recon) , and that is how they manage their foliage. I also have the confirmation that the guys at 'Horizon Zero Dawn' did the same. I haven't pulled the meshes out of my head, I've asked people with more skill than me first.
     
    nirvanajie and SirTwistedStorm like this.
  3. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    yeah, draw them as quad and place the textures into a single texture so they all share the same material/texture
    in theory it should run slow because of all the transparency overdraw but my experience so far has been the opposite. Using meshes I've got tons of complains from people saying it was slow to crap and using billboards it runs perfectly fine. www.dogfightelite.com if you want to download the pc version, using quads.

    With meshes the advantage that you get is that it looks better: you can get 4 times the density of grass. So it looks more populated. But speed wise... i've never seen it run faster than regular quads, under any scenario. Then only thing that runs faster than quads is if you draw the grass using dx11 shaders, which is gpu based system.
     
    SirTwistedStorm likes this.
  4. shamsfk

    shamsfk

    Joined:
    Nov 21, 2014
    Posts:
    307
    I just modified my review and thought "oh well this CFS is kinda nice despite some drawbacks"

    but then

    NullReferenceException: Object reference not set to an instance of an object
    CritiasFoliage.FoliagePainter.ProcessSubCell (CritiasFoliage.FoliageCellSubdividedData cell) (at Assets/CritiasFoliage/Code/FoliagePainter.cs:1760)
    CritiasFoliage.FoliagePainter.ProcessCell (CritiasFoliage.FoliageCellData cell) (at Assets/CritiasFoliage/Code/FoliagePainter.cs:1735)
    CritiasFoliage.FoliagePainter.<Update>m__4 (Int32 hash) (at Assets/CritiasFoliage/Code/FoliagePainter.cs:1651)
    CritiasFoliage.FoliageCell.IterateNeighboring (FoliageCell cell, Int32 depth, CritiasFoliage.FoliageIterationAction action) (at Assets/CritiasFoliage/Code/FoliageCell.cs:174)
    CritiasFoliage.FoliagePainter.Update () (at Assets/CritiasFoliage/Code/FoliagePainter.cs:1645)

    and half a day of work is gone, and there is no grass on the scene (and I didn't add no new meshes, and I didn't remove no mesh as on MAc I can't, there is no Delete)
     
  5. shamsfk

    shamsfk

    Joined:
    Nov 21, 2014
    Posts:
    307
    Well, it sucks I hope it never happens again. But I used that to recreate grass field. And found out that CFS places grass not like the terrain does. CFS uses density just to guide itself how much to place here and now, but terrain uses strength to decide an overall density in the painted area and it is much better in many cases.

    I managed to make the same looking field with 7k vs 15k clusters, but it is kinda a pain to always think not to draw twice on the same spot and to tweak the density first hand.

    You should have 2 modes one like current and another with the target value, that will increase/reduce the number of details to match it, it is very useful mode.

    Currently, CFS is not meant to precise work, it favors broad strokes, but to make a playable scenery we sometimes need a lot of control like target density or small brushes.
     
  6. shamsfk

    shamsfk

    Joined:
    Nov 21, 2014
    Posts:
    307
    And one more problem arrived. How do I bake navmesh? T_T
    This is critical!


    If I'm correct and it still was not though after. Then there is a quick hack, just make a script to export some primitives like cylinders or colliders under one parent in the root of a scene with no renderer, just mesh and navigation static flag. Make a button to update it or even better update it on save.

    It is an absolute must to bake some objects into navmesh, like trees. There should be a checkbox indicating that possibility.
     
    Last edited: Dec 8, 2017
  7. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Hello,

    Thank you very much for the feedback. For some issues you have pointed out I really hope that I can provide an explanations.

    1. Overriding Ctrl+S on save is king of hacky and it is not properly supported by the unity editor, I can't inject my event on a save. I was forced to stick to other key combination. You can modify the 'F4' with 'Ctrl+A' or something else if you wish. It will be the same with undo (Ctrl+Z), I can't use that I'll have to rely on other key combinations. For the 'mac' delete of foliage I'll add another possible key combination, really didn't thought at it.

    2. Thank you for pointing out the difficulty of painting, I am aware that some people (unlike I've initially designed) might use the system as a painter. However there is a major difference between something like Prefab Painter and my system, that is not designed to paint, but more like extract and render. However thanks for pointing Prefab Painter out, I'll check it out to see how it feels, and try and improve mine.

    3. For the performance problem, the fact that you have the same performance it is expected, I think I've repeated on this forum at each performance post, I've added it to the documentation and I've put it in the video tutorials, with no avail. Using 4vert grasses will not only keep your previous performance at the same level, but it will also make it worst! Hardware instancing works good with grass that has 200-300+ triangles and very well optimized shaders. For how grass looks in modern games try out this talk: https://80.lv/articles/artem-brizitskiy-master-of-digital-foliage/
    Or see my foliage used in the video demo: 265 triangles, 100+ FPS on a GTX970 with millions of instances and good performance on a GTX750. And it looks way better than billboard grass. Grass.jpg

    4. Navmesh baking, is indeed a major issue, I've added it to my URGENT update list. Usually people extract the trees from a terrain and those are taken into consideration when baking the navmesh or distance shadowmaps, but for people that manually paint them, I haven't thought at a solution, sorry. I'll probably add a button, so that when you are not using runtime colliders, you can bake the colliders in the map with objects set to 'static' and that will generate the navmesh.
     
  8. shamsfk

    shamsfk

    Joined:
    Nov 21, 2014
    Posts:
    307
    Hi! Thank you for the reply!

    Six things to point out:

    0) I found a new, not too big but still a problem - AQUAS tries to reflect all the 10k of my grass meshes, I need to somehow choose what layer they reside on.

    1) The button problem is not with the exact button, but with the fact, work vanishes if you forget to save it. Would be nice to have it saved automatically or at least not vanish on entering playmode.

    2) While CFS is not a painter, there is no other decent way to paint while I switched to CFS. I have no more trees nor grass on terrain (I'm ditching terrain entirely to replace with meshes)

    2.1) Undo is needed, not critical, but it is quite unpleasant to work without it.

    2.2) Please add a selection of layer mask to paint on

    3) I'm already using this grass setup from the beginning I converted to CFS, I replaced terrain grass with 10k speedtree grass clusters. But not as big as one on your picture due to that big of cluster won't bend. Or is there a way to bend it nicely in CFS? I would gladly convert to bigger ones.

    https://imgur.com/a/9j9hw (2 clusters on a small screenshot there each is 112 polys)

    4) Navmesh is indeed urgent

    5) I notice visible fps hickup when turning my head to the general area were most of 10k grass clusters reside. After a moment it runs smoothly. Can it be dealt with?
     
    Last edited: Dec 9, 2017
  9. shamsfk

    shamsfk

    Joined:
    Nov 21, 2014
    Posts:
    307
    The more I work with CFS the more I feel like there needs to be a way to export objects from CFS to the project and back. By mesh type to mesh type case, like checking mesh types to export and then doing it. It would solve a Navmesh issue right away as I could export trees, bake navmesh, delete trees or disable them. And it will allow making some fine edits.

    And I would feel much safer knowing that I can opt out if something goes wrong, or just that I can backup my foliage in a Unity's native format.
     
    Last edited: Dec 9, 2017
  10. shamsfk

    shamsfk

    Joined:
    Nov 21, 2014
    Posts:
    307
    Just a little shout praising CFS :)

    Despite all the downsides, it is a great system, I managed to have the lushest smalll island with LOTS of grass and playable fps.

    https://imgur.com/a/YK5Mh
     
  11. shamsfk

    shamsfk

    Joined:
    Nov 21, 2014
    Posts:
    307
    In the game, I have a camera rotated around a character in player's control. It is kinda isometric and has FOV of 35 and is at a quite distance from the character. So by rotating it around player triggers CFS foliage bounds quite a lot. Is it possible (and is it viable) to calculate draw distance of a foliage not based on camera position, but on some transform's position (like character)?
    It is quite a sight to see grass growing in a distance while you rotate around your character.
     
  12. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    0) Inside the 'FoliageRenderer' script you can set your render layer and render camera. Render your grass for a specific camera or maybe render it on a layer called 'Foliage' and disable that layer for the water's reflection

    1) I'll try to find a callback or something when you enter play mode to auto-save but I think at that moment of coding I could not find a workaround

    2) Ok, I've said that it is already on the list

    2.1-2.2) Ok, no problem, will do my best

    3). Are you talking about wind bending? I've managed to do that in the SpeedTree grass creator with the custom wind, it works just fine for me even with larger clumps. However 100vert grass is decent, I don't know how your game performs, and your target platforms, I'd optimize based on that

    4) Added to the urgent list

    5) Does it happen with a final build too? Or just in edit mode? I'll have to try and reproduce it myself (I think it happened for me but only in edit-mode) and see where the hiccup comes from
     
  13. shamsfk

    shamsfk

    Joined:
    Nov 21, 2014
    Posts:
    307
    No, I mean bending on contact with a player, a large cluster of grass bends as a solid pice which looks weird. So I'm forced to use small clusters. T

    I haven't tested it in build, everything is in the editor now.




    Is there a way to have more than 1 transform affecting grass bending? Say not only the player but also several monsters around.
     
  14. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    1. I think that CryEngine solves that by using a physics component for all 'active' grass blades, that means more CPU work and less GPU but at the moment I am unsure what path to take with grass interaction. In Unreal I think that will be the future approach too, looking through the beta source code. In Uncharted 4 only the main character affects the small close-by grass while vehicles use render textures and grass get their bending data applied from a texture.

    All the 'real' solution would take a lot of time to implement, and I'd call them major features. For your needs I'd just enlarge the array from only the player's position to an array of a maximum of 'monsters' that can affect the close by grass. Unfortunately I would really really not have time to do this myself, the update list is huge with a lot of bugs and improvements. However I'll certainly add it to the update list, I hope that I can publish at least the 'easy' workaround.

    2. Test it in build, I think that it should work fine then. If there are hitches (and I'll check for them too) I'll look into it and see what might cause them. Maybe an allocation or visibility calculation, however I'll try and solve it.

    Thanks!
     
  15. shamsfk

    shamsfk

    Joined:
    Nov 21, 2014
    Posts:
    307
    Thanks! It is not urgent, but can you point me to a code points, were to change that array with a general description of how, so I could try to do it myself?
     
  16. shamsfk

    shamsfk

    Joined:
    Nov 21, 2014
    Posts:
    307
    and please, look at that:
    This is a very needed feature. I'm in constant stress due to the fact that all my foliage is stored in a way I have no direct access to. And it will fix navmesh thing as I said earlier.
     
  17. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Starting at line 93 in 'WindTree_Grass.shader' you can modify the 'CRITIAS_Bend_Position' to be an array and an extra count parameter to know how much to iterate through it (like CRITIAS_Bend_Position_Count). Except that it might get a little bit stuffy since you need to update for all your game objects that you want to affect grass their position in the renderer each frame. It would involve both CPU and GPU work, so maybe if you are too busy you can wait for the next update where I'll try to stuff that part in.

    For the collider/conversion I've added it to the important immediate update list, since I consider that navmesh walking is vital for any game.
     
  18. shamsfk

    shamsfk

    Joined:
    Nov 21, 2014
    Posts:
    307
    https://imgur.com/a/ncGZD

    so much work.....

    I didn't even touch foliage for hours as it was finished!

    It is unacceptable.
     
    Last edited: Dec 11, 2017
  19. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    So I saw a post a while back about no runtime api to change stuff. But it was also mentioned it was inherently designed to support it. So I'm curious how much work it is to add in, assuming an experienced dev. Like are the core abstractions needed there? Or is it more a case of a number of things need to be abstracted out more?
     
  20. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    With the modifications I'm starting now, I'll add some option to clean the foliage data, because if some type is removed from the file without removing it from the system first, things might go very wrong. And make sure that you use SVN and backup often to revert to a working copy in case something goes wrong.

    For the runtime api there is current support for adding/removing trees to the system, if that is enough then it is quite fine. If you also require grass, you can do that too, I'd estimate it at maximum 1 week of development (it would take me about 3 days if I'd have the time) if you are not familiar with the codebase. When I say that I am thinking 'Horizon Zero Dawn' style procedural placement in nearby foliage cells, with runtime grass appending.
     
    Last edited: Dec 12, 2017
  21. shamsfk

    shamsfk

    Joined:
    Nov 21, 2014
    Posts:
    307
    I removed nothing. It just broke. The only thing that happened that time was unity to crash. And after the relaunch, it was that way.
     
  22. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Probably the crash corrupted the file io data somehow. Unfortunately that can happen with other software not only mine. I've got a corrupted blender file one time, another time with a photoshop file. You should use SVN, it will prevent issues like that from happening again.
     
  23. shamsfk

    shamsfk

    Joined:
    Nov 21, 2014
    Posts:
    307
    Yeah, I was out of the town, with almost no internet for several hours. Got back and only thing I've got to do was to rant.

    PLEASE, make a small script to export objects out of CFS into the scene. I would like to export my last saved foliage to modify it in editor.
     
  24. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Yes, no problem, in fact I was working on that right in this moment. I hope that until Friday I can send to the store the next update.
     
  25. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    V 1.3 is in currently in review. Stay tuned!
     
    GingerDr73 and shamsfk like this.
  26. lod3

    lod3

    Joined:
    Mar 21, 2012
    Posts:
    679
    @Assembler-Maze

    Does extracting foliage from gameobjects currently work? I followed the documentation, and ended up repeating the steps from scratch four times, but nothing is being extracted.

    Testing in an empty scene with 8 SpeedTree trees. StreamingAssets folder was the first thing I created. After each attempt to extract, F4 was pressed to save. But, absolutely nothing happens. The trees don't even appear as foliage types in Critias_Painter after extracting, so that's probably the biggest clue that it isn't working for me.

    Of the 4 attempts, 2 were done with the 8 trees nested under an empty gameobject, which was then inserted into the gameobject slot of the window that appears after pressing Extractor. Auto-Extract is unchecked as it's not a terrain (I did try it once just in case, but it had no effect).

    The last 2 tests I dragged each of the 8 trees individually into the Extractor slots, but that yielded nothing as well. I've exhausted the manual and out of ideas. Running 2017.2.0f3 with DX11 on Win10.

    Edit_01: Hope this helps. I noticed Critias made a save file from my trees anyway, but it's only 1kb. I've attached it.

    Edit_02: Did one last test to rule out a conflict by creating a new project with only CFS and the American Elm SpeedTree, repeated the same steps as previously, but still nothing extracts.

    Edit_03: Figured it out, but not sure why it wasn't mentioned in the manual. For gameobjects at least (not tried with a terrain), all foliage parented to a gameobject for extraction must first be added to Critias_Painter as existing foliage types.
     

    Attached Files:

    Last edited: Dec 14, 2017
  27. timothy92

    timothy92

    Joined:
    Mar 7, 2016
    Posts:
    12
    Can we please just get a public bool toggle for the Foliage logs on the, they are so tedious and the instructions on how to turn them off are so unclear.
     
  28. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Hello,

    Make sure that the foliage types that you wish to extract appear as foliage types in the foliage inspector BEFORE extracting the trees. Follow these steps:

    1.(IMPORTANT) Manually add the tree prefab to the foliage inspector. It can be done with drag&drop
    2. Add the trees to an empty game object at location 000
    3. Extract the trees

    Auto extraction works only for terrains, for other stuff you have to manually add the types in the inspector. If the problem still persists contact me here again anytime.
     
    lod3 likes this.
  29. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Sorry, but since those are in a static class and have conditional compiling for extra performance I didn't wanted to make them dependent upon a dynamic class.

    However you can change the 'Foliage.cs' file line 18 from 'private static int DEBUG_LEVEL = DEBUG_INFO;' to 'private static int DEBUG_LEVEL = DEBUG_WARNING;'
    That will only print errors and warnings.
     
  30. lod3

    lod3

    Joined:
    Mar 21, 2012
    Posts:
    679
    Heh, just posted the same thing. I'd add this step for extraction in the manual. The verbiage sounded like extraction would handle this (but not configure foliage types unless coming from a terrain).
     
  31. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Sorry, I should have been more clear in the docs. Yea, bad docs can be a time waster :(. Will modify them now.
     
    lod3 likes this.
  32. lod3

    lod3

    Joined:
    Mar 21, 2012
    Posts:
    679
    No worries!
     
  33. lod3

    lod3

    Joined:
    Mar 21, 2012
    Posts:
    679
    @Assembler-Maze

    Just tried making a build that failed with these 2 errors:

    Shader error in 'Critias/WindTree_Grass': Did not find shader kernel 'frag_surf' to compile (on d3d11)

    Compiling Fragment program
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME

    As well as:

    Error building Player: Shader error in 'Critias/WindTree_Grass': Did not find shader kernel 'frag_surf' to compile (on d3d11)

    Compiling Fragment program
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME

    Any ideas?

    Edit: As before, to ensure no outside conflicts, I tried to make a build in a clean project with only CFS and SpeedTree, but it also failed. This time with more errors:

    Shader error in 'Critias/WindTree_Grass': Did not find shader kernel 'frag_surf' to compile (on d3d9)

    Compiling Fragment program
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP


    And:

    Shader error in 'Critias/WindTree_Grass': Did not find shader kernel 'frag_surf' to compile (on d3d11)

    Compiling Fragment program
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME


    And:

    Shader error in 'Critias/WindTree_Grass': invalid input semantic 'POSITION': Legal indices are in [1,15] invalid ps_3_0 input semantic 'POSITION' at line 253 (on d3d9)

    Compiling Fragment program with LOD_FADE_CROSSFADE GEOM_TYPE_BRANCH
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP


    And:

    Shader error in 'Critias/WindTree_Master': invalid input semantic 'POSITION': Legal indices are in [1,15] invalid ps_3_0 input semantic 'POSITION' at line 165 (on d3d9)

    Compiling Fragment program with LOD_FADE_CROSSFADE GEOM_TYPE_BRANCH_DETAIL
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP


    And:

    Shader warning in 'Critias/WindTree_Master': 'LOD_FADE_PERCENTAGE' : macro redefinition at Assets/CritiasFoliage/Shader/WindTree/Tree/WindTree_Include/WindTreeCommon_Master.cginc(14) (on d3d9)

    Compiling Vertex program with DIRECTIONAL LOD_FADE_PERCENTAGE GEOM_TYPE_BRANCH_DETAIL
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP


    And finally:

    Shader warning in 'Critias/WindTree_Master': 'LOD_FADE_PERCENTAGE' : macro redefinition at Assets/CritiasFoliage/Shader/WindTree/Tree/WindTree_Include/WindTreeCommon_Master.cginc(14) (on d3d11)

    Compiling Vertex program with DIRECTIONAL LOD_FADE_PERCENTAGE GEOM_TYPE_BRANCH_DETAIL
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME


    Hope that helps.
     
    Last edited: Dec 14, 2017
  34. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Yes, the errors come due to the fact that the version of unity is quite unstable. They don't seem to affect the running of the system, just re-import the shaders and the errors should go away.
     
    lod3 likes this.
  35. lod3

    lod3

    Joined:
    Mar 21, 2012
    Posts:
    679
    Re-importing fixed it, but, I guess I'll have to download the latest version of Unity as I did 2 builds with identical scenes (16 Elm trees), one build with CFS, and the other without. With Vsync disabled to measure FPS (via FRAPS), the CFS build ran an average 350FPS, but the same scene without CFS was a steady 500FPS. Hoping it's just Unity. I'll report back with my findings once I've tested using the latest version of Unity.

    Edit1: Got CFS working, tweaked some settings to improve performance, but not sure what to make of it. In-editor CFS show a 50-100FPS boost (Average 1250-1300FPS) vs. without CFS (Average 1175FPS-1240FPS), but when a build is made, the table is flipped. Seeing 450FPS using CFS, but 550FPS without. Attached a comparison image. Still planning to test a newer version of Unity, but feeling like that will just fix the Wind Grass shader (that has to be re-imported every time before making a build). Fingers crossed.
     

    Attached Files:

    Last edited: Dec 14, 2017
  36. shamsfk

    shamsfk

    Joined:
    Nov 21, 2014
    Posts:
    307
    My guess is that CFS has some overhead. Try much more tightly populated scene, it may show different results.
     
  37. lod3

    lod3

    Joined:
    Mar 21, 2012
    Posts:
    679
    Thanks for the reply! I attached a topdown image of the above posted screenshots. It's pretty tight :)
     

    Attached Files:

  38. shamsfk

    shamsfk

    Joined:
    Nov 21, 2014
    Posts:
    307
    I meant not their tight relative position but making 5000-10000 trees scattered around and then looking at it.
     
    lod3 likes this.
  39. lod3

    lod3

    Joined:
    Mar 21, 2012
    Posts:
    679
    I see what you mean now. That's a shame; the intended scene is small and dense, not an open world. I estimate no more than 150 trees total. If this tool is intended for open worlds with thousands of trees, then I suppose CFS will not help me. Thanks for the tip!
     
  40. shamsfk

    shamsfk

    Joined:
    Nov 21, 2014
    Posts:
    307
    I have a small island with ~100 trees, but 30 000 grass clusters to make it green and lush and CFS works well.
     
  41. lod3

    lod3

    Joined:
    Mar 21, 2012
    Posts:
    679
    How is your CFS performance with just the trees, compared to not using CFS?
     
  42. shamsfk

    shamsfk

    Joined:
    Nov 21, 2014
    Posts:
    307
    Hi! There is a bug in 1.3 with navmesh. I have 2 types of sword fern they are imported as trees as there is no middle category between trees and grass in CFS, I unchecked generate collision on both of them. And then baked a CFS navmesh. CFS navmesh baker ignored it and baked my ferns. Wich resulted in navmesh baker making them not walkable. Please, post a fix here or via PM, I suspect it to be a small change.
     
    Last edited: Dec 14, 2017
  43. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Hello,

    For up to 1000 trees, and no grass I think that there will not be a significant performance boost from using my system. I'd recommend it if you have a lot of mesh grass too. For example if you have an 500x500m terrain you might want to use aprox 50-100k grass clusters to populate it. If you'll do that, my system will be very beneficial. But if you only plan to have those 150 trees without grass there will not be any performance boost.

    However for current standard games (even indie ones) I'd recommend having mesh grass + take a look at the Megascans web-site. It provides AAA looking textures and it's very easy to set up your own AAA grass.

    If you have any other questions or if the system doesn't suit your needs feel free to contact or file me a refund request.
     
  44. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Hello,

    The navmesh baker extracts the trees from the system that have any 'Collision' component on them. If you press the 'Bake navmesh' all trees from the system that have a 'collision' component on them will be baked. For your ferns make sure that their prefab doesn't have any collision components on them.

    If after that the problem still persists, feel free to contact me here or private with a version of the ferns that get extracted, and I'll look over them and see why their renderer is extracted when it shouldn't.
     
  45. shamsfk

    shamsfk

    Joined:
    Nov 21, 2014
    Posts:
    307
    They do have collision and I need them to. I will need to play some SFX when a character steps on them. But I don't need them, to be baked into navmesh. So it is only logical to bake based on some checkbox like export collision or to make a special one like "bake to navmesh".
     
  46. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    I did not thought at that use-case. However you can use the 'Bake All' option and bake only the objects that you need into the navmesh. Using 'Bake All' you can select what objects you want to bake. After the owner(parent) object that holds all the instances is created in Unity's hierarchy you can set it's static flag to 'navmesh' only and that will change all it's contained childrn and it will solve your problem.
     
  47. shamsfk

    shamsfk

    Joined:
    Nov 21, 2014
    Posts:
    307
    Hi again) I noticed something. Instanced inderect seem not to work for me. As when I turn it on or off, drawcalls stay the same. Is there some special setup to make it work?
     
  48. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    The foliage draw type (for grass only) must be set to "INSTANCED_INDIRECT" inside the inspector instead of "INSTANCED". If you can see the grass with it's type set toe "INSTANCED_INDIRECT" it means that it is working.

    However based on a large number of factors the draw count 'might' stay the same if you have < 1000 foliage clumps per cell. If you have more than 1000 clumps per cell it 'might', only for that cell decrease the draw count by 1-2 draw calls. However that might not be the case in your project.

    Indirect instancing is NOT about the draw call count anyway, but about the fact that the foliage's position is cached on the GPU, the grass cells are cached on the GPU as they come in and out of the view frustum and used from there instead of copying them each frame from the main memory to the GPU's memory through the CPU.
     
  49. shamsfk

    shamsfk

    Joined:
    Nov 21, 2014
    Posts:
    307
    The only thing I can compare with is Vegetation Studio. The author has just released beta version of the instanced indirect shader for a speedtree grass. And when I use it I get my 20k drawcalls shown as saved by batching in stats window reduced to 20 while it doesn't happen with CFS. This is why I asked the question.
     
  50. shamsfk

    shamsfk

    Joined:
    Nov 21, 2014
    Posts:
    307
    Oh my... I totally missed that one *bashing on the head*
    It works smoothly like a butter now. 20k -> 600 batches.