Search Unity

[Released!] Custom tree importer

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

  1. deekpyro

    deekpyro

    Joined:
    Oct 16, 2012
    Posts:
    71
    I'm having the same issue with the test scene where the Custom Tree isn't responding to wind. I tried reimporting the custom tree and also re-adding the wind zone.
     
  2. deekpyro

    deekpyro

    Joined:
    Oct 16, 2012
    Posts:
    71
    Okay - I found the issue. I had a script named "Tree" that something was confusing for the Tree nature script that seems to be required for this effect.
     
  3. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    hi there,

    just a very quick and sneaky preview on what i am working on right now: the support for smoothly fading lod groups.
     
    Baldinoboy likes this.
  4. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    hi there,

    i have uploaded version 3 to the asset store. i hope i will get approved soon.
    the main new features are:
    • support for LOD groups
    • improved bending
    • physically based shading
     
    Mister-D and Baldinoboy like this.
  5. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    hi there,
    today i have just made a quick test with unity 5.4.0b5 and its new instancing feature.
    unfortunately lod groups placed using the terrain engine sshow up some glitcjes (which is a know bug or missing feature as far as i know) but trees places as game objects work pretty well - although i had to remove the tree script from the mesh trees. so there won't be any radial wind... directional wind however will still be supported.
    i hope unity will stop all the stuttering and support instancing using the terrain engine as well. than rendering a vast amount of mesh trees might finally reach a new dimension.

    please note: not all mesh trees are rendered in a single batch as they are in different lod states = different meshes.
    not even all trees which are in the same lod state are drawn as instances. but nevertheless instancing saves 48 batches in this screen shoot. not that bad.

    instancing.PNG
     
  6. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Hey Lars, Thanks for the update. Are there any post in the beta forum about this problem with instancing and the terrain? That would be extremely disappointing if Unity passes over the Terrain system with another feature. Especially this one.

    Looking forward to version 3 being accepted.
     
  7. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
  8. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Do not mean to spoil your post Lars but 3.0 is out! Have been looking forward to the notification. Downloading it as I type.
     
  9. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    oh, i did not get any notification about this, fine!
     
  10. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    @Baldinoboy and let me know about any findings. i had to do some last minute fixes which usually are prone to issues…
     
  11. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Imported without any errors and played both demo scenes which look great without any problems. Have not done any import test yet but will let you know when I do
     
  12. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Tested an import from xlod00 to setting up the billboard. Flawless! Edited the tree to have single-sided leaves. That alone saved a third of the tris. Then setup the xlod naming. Did regular decimating with each export and have the smaller branches which I named to go away at certain levels smoothly shrink away at LOD transition. After reading the instructions made the billboard easily. Pretty simple process once you get used to it. Along with the bending the shading is amazing. Really improved. Eventually will get a little scene together to show off my CTI 3.0 trees.
     
  13. Exguardi

    Exguardi

    Joined:
    Jul 31, 2013
    Posts:
    11
    I have some confusion regarding the functionality of the tree objects re: specularity. While both the TreeCreatorBark and TreeCreatorLeaves shaders include a "shininess" and "gloss" property, adjusting the "shininess" or loading a gloss image appears to have no effect.

    I've combed through the shaders with a fine-toothed comb and compared them to working specular shaders, and I'm mystified as to what is preventing the specular functionality from working.

    On a side note, while the v3.0 changelog of the asset mentions support for 'physically-based shading' I'm unsure as to what this means. The 'tree waving' effect will not function unless the TreeCreatorBark/Leaves shaders are applied, and there doesn't seem to be any modifications to these shaders.

    Advice welcome!
     
  14. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    There must be something wrong with the textures you are inputting. The gloss needs to be in the alpha of the translucency texture and the specular in the red(blue if using the new LOD leaves shader). If setup properly it will work fine.

    If you were to upload the textures you are using for on of the trees leaves we would be able to help you out more easily with them.

    For the physically based shading part Lars has created new shaders that are Physically based and Deferred rendered that contain the same bending features as the new tumbling shader and much better then the original treecreator shaders.
     
  15. bpears

    bpears

    Joined:
    Aug 23, 2012
    Posts:
    249
    Can you describe what the importer is doing to vertex colors on the leaves and branches? What if I wanted to paint them to be effected customly in modeler?
     
  16. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    The only vertex color the importer adds is vertex blue for tumbling and red for variation(xp).

    Vertex green(edge turbulence) has to be painted, baked yourself.

    Vertex alpha(for AO) can be painted or baked in the 3d app and the importer will use it if you add the control tag _xao at the end of the file name. If you do not want to or can not paint vertex alpha you can use the AO baker script included

    The only reason to paint vertex blue is -

    (from the docs)
    Mask bending
    As thick branches tend to get disconnected from their parents even if you have placed their pivots properly you may mask the vertices around the fork using vertex color blue. Set the vertices which should stay connected to their parents to vertex color blue = 1.0.
    In order to enable this feature you will have to add "_xmvcb" to the file name. Otherwise vertex color blue just gets ignored.
     
  17. bpears

    bpears

    Joined:
    Aug 23, 2012
    Posts:
    249
    Thank you for the info. Can you link the doc with that? I can't find it googling or entering it in the search.
     
  18. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Your welcome. The documentation is included with Custom Tree Importer. Not sure if I can share it even if it is just a doc. Will let Lars send you the information
     
  19. bpears

    bpears

    Joined:
    Aug 23, 2012
    Posts:
    249
    Oooooh I thought that was written in Unity Docs somewhere for their stuff. I see now
     
  20. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    No. Lars does it all
     
  21. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    as baldinoboy has already written: version 3 ships with a complete new and additional set of shaders which fully support physically based shading – and bending of course.
     
    Mister-D likes this.
  22. VirtualVassal

    VirtualVassal

    Joined:
    Oct 5, 2015
    Posts:
    13
    Just picked this and AFS up; just wanted to drop by and say thanks for making these. My game relies on having custom, unique trees and I hadn't been able to get things working with the standard Unity assets (a lone, unmoving mesh does little to bring a scene to life).

    Keep it up!
     
    Baldinoboy likes this.
  23. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    a video of a small scene where all foliage(trees plants and flowers) was processed by the custom tree importer(except those ugly grass planes offcourse ;) )
    tnx lars for your plugin!
     
    Baldinoboy and hopeful like this.
  24. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,685
    Very nice! Esp. like the use of cloth.
     
    Mister-D likes this.
  25. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    you are welcome!
    and thanks for sharing the results, your video looks great.
    maybe you could post another one showing more wind :) ?

    lars
     
  26. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    tnx lars
    ill make a new video when its done. im thinking of selling the environment and character seperated, i never did a full environment before, only character stuff. but i still have lots of other packs to finish first ;)
     
  27. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    hi

    ive got a wind problem and cant find the solution to fix it
    im also usig the CTI for plants. the issue i have is that the first leaf mesh in the hierarchy doesnt get calculated so there is no wind applied to it.
    any idea or workaround for this?
    see the screen for my setup and example
    cheers
     

    Attached Files:

  28. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    right out of my head:
    you may tray to activate leaf bending:
    Control the amount of leaf bending adding the corresponding "_xt" value to each leaf plane or set it globally by adding "_xlb" + 2 digit value to the file name.
    Adding "_xlb00" disables leaf bending.​
     
  29. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    still the same, first leaf in hierarchy = no bending
     
  30. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    I have had this problem before. There is no actual model for the trunk right? At least with me it was like the first model the script could grab after the root it treated like the trunk. Shaded fine and materials were working but the bending on the leaf was messed up. Do not know what I did, maybe put a xw30 or something on it. Do not remember.
     
    Mister-D likes this.
  31. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    could you please send me the fbx file?
    larsbertram69 at gmail dot com
     
    Mister-D likes this.
  32. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    did u get my email?
     
  33. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    yes, but i am very short on time. looking into it right now.
     
  34. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    as baldinoboy already wrote: the first leave mesh will not get any leaf bending as the script expects a trunk to be the first mesh element in the hierarchy (which is excluded from secondary bending).
    so you could simply add a simple tiny quad as dummy trunk to make it work –
    or use the updated script i will send via email.
     
    hopeful and Baldinoboy like this.
  35. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    tnk u sir!
    it works now :)
     
  36. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    fine.
    so if anybody else faces any problems importing simple plants (without a trunk geometry), just let me know and i will provide a tweaked version of the importer script.
    updating the package on the asset store will take a while.
     
    Baldinoboy likes this.
  37. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Thanks Lars, Will probably be in need of this in the next couple weeks.
     
  38. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    yes, i know its maybe not intended to process plants also but i find it usefull to use plants as "treeobjects" with a terrain.
    this also means i can add plants to a asset pack that bend with wind without the need to include custom shaders.
    so its a welcome addition.
     
  39. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    script sent.
     
  40. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    just a small update: billboard asset now may be created and saved much easier :)
    the update is available at the asset store right now.
     
    Baldinoboy likes this.
  41. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Awesome Lars, Thanks!
     
  42. Shiyao

    Shiyao

    Joined:
    Nov 27, 2013
    Posts:
    23
    Hi Lars, I purchased this asset 2 weeks ago. This is a awesome asset. right now I have a question. How can I use alpha channel for bark shader? I create a very big tree, so I need to use alpha channel for some small branches, so can you help me to solve this problem?
     
  43. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    that wont work, u r probably better of using an atlas texture for your branches with leaves and only branches and use that in the leaf shader.
     
    Shiyao and Baldinoboy like this.
  44. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,901
    as mister d already has written: the bark shader is opaque. so you have to use the leaf material in case you want cut out twigs.
     
    Shiyao likes this.
  45. PaulAfello

    PaulAfello

    Joined:
    Sep 19, 2015
    Posts:
    16
    Hello everybody!

    I have been struggling the last couple of days to get any tree to work properly but with barely any results that one would expect. I started with my own nicely modelled and textured tree but I restarted many many times and now am working with three cylinder shapes I can not even get to work... Lars already looked at the FBX and the script but it seems to be a problem with something in Blender. Is there anybody who could look at my file and set me on the right path? It would mean an awful lot to me because right now I just start to feel dumb and frustrated.

    FBX file: https://www.dropbox.com/s/j7b3s7inzffp0d4/Tree01_01_afsTREE.fbx?dl=0

    Blender file: https://www.dropbox.com/s/qhsb94sffl3fhyt/Tree01_01.blend?dl=0
     
  46. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Hey @PaulAfello,

    No worries. I get stuck on stuff like this a lot. I am a Blender user so took a look at your test tree and got it working. Here is the .blend and FBX:

    https://www.dropbox.com/sh/p8yb2kre8ufbj74/AABLyJVttwyqzvDmLC4WQHjFa?dl=0

    These are the things I did to get it working. Some might not actually effect the script but I still do it for consistency:

    --Change the name of the base gameobject to root

    --Not sure if it is case sensitive but changed Trunk to trunk

    --Think this is Blender specific but the root gameobject and trunk have to be rotated x90

    --So I un-parented the trunk from the root and the branch from the trunk - Set the pivot to 3d cursor which should be at 0,0,0 - Went into edit mode and rotated the trunk x -90 - Left edit mode and rotated it x +90 so it is upright with a rotation of x90y00z00 - The root gameobject is easy and just needs to be rotated x +90 - Finally re-parented the branch to the trunk and trunk to the root

    --Renamed the material to bark

    --Added _afsTREE to the export name so that the script will grab it

    --Exported it

    --Imported and changed the Materials import setting to From Model's Material. * That is why I changed the material in Blender to bark. Should work without doing this but find it easier controlling materials then using the uv texture in Blender

    It bends fine. Let me know if there is an issue with the files I sent but it should work fine. Hope this helped some.
     
    Last edited: Oct 21, 2016
  47. PaulAfello

    PaulAfello

    Joined:
    Sep 19, 2015
    Posts:
    16
    You are amazing good sir! It bends like a charm :) Unfortunately I was too busy yesterday and will be today as well to start from scratch following your advice cause I am incredibly excited right now, but tomorrow I am gonna add me some leafs and when I see that works I will go back to my original tree!

    THANK YOU so, so much!! You and Lars really helped me out a lot! :) Much obliged for taking the time and sharing your knowledge!
     
    Baldinoboy likes this.
  48. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    No problem man. Let us know how it goes and if there are any problems.
     
    Mister-D likes this.
  49. PaulAfello

    PaulAfello

    Joined:
    Sep 19, 2015
    Posts:
    16
    I found out where my main problem is. If I end my Blender filename with _afsTREE and let Unity do the importing and fbx creating part, all is fine. But when I do a manually fbx export from Blender (which I would prefer) the objects in the fbx start reacting all strange and the whole damn tree is broken again. Could you maybe tell me what export settings you use on trees?
     
  50. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Yeah. One thing I have noticed is after Blender 2.74 the FBX export just does not work right. Sure there is a way to get it working but for me it is easier to just keep a 2.74 install for Unity. These are the FBX export settings I use:



    I do not touch the animation settings but am sure those can be disabled. Also main thing is do not Select Apply Transform. That just screws it up with Blender.