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

MTree - Tree creation

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

  1. A_World_Maker

    A_World_Maker

    Joined:
    Apr 21, 2018
    Posts:
    213
  2. praesidenter

    praesidenter

    Joined:
    Mar 5, 2016
    Posts:
    36
    The tool looks fantastic, I'm looking forward to HDRP support!

    Someone asked this earlier in this thread, but it wasn't adressed back then:

    Are there / Will there be smooth LOD transitions?
    Trees jumping from one to another LOD all over the place without smooth transitions (like shown in the promo video) kind of works against the idea of beautiful trees, so I think this would be a very important feature.
     
  3. mherpin

    mherpin

    Joined:
    Oct 1, 2013
    Posts:
    103
    I agree, LOD fading is a must have. I have struggled to make it work; the issue is that the shader has vertex displacement, and in order to have the shadows following the movement I added a directive to the shader that doesn't work well with LOD fading.

    So I have multiple options:
    • Have no LOD transition (current behavior).
    • Have LOD transitions with moving shadows (but shadow disappear during transitions).
    • Have LOD transitions, but static shadows, which doesn't work well when the wind displacement is too noticeable
    For those who want to test the last option, here is the link to download the updated shaders, but I want to find a better solution before putting it in Mtree.

    If any of you is good with shaders and want to help, It would be fantastic !

    EDIT

    I just discovered that I only had to add one directive to the shader in order to make it support LOD transitions.
    So... LOD fading confirmed !
     
    Last edited: Feb 18, 2019
  4. mherpin

    mherpin

    Joined:
    Oct 1, 2013
    Posts:
    103
    I downloaded Treeit, I will make some tests !
     
  5. NoSpoonAnim

    NoSpoonAnim

    Joined:
    Feb 10, 2016
    Posts:
    13
    I just purchased your asset, looks good, really handy, but apparently does not support HD/LW (at least the shaders don't)
    vertex wind doesn't work either. Is this just for standard pipeline?
     
    soleron likes this.
  6. mherpin

    mherpin

    Joined:
    Oct 1, 2013
    Posts:
    103
    Support for HDRP and LWRP is coming in the next version !
     
    Last edited: Feb 18, 2019
  7. NoSpoonAnim

    NoSpoonAnim

    Joined:
    Feb 10, 2016
    Posts:
    13
  8. A_World_Maker

    A_World_Maker

    Joined:
    Apr 21, 2018
    Posts:
    213
    Thanks.. I have asked Evolve Software, about the animations being able to be transferred into the fbx file, but ofc, it's a shader driven solution, same as yours. I already own a forest of TreeIt foliage the size of brazil, so would like them to work with your shaders and trees :)
     
  9. marcos

    marcos

    Joined:
    Oct 18, 2009
    Posts:
    592
    Has anyone made any stylised trees with this? It would be nice to see some examples :)
     
  10. praesidenter

    praesidenter

    Joined:
    Mar 5, 2016
    Posts:
    36
    Sounds good! Will it be in the HDRP-version as well?
     
    mherpin likes this.
  11. riba78

    riba78

    Joined:
    Feb 16, 2018
    Posts:
    33
    @mherpin good roadmap and develpment plan!!!

    Go on!!
     
    mherpin likes this.
  12. mherpin

    mherpin

    Joined:
    Oct 1, 2013
    Posts:
    103
    It will, LOD dithering is added by default on HDRP shaders, one just need to check that it is enabled in the HDRP asset.
     
    praesidenter likes this.
  13. praesidenter

    praesidenter

    Joined:
    Mar 5, 2016
    Posts:
    36
    I just bought Mtree and played a bit with the example assets. It's really cool so far and seems very easy to use!

    A few questions/suggestions that came up while testing:
    1) Some important features like normal map, smoothness map and translucency map support are missing from the current leaf shader, are those planned in the future?

    2) Is there any way to go back to the tree creation process after a tree is saved as a prefab and deleted, in case I'd want to change a few settings later?

    3) I see that in order to change the wind on a prefab I need to go to the prefab itself and change the wind settings there. It would be fantastic if there was a unified way to change wind settings for all trees that are currently in a certain scene. Similar to how windzones and speedtrees work (from a user perspective).

    4) I tried to change the wind setting on a prefab after I had already painted trees of that type on a terrain, but the wind on the already painted trees wasn't updated. If I dragged a single prefab into the scene it had the updated wind.

    5) Similar to 3) & 4) - could the wind settings be changed dynamically in order to simulate changing weather etc?
     
    mherpin likes this.
  14. mherpin

    mherpin

    Joined:
    Oct 1, 2013
    Posts:
    103
    Here is my attempt at stylized tree:
    Capture3.PNG Capture3.PNG Capture2.PNG
     

    Attached Files:

  15. mherpin

    mherpin

    Joined:
    Oct 1, 2013
    Posts:
    103
    I'm glad you like it !

    1) I will make the leaf shader more complex at least for the HDRP version, and maybe also for the standard version.

    2) You can't revert to the tree creation process after export, you can however save the tree with Mtree component attached into a prefab in case you want to make some changes, then re-export.

    3) You are right, I will make an editor tool that changes the wind value for all trees !

    4) You can update the trees with the "refresh" button on the tree painting tab on the terrain component.

    5) It shouldn't be a problem to change the wind strength at runtime, simply access all "TreeWind" components and change the "WindStrength" value on them.

    Don't hesitate to send me a message if you want more details !
     
    Last edited: Feb 22, 2019
  16. dan_wipf

    dan_wipf

    Joined:
    Jan 30, 2017
    Posts:
    313
    for global controll delete the publi property of the wind in the shader

    and run a script like this:

    Code (CSharp):
    1. [ExecuteInEditMode]
    2. public class TreeWind : Monobehaviour {
    3.   public float WindStrength;
    4.  
    5.   public void Update() {
    6.     Shader.SetGlobalFloat("WindFloatFromShader",WindStrength);
    7.  
    8. }
     
    noufany and Mark_01 like this.
  17. gtox

    gtox

    Joined:
    Apr 23, 2013
    Posts:
    25
    I see from earlier in the thread that you can use different leaf types (for example to represent leaves and flowers), but I'm not sure how to do this. The shader uses a single texture, and whichever texture I use applies to both sets of leaves. How do I get each leaf type to use its own texture? Great tool BTW.
     
  18. mherpin

    mherpin

    Joined:
    Oct 1, 2013
    Posts:
    103
    You can have a texture with both the branch and the flower on it, and two custom leaves meshes that use one part of the texture, or the other.

    Here is a texture with the branch and the flower:
    branch serrate1.png
    Here is the uv layout of my two leaf meshes:
    UV layout.PNG

    And here is the result:
    result.PNG
     
    CaliCoastReplay and dan_wipf like this.
  19. gtox

    gtox

    Joined:
    Apr 23, 2013
    Posts:
    25
    Ah, thank you.
     
  20. gtox

    gtox

    Joined:
    Apr 23, 2013
    Posts:
    25
    I would like to create a set of African trees for the asset store - should I use the default Tree creator shaders, or is it OK to include the Mtree shaders? Also, is it OK to include the Mtree wind script?
     
  21. mherpin

    mherpin

    Joined:
    Oct 1, 2013
    Posts:
    103
    It's perfectly ok to use both the Mtree shaders and the wind script.

    I can't wait to see what you made with Mtree !
     
    CaliCoastReplay likes this.
  22. sylon

    sylon

    Joined:
    Mar 5, 2017
    Posts:
    246
    I've been trying out MTree the last few days, and i really like it.
    There are a few things however that would like to suggest.

    - For some trees i need roots. Maybe add a "Roots" function?

    - AO baking is very nice. But i miss AO on the bottom of the trunk, near the ground.
    - Would be nice to have AO contrast & brightness control (at generation)
    - AO is so cool, i want to see it all the time. Perhaps an "auto bake" option? (and do the baking with Jobs?) At least put the button on a place where i can get to it while tweaking.

    - Sometime i randomize a tree and i really like the result, except for some rogue out of place leave-planes. Would be so nice to be able to (re)move individual planes.
    - I miss the option to set a minimum leave size and random leave rotation. Also would help if i could set a minimum branch diameter in addition to the max.
    - When generating a prefab i do not always need all LOD levels. A bit more control on number of LOD's and detail per LOD would be handy. Also do not need the billboard, since i am generating that with Vegetation Studio.

    When tweaking a tree, the results are not always stable.
    I randomize a tree, like a result, and then when i start tweaking it, sometimes it sort of randomizes again and i loose my pretty result.
    This does not happen all the time. Anyone else experience this?

    Last thing.
    When i have altered a tree, and save the scene, later when i open the scene and select the tree, it reverts to it's old settings. Small bug i guess..

    I don't know if you intend to keep improving MTree, if so, i hope these remarks help.
     
  23. gtox

    gtox

    Joined:
    Apr 23, 2013
    Posts:
    25
    Thank you, I'm loving this tool. trees 2.jpg African Trees.jpg trees 1.jpg
     
  24. mherpin

    mherpin

    Joined:
    Oct 1, 2013
    Posts:
    103
    - Roots will be there eventually, but not on next version !
    - I agree, AO controls is a nice feature to have.
    - An auto bake feature would be great, the problem is that baking AO is takes a few seconds, maybe it would be a good Idea to trigger the baking when the user stops tweaking the parameters for some time.

    - I had made some tests with handles to have complete control over the tree (rotate branches, ect) but I found it a bit clunky, I could use a similar system to allow for small tweaking on the leafs.
    - I agree, more leaf size control is coming !
    - I will add an option to have less LOD levels generated.

    About the tree randomization, I'm afraid I can't do much about it without adding unnecessary complexity to the code. It boils down to the fact that branches follow some rules in order to look natural, and tweaking the trunk sometimes result in a branch not spawning, changing the positions and orientations of following branches.

    - When the tree is also a prefab, sometimes the parameters are reset to those of the prefab it is linked to. In order to avoid that, you can override the prefab with the modified tree. I can also automatically break prefab link when modifying parameters of a tree that is an instance of a prefab, what do you think about it ?

    Thank you for your feedback, it is what helps me to identify the things to improve, so feel free to point out any other problem/wanted feature !

    The next version is coming soon, I have made the HDRP and LWRP shaders, and I am currently improving the standard ones. After that I can make the new release and start working on all those new features.
     
    Last edited: Feb 26, 2019
    sylon, Mark_01, dan_wipf and 2 others like this.
  25. Rensoburro_Taki

    Rensoburro_Taki

    Joined:
    Sep 2, 2011
    Posts:
    274
    Hi, does this system work in VR? Performance SpeedTree vs Mtree?
    If so, I'll buy it immediately!
     
  26. mherpin

    mherpin

    Joined:
    Oct 1, 2013
    Posts:
    103
    The package should work in VR, and VR lightweight whith the next version.

    About performances: when exported as prefabs, Mtree trees are regular meshes organized in a LOD group, and the shaders used are simpler than the SpeedTree ones, so my guess is that they are faster, but I didn't make comparison tests.
     
  27. Rensoburro_Taki

    Rensoburro_Taki

    Joined:
    Sep 2, 2011
    Posts:
    274
    Nice, this sounds very promising! When do you thing, will the shaders/package be ready for VR?
     
  28. mherpin

    mherpin

    Joined:
    Oct 1, 2013
    Posts:
    103
    In a few days, hopefully !
     
    Mark_01 and Rensoburro_Taki like this.
  29. Rensoburro_Taki

    Rensoburro_Taki

    Joined:
    Sep 2, 2011
    Posts:
    274
    days? That means I am able to use it for my actual project, that I have to finish for my client! =)
    Consider it as bought!
     
    mherpin likes this.
  30. mherpin

    mherpin

    Joined:
    Oct 1, 2013
    Posts:
    103
    I have made a more complex bark shader for HDRP that blends two textures at the start of the trunk:
    HDRP bark advanced.png
     
    Flurgle, sarum, A_World_Maker and 9 others like this.
  31. praesidenter

    praesidenter

    Joined:
    Mar 5, 2016
    Posts:
    36
    That looks fantastic! Is that blending height based?
    Is there an ETA for the hdrp-shaders? I'm looking forward to trying them in our project :)
     
  32. Migueljb

    Migueljb

    Joined:
    Feb 27, 2008
    Posts:
    562
    Do you know if the Mtree shaders work well in mobile VR say for the Oculus GO?
     
  33. DiscoFever

    DiscoFever

    Joined:
    Nov 16, 2014
    Posts:
    286
    Sadly it doesn't build :(
    Can you please fix it ?!

    Code (CSharp):
    1. An asset is marked with HideFlags.DontSave but is included in the build:
    2. Asset: 'Library/unity editor resources'
    3. Asset name: node1
    4. (You are probably referencing internal Unity data in your build.)
    5. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    6.  
    Code (CSharp):
    1. An asset is marked with HideFlags.DontSave but is included in the build:
    2. Asset: 'Library/unity editor resources'
    3. Asset name: ShurikenMinus
    4. (You are probably referencing internal Unity data in your build.)
    5. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    6.  
    Code (CSharp):
    1. An asset is marked with HideFlags.DontSave but is included in the build:
    2. Asset: 'Library/unity editor resources'
    3. Asset name: node1 on
    4. (You are probably referencing internal Unity data in your build.)
    5. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    6.  
     
    mherpin likes this.
  34. mherpin

    mherpin

    Joined:
    Oct 1, 2013
    Posts:
    103
    Hi, this error probably occurs because you have a tree with the Mtree component still attached in one of your scenes. All trees made with Mtree must be exported as prefabs and replaced by the resulting prefabs before building the game.

    If exporting all the trees as prefabs does not work, make sure you have the Mtree package updated to its latest version.

    If the problem persists, please contact me on maxime.herpin@outlook.com, and I will help you solve this issue.

    I hope that helps !
     
    CaliCoastReplay likes this.
  35. DiscoFever

    DiscoFever

    Joined:
    Nov 16, 2014
    Posts:
    286
    Ohhh ... that was it ! It worked ! But it's not very practical, wouldn't there be a way for you to remove this feature so it could still build without the component attached ? Can be a very complex workflow when going back and forth with editing.

    Also, there's no mention nowhere about this 'trick'. Maybe you should write it clearly somewhere (another user also complained in a bad review)

    Thanks, i'll now update my 'bad' review :)
     
  36. mherpin

    mherpin

    Joined:
    Oct 1, 2013
    Posts:
    103
    Thanks, I agree that it would be better to be able to build with a tree that has the Mtree component attached.
    It happens because I use a sprite from the unity editor for the Mtree inspector display, so I only need to use a custom texture to avoid the issue. I will try that for the next version !
     
  37. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    @mherpin ,

    How goes it? Close to next release now? Will next release include the single leaf to multi-leaf branch thing and the Vegetation Studio Pro integration?
     
    Mark_01 and CaliCoastReplay like this.
  38. mherpin

    mherpin

    Joined:
    Oct 1, 2013
    Posts:
    103
    I'm wrapping up the next version, which will include: support for HDRP and LWRP, the single leaf to multi-leaf branch thing, Vegetation Studio Pro support, bug fixes, new textures and improved branch generation !

    I'm currently writing the documentation for the branch texture creator, then I check for last minute bugs and submit the new version.
     
  39. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
  40. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    A bit (very, perhaps) counter-intuitive - but did you give some thought to having the option to expert an MTree as a Unity Tree format tree?
     
  41. dan_wipf

    dan_wipf

    Joined:
    Jan 30, 2017
    Posts:
    313
    looking forward for the update!
     
  42. Mark_01

    Mark_01

    Joined:
    Mar 31, 2016
    Posts:
    623
    Reading some of the posts, if I am reading correctly, would it be possible
    to add a button to export the current tree as a prefab?
     
  43. sylon

    sylon

    Joined:
    Mar 5, 2017
    Posts:
    246
    That button is already there :) mtree.jpg
     
    Mark_01 likes this.
  44. Mark_01

    Mark_01

    Joined:
    Mar 31, 2016
    Posts:
    623
    great, good to know, thank you
     
  45. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    "Save as Unity Tree" button?
     
  46. mherpin

    mherpin

    Joined:
    Oct 1, 2013
    Posts:
    103
    I'm not sure that's possible since Mtree doesn't use the same process as unity fro generating branches. For example, unity trees can't have a branch split in two (as far as I know).
     
  47. dan_wipf

    dan_wipf

    Joined:
    Jan 30, 2017
    Posts:
    313
    @Duffer123 why would you want to use the trees as a unity tree? what’d be the benefits of that?
     
    Duffer123 likes this.
  48. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    Noted. Probably pointless then... Ignore... ;)
     
  49. A_World_Maker

    A_World_Maker

    Joined:
    Apr 21, 2018
    Posts:
    213
    I can see you are making outstanding progress. May I query if you have made progress to include TreeIt foliage in your shaders? I would like to be able to include all the trees I have under one wind control.
     
  50. dan_wipf

    dan_wipf

    Joined:
    Jan 30, 2017
    Posts:
    313
    well you could write this by your own, if necessary, what you need to do find the script froom treeit and set there something like

    Shader.SetGlobalFloat(“MTreeWindLookInMtreeShadetWhatsTheName”, FloatFromTreeItWhichDefinesTheStrengthOfWind);