Search Unity

  1. 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

MTree - Tree creation

Discussion in 'Assets and Asset Store' started by mherpin, Aug 31, 2018.

  1. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,271
    Woo–hoo! Congrats on the update! My scenes are all about to become a lot more mTree-er.

    Screen Shot 2019-12-18 at 2.26.25 PM.png
     
    Baldinoboy and dan_wipf like this.
  2. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,398
    Update looks great! Awesome work guys!

    Quick question on the vertex colors. Thinking of making my own shader for mtrees and curious which vertex colors are doing what? Main Wind, Turbulence, Variation, and AO?

    Also are they using any UV2 for bending or just vertex colors?
     
    wetcircuit likes this.
  3. dan_wipf

    dan_wipf

    Joined:
    Jan 30, 2017
    Posts:
    283
    @Baldinoboy
    red=mainwind
    green=turbulence/randomness
    blue=turbulence/randomness
    alpha=baked AO

    you can use the provided amplify function for wind(but do not include the function in final asset if you’re targeting the asset store market place)
     
    Baldinoboy likes this.
  4. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,398
    Cool, Thanks for the information!
     
  5. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634


    So you where able to make scans and using Mtree for the top portions? or did you use Mtree for the whole thing and use scan textures? The reason I ask, if you never made scanned models for trees, typically the bottom half is done in tools like Agisoft, or Reality Cap.. and the rest we use software to model.


    If Mtree can do something like this, it would be a game changer...because right now we use other software to finish off the top aspects of scanned trees. So this is why I was wondering. ( I still have not used Mtree that much. so curious .Thanks for any info.
     
    Artomiano and dan_wipf like this.
  6. dan_wipf

    dan_wipf

    Joined:
    Jan 30, 2017
    Posts:
    283
    If i recall right, he did made and used scanned Textures and used them for the tree. the whole mesh was made in mtree!

    hopefully this answers your question!

    dan(mtree)
     
    recon0303 likes this.
  7. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,398
    This feature would be super cool but it would be extremely complex. Like easier to make a couple finished games than do this. SpeedTree is very powerful, which explains the greed, but they are able to pull this off. Would take a crazy amount of time and investment for a small team to be able to do this in Unity.

    Right now think the best method would be to make the mTree and export it to your 3d application and blend them manually. Would need a custom shader on import though, preferably with texture array, to render both the scanned model and bark material.
     
    dan_wipf likes this.
  8. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634

    Actually already use Maya, and some in house tools, to handle stitching, scans tree to a procedural model . ( I was just looking to see what you did and what others been offering.:)

    Sure Speed tree can be greedy all they want its there company. but they need to stop pretending. like I said I used the enterprise version, and the indie.. they should be different, but there licensing has never made sense. So they shouldn't bother.
     
    Baldinoboy likes this.
  9. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634

    Yes it answer it, so its not really what I was looking for. We actually make our scans, totally as a mesh.. Then the tops are procedural, like most users. I know some may use 3d party like say Mtree, and make the trees, and the textures are the scans. ( not what i'm looking for. ) but I figured that was the case. since most tools are no where as good as Speed tree ... which is why we build in house tools to handle some of these functions .( not as good as ST either.but better than doing it manually) anyways, I was just wondering. Thanks for that info.
     
  10. dan_wipf

    dan_wipf

    Joined:
    Jan 30, 2017
    Posts:
    283
    Mtree 2.2f0.1 is here:

    Code (CSharp):
    1. * Fixed HDRP 6.9.2 Material Inspector Issue
    2. * Added Billboard brightness slider to ajdust the finial Billboard Image
     
  11. Artomiano

    Artomiano

    Joined:
    Dec 1, 2014
    Posts:
    197
    Would be great, yes. But don't forget about the Speedtree background. ;)
     
    recon0303 likes this.
  12. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634

    of course:) I been using it since before, it become to indies used it in the early days. but it don't mean stuff like this is impossible. Right now scanning (photogrammetry)
    is the future. no matter if we like it or not. and right now we are limited on tools. to do so. Right now the people who do it ( I'm one, we have to use, about 15 different tools and even made some of our own, to create them. but this is what clients want, and the industry more and more.

    So, I suspect soon we will see some tools being made. outside of ST..

    anyways thanks guys for the info.. :)
     
    Baldinoboy likes this.
  13. dan_wipf

    dan_wipf

    Joined:
    Jan 30, 2017
    Posts:
    283
  14. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634

    I just asked how he handled it. ( I was just curious to what he used for the Mtree part of it, he answered he actually just used the textures only . We typically make our meshes from our scans, and need to create the tops. ( Like most, I was curious if Mtree was able to do that, I thought maybe he may have done so. ( I knew it didn't handle stitching. ( I had created something in Maya for it anyways with a tool .... but if say Mtree, you could create the top procedurally, it would work. ( I only used Mtree once.) .

    So for example when we create the meshes, which is basically the lower part of the tree. .. the rest, we use another ( a few actually) programs, procedurally, to make the rest of it. and use textures from our scans to finish it. So, if Mtree, allowed say something like that, that is really all it needs. it don't need the stitching aspects. that can be handled anyways easily in a 3d software. like Maya, etc. ( we built a plug in for it in Maya.)

    Not many tools allow you to make your own work, and sell it. ( we do) sadly Speed tree does not. So, we use a mix of tools to handle scans meshes and such.) but if Mtree, allowed say, where we could procedurally make the branches, and the top trunk of the tree only. so we could connect it to a scanned mesh. I thought maybe he had possible used it for something like that.
     
    Last edited: Dec 28, 2019
    dan_wipf likes this.
  15. riveranb

    riveranb

    Joined:
    Jul 16, 2017
    Posts:
    16
    Hi, I just imported new version MTree v2.2f0.1, try to use it with HDRP 5.16.1 (Unity 2019.1.10f1)
    But I have trouble on producing tree prefab with failed billboard (LOD4).
    I am not sure the correct SRP installation steps.
    I do not have amplify shader editor,
    should I install "HDRP_5.16.1_2019.1 Amplify.unitypackage" and "HDRP 5.16.1 Amplify.unitypackage" ?

    This is what I get from "save as prefab"
    Did I miss something?

    upload_2019-12-29_13-17-11.png
    upload_2019-12-29_13-17-18.png
    upload_2019-12-29_13-17-25.png
    upload_2019-12-29_13-17-30.png
     
    Last edited: Dec 30, 2019
  16. dan_wipf

    dan_wipf

    Joined:
    Jan 30, 2017
    Posts:
    283
    i will have a look into this! have you deleted mtree 2.1 first befor import?
     
  17. riveranb

    riveranb

    Joined:
    Jul 16, 2017
    Posts:
    16
    Yes, I start a new HDRP template project (Unity2019.1.10f1)
    HDRP upgrade to 5.16.1 version
    Then import MTree v2.2
     
  18. dan_wipf

    dan_wipf

    Joined:
    Jan 30, 2017
    Posts:
    283
    I just did Test it on Unity 2019.1.14f1 -> SRP 5.16.1 and everything worsk as expected.

    Ok first a Tip: if you have installed HDRP via a new Package (Marked with red X), you most likely installed an old Version of HDRP with all it dependencies! Better go with a Standard 3D Project (Marked with green )

    No Way.png
    Then have a look at your Package Manager that you have folling installed with the current version 5.16.1 (marked yellow)

    - High Definition RP
    - Core RP Library
    - Shader Graph

    HDRP 5.16.1.png

    If you Need further help, it'd be easier to have a Chat on Discord (link in my signature)
     
    Mauri and riveranb like this.
  19. riveranb

    riveranb

    Joined:
    Jul 16, 2017
    Posts:
    16

    I follow your suggestions, problem solved.
    If I created HDRP template, then I will get HDRP 5.7.2 installed defaultly.
    And I only upgrade HDRP to HDRP 5.16.1, but missed Core RP library & Shader Graph.
    It's why something not working.

    Thank you!
     
    dan_wipf likes this.
  20. Artomiano

    Artomiano

    Joined:
    Dec 1, 2014
    Posts:
    197
  21. dan_wipf

    dan_wipf

    Joined:
    Jan 30, 2017
    Posts:
    283
    Talked to Maxime about that, and i guess this wont be feature we follow to develop. We stick at procedural only (the benefit atm for most users wont be enough, to support custom mesh trunk with procedural top), better have more realistic growth of the branches and hopefully propper roots :)
     
    mherpin likes this.
  22. Artomiano

    Artomiano

    Joined:
    Dec 1, 2014
    Posts:
    197
    Don't worry, it was just a joke! :rolleyes: I know that MTree benefits from its procedural system.
     
    dan_wipf likes this.
  23. dan_wipf

    dan_wipf

    Joined:
    Jan 30, 2017
    Posts:
    283
    a baked prefab? or an mtree prefab? prefabs with mtree component dont work. you need to use templates for this.

    maybe investigate in the lodgroup component
     
  24. Ne0mega

    Ne0mega

    Joined:
    Feb 18, 2018
    Posts:
    341

    Heh, you answered as I was deleting. Working now. Thanks.

    Actually, it appears to be related to "recalculate bounds" in the LOD group. Monkeying around with it.

    Yup, recalculate bounds will ruin LOD for some reason. The only way I could figure to recover is to delete the prefab and re-import. Now runs like a charm.

    EDIT: So, in the very beginning, weeks ago, it appears I was messing with settings, and turned the palm tree (which was the first tree I messed with) to STATIC.

    And that little mistake cost me weeks of hair pulling. :oops:
     
    Last edited: Feb 3, 2020
    dan_wipf likes this.
  25. Dobalina

    Dobalina

    Joined:
    Sep 6, 2013
    Posts:
    67
    Hello! I'm sorry if this has already been asked, I'm wondering if it's at all possible to have the tree leafs set to billboarding? I'm creating a flying game in which you can fly over farm lands and fields of trees. From what I can tell, Mtree doesn't render a top card in the lowest LOD and made me think, billboarding leafs would actually hold up better throughout all levels of LODs and reduce the overall number of leaf cards. I think Warthunder might do the same for their tree LODs. Is this possible?
    Thanks!
     
    dan_wipf likes this.
  26. dan_wipf

    dan_wipf

    Joined:
    Jan 30, 2017
    Posts:
    283
    good news! your the first how asks this. (well flying over a scene, i defently saw this before, but irrelevant. so atm there’s no solution, but we will add this to our goal for one of the next updates! i gues it will be possible to provide a solution (but no guarantee)
     
    Willbkool_FPCS and hopeful like this.
  27. Dobalina

    Dobalina

    Joined:
    Sep 6, 2013
    Posts:
    67
    Awesome! Glad to hear it, I'll keep a look out :)
     
    dan_wipf likes this.
  28. dan_wipf

    dan_wipf

    Joined:
    Jan 30, 2017
    Posts:
    283
    Mtree 2.2f1.0 is on its way!

    Changelog:
    Code (CSharp):
    1. * Fixed URP Shaddow bug.
    2. * Added SRP 5.7.2, 6.9.1, 7.1.6
    3. * Added Toon Shaders for MTree (BETA)
    4. * SRP 7.1.5 is now deprecated, and nolonger supported.
    5. * Changed AO distance behaviour.
     
    Baldinoboy and wetcircuit like this.
  29. dan_wipf

    dan_wipf

    Joined:
    Jan 30, 2017
    Posts:
    283
    @Dobalina, did a simple test, what could improve the Overall look of the distance billboard, when flying over the tree. so far i'd say the easiest way is to add an additional plane to the Billboard. Target BB.png

    This will then look like this:
    Billboard Test.png
    (Made a screenshot and then edited with PSD, just to say, havent coded any Thing yet, ist just to Show, what solution i think could be possible and acceptable)
     
  30. Ninjabase

    Ninjabase

    Joined:
    Mar 11, 2018
    Posts:
    1
    This asset is grate! for new features, wish there were root generation. Also able to attach meshes to the trees for pine cones,mushrooms, bird nests etc...
     
    dan_wipf likes this.
  31. dan_wipf

    dan_wipf

    Joined:
    Jan 30, 2017
    Posts:
    283
    @Ninjabase glad you like it!

    for custom objects there is a work around! (but its maybe more for like pinecones/apples etc, and not for single objects)

    you can follow this tutorial to get an idea:

     
    Ne0mega likes this.
  32. Dobalina

    Dobalina

    Joined:
    Sep 6, 2013
    Posts:
    67
    Nice! Looking like a step in the right direction. Although, what are the possibilities of a camera orientating leaf billboards? And I mean that for all levels of of LOD, including LOD0. The reason I bring this up is because in a flight game with lots of trees in view, tree LOD transition pops become even more apparent. Less noticeable LOD transitions seem to require more leafs, of which you shouldn't/or cant really do performance wise in a flying game. Thus, my curiosity of camera orientating leaf billboards throughout all LOD levels which would greatly reduce the number of required leaf cards and hold up better between transitions. Is that a tall order?
     
  33. dan_wipf

    dan_wipf

    Joined:
    Jan 30, 2017
    Posts:
    283
    have you tested with speedtrees? they use another technique with the billboard renderer
     
  34. dan_wipf

    dan_wipf

    Joined:
    Jan 30, 2017
    Posts:
    283
  35. simonini_thomas

    simonini_thomas

    Joined:
    Apr 30, 2015
    Posts:
    27
    Hi @dan_wipf
    Your tool is really amazing. But I have an import problem. So I followed what you said in the forum on how to create the prefabs. I created the trees, then created the prefabs and generated a package (containing all the elements you specified) on this project that use Unity 2019.3.0f1 and normal 3D.

    But when I import this package in another project (same configuration Unity 2019.3.0f1 and normal 3D) I get this.

    upload_2020-2-1_9-55-46.png

    Screenshot 2020-02-01 at 09.54.07.png




    Thanks for your help.
     

    Attached Files:

    Last edited: Feb 1, 2020
  36. dan_wipf

    dan_wipf

    Joined:
    Jan 30, 2017
    Posts:
    283
    @simonini_thomas hey!

    ok looks like you havent imported the shaders they need to stay in the same hirarchy order as its in mtree, due to VSP integration!

    So select the prefab + folder + legacy shader folder on export as an asset. the pinky things most of the time says: shader error (not imported or broken)

    dan

    PS for further support its easier when you pm me on discord
     
  37. Ne0mega

    Ne0mega

    Joined:
    Feb 18, 2018
    Posts:
    341
    Using HDRP, 2019.3. There is a check box for enable GPU instancing on all the MTree/SRP shaders, but I am not sure it is working... does it work just by clicking the box, or is there something else I have to do?
     
  38. dan_wipf

    dan_wipf

    Joined:
    Jan 30, 2017
    Posts:
    283
    @Ne0mega It's quite easy to detect if instancing works or not.

    See the two Pictures with 10'000 Trees of the same Kind tested. Without Instancing checked on all the Materials we have 35'482 Batches and 0 saved by batching. If you activate now GPU Instancing you will see that the Batches decrease by 35k+ and saved by Batches increase by 35k+ =)

    So this means you'll get a Performance boost!

    Without GPU Instancing checked:
    10'000 Terrain Trees No Instancing.PNG

    With GPU Instancing checked: 10'000 Terrain Trees with Instancing.PNG

    With GPU Instancing checked on Legacy Shaders:

    10'000 Terrain Trees with Instancing LEGACY.PNG
     
    Last edited: Feb 3, 2020
    Baldinoboy, Neviah and wetcircuit like this.
  39. Ne0mega

    Ne0mega

    Joined:
    Feb 18, 2018
    Posts:
    341
    crud. I was afraid of that. That means it is not working. Do I have to turn off something first? I saw a warning about static batching on one of the trees when I first turned GPU instancing on, but to my knowledge, I have not turned on static batching or anything.

    EDIT: So, in the very beginning, weeks ago, it appears I was messing with settings, and turned the palm tree (which was the first tree I messed with) to STATIC.

    And that little mistake cost me weeks of hair pulling. :oops:
     
    Last edited: Feb 3, 2020
  40. Ne0mega

    Ne0mega

    Joined:
    Feb 18, 2018
    Posts:
    341
  41. dan_wipf

    dan_wipf

    Joined:
    Jan 30, 2017
    Posts:
    283
    try to set the cutoff the billboard to diffrent value, maybe mess with the lod settings, working on smoother transitions anyway :)
     
  42. Ukounu

    Ukounu

    Joined:
    Nov 2, 2019
    Posts:
    99
    Hello, there seems to be a significant issue with branches being separated from the main trunk. I'm not sure why nobody is discussing this? This issue is clearly visible on all trees even without wind, and as soon as some wind applied, a lot of branches disconnect completely (the screenshots are from the default example scene, without any modifications). Is there any chance that this issue will be solved in a future update? Untitled-1.png
     
    Last edited: Feb 6, 2020
  43. dan_wipf

    dan_wipf

    Joined:
    Jan 30, 2017
    Posts:
    283
    Hi!

    Thanks for reporting this. (never encounter such issues (2017.4 - 2020.1)

    What Unity version do you use exactly?

    Did you upgrade from 2.1 to 2.2? or a fresh install?

    dan
     
  44. Ukounu

    Ukounu

    Joined:
    Nov 2, 2019
    Posts:
    99
    I drew a quick chart showing some possible solutions for this problem.
    Fig.1 is showing how branches are attached to trunks now (snapping to surface);
    Possible solution #1 (Fig. 2): branches have the same geometry, but are submerged for a few centimeters inside trunk during procedural generation, instead of snapping to surface;
    Possible solution #2 (Fig. 3): branches are generated at the same positions on trunk surface, but have one additional vertex on the central trunk axis, connecting to vertices on branch basis.
    Possible solution #3 (Fig. 4): vertices on branches and trunks are connected, which completely eliminates any chance for any holes. This would be the best solution, but probably the most difficult to implement, since it requires generating additional vertices where branches and trunks intersect.
    Untitled-3.png

    This issue is not unique to MTree, since both Unity trees and SpeedTree trees have the same bugs. And which is why I ended up never using them. This asset looks quite promising, so I hope there will be some fix for this issue.
     
    dan_wipf likes this.
  45. Ukounu

    Ukounu

    Joined:
    Nov 2, 2019
    Posts:
    99
    I think you, like many other people, just never looked closely. Every single Unity tree and SpeedTree out there have exactly the same problem, yet thousands of developers use such trees for production. They don't notice, or pretend not to notice, or just think "meh, it will pass". Maybe I just have a bit higher quality requirements than an average Unity developer.
    I'm using Unity 2018.4 and MTree 2.2, but it doesn't really matter - as I explained above, this issue is not exclusive to MTree, but a common problem for all procedurally generated tree solutions. The trees can be exported as fbx and opened in Blender, and all the holes from poorly connected branches are visible. It's not a problem of Unity or shaders, it's just an issue with geometry caused by procedural generation.
     
    Last edited: Feb 6, 2020
    dan_wipf likes this.
  46. dan_wipf

    dan_wipf

    Joined:
    Jan 30, 2017
    Posts:
    283
    thanks for the detailed explenation!

    i will pass this further to maxime!

    dan
     
  47. Ukounu

    Ukounu

    Joined:
    Nov 2, 2019
    Posts:
    99
    A few more questions...

    Crossfade doesn't seem to work for me. I loaded example scene, made a prefab out of a tree (without modifying anything) and added it to the scene. When camera zooms in/out, next LOD just appears/disappears without any dither/fading effect. Are there some additional setup steps required?

    Are you planning to implement spherical wind zones?
    They would be useful for quick and easy simulation of a character walking/running through bushes/ferns and other small plants, I think.

    Also, I noticed that once you add a wind zone to scene, trees "remember" wind force/direction and keep moving even after wind zone object is deleted. Is that a bug or a feature?
     
    Last edited: Feb 9, 2020
  48. dan_wipf

    dan_wipf

    Joined:
    Jan 30, 2017
    Posts:
    283
    the windzone i’m aware of this. its not really a bug or a feature, its dueto global values which are set and not set to zero when object is destroyed.

    Spherical wind zones are in mind but not planed yet.

    The lod crossfade is in development and not availanle yet.
     
  49. Ukounu

    Ukounu

    Joined:
    Nov 2, 2019
    Posts:
    99
    Ok. I think I can add spherical wind zones by myself through a script, so it's not a big deal.

    Smooth crossfading for LODs would be great, so I hope you can add it in a future update.

    Meanwhile, I want to report another bug.
    Untitled-1.jpg
    I noticed that with some branch settings leaves are no longer attached correctly to branches, as clearly visible on screenshots above. This happens if I edit curve for "branch length". Some curves work just fine, but some turn trees into complete mess. E.g., a smooth curve that goes from 0.5 to 0.2 (check the screenshot). You can easily replicate this bug by setting this curve for branch length for small tree (or any other default tree template). Every tree generated with this setting will be broken.
    Untitled-2.jpg
     
  50. dan_wipf

    dan_wipf

    Joined:
    Jan 30, 2017
    Posts:
    283
    thanks i will have a closer look at this
     
unityunity