Search Unity

[Released!] Custom tree importer

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

  1. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    Benefits
    Import manually modeled trees from Maya, 3ds Max, Modo or Blender and let them get adjusted to be compatible with unity’s advanced tree creator shaders and wind zones “automatically”.
    Benefit from bark and leafs casting and receiving real time shadows, translucency and specular lighting and add your trees using the terrain engine or place them as independent game objects.


    Limits

    Please do not expect the custom tree importer to simply make any tree just work: You will have to spend some time tweaking your model.
    First and foremost the custom tree importer needs trees to be imported as nested, hierarchical objects – like shown in the screen shoot attached.
    You should be quite familiar with your 3d app and do have a basic understanding of the tree creator and things like “main wind“, “main turbulence” and “edge turbulence”.

    Watch a simple demo
    Get it from the asset store

    The custom tree importer script works as asset postprocessor. It combines all submeshes into one and adds the needed vertex colors and uv2.
    Bending is fully controllable on each level of the tree.

    Hierarchical setup of the tree
    In order to be able to calculate main wind and main turbulence for the trunk, the branches and leaf planes the importer script has to know about the different parts of the tree and their origins.
    For this reason you will have to provide trees as nested, hierarchical objects like shown below.

    Bildschirmfoto 2014-08-20 um 00.42.23.png

    Adjust bending
    Adjust bending on each level of your tree using control tags which would let you specify its reaction to: main wind, main turbulence and edge turbulence.

    Advanced rendering
    Trees imported using the custom tree importer are fully compatible with the built in tree creator shaders and also any tree shader based on those like he AFS tree and billboard shaders, Skyshop or Lux.



    lars
     
    Last edited: Sep 3, 2014
    NeatWolf and Alverik like this.
  2. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    As always Lars you are awesome. Cannot wait to try this out. For complex leaf meshes can the edge fluttering be handled in the 3d programs?
     
  3. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    well, to be honest: edge fluttering should be applied in your 3d app. the script simply copies vertex color green to the final mesh...

    lars
     
  4. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Cool. One more question. For now;). Will this script be able to place AO in the trees without editing the alpha vertex colors in a 3d app?
     
    Last edited: Aug 20, 2014
  5. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    you will be able to bake ao within unity using a free script.
     
  6. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Awesome:D. Thanks Lars. Looking forward to it.
     
  7. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    This is looking mighty!
     
  8. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    Last edited: Aug 20, 2014
  9. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    Now this is game changer.......awesome as always lars
     
  10. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    wo
    holy S***! without having read the documentation your tree nearly fits the needs of the script.
    i only had to rename the materials and it just worked!
    i also added some control tags to add some variation in bending and quickly set up the needed textures: 5 min of work and your tree looked like shown in the webplayer attached:

    http://dl.dropboxusercontent.com/u/...sertree/treeimporter_simpledemo_usertree.html

    one might fine adjust the pivots of the single parts of the tree to make bending more accurate or add edge fluttering to the leaves but overall it is a nice result.

    as far as the price is concerned: i am not really sure about it.
    this is a very special script. most people will most likely stick with the built in tree creator trees or switch to speedtree when unity 5 is out. so it is only for people you really now what they do and want to keep their workflow using the 3d app of their choice to create trees. for this reason the number of potential clients is not very large and i think about charging $25 – 35. compared to other packages this might be rather expensive – but as i have written before: this script is very special and i do not expect any hobbyist to go for this asset but more or less only pro users who have a special artwork they want to get to work with unity. what do you think?

    lars
     
    Mister-D likes this.
  11. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    well, let’s have a look at speedtree and unity 5 first ;-)
     
  12. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    True, but well mostly i prefer working in 3d apps if it's possible :)
     
  13. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    I think it's great, those with speedtree subs in U4 could get them into max and prepare the trees with this - even when speedtree comes to unity, if speedtree is using its own system and you want to keep working with wind zones, you can convert with a lil bit of work in a modeller, as well as possibly being able to repaint verts on the tree to suit you and that being quite controllable with Lars' work. I'd love to see what Lars' AFS could do with converted speedtree models when the IBL is compatible with both Lux and Skyshop off the bat.

    I'm going to finish prepping Shader And Renderer Test Module Jr (Intending this to be something I test stuff like Lux out on amongst others) and then i'll try get a speedtree effort converted, since i've already chosen the tree and all
     
    WarGod100 likes this.
  14. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    im glad it worked :), im thinking not more then 30 euros, i had been looking for something like this just a week ago, and now u posted this :) i actually prefer making trees in a other app than unity, gives me much more control, cant wait for the release, u can use the tree i posted in your demoscene if u want lars
     
  15. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    thanks mister d,
    your tree will probably be a big help for people getting started if i include it in the package.
    and $35 would be less than 30 € ...

    lars
     
    Mister-D likes this.
  16. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    tree1_0029.jpg tree1_0039.jpg
    working on some trees to test the script with
     
    florianalexandru05 likes this.
  17. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    That looks really nice! Never got the hang of modelling trees so hats off to you
     
  18. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Really awesome job Mister D. Looking forward to seeing them sway in the wind:).
     
  19. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    tnx, unityrender.jpg ive finished the small testscene for lars, now its up to the scripts to make the trees move :)
     
  20. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    I really like that, i think i'll have a go myself, but give the tree rendering a go inside the new Jove
     
  21. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    its not that difficult really, i used sweep splines alot so i got a clean vertical tilling uv map for the branches and for the leafclusters i used a single texture with 3 leaves variations in it. good luck
     
  22. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    I'd never actually thought of that method for modelling the trunk and branches, yet it makes complete sense! Thanks for that! I was going to use a Speedtree example but maybe i'll have a shot at modelling a tree tonight, very much appreciated

    Even if I give in and use a Speedtree example for this just for quick and easy, you just pointed me very much in the right direction. Which app is this in? I'm wondering if I could use particle flow in max to place twigs and leaves onto an authored trunk and branch arrangement
     
  23. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    i made it in cinema4d so i dont know if u could do a sweep spline function in 3dsmax but there should be a similar function i guess :)
     
  24. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    I'm imagining a sweep spline is a meshed spline with a controllable profile (like a lathe along a spline), im sure max has something like that. Actually i could try and be audacious and make it in-unity with Megashapes and some codey stuff to generate twig/leaf groups assuming the megashapes api has some relevant functions. Thats quite a neat possible project, cheers for the inspiration!
     
    Mister-D likes this.
  25. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    hi there,
    i am not sure how i managed to corrupt the atmosphere but at least the trees bend in the wind.
    here is a webplayer of mister d’s scene:

    Webplayer

    well, one could spend some more time on fine tuning the bending...

    lars
     
  26. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    I suppose it could do with fine tuning as to wind influence but it demonstrates your script working perfectly, great stuff

    I'm trying to do too many things at once today but if i can fit in some tentative megashapes + vpaint + your script based experiments i will, sometime soon, seeing how your work translates to Jove will be nice too although there's no reason it wouldnt work, just showing people something is nice
     
  27. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    looks cool lars! its probably cause i used some image effects on it :)
     
  28. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    hi there,
    image effects! of course...

    and btw: if you model the leaf plane geometry you should rather think of triangles than of quads and model the geometry pretty tightly to your texture. otherwise you would waste a lot of fillrate.
    even if it would mean adding some more vertices it is still worth doing so as fillrate will most likely become the bottleneck and not the vertex count.
    but tris might even lower the vertex count as shown below.

    lars

    betterleafgeometry.png
     
  29. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    interesting ... ill make another one then(better leaf textures was allready on my list), is there more i need to consider?
     
  30. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    apart from what you have already done:
    - trees must be separated from the scene and saved as single file.
    - the bark material should contain "bark" somewhere in its name, the leaf material "leaf".
    - you should prepare the needed textures (albedo, normal, gloss, (translucency)).
    - take care about the pivots.
    - add vertex color green = something like 0.1 at the outer edges of the leaf planes to get edge fluttering.

    lars
     
  31. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    i understand most except the last, u mean i should give the leaves an outline like attached image?
    edit
    oh i think i understand , i need to paint vertex colors on the leaf meshes
     

    Attached Files:

  32. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    yes, you should vertex colors. but i am not sure if cinema 4d supports vertex color painting by now. at least it used to do not...
    blender, modo or maya however do.

    lars
     
  33. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    Reanimate_L likes this.
  34. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    any ETA on release lars?
     
  35. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    well, i have sent it to the asset store one week ago…
     
    Mister-D likes this.
  36. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Cool. Cannot wait to try it out.
     
  37. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
  38. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
  39. kaz2057

    kaz2057

    Joined:
    Jan 18, 2011
    Posts:
    326
    Hei Lars,

    But with this asset it is not necessary paint wind vertex color?
    I suggest you to create a video tutorial also to boost sales :)

    Thanks
     
  40. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    trees1.jpg
    some more custom trees
     
  41. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    hey mister d,
    wow! tose look nice.
    but what’s about a webplayer to see them in action?

    lars
     
  42. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    sorry for my late reply – but i did not get any notification...
    nevertheless, here we go.

    using the custom tree importer primary and secondary bending will be added by script and can be controlled by user on each single level of the tree using "bending tags" – which are simply added to the name of the geometry like:
    - trunk
    - - branch_xt20
    - - - leafplane
    - - branch_xt15_xp08

    you see e.g. "_xt20"? that will set the turbulence of that branch and all its child nodes to 2.0.
    next branch only uses a turbulence of 1.8 but changes its phase to 1.5

    however edge fluttering or edge bending is still controlled using vertex color which have to be set up by the user.
    but that is pretty simple as you usually only add some vertex color green = 0.1 – 0.5 to the outer vertices of your leaf planes.

    if you know how to bake ambient occlusion to vertex color alpha you can import it. otherwise the package ships with a free script that will add to the final mesh.

    lars
     
  43. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    tnx lars but im waiting for paypal transfer to be complete to buy your package, once i ve got it and i have enough trees and plants ill make a webplayer to walk around :)
     
  44. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    This script is really amazing. When I get all my trees ready I am going to put a webplayer here.

    Thanks Lars
     
  45. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    hi lars im getting a warning in the editor "The tree treesmall1_afsTREE must use the Nature/Soft Occlusion shader. Otherwise billboarding/lighting will not work correctly." other than that its working perfectly
     
  46. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
  47. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Really beautiful scene Mister D. The trees are bending very nicely.
     
    Mister-D likes this.
  48. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    very nice scene mr d!
    but when it comes to trees i think it is essential to add more variation in phase ("_xp") to the different branches of the first level. now they all sway at exact the same frequency, don’t they?

    lars
     
  49. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    tnx, yup it was just a quick import,i didnt do the naming part yet
     
  50. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    oh, i see ;-).
    btw: the leaf planes on the picture you have attached look pretty nice!