Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Assets AltTrees System [WIP] [AssetStore]

Discussion in 'Works In Progress' started by Diab1O, Sep 19, 2016.

  1. trilobyteme

    trilobyteme

    Joined:
    Nov 18, 2016
    Posts:
    306
    I'd like to request adding support for MapMagic World Generator. It's an excellent tool for creating procedural terrains, and the developer includes instructions on how to make custom generators - so that in theory something could be written to allow it to place alttrees objects on the procedurally generated terrains. I made the request of him as well, hopefully he's able to reach out to you or you're able to reach out to him so that some kind of integration is possible in the near future.
     
    Vagrod and MarkusGod like this.
  2. Diab1O

    Diab1O

    Joined:
    Mar 31, 2013
    Posts:
    317
    The author of the MapMagic wrote to me. We will work together to integrate AltTrees with MapMagic.
     
    Vagrod and blacksun666 like this.
  3. Diab1O

    Diab1O

    Joined:
    Mar 31, 2013
    Posts:
    317
    Who downloaded 0.9.8 version - download it again, please. I fixed some bugs.
     
  4. trilobyteme

    trilobyteme

    Joined:
    Nov 18, 2016
    Posts:
    306
    Great news, thanks!
     
  5. Freznosis

    Freznosis

    Joined:
    Jul 16, 2014
    Posts:
    293
    Getting an error after updating today to 0.98.

    Code (CSharp):
    1. System.NullReferenceException: Object reference not set to an instance of an object
    2.   at AltSystems.AltTrees.AltTreesManager.createMeshBillboardsStartThread (System.Object obj) [0x00110] in E:\NTFS 1\Beta\Assets\Plugins\AltSystems\AltTrees\Scripts\AltTreesManager.cs:3565
    3. UnityEngine.Debug:LogError(Object)
    4. AltSystems.AltTrees.AltTreesManager:createMeshBillboardsStartThread(Object) (at Assets/Plugins/AltSystems/AltTrees/Scripts/AltTreesManager.cs:3775)

    Edit: The update also deleted all of my trees and completely reset the terrain.
     
  6. rsklnkv

    rsklnkv

    Joined:
    Sep 8, 2012
    Posts:
    59
    After update I'm getting constant 100ms lag from FindObjectsOfType... (in scene view)
    Our scene contains 24 tree prefabs and 300k trees
     
    Last edited: May 2, 2017
  7. rsklnkv

    rsklnkv

    Joined:
    Sep 8, 2012
    Posts:
    59
    so, after all, we've switched to Critias Tree System...
     
  8. crudeMe

    crudeMe

    Joined:
    Jul 8, 2015
    Posts:
    81
    Hi,
    I've got an issue with custom SpeedTrees which were modeled in SpeedTree Modeler.

    When I use Unity' Post Process Behaviour with Ambient Occlusion I do receive strange ao artifacts on Alttrees. On the screenshot, you can see two alttrees on the left and speedtree on the right, from which alttree was created. Screenshot was taken with ambient occlusion from post process stack.


    Same thing happening with other custom trees that were created for us in Speedtree modeler. Might be an export issue or something. Have you seen such an issue?
     
  9. Diab1O

    Diab1O

    Joined:
    Mar 31, 2013
    Posts:
    317
    Hello everyone!
    I'm sorry that I could not answer earlier.:( I will now look for problems and tell you how to fix it.
     
    Freznosis likes this.
  10. Diab1O

    Diab1O

    Joined:
    Mar 31, 2013
    Posts:
    317
    Hi,
    I send you file, replace it and try please.
     
  11. Diab1O

    Diab1O

    Joined:
    Mar 31, 2013
    Posts:
    317
    Hi,
    I can not reproduce this bug. Can you send me a screenshot of the profiler with this lag?
    I'm sorry that I failed you
     
  12. Diab1O

    Diab1O

    Joined:
    Mar 31, 2013
    Posts:
    317
    Hi,
    If you used Forward rendering, then you need enable this option:
    03-05-2017 23-49-50.png
     
  13. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,864
    You should cache the object and never do a find during runtime.
     
  14. Diab1O

    Diab1O

    Joined:
    Mar 31, 2013
    Posts:
    317
    I never find objects through this function during runtime. Most likely this function is called Unity, when the scene changes.
     
    magique likes this.
  15. Diab1O

    Diab1O

    Joined:
    Mar 31, 2013
    Posts:
    317
    Do you also get this lag? Tell me the version of Unity and the version of AltTrees - I'll send you a test file.
     
  16. rsklnkv

    rsklnkv

    Joined:
    Sep 8, 2012
    Posts:
    59
    Issue caused not by direct call to FindObjectsOfType, but by call to EditorUtility.SetDirty(this.gameObject); in void OnRenderObject() at AltTrees.cs
    I've mentioned this before
    Also I've tried to pinpoint other indirect calls to FindObjectsOfType which appear when camera moved around, but decided that this is too time consuming
     
  17. GingerDr73

    GingerDr73

    Joined:
    Sep 25, 2013
    Posts:
    21
    I've recently implemented AltTrees for my studio's current project and we are very pleased with it so far. However we've encountered a problem with the trees not appearing in screenshots, like their layer isn't being captured by the camera. I've checked the camera layers while the screenshot is happening but that didn't seem to make any difference. As far as I can tell the trees are part of the Default layer but like I said the layers don't seem to matter. Any ideas as to what might be happening?
     
  18. Diab1O

    Diab1O

    Joined:
    Mar 31, 2013
    Posts:
    317
    Oh, strange, I already deleted this function. Likely when I restored the project from backup - this function was restored also. Thank you.

    Who gets lags in the editor - please delete the "OnRenderObject" function in the file "Assets\Plugins\AltSystems\AltTrees\Scripts\AltTrees.cs"
    This:
    Code (CSharp):
    1.         #if UNITY_EDITOR
    2.                     void OnRenderObject()
    3.                     {
    4.                         if (!Application.isPlaying)
    5.                             EditorUtility.SetDirty(this.gameObject);
    6.                     }
    7.         #endif
     
  19. Diab1O

    Diab1O

    Joined:
    Mar 31, 2013
    Posts:
    317
    Hi,
    How do you make a screenshot? And what version of Unity and version of AltTrees?
     
  20. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,864
    I haven't tried the latest AltTrees. The last time I tried it I was still seeing performance issues and the really long time for trees to appear after the scene was already started. I might give it another try soon to see if these things have improved.
     
  21. Mark_T

    Mark_T

    Joined:
    Apr 25, 2011
    Posts:
    303
    Would it be possible to implement something like this? Thanks!
     
  22. Diab1O

    Diab1O

    Joined:
    Mar 31, 2013
    Posts:
    317
    I plan to do something similar, but not soon.
     
  23. GingerDr73

    GingerDr73

    Joined:
    Sep 25, 2013
    Posts:
    21
    Ok, I'm running Unity 5.6.0f3. AltTrees 0.9.8. Attached is what the code that captures the screenshots looks like.
     

    Attached Files:

  24. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,864
  25. Diab1O

    Diab1O

    Joined:
    Mar 31, 2013
    Posts:
    317
    First, you need to move the screenshot code from "Update" to "LateUpdate".
    Second, you need to set the "Script Execution Order": http://joxi.ru/el2ZYzEcpl9omJ
    set 100, or more
    (On the screenshot my script name is Capture.cs )
     
  26. Diab1O

    Diab1O

    Joined:
    Mar 31, 2013
    Posts:
    317
  27. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    833
    Hi, I'm really interested in AltTrees system, I use lots speedtrees in my project.
    But I have some questions need to know:
    1. Can I interact with the trees in runtime? (as removing, replacing it with a mesh, plant a tree on destined position...)
    2. I'm using mapmagic for runtime terrain generation, does this asset compatible with mapmagic? Can I use it for runtime random generated terrains?
    Hear you soon ;)
     
  28. Diab1O

    Diab1O

    Joined:
    Mar 31, 2013
    Posts:
    317
    Hi,
    1. Yes, in the latest version I added the API. Look here please: API
    2. At the moment, you can not. But, we with the author MapMagic plan to make integration in the near future.
     
  29. crudeMe

    crudeMe

    Joined:
    Jul 8, 2015
    Posts:
    81
    Didn't help. Maybe I can send you a speedtree model, so you can check what's up? Single trees exported from modeller are okay, but when they are converted to alttrees those artifacts appears.
     
  30. Diab1O

    Diab1O

    Joined:
    Mar 31, 2013
    Posts:
    317
    Ok, send me a model please, I'll check.
     
  31. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    833
    good to hear that mapmagic will be supported!
    May I ask at what time approximately will the integration be finished? I can rearrange my project's schedule accordingly. :)
     
  32. Diab1O

    Diab1O

    Joined:
    Mar 31, 2013
    Posts:
    317
    I think 1-2 months. But this is not certain.
     
  33. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    833
    got it, it's a quite a long time...
    seems I'll have to try my own ways to integrate them together :\ any suggestions?
     
  34. Diab1O

    Diab1O

    Joined:
    Mar 31, 2013
    Posts:
    317
    This is difficult to do. You need to rewrite a lot of code.
     
  35. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    833
    is it possible to convert trees from terrain automatically in runtime?
     
  36. Diab1O

    Diab1O

    Joined:
    Mar 31, 2013
    Posts:
    317
    No. But you can try using the API to add trees.
     
  37. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    833
    I can convert trees in editor, tree types are limited and predefined, what about using mapmagic to place altTree prefabs?
    Mapmagic allows us to wright our own output node, is it possible to script an output node that can plant altTree prefab directly into altTrees system?
    I just bought altTrees system several days before, haven't got time to test it yet.
     
  38. Diab1O

    Diab1O

    Joined:
    Mar 31, 2013
    Posts:
    317
    Maybe, I have not watched how MapMagic works. When I finish work on more important updates - I will do integration with MapMagic.
     
  39. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    833
    great to know!
    regarding map magic, it's based on logical nodes, nodes generate numbers for each point on terrain.
    for the trees, it will generate every tree's location, rotation and scale then export the data into unity terrain.
    I maybe able to think of one or two methods to transfer these data into altTrees system if I know how altTree handles trees, and where the trees' data are stored.
     
  40. Diab1O

    Diab1O

    Joined:
    Mar 31, 2013
    Posts:
    317
    You can try using the API to add trees.
     
  41. trilobyteme

    trilobyteme

    Joined:
    Nov 18, 2016
    Posts:
    306
    Working on a fresh project, I installed a fresh copy of 0.9.8 from the Asset Store (release notes say it adds Unity 5.6 support), and then used the Windows/AltSystems menu to install/update. Once that completes, any time I try to add AltTrees to a scene, it adds the component and then immediately crashes Unity.

    I'm on a Mac, and am finding that it consistently crashes in Unity 5.6.1f1 and 5.60p4, but works in 5.5.2p2. I looked back at this post, but the code in 0.9.8 does not match up with the lines it suggests to change. Your lines 1905 & 1964 do not match, and lines immediately above/below don't contain that text. Searching for that string you list for 1905 turns up a match... on line 2717. And the line you show at 1964 turns up twice, at lines 2801 and 2825.

    For good measure, I deleted the version from the Unity asset store and downloaded the 0.9.8 archive for Unity 5.6 from your site, but I'm still getting the same result.
     
  42. Diab1O

    Diab1O

    Joined:
    Mar 31, 2013
    Posts:
    317
    Sorry, I do not have Mac. I now checked in Unity 5.6.1f1 in Windows - no crash.
    Please send me a log of Unity after the crash.

    This is for 0.9.7.1
     
  43. trilobyteme

    trilobyteme

    Joined:
    Nov 18, 2016
    Posts:
    306
    Okay, log sent!
     
  44. 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.
     
  45. Diab1O

    Diab1O

    Joined:
    Mar 31, 2013
    Posts:
    317
    Hello,
    Yes, it can be done with the API.
     
    TokyoDan likes this.
  46. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    How is each individual tree accessed? Are they stored in an array?
     
  47. Diab1O

    Diab1O

    Joined:
    Mar 31, 2013
    Posts:
    317
  48. QuantumTheory

    QuantumTheory

    Joined:
    Jan 19, 2012
    Posts:
    1,082
    Perhaps I'm doing something wrong, but I'm profiling what I'm distributing and it's performing much worse than Unity Terrain-placed objects.

    I have a 66 triangle rock that I scatter a bunch of times. I'll use the bark shader on it just to test performance. When I profile, the numbers are not encouraging. I'm not scattering thousands now, just maybe 200-300. The profiler says that nothing is getting batched. Nothing is getting instanced. I can only assume these objects are literally clones of gameobjects and it's taking 2ms to draw this bunch whereas I can literally slather the Unity Terrain with detail objects and the timer barely budges. Please advise!

    *edit* And the frame debugger shows each one is drawing one at a time.
     
    Last edited: May 26, 2017
  49. Diab1O

    Diab1O

    Joined:
    Mar 31, 2013
    Posts:
    317
    Hi,
    You use AltTrees 0.9.8?
    I recommend activating the GPU instancing for small objects (in the settings of each object).

    Unity Terrain(Trees):

    Unity Terrain(Details):

    AltTrees:



    Unity Terrain(Trees):

    Unity Terrain(Details):

    AltTrees:


    Unity Details are faster, because there is used another algorithm (the same as for grass). In future updates I plan to make my version for grass and small objects with more optimization.

    No, my system does not use the GameObjects for drawing.
     
  50. QuantumTheory

    QuantumTheory

    Joined:
    Jan 19, 2012
    Posts:
    1,082
    Thanks for your response, but I can't find how to activate GPU instancing.
     
unityunity