Search Unity

[Released!] Custom tree importer

Discussion in 'Assets and Asset Store' started by larsbertram1, Aug 19, 2014.

  1. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    What about I export with the root node which is always at 0,0,0 for each part?
    Will this get all the trunks' height right?
    And about the little fix you were talking about after I figure out my common workflow, what is it?
     
  2. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    no, this is mandatory anyway. the height usually gets read from the bounding box of the mesh on level 1 – which in case the mesh is only a chunk of the trunk will be way too small.
    so you have to set in manually.

    actually, the small fix turned out to be a little bit bigger than i initially thought as the trunk is treated in a special way at various parts of the importer script and you will have to make sure that chunks are handles the same way.

    right now i have a working version which unfortunately is a mess. i will have to clean it up during the next days.
    so i might be helpful if you could send me your fbx file.
     
  3. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    thanks for your fbx file. with some little changes to the importer script it turned out to work fine :)

    on the left the complete fbx containing stump and the trunk divided into 2 more parts.
    on the right you can see only "trunk2 which pretty much fits as far as bending is concerned.

    Bildschirmfoto 2018-01-23 um 12.17.28.png

    i was a little bit frightened first because of leaves loosing the connection but then i noticed that you have added vertex color green = 1 to the leaf meshes. this will make them break. even if vertex color green would only influence classical edge fluttering leaf planes would get disconnected. but the cti shaders also use it to add some extra secondary bending to the leaves. so you have to make sure that vertex color green is set to 0 at the leaf plane's pivot – all other vertices should use rather low values like 0.2 – 0.4.

    instead of using the "old stye" cti tree creator shaders i used the LOD shaders by simply adding "_xlod00" to the file name. these give you some more control and better bending, do not ned double sided leaves and come with a debug shader which lets you easily spot bugs in bending and find their cause.

    not tackled yet: tree position in materialpropertyblock from script when the tree breaks apart and the single prefab is replaced by mutiple gos.
     
  4. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Can't wait to learn how to tweak the codes to make it work!
    About the vertex color, I'm not sure if I used 3dsMax's vertex painting in the right way.
    It only allow me to paint vertex with a chosen color, not separated channels that I can tweak with.
    So I chose pure green thought it would be painted into the green channel, then used 20% strength to paint it.
    Now I think maybe I should choose a green depth about 50(20% to 255) to paint the vertex.
    And about the pivot vertex, I actually painted pure black on it, don't know why it's green channel is still 1.

    And I also got a question about the shaders, I noticed after importing the default shader does not have an option to disable backface culling, does it mean I have to make every leaf plane twice to make them be seen from both sides or there is an exist shader in CTI that I can use with double side rendering?
     
  5. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    i am not either. i opened the fbx in maya 2013 – which already currupted al normals. maybe the vertex colors got corrupted as well.
    the cti debug shader however lets you preview these so you know how the shader will see them.

    adding "_xlod00" to the file name will make the importer assign the lod shader – instead of the tree creator like shaders – which support single sided geometry on leaves, deferred translucent lighting and much more.
     
  6. form_d_K

    form_d_K

    Joined:
    Jul 12, 2017
    Posts:
    14
    Hi! Is it feasible to have this work with XFrog trees?
     
  7. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    it should work fine, yes.
     
  8. form_d_K

    form_d_K

    Joined:
    Jul 12, 2017
    Posts:
    14
    Nice! Thank you. :)
     
  9. Fer00m

    Fer00m

    Joined:
    Feb 28, 2014
    Posts:
    170
    Hey,

    I'm working on some forest assets with help of photogrammetry and CTI and wanted to show what I got so far. CTI is such a fantastic tool and I'd say it easily blows SpeedTree (as long as you want to manually model your trees) out of the water considering its rather disappointing Unity implementation. Everything is still pretty much WIP.









    Let me know what you think!
     
    Mister-D, nirvanajie, zmaxz and 5 others like this.
  10. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Wow @Fer00m, That is stunning! Yeah CTI is definitely a life saver if you want to make trees anything close to these.
     
  11. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
  12. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    132
    Hello Lars, great asset, I'm finding it very powerful. I'm having an issue with LOD groups and terrain though.

    So, I can build and import a tree, wind works perfectly. But once I create a LOD group and assign the meshes the wind stops working, but only when the trees are painted on the terrain. Hand placing a tree works fine, wind with LOD. Am I missing a step? Thanks!
     
  13. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    if you add the trees to the terrain you have to make sure you checked "Use Wind for LODGroups on Terrain" in the material inspector :)
     
    Noogy likes this.
  14. BigPoodle

    BigPoodle

    Joined:
    May 27, 2015
    Posts:
    6
    Hi, thank you for this awesome asset. Now I don't have to use Tree Creator anymore..

    I have a question. Are CTI/LOD shaders fully compatible with Vegetation Studio?
    I was just testing CTI's sample Jacoba LOD tree with VS, but it looks like the trees are
    stuck at LOD0 regardless of distance. They do switch to VS's billboard rendering
    when they are far enough away though. And if I disable VS's billboard function,
    the trees remain at LOD0 all the way to the camera's culling distance.

    I am using mac Unity 2017.4 and both the assets are the latest versions btw.
     
  15. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    lods are nothing cti shaders or meshes do control – that is all done by vs. so if the lods do not change something is wrong with the setup of the tree in vs. most likely vs did not recognize the lod levels as it at least used to be restricted to standard unity lod names. so simply try to rename the lods accordingly.
     
  16. BigPoodle

    BigPoodle

    Joined:
    May 27, 2015
    Posts:
    6

    I just checked the sample Jatoba tree prefab.
    It turns out the names of its child LOD instances lacked the standard_LODx suffixes.
    So I added that and it works now! Wow, I feel dumb.
    Thank you very much for the quick response.
     
  17. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    i trapped into the same pitfall once...
     
    BigPoodle likes this.
  18. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    why does the treecreator shader doesnot work with the unity postprocessing stack bloom?
    i get horiible white balls on my trees when using it
     
  19. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    no idea – usually these are caused by NaNs but the shader should not produce any.
    do you use deferred? and which version of the stack?
     
  20. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    i use forwar
    i use forward linear color space and the latest version
     
  21. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Hey @Mister-D, Unless it has been updated since I last used it the tree creator shader does not play very well with effects or lighting.

    One thing you could try is setting a black gloss in the combined map. Think it was gloss but could be specular.

    Also another thing that helped at the time was using the treecreator shader that was included with Lux. Not sure if there still is a Lux Optimized Leaf shader but that helped with the gloss issues.

    Using Unity 2018.1?
     
    Mister-D likes this.
  22. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    i totally overread "treecreator trees"...
    so these use blinn phong on the bark which in combination with the wind animation tends to produce weird specular highlights where there should not be any. may be this goes crazy if bloom is enabled.
     
    Mister-D likes this.
  23. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    yes its probably the specular highlights that go crazy. is there another shader i canuse ?
    i want to sell the pack later on but dont know if i can include your CTI shaders in it
     
  24. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    tnx for the suggestion . yes just updated to 2018.1
     
  25. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    fixed it by setting the specular to complete white in the combined normal map (red channel)
    tnx guys
     
  26. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    you can include cti shaders.
     
    Mister-D likes this.
  27. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Yes with Lars permission above please use the CTI LOD Bark and Leaf shaders! They are truly stunning and will not give you the render pains that the tree creator shaders will. Takes some reworking on your models, mainly if you want single sided leaves, but is definitely worth it.
     
    Mister-D likes this.
  28. poisonnuke

    poisonnuke

    Joined:
    Nov 22, 2016
    Posts:
    82
  29. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    i do not really know as i do not know TheGroove3D.
    it depends on if TheGroove3D allows you to break up the final tree model into trunk, branches and subbranches.
    do you happen to have a demo model?
     
  30. florianalexandru05

    florianalexandru05

    Joined:
    Mar 31, 2014
    Posts:
    1,811
    Would this work with the new SRP HD and LW shaders? I'm still interested in buying it but I didn't get to work on my environment update yet and It's gonna take me another moth till I do maybe.
     
  31. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    i haven#t work on any lw or hd shaders yet, sorry.
     
    florianalexandru05 likes this.
  32. florianalexandru05

    florianalexandru05

    Joined:
    Mar 31, 2014
    Posts:
    1,811
    Alright np, I might buy it sometime to learn from it...
     
  33. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    you should :)
     
  34. Talavaj

    Talavaj

    Joined:
    Sep 22, 2013
    Posts:
    41
    Hello there!
    Perhaps I have missed something obvious, (other than the information in the readme) but I can't seem to get the LOD Leaves material to work in 2018.2.0b10 (the 3D template not the HD).
    Is it expected to work there at all?

    This is how the affect material looks like:
    leaves.jpg
     
    florianalexandru05 likes this.
  35. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    the original leaf shader breaks in 2018.2. ...
    but you can find a fixed version (unity 2018.2. only) here:
     
    florianalexandru05 and Talavaj like this.
  36. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Everyone here is the fix for the default folder setup for CTI in a project. My other link above will only work for the TFP setup. Here is for normal CTI folder location to replace the debug and leaf shaders-

    CTI_2018.2_Fix
     
  37. Talavaj

    Talavaj

    Joined:
    Sep 22, 2013
    Posts:
    41
    CTI doesn't seem to like my 3ds max exported trunks at all.
    The branches and leaf cards seem to be attached to a non existent trunk and they react to wind just fine, but the mesh of the trunk itself remains stuck.
    When I set the wind intensity to 50, most of the trunk remains fixed with only one side pulling down a little.

    So far I tried a tree mesh with no scaling transformations, mesh with frozen transformations as well merged and subsequently detached objects with readjusted pivots.

    Has anyone encountered an issue like this?
     
    florianalexandru05 likes this.
  38. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    i do not have 3ds max, so i have never tested it.
    but have you tried to import a suoer simple tree - like in the tutorial?
    a trunk just made out of a subdivided cylinder, one parented branch also just a cylinder and a simple leaf plane?
     
  39. Talavaj

    Talavaj

    Joined:
    Sep 22, 2013
    Posts:
    41
    Crisis averted.
    I just rotated the pivot of every element to x90 and that seems to have fixed it.
    Rotating only the root does make the tree point upwards, but the bending will be odd unless the trunk (and possibly branches) is also rotated.

    Looks great!
     
  40. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
  41. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    132
    Awesome, thanks for this, was struggling after updating Unity.
     
  42. swredcam

    swredcam

    Joined:
    Apr 16, 2017
    Posts:
    130
    I need to make a slight adjustment to the color/tint of an existing tree. I don't see such an adjustment in the CTI shader though. Is it possible to do this? I have similar plants using AFS and adjusting tint is pretty easy there. CTI is a great asset BTW!
     
  43. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    actually cti only offers "color variation". in order to generally tint an existing tree you will have to edit its textures (or the shaders).
    it would be great if you wrote a short review on the asset store :)
     
  44. florianalexandru05

    florianalexandru05

    Joined:
    Mar 31, 2014
    Posts:
    1,811
    Good package! I got to see what it's capable of and I have to say I'll be glad to be one of its proud owners! I also need a bit of customer support so if someone could notice this post and/or the inbox message... :))
     
  45. Talavaj

    Talavaj

    Joined:
    Sep 22, 2013
    Posts:
    41
    I was wondering, what would be the most resource efficient way of adding small foliage cards to the trunk of the tree?

    I want to make a few hero resolution trees and I would like to add transparent moss cards to their roots, but I figured that using the CTI shaders on those will waste a lot of resources, especially since there is no need to animate the moss.

    What would be the best way of going around this?
    Is there a tag to disable wind on particular objects in the hierarchy?
    Can I use the branch texture for transparency but import the cards as a trunk/branch object?
     
    florianalexandru05 likes this.
  46. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Hi @Talavaj, Not sure what 3d app you are using but if using Blender would recommend using a particle system. Set up a vert group on the trunk for the area you want the moss to grow and in the particle system make it a hair system, also advanced, and down below select model and set it. Is something that needs to be played with to get working but it is the best method for quick placing a bunch of models on a trunk.

    No need to have anything animated. For the moss model that you will propagate would have some vertex color green on the edges but if you want it completely static than make sure it is all vertex black. Then have _xw00_xt00_xlp00 in the name of the mesh that you do not want bending so that it will not bend using the main wind, turbulence. Tree will still bend and the moss will stay with it but the moss itself will not bend.

    No anything you want transparent needs to be imported as a leaf.

    Hope this helped some.
     
  47. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    nothing more to say left :)
     
  48. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
  49. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    if have a dev version of cti shaders supporting lux snow and wetness. but i am not working on it right now actually.
     
  50. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    hello
    this might be of topic but i ve sculpted some trees to get a more organic look
    this:

    problem is i cannot use the seperate branches setup that CTI uses.
    (currently i just use vertex color offset shader for leafplanes, so no branches bending.)
    so, will CTI support a solution for this in the future?