Search Unity

Assets Critias Vegetation System [Asset Store]

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

  1. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    If you have the trees/details on a terrain or they're held by an game object it doesn't care from which source the data comes. If you want to spit the data straight from MapMagic to my foliage system I'm afraid you can't do that.

    I've tried to talk with some guys that make map generation assets for a tight integration however there was not too much of an interest from their side, at the moment at least, since that tight integration would mean that a lot of custom code would have to be written on their side.

    But if you generate the data on a terrain you can extract that data from the terrain with no problem.
     
  2. Migueljb

    Migueljb

    Joined:
    Feb 27, 2008
    Posts:
    562
    WOW asset store were still waiting!

    Really want to see if this solves my problems in unity with the terrain and tree rendering in VR.
     
  3. FrozenEmpire

    FrozenEmpire

    Joined:
    Sep 10, 2016
    Posts:
    96
    And billboard shadows ?

    I still think this is a must for visual quality, more than billboard wind... maybe in V1.1a
     
  4. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Just woke up at 7am in the morning to see that my asset was declined from the store, with the reason that "it is a violation to redistribute or resell any works created from SpeedTree applications or obtained through the SpeedTree marketplace".

    I already know that and that is why I haven't included the foliage in the system, only the code, but somehow the guy that made the review thought that maybe I've included the SpeedTrees in the package....

    Anyway I'm sorry folks but that means that we're going to have to wait another month or so before any V1 or V1.1 or V1.1a to sort things out.
     
    Last edited: Oct 11, 2017
  5. RoloJo

    RoloJo

    Joined:
    Feb 26, 2013
    Posts:
    28
  6. Sparky11

    Sparky11

    Joined:
    Aug 27, 2017
    Posts:
    2
    Ah damn :(. Looking forward to the release, whenever it may be.
     
  7. 600

    600

    Joined:
    Dec 18, 2013
    Posts:
    385
  8. FrozenEmpire

    FrozenEmpire

    Joined:
    Sep 10, 2016
    Posts:
    96
    Is there any way to challenge it... ?

    It seems strange to me given that your Tree and Grass Systems are readily available on the Asset store ?!?
     
  9. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    I've just received reply from the store team, I need to change some naming conventions from the scripts, I have some scripts managing SpeedTree and they thought that those scripts are SpeedTrees somehow.

    Anyway it's an easy fix, and look on the bright side! I'll be submitting right into V1.1 which comes with detail extraction!
     
    GingerDr73, 600 and FrozenEmpire like this.
  10. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    I have just submitted V1.1 with less bugs and terrain details extraction! Today, 12 Oct 2017, with all the stuff they've told me to modify, so there's no other confusion.
     
    zmaxz and 600 like this.
  11. GingerDr73

    GingerDr73

    Joined:
    Sep 25, 2013
    Posts:
    21
    Good luck! Hope its less of a wait this time. Detail extraction sounds good, does it work with terrain grass/detail meshes and GameObjects in the scene?
     
  12. RoloJo

    RoloJo

    Joined:
    Feb 26, 2013
    Posts:
    28
    Does V1.1 have an add tree at runtime feature?
     
  13. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Yea, extraction works with:

    1. Objects in the scene
    2. Trees in the terrain
    3. Detail meshes from the terrain
    4. Detail grass billboards from the terrain
     
    GingerDr73 likes this.
  14. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    I don't think I've also added the adding, but only the removing. I'll have a quick patch for that too, shouldn't be to difficult, however I'd like to hear the context in which you want to use that, since I might solve the issue with the wrong approach if you know what I mean.
     
  15. RoloJo

    RoloJo

    Joined:
    Feb 26, 2013
    Posts:
    28
    I am looking to create a dynamic environment of sorts where the vegetation in the world changes over the course of the game. I create a grid, dividing up the terrain and then throughout the game vegetation is added to a cell on the grid or removed from it. Typically multiple adds and removes occur per tick. I hit a snag with Unitys Terrain Tree system, when removing trees it would cause a sharp fps drop.
    The game also allows the player to remove vegetation from the game (and potentially add it too).
     
  16. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    I would really not recommend that. However adding a big grass grid would be fine, if you already know where the grass would be and in what grid. If the player can also add foliage that is not a problem. I've already thought at that feature (not for your specific case) but for runtime generation of foliage based on rules, but that is very intensive too, and should fit your requirement well. But it is a major feature and it will not come any time soon (anyway not in the optimized form).

    And there are certain limitations in C# and in the Unity's API that do not allow me to optimize everything the way I want...
     
  17. RoloJo

    RoloJo

    Joined:
    Feb 26, 2013
    Posts:
    28
    Sorry, I may have said this in a misleading way. By tick I did not mean every Update. Rather the array of terrain trees is updated after a few seconds. Most of the underlying rules sit on a separate thread. My game is in effect a simulation of an existing environment, not generating one. If a player can add trees then this would probably be sufficient for my purpose in the simulation.

    If I remember correctly the main problem came when updating the array of TreeInstances of the Terrain. I tried a number of suggestions online (eg disabling tree collides) but I could never get rid of the fps drop.
     
  18. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Yea, it is quite a 'heavy' operation. Don't worry then, if you don't need something too fancy we'll see after the release when we can rig up something quick and nice. And you won't need to worry about any FPS drop.
     
  19. Migueljb

    Migueljb

    Joined:
    Feb 27, 2008
    Posts:
    562
    This is good news. Whats the lowest and highest unity version this works for?
     
  20. JRRReynolds

    JRRReynolds

    Joined:
    Oct 29, 2014
    Posts:
    192
    @Assembler-Maze I wanted to test out Critias before purchasing the full system. In the grass demo I noticed that while the bushes are affected by the wind continuously, the ground grass seems to sway for about 1 second and then stops and is no longer affected by any wind. Is there a reason for that? I know on the store page it says responds to wind so I'm just wondering if this is a setting somewhere I am missing.

    I was also wondering if your note still applies that it should technically work in 5.6.
    Thank you.
     
    Last edited: Oct 13, 2017
  21. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Sometimes I see that hapens but it should work. I'm looking into this and I think I should make the grass' AABB around the player a little larger.
     
  22. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Good news everyone! The asset store team just released my asset! You can grab it from here.

    Thanks to the asset store team for being so quick this time!
     
    No0B25, GingerDr73 and 600 like this.
  23. MarkusGod

    MarkusGod

    Joined:
    Jan 10, 2017
    Posts:
    168
    Any ideas how your system can be used with world streamer?
     
  24. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    From what I know world streamer breaks up your scene into chunks and loads your objects dinamically from the HD based on the visibility of the camera's frustum.

    However my system stores the foliage in it's internal format and the data is kept in memory. Even if you use the world streamer there should be no influence since my system grabs the matrix positions from the HD (basically a 4x4 matrix) and draws them based on the visibility. So it works independently of any other asset that you might use.

    If you want to see how that works try out my free tree system with world streamer and see if that fits your needs. If it works fine for you feel free to move onto this full system.
     
    MarkusGod likes this.
  25. Migueljb

    Migueljb

    Joined:
    Feb 27, 2008
    Posts:
    562
    Anyway to get this to work in say unity version 5.5.0?
     
  26. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    +1 For removing and adding trees during runtime. I have a need to be able to cut down and then regenerate those same trees at a later time.
    Looking good!
     
  27. ranaUK

    ranaUK

    Joined:
    Mar 1, 2017
    Posts:
    166
    Yippie-Ki-Yay -- It's ALIVE on AppStore.....
     
    Assembler-Maze likes this.
  28. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    I'm not entirely sure... However I think that 5.5 has the 'DrawInstanced' api so... But anyway it is not supported. I know for sure that one guy that I've gave the system to uses it with Unity 5.6 and he did not complain (read the description on how to get it working for 5.6) until now... However again, it's not supported.
     
  29. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Hey! At the moment only the tree removal is possible, the tree adding will be coming to V 1.1.1 as a minor feature.
     
  30. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Sweet! : )
     
  31. No0B25

    No0B25

    Joined:
    May 2, 2016
    Posts:
    70
    My 15 bucks are yours. Kudos to you for streamlining the two systems.

    EDIT: Oh yeah, did the performance improve for very near tree distances? I've got very thick fog which lets me limit the draw distance to about 100. I remember you writing that the tree system isn't very effective with such small draw distances. Did that change by now or is it something that could be looked into?
     
  32. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Congrats on the release @Assembler-Maze !

    Have followed your work for a while and liked Critas Tree & Grass but needed to use custom tree and plants. When I saw '- Not dependent on SpeedTree only!' I'll admit I jumped out of my chair a little :)

    Wondering though how much does this extend and how compatible is your system with custom shader LOD trees (that support instancing- like CTI) and just regular tree creator trees?

    Cheers
     
  33. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Well not smaller but bigger draw distances are the problem. In this system you can set the draw distance per type. I can't remember what I've told you but it certainly works quite well with small draw distances.
     
  34. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Um, you can add to my system objects with multiple LOD's that have custom shaders. They can be metal pieces, rocks, tanks, trees or grass. However the wind only works for SpeedTree at the moment out of the box. Since there are some values calculated on the CPU I need to extract those data from the CPU by using 'CopyMaterialBlock'.

    However if your tree calculates it's wind inside the shader procedural 100% without the need of the CPU your objects should work just fine... And instancing support is kinda mandatory for my system (at least for grass) since that's the whole system's point. Performance.
     
    Last edited: Oct 14, 2017
  35. timothy92

    timothy92

    Joined:
    Mar 7, 2016
    Posts:
    12
    Hello,
    I just bought the foliage system, and I love it. It is very well made and user-friendly.

    I am having one issue though, when I place grass (OTHER_GRASS type) it isn't lit properly. the prefab on the right in the image below is lit as expected, while the placed grass is producing some weird results. Here's a screenshot:

    http://prntscr.com/gx8vco
    Am I doing something wrong or is this a bug?

    Thanks
     
  36. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Hm... I see that the prefab does not have any masking enabled while the drawn grass has masking. Are you sure that you're using the same shader? You could try to press 'refresh' near the prefabs window to refresh the shader in case you changed it in the prefab and did not on the system.
     
  37. RoloJo

    RoloJo

    Joined:
    Feb 26, 2013
    Posts:
    28
    Hey, any chance of expanding on the API documentation? I'm a noob and its not all that clear how to remove a tree, specifically where to get the guid and the type hash from.
     
  38. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Yea, sure no probs. Actually what would be the best would be for me to make a code snippet that should do just that.

    At the moment follow the steps:

    1. In the 'FoliageCollisionSettings' set the 'm_UsedLayer' (do this in the UI not in the code) that is the layer the objects are going to be added to and set it to the layer you are going to use the trees to, for example "TreesPhysics"
    2. With your custom logic do raycasts, boxcasts or whatever against your colliders in the scene that are on the 'TreesPhysics' layer
    3. With the returned colliders check for their game objects and if they contain the script called 'FoliageColliderData'
    4. The script 'FoliageColliderData' shoud contain all the data you require in a public member called 'FoliageInstance' from type to GUID.

    Try the below snippet just in your context:
    Code (CSharp):
    1. CritiasFoliage.FoliagePainterRuntime runtime = FindObjectOfType<CritiasFoliage.FoliagePainter>().GetRuntime;
    2.  
    3.         // Change this to whatever layer you use for trees
    4.         const string queryLayer = "Default";
    5.  
    6.         RaycastHit hit;
    7.         if(Physics.Raycast(transform.position, transform.forward, out hit, 100, LayerMask.GetMask(queryLayer)))
    8.         {
    9.             if(hit.collider)
    10.             {
    11.                 var data = hit.collider.gameObject.GetComponent<CritiasFoliage.FoliageColliderData>();
    12.  
    13.                 if(data)
    14.                 {
    15.                     CritiasFoliage.FoliageInstance instance = data.m_FoliageInstance;                
    16.                     runtime.RemoveFoliageInstance(instance.m_UniqueId);                
    17.                 }
    18.             }
    19.         }

    In the next version I'll also add the code samples that I accidentally removed when submitting V1.1. I know that people require changing runtime settings + removing of the trees. Sorry for the mishap :)
     
    Last edited: Oct 14, 2017
    RoloJo likes this.
  39. No0B25

    No0B25

    Joined:
    May 2, 2016
    Posts:
    70
    Hey there,

    so I got around to trying the system out. I have to say, this is much easier to set up than the tree and grass systems. Good job on that one! :) I caught two things that I would consider slight annoyances, nothing too urgent.

    So I dropped some very ugly SpeedTrees onto a 640x640 terrain, populated it with grass and then extracted all the things from the terrain. I got one tree, one bush and four grass prefabs. The grass is custom with a custom shader for wind. In terms of how many instances there are, it looks like this:



    The density for all grass prefabs is at .2 and the draw distance is between 12 and 30. I don't think that this is too crazy. But then I get this kind of performance in the editor: https://c.lewd.se/jQn02D_2017-10-14_16-25-19.mp4 - That happens when I rotate the camera holding the right mouse button, no matter whether the Critias_Painter object is selected or not. The video itself is 60fps by the way, just in case. Profiling the editor yielded this:



    So the painter occasionally generates somewhere between 20MB and 65MB of garbage, when it writes "Update draw!" into the console (of course not the console call itself, but somewhere around there), resulting in these spikes. Is this something that is inherent to the system operation, or can it be optimized? Ingame the performance is perfectly fine (the painter script is turned off though of course).

    I vaguely remember somebody else mentioning the following thing, but I may just be crazy. Anyway, it is that trees stop playing the wind animation depending on the way the main camera looks: https://c.lewd.se/GRPsBh_2017-10-14_16-42-30.mp4
    Here it's between somewhere around -164.3268° and -68.5505° where it works, but I think these numbers are too odd to make any sense. I'm using a UFPS AdvancedPlayer, so the rotation on the y-axis happens on a parent object of the camera.

    Aside from these two things I like it so far! Keep it up! :)

    Greetings,
    Jan

    EDIT: Oh right, I forgot to mention my hardware, but the performance I'm getting is probably not coming from hardware bottlenecks. I'm on an i7 7700K, 32GB of RAM and a GTX 1080Ti. The Unity project is on a Samsung 960 EVO M.2 SSD.
     
    Last edited: Oct 14, 2017
  40. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Sorry for the editor performance, I will look further into it. The bad stuff is that I have to update the data that is not as well structured as the one at runtime and I have to copy it quite stupidly around since the buffers might grow larger than the allowed 1024 limit. However I'll add performance optimizations for the editor too in order to tweak the density, distance and others performance stuff for the editor too.

    For the angles where the wind doesn't work I'll look into it, I'll probably have to make the bounds of the fake invisible objects larger, or maybe but the in front of the camera.
     
    GingerDr73 and No0B25 like this.
  41. timothy92

    timothy92

    Joined:
    Mar 7, 2016
    Posts:
    12
    I tried what you said, and tried again in a fresh scene, the problem still persists. Any ideas?
    http://prntscr.com/gxj6h5
    I tried using a custom shader (infiniGRASS) but the grass painted was invisible, are you ever going to support custom shaders?

    EDIT: I also tried creating a completely new project and the problem persists, I'm pretty sure its just the WindTree_Grass shader.
     
    Last edited: Oct 15, 2017
  42. GingerDr73

    GingerDr73

    Joined:
    Sep 25, 2013
    Posts:
    21
    +1 for the Editor optimisations, it's a bit difficult to paint with at the moment. Could you make a checkbox on the painter to toggle the debug messages? I found the explanation of how to disable them confusing and I'm often flooded with them.
     
    timothy92 likes this.
  43. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    No problem, it's on the list.
     
  44. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    To support custom shaders for fade in/out and stuff you have to use the shader defines to use that. It will work but you can't have fading.

    However, Lars (Advanced Foliage Shader 5) messaged me and told me he is willing to modify his shader to support my system out of the box, I'll ask him on the progress.

    And if your problem still persists don't hesitate to pack a project (please a small one, <50-100MB) with the shader that causes problems and the prefab and I will look into it ASAP, and pinpoint the exact problem. If I can't find the problem for your specific case, I'll offer you a refund.
     
  45. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Thank you for the project.

    The issue comes from the fact that the grass does have custom normals as it should. The face's normal's point by the face's direction, which is generally good, but it's very bad for grass. The solution to that is to edit the foliage's normals for better terrain blend.

    I've done it in blender using the 'Normal Edit Modifier' with the directional mode, and parallel normals. You can do it in maya or any other software you feel comfortable with. Make them point directly up:
    BlenderSetup.png

    After the normal editing, I've applied the rotation and scale, exported the FBX file, added it to the critias foliage system and obtained the following:
    Fix1.png

    Crisp clear foliages.
     
    Last edited: Oct 16, 2017
    Alverik and timothy92 like this.
  46. 600

    600

    Joined:
    Dec 18, 2013
    Posts:
    385
    Asset Store links in the first post goes to store Home, not asset.
    Works in your signature.
     
    Assembler-Maze likes this.
  47. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Link works fine for me, you are probably still on the old store?
     
  48. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    I've just fixed it. They new store stuff links are quite weird, not working as expected all the times.
     
  49. ranaUK

    ranaUK

    Joined:
    Mar 1, 2017
    Posts:
    166
    @Assembler-Maze, any idea why a tree is looking in between fades? Uploaded an image - the tree I'm talking about is almost in center.
     

    Attached Files:

  50. Assembler-Maze

    Assembler-Maze

    Joined:
    Jan 6, 2016
    Posts:
    630
    Yea... it's because of the cross-fading, since the tree fades from 1 to 0 and the billboard from 0 to 1 there is that 0.5 where both are a little transparent. I've tried to mitigate it by making shorter values so that none of them are transparent when the other is transparent, but there's room for some improvement. I'll see to change the dithering pattern for the other model to hide that error.

    Added to the V1.2 list.