Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Critias Tree System [Asset Store]

Discussion in 'Works In Progress - Archive' started by Assembler-Maze, Oct 21, 2016.

  1. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Sorry, but I have the same problem when using Unity's occlusion culling, I ended up removing it. I am not 100% sure that it works how it should... I'll need to take more tests but at the moment I've removed it too.
     
  2. rsklnkv

    rsklnkv

    Joined:
    Sep 8, 2012
    Posts:
    62
    So my "fix" actually works as I expect it to work? :)
     
  3. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Yes. Theoretically Unity should hold those spheres that I add to them and occlude them properly. But it doesn't seem to work. Maybe because the sphere's are too large and you need to use smaller grid cells so that the occlusion spheres are not that large.

    But at the moment that is quite bad, since there is an overhead for each cell added to the system. That is why I made some improvements in the next version that should only take into account the cells around the player for tests of any kind.

    I already made an update and I am testing it and it seems to work quite better.

    I'll upload a new version of the system later today (I hope).

    It includes:

    1. Optimizations related to cells, the count of cells are not important any more now, only the 9 surrounding cells around the player take any performance. That can enable you to have very small (100m) cells that are very precise. However you will not be able to have a mesh tree distance that is larger than the cell size.
    2. Some other code optimizations (like not copying all the matrices values but only rotation, translation part that might sound trivial but they really take up quite some time on the CPU.
    3. Ability to add LODGroups to the baked billboard meshes so at a certain distance they will vanish and not take any resources after a certain distance.
     
    marcatore, Alverik and wood333 like this.
  4. rsklnkv

    rsklnkv

    Joined:
    Sep 8, 2012
    Posts:
    62
    Sounds great!
     
  5. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    I see in your documentation that when in play mode the managed terrain's foliage rendering is turned off. Is this still true? If so, since I use uNature for my grass, and not unity, then would it be true that I don't need 2 terrains.
     
  6. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    The foliage is turned off. To solve that you can have 2 terrain at edit time. You paint the trees on one of those terrains, and after you are done editing them you can delete the tree terrain, and keep the system only. It doesn't require the terrain for proper functioning.
     
  7. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    I've just submitted v 9.0.5 for review, it should include some nice new utilities.

    1. Adding LODGroups to batched billboards
    2. Transform matrix copy optimization
    3. Cell managing optimizations
    4. Checkbox for turning off occlusion culling

    In the previous version distance/frustum checks were done for all the cells of a visible terrain. In this new version only the 9 cells surrounding the player are taken into account for frustum/distance/occlusion checking. However this limits the maximum distance of visible 3D mesh trees to the size of the cell, if you have a cell size of 200m the max view distance will be 200 (which is more than enough for many games tbh).

    They are not a ton but it improved the CPU time my system uses from 1MS to 0.5MS in my project. And each and every extra bit of performance squeezing is welcomed.


    These improvements came with the fact that we've managed to finish our game's alpha demo (with a beta coming soon) and we hope that next week we can enter greenlight with our finished demo! It will be the first 'real' game using the system and I can't wait to see the people's feedback!
     
  8. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Sounds great!
     
  9. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    With this asset is it possible to access properties of each single tree so that I can change its appearance during game play. e.g The tree is healthy and green then later it is unhealthy and losing its bark.
     
  10. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    There is no built-in function to do that, and I don't plan anything like that in the future. I'll focus more on optimizing, making it more friendly and adding support for non-tree objects.

    P.S: it seems that it will take some while longer for the new version of the system to be updated to the asset store, I'm still waiting for it.
     
    Alverik likes this.
  11. crowjambo

    crowjambo

    Joined:
    Oct 12, 2016
    Posts:
    3
    Hello. I'd really love to put your system to use, but I tried a couple of times already by following all instructions on the video, but an error always stops me
    http://imgur.com/a/cPzgB

    Basically the moment I press apply, it throws those errors? I am sort of new to all of this, so I am not sure what to do about it

    I don't have the screenshots now, but on my first try I could see trees shown by your system, but they would be VERY VERY FAR AWAY on the edges of terrain only. All the trees which were supposed to be around my transform would get automatically hidden, or so it appeared.

    Any clue on what I could do to make it work?
     
  12. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    1. Disable occlusion culling for the vanishing trees problem
    2. You should not require to apply the settings
     
  13. marcatore

    marcatore

    Joined:
    May 22, 2015
    Posts:
    160
    Hi @Assembler-Maze
    I've downloaded your last update.
    I've a problem with the "use instancing".
    If I enable it, the trees disappear and console report this


    About "use occlusion" I've problem also with it. The problem is that Trees sometime disappear depending on some camera orientations.
     
  14. Gnimmel

    Gnimmel

    Joined:
    Apr 21, 2010
    Posts:
    358
    This looks great, but I'm still using 5.5 at the moment and wasn't planning on moving to 5.6 just yet.

    Saying that, I will if this fixes the speed tree billboard problem in VR where the billboards follow the camera's rotation so as you look around all the trees spin and rotate making the scene very sickening?
     
  15. Alverik

    Alverik

    Joined:
    Apr 15, 2016
    Posts:
    417
    @Assembler-Maze How's the demo coming along? The videos and screen shots are looking fantastic. I specially love the underwater effect you are using, really cool. Would love to know how you did it, lol. (I suck at making shaders though, lol).
     
  16. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Delete all the tree data and re-generate the data (using GenerateTreePrototypeData button) and re-generate the speed-tree material data using 'Regenenerate materials' option from the SpeedTree prefab menu. That should solve this issue.
     
  17. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Hello, the asset is compatible with 5.5, I'm not using anything special at the moment so you can just copy/paste it in the project and have it 'just work'. That is the case only for 5.5, it is not compatible with anything else.

    As for the trees rotating with the camera, I really don't know how it can be made to look better in VR. I had some plans to improve the tree billboard switch by using a fade between the billboards, but they will still follow camera movement.

    However I think I've programmed them to look at the camera and not at it's rotation, so it should be cool.
     
  18. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    The game's demo is finished, but we have to prepare the trailer/gameplay stuff now, and sent it to 'greenlight' and GOG.

    The underwater effect is used from the 'Ceto' ocean system, that is now deprecated. However we modified the caustics to make them dynamic instead of static, using some 3rd party caustic generator that we found on substance share.
     
    Alverik likes this.
  19. marcatore

    marcatore

    Joined:
    May 22, 2015
    Posts:
    160
    Thank you.
    It works!
     
    Assembler-Maze likes this.
  20. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    For those interested to see my system live in a game you can check our game's (The Unwritten Critias & the Lost Island) trailer here!

    The game's demo is also finished, so you will have the opportunity to see everything live in a complete chapter of our game!

    We will require your full support on the upcoming 'Greenlight' campaign!

    BigLogo1.png
     
    Last edited: May 29, 2017
    Mukabr, lezan_, mons00n and 3 others like this.
  21. FrozenEmpire

    FrozenEmpire

    Joined:
    Sep 10, 2016
    Posts:
    96
    Hi, great work on this asset and thanks for sharing it...

    ... however I've been toying with it over the last week or so, and I'm not sure I've got it working right...

    It seems that I only have 3d mesh LODs appearing in the game view, not billboards and no matter what settings I tweak, I cannot seem to influence that.

    In the scene view, everything looks as it should, zooming out the speedtrees revert to billboards and zooming in they go through the LODs to full detail.

    Could you please recommend the most important things to check given these symptoms.
    Many thanks!
    (running 5.6.1f1 by the way)

    upload_2017-5-29_12-8-36.png upload_2017-5-29_12-9-4.png
    upload_2017-5-29_12-10-25.png
     
  22. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Try increasing the 'Max Tree Distance' to something at least 50 meters. Also delete/regenerate the tree data. Also uncheck the 'Add LOD Group To Billboards' checkbox, maybe the LOD group breaks things up? Try those and if the problem still persists post here again.
     
  23. FrozenEmpire

    FrozenEmpire

    Joined:
    Sep 10, 2016
    Posts:
    96
    Tried all those things you suggested last night, but still no joy...

    Although it had no effect, my world units are actually not meters, but "map cells", and my terrain is only 64x64 map cells in size, therefore I do actually need a max tree distance less than 50, unless I scale up my whole terrain...

    Can I check a few assumptions:

    (1) The billboards as rendered by your batch method should look identical to the billboards that are rendered in the scene view?
    (In my case I clearly see billboards in the scene view in close proximity, however in the game view there are only 3d models rendered, and there are no similar looking billboards in the game view at all)

    (2) Disabling the billboard MeshCells whilst in runtime should prevent a section of billboards being rendered right?
    (In my case disabling ALL MeshCells has no effect - another indication there are no billboards)

    Thanks for any further hints on how to go about debugging this.
     
  24. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Hey, I am sorry but my system does not support terrain so small as yours. It works with 'meter's as units and a 64x64 terrain is very small, I never tested with something that small.

    1. Yes, they should work and look like the scene view
    2. Yes

    I really recommend testing out the system with naturally scaled terrains.
     
  25. ghiboz

    ghiboz

    Joined:
    Sep 7, 2012
    Posts:
    465
  26. FrozenEmpire

    FrozenEmpire

    Joined:
    Sep 10, 2016
    Posts:
    96
    Hi, yes I see that my scaling is non standard, I'm fairly new to unity development...

    Before I rescale everything, would you be able to share a demo unity project working in 5.6 where I could compare and contrast the setup and debug the reasons for it not working as intended... I'll do that alone if you could provide a reference project.

    Many thanks
     
  27. Alverik

    Alverik

    Joined:
    Apr 15, 2016
    Posts:
    417
    Be careful with scaling. Scale affects physics, so, with the default gravity settings (which reference meters), smaller objects will seem to react faster than huge objects (really huge objects will move like they are planets moving in orbit, lol)...

    Quoting an old post by runevision:
    There is no "default unit" in Unity. Just choose what you want units to represent and stick to that. If you have gravity in your game, you need to set it up to match the unit representation you have decided on (if you want it to be realistic). The gravity per default is set to be like earth's gravity as measured in meters per second, but if you use centimeters for your units, you can just multiply the gravity by 100.
     
  28. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Sure, for a full project check out github: https://github.com/AssemblyJohn/Critias-TreeSystem
     
    Alverik likes this.
  29. marcatore

    marcatore

    Joined:
    May 22, 2015
    Posts:
    160
    Assembler-Maze likes this.
  30. FrozenEmpire

    FrozenEmpire

    Joined:
    Sep 10, 2016
    Posts:
    96
    Thanks for the hints!
    I hadn't considered that scaling might be influenced by physics and gravity, good point.
    I guess it's about what units make most sense within my particular use case.

    At the moment I'm just curious why the billboards are not showing up at all; I'm not convinced it's related to the non standard scaling but could be wrong.
     
    Alverik likes this.
  31. FrozenEmpire

    FrozenEmpire

    Joined:
    Sep 10, 2016
    Posts:
    96
  32. FrozenEmpire

    FrozenEmpire

    Joined:
    Sep 10, 2016
    Posts:
    96
    Well I couldn't get to the bottom of why the small scaling would not work... upscaling everything by a factor of 100 has now got the billboards working. I guess I'll stay with that.

    Thanks for the support.
     
  33. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Yes, you have to use the 1unit=1meter system. Sorry.
     
  34. marcatore

    marcatore

    Joined:
    May 22, 2015
    Posts:
    160
    @Assembler-Maze I've a problem with your last version.
    I've download it from the Asset store to be sure to have the last one

    The problem is it seems that billboard shader has some problem and actually when I play the scene they're not visible.

    I've created a simple scene here


    I can't understand where I'm wrong.
     
  35. SteveMH

    SteveMH

    Joined:
    Jun 11, 2017
    Posts:
    1
    Hi @Assembler-Maze, thanks for taking the time to release this asset! As expected, the performance is excellent. However, the quality of the billboards is not good enough. I'm looking into your implementation to see if there is something I can do to make themt good enough for my use case. Would you happen to have any ideas?


    ^Unity terrain with 100 000 trees (10 fps). Pretty billboards.

    ^Critias tree system, 100 000 trees (350 fps). No billboard shadows, billboard color does not match models.
     
  36. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Hey!

    1. The billboards don't match the color since they don't have implemented per-billboard hue variation. You can try implement it for more color variation, based on the position, shouldn't be too difficult
    2. They should cast shadows however, I don't know why they don't. Try smaller tree cells, maybe the combined tree mesh is too big and something goes wrong there. Or enable the forward shadows in the shader. However I've checked this and it should work, but when I have time I'll look through it again
    3. Having a per-pixel depth offset would be very cool, better transitions, would look better etc...
    4. Billboard subsurface scattering would also help a lot

    I really hope that I can fix those myself, but I'll only do it after (and if) we pass the kickstarter for our game. Otherwise we'll just move to another game in another engine that has all those problems fixed by default.
     
    Last edited: Jun 12, 2017
  37. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Thanks for the scene!

    1. Disable the 'Use XML data' from the 'Treeifier' and re-generate your trees. You had a problem generating the trees and an exception was thrown upon starting the 'play mode'
    2. Disable 'Use Occlusion Culling'
    3. There are some very weird shadow artifacts, in your scene that I've never saw before, I'll try look deeper into those, I don't know what causes them. However I don't have too much time this week, I'll try and see for them next week

    Maybe 5.6.1 introduced some new bugs, I'll check it out next week.
     
  38. ptim

    ptim

    Joined:
    Jun 7, 2017
    Posts:
    1
    After doing this and fixing the specular color of billboards (had 0.04 for billboards, while speedtree models had 0) the colors match nicely.

    Unrelated to above, there seems to be a problem with the LOD transition. Some trees suddenly disappear and reappear when the camera is moved. I also understood there should be some kind of smooth cross fade / dithering effect from models to billboards, but I do not see one. I created a minimal example scene with a fresh copy of CritiasTreeSystem. I tested it with Unity 5.6 and 2017b, problem occurs with both.

    What happens when pressing play:
    https://i.imgur.com/7NvTXmc.png
    After moving the camera a tiny bit:
    https://i.imgur.com/6rxzDEB.png
    Scene download link:
    https://drive.google.com/file/d/0B8phcWiE6o0iQXhudVVRMVNReUk/view

    Best of luck with your kickstarter!
     
  39. Aleksei-Kolotilov

    Aleksei-Kolotilov

    Joined:
    Jun 3, 2015
    Posts:
    17
    Hello. If you enable Collaborate service in the project, then when you save and load the scene (loading longer by 5-10 times) everything slows down, even when you click on the TreeSystem object in the hierarchy. How can I fix it?

    P.S. Such lags only when the CritiasTreeSystem plug-in is configured in the scene.
     
    Last edited: Jun 14, 2017
  40. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Thanks for the tip, I'll integrate it too sometime.

    For the transition it 'should' work, however make sure that the tree distance is a little larger (like 70+m). I know it is kinda flimsy (worked for me on 5.6.0 that's why I haven't developed more for it) and there is a useless transition between the billboard and the 3D tree using an intermediate billboard that might cause trouble.

    The solution to that is using 2 custom shaders for the batched billboards, one for the close billboard grids that can transition per-billboard without that intermediate billboard, using some sort of fast GPU computing for the transition value calculation and another shader that is optimized without the 'per-instance' value and without the calculation for the distance billboards.

    I'll let you know how the progress goes and will post here when I'll have additional info on this.
     
  41. Aleksei-Kolotilov

    Aleksei-Kolotilov

    Joined:
    Jun 3, 2015
    Posts:
    17
    Does anyone have any thoughts on this?
     
  42. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Sorry, I really have no idea on that one.
     
  43. Aleksei-Kolotilov

    Aleksei-Kolotilov

    Joined:
    Jun 3, 2015
    Posts:
    17
    I found a solution. Need to choose the serialization mode to Force Binary. Service Collaboration activates Force Text and start lags when loading scenes, and saving.
     
    Last edited: Jun 19, 2017
  44. Aleksei-Kolotilov

    Aleksei-Kolotilov

    Joined:
    Jun 3, 2015
    Posts:
    17
    There is a problem with the artifacts on the stage. There was originally no tree, but there was a shadow from some kind of billboard.

     
  45. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    I'm currently looking into this issue, I don't know what's happening, I've saw it appears in the new version of unity (5.6.1)
     
  46. Aleksei-Kolotilov

    Aleksei-Kolotilov

    Joined:
    Jun 3, 2015
    Posts:
    17
    I have a version of Unity 5.6.0f3 (64-bit)
     
  47. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Weird, I can't see it in 5.6. Have you tried to get the default project from github and build on top of that?
     
  48. Aleksei-Kolotilov

    Aleksei-Kolotilov

    Joined:
    Jun 3, 2015
    Posts:
    17
    Installed from the asset store
     
  49. Funkeys

    Funkeys

    Joined:
    Apr 16, 2017
    Posts:
    64
    Hello Assembler-Maze,
    i do have a problem setting up the tree system. As far as i understand it from the documentation, i can use different cell count and cell sizes, even if i have only one terrain tile?
    But I just can get the system running when i define one cell with the size of the terrain tile.
    When i try to use 2 cells with half the terrain size i get this error:

    "Invalid cell sizes for the count of managed terrains!"

    Do i understand something wrong there ?

    And the other problem is that i had my terrain running with the tree system, then i made a new iteration of the terrain, (new tree placement but same trees, less polys for the terrain). I changed the terrain in the scene and in the treesystem, extracted the new prototypes and tried to generate the trees and got the error message that the mesh has too many vertices.
    I don´t know the exact message yet because i started to rebuild the terrain and about that i cannot reproduce it right now.
    Can you tell me what is the problem there?

    Thank you!

    br
    Funkeys
     
  50. Fatalis

    Fatalis

    Joined:
    Sep 9, 2013
    Posts:
    52
    I am suddenly getting an error when I try to extract tree data. One of my artists updated one of the trees I use in Critias and I suspect it is this updated tree that is causing an issue (Critias successfully extracts data of all trees until it gets to the one that was updated in the treeifier script, then stops and throws the error leaving the rest of the trees unextracted), but I am not sure why or how.

    Here is the error:
    NullReferenceException: Object reference not set to an instance of an object
    Treeifier.ExtractXMLTreePrototypeData () (at Assets/CritiasTreeSystem/Code/Treeifier.cs:231)
    TreeifierEditor.OnInspectorGUI () (at Assets/CritiasTreeSystem/Code/Treeifier.cs:22)
    UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1236)
    UnityEditor.DockArea:OnGUI()