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

[Released!] Custom tree importer

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

  1. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Sorry but am not sure if you can see the image above. In a bad internet situation right now. Hopefully it will attach here.
     

    Attached Files:

  2. PaulAfello

    PaulAfello

    Joined:
    Sep 19, 2015
    Posts:
    16
    Thanks! I'm gonna try your settings and if those give the same results I'm gonna hunt me down a 2.74 version of Blender :)
     
  3. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
  4. PaulAfello

    PaulAfello

    Joined:
    Sep 19, 2015
    Posts:
    16
    So, after a bunch of tweaking and cursing and tweaking in Blender I finally figured out how to get it right :) And thankfully it also works for a 2D kinda tree existing only out of planes! (I'm a 2D illustrator/animator trying to figure out how to implement all this 3D stuff so I can make incredibly lively scenes). So this is is still a try out but I wanted to share it with you so I can say THANK YOU one more time and show you the first results of your help!

    (gif is running 12 fps so it's crude but hey, that tree bends like a charm!)

    http://g.recordit.co/y9Sp9yAUU7.gif
     
    Mister-D and Baldinoboy like this.
  5. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Awesome work man! Looks great
     
  6. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    crazy!
     
    PaulAfello likes this.
  7. phantomy1

    phantomy1

    Joined:
    Sep 7, 2016
    Posts:
    18
    Hey Lars,
    could you please make a quick video that shows the workflow using Blender, your Plugin and Import to Unity?
    There is nothing on youtube that shows how the workflow is. How would I have to structure the model hierarchy so it works correctly in your plugin etc.

    I would like to see how easy it is to get everything set up before I buy. That would be great. Thanks in advance.
     
  8. Baldinoboy

    Baldinoboy

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

    The documentation is actually very detailed. Will admit it can be a complicated procedure nonetheless. Lars is not a Blender user. I am but my if is pretty crazy right now. In the future I do plan on making a video tutorial for using CTI. I am a bad teacher but know even just seeing the motions is helpful. So will try to get one out by the end of the year. Will link it on this thread when it is done.

    For now recommend looking through the documentation a few times and ask someone on the thread if you are stuck on something. It is detailed and just needs time and patience to get right.
     
  9. paul_h

    paul_h

    Joined:
    Sep 13, 2014
    Posts:
    29
    Hi,
    sure I am missing something important.
    I modeled a simple tree following the manual but nothing happened, no sign the plugin was kicking in.
    So I started super-simple from 3dsMax:
    a dummy placed at 0,0,0 > a box pivoted at 0,0,0 called "trunk" > then I copied and rotated the trunk and made a "branch01" > then I placed the branch so it's pivot was at the intersection with the trunk > I made a small box and called it "Leaf Plane". Everything has UV coords.
    parenting is:
    dummy
    - trunk
    --branch01
    ---Leaf Plane.
    Then I made two materials, Bark and Leaves and assigned them.
    Then I exported a standard FBX named "appo_afsTREE" and opened it in unity.
    According to the manual, just importing the fbx in unity would trigger the script but nope, nothing happens, debug empty.
    I was expecting to see at least the mesh copy.
    Me sad
    :-(
    However I noticed a difference between my imported hierarchy and the example you provided, as you can see in the image I attach. Trunk appears as a model and also as a mesh, perhapes the trouble comes from here?
    What am I doing wrong?


    Perhaps it could be a good idea to give some sort of feedback on importing in the debugger, and/or a first steps tutorial just to see how to get the thing running.

    Thanks!
     
  10. Baldinoboy

    Baldinoboy

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

    Did you name the dummy root? Also I believe it is case sensitive, sorry if I am wrong, so make sure root, trunk, and the materials; leaf and bark, are lowercase. I do not use Max but this should work. Let us know if you get it working or not.
     
  11. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    you should get a feedback if the importer script has been triggered (and might fail).
    so if you do not get any feedback the importer script is not triggered...
    which sounds pretty weird as your naming seem sto be correct.
    which version of unity do you use?
    and could you please send me your fbx file?

    thanks,
    lars
     
  12. paul_h

    paul_h

    Joined:
    Sep 13, 2014
    Posts:
    29
    Hi, thanks for your quick reply!
    I found out something.. trying to assign the fbx as a tree to a new terrain I bumped into a "the prefab does not contain a valid mesh renderer". Thinking it was a coords issue I rebuilt the tree from the front view, but had no luck.
    Then I deleted the leaf box and Unity stopped complaining. Following this hint I duplicated and renamed "leaf plane" the branch box, reparented it and everything worked ok including the tree importer.
    Built another leaf box from scratch, built a plane, built a sphere and the error popped up again.
    Replaced the leaf with a dummy and unity liked it.
    I am more confused than ever!
    I am working on Unity 5.4.3 and max2014 (tested on Unity 5.3.5 with the same results)
     
  13. knotFF

    knotFF

    Joined:
    Apr 13, 2013
    Posts:
    66
  14. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    i do not have max. but you could send me your fbx file and i could have a look into it.
    lars
     
  15. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    as far as i can say e.g. xfrogplants europe 2 handles each leaves as separate geometry – which still is way too demanding for real time rendering.
    but i remember a youtube video where they show how to built and render traditional leaf planes using xfrog.
     
  16. phantomy1

    phantomy1

    Joined:
    Sep 7, 2016
    Posts:
    18
    Hey Lars,
    is it possible to sell trees that are made with your plugin here in the asset store?
    Meaning: Will the trees I model be transferred into "Unity Tree Format" or will
    they need your scripts to perform correctly?
     
  17. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    edited (i have to admit that i do not know my own asset:) ):
    the custom tree importer script creates an ".asset" file from the original fbx which contains the processed mesh and all needed information. this ".asset" file does not need the script any more. so it could be easily included in any kind of unity package.
    lars
     
    Last edited: Dec 26, 2016
  18. phantomy1

    phantomy1

    Joined:
    Sep 7, 2016
    Posts:
    18
    Ah ok, so I can make a tree with your plugin and sell it in the store. Thats great. Thanks.
     
  19. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Yeah. You just need the CTI Runtime folder in your asset folder. Make sure to have what the folder is for in the notes, Readme file in your asset. I made a Asset Store pack using CTI 2 to import the trees. Worst thing I can think of is the Asset Store rep you go through might not want you to include the files from another asset but you can probably just resubmit with notes on what it is and you have permission from the dev.
     
    Last edited: Dec 27, 2016
  20. ifreed92

    ifreed92

    Joined:
    Jan 29, 2017
    Posts:
    4
    Hi Lars.
    It receives shadows from point or spotlights?
     
  21. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    all lights.
     
  22. TommiSticks

    TommiSticks

    Joined:
    Apr 27, 2013
    Posts:
    3
    @larsbertram1

    Hey Lars
    I just got the script and am really excited to use it... However, I am having some trouble. I've done my best to follow the document precisely, but every tree I import looks like its stretching out for miles when the wind zone is on. (see pictures) All the sample trees that come with the script look great with the wind, but the 10 I've made so far don't work. What am I doing wrong? I've been trying to get it to work for hours. Please help (Unity 5.5.0f3)
     

    Attached Files:

  23. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    hey tommi,
    your hierarchy still contains these "history" elements...
    try to get rid of these.

    lars
     
  24. sara_conagher

    sara_conagher

    Joined:
    Jul 9, 2015
    Posts:
    8
    The link to the demo is not working, neither here or on the page on the asset store :(
     
  25. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    dropbox does not support hosting html files anymore... so all i can offer are the youtube videos:



    or baldinoboy's latest video:

     
  26. Elzean

    Elzean

    Joined:
    Nov 25, 2011
    Posts:
    584
    I want to offer a tree compatible with wind+terrain in my asset pack. Is it really OK with you to include the CTI Runtime folder inside my pack ? Do you have anything like a license file for this folder ?
    From what i saw i should then be able to use your LOD_bark and LOD_leaves shaders and the WindForLODGroupsOnTerrain script which seems like all i would need right ?
     
  27. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    yes – at least for me. unity might see this different, though.
    no, as unity would not accept this.
     
  28. Elzean

    Elzean

    Joined:
    Nov 25, 2011
    Posts:
    584
    Ok thanks, hopefully it will be fine, otherwise there is no way for wind / lod to work with one of their shader right ?
     
  29. Nighs

    Nighs

    Joined:
    Jul 8, 2017
    Posts:
    3
    I have three questions. Does the script create automatic LOD Billboard for custom trees? If I buy your script and model my trees will I be able to sell in the asset store? Does not the script need to be together to work?
     
  30. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Hey Nighs,

    The Billboards are not automatically created on tree import. It is a well documented process that involves using a SpeedTree billboard and using a script to bake the billboard maps from the needed tree. It is a simple process once you have done it a couple times.

    You do not need the CTI importer script for the trees to work but you do need the CTI Runtime Components, which you can just copy to your asset's folder. Lars gives permission to include this folder with your asset but it might depend on the Asset Store person you deal with. I submitted my Tropical Forest Pack using CTI 2 but have not submitted the update that is using CTI 3. Main worry I have is that is has a few more scripts and much more advanced shaders that they might question. So think it will work but can not guarantee.

    Like in the previous paragraph the Import script is not needed but the Runtime Components are. These are the shaders, wind script. Also including the Deferred and Depth-Normal shaders.

    Cheers
     
  31. Elzean

    Elzean

    Joined:
    Nov 25, 2011
    Posts:
    584
    What would be nice is may be have an external download for the runtime part, like a google drive zip or on github and we could just add instruction to download this inside the readme. That would be fine with asset store.
     
  32. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Problem with that would be the Custom Tree Importer from the Asset Store would be broken on initial import and the Asset Store would not accept it. Hopefully it would not be a problem to include the runtime components. If it is than I am in trouble.
     
  33. Elzean

    Elzean

    Joined:
    Nov 25, 2011
    Posts:
    584
    Custom Tree Importer doesn't have to change, if someone already own that asset it doesn't have to reimport the runtime folder (so users can just skip that step). This actually solve the current problem of our runtime folder overriding Custom Tree Importer version.
    This is simply a way for us to not have to include a version of an external asset. Same as how Unity want us to do with their Standard and Post Process pack that we can't include anymore (have to ask the user to download them)
     
  34. jonathanlight

    jonathanlight

    Joined:
    Jul 23, 2017
    Posts:
    1
    Excellent tropical trees would like to buy it is it possible to import your trees to unreal engine 4?
     
  35. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Wrong thread man but for the trees and importing in UE4 with the current bending no. I have tested them in UE4 and they look good but the quality bending is achieved through the use of the Custom Tree Importer which is not in UE4. Guess it would take some testing but decent bending might be possible in UE4 with a bit of work. Also a working and full FBX exporter in Unity would do the trick.
     
  36. Elzean

    Elzean

    Joined:
    Nov 25, 2011
    Posts:
    584
    I have some issues in unity 2017.1.0f3
    upload_2017-7-24_22-33-14.png

    Did some of you test in lastest version of unity, or do you know how i can fixe this ?
     
  37. Elzean

    Elzean

    Joined:
    Nov 25, 2011
    Posts:
    584
    @larsbertram1 I tried some fixes with the help of a Unity mod in the shader forum but various other erros appears in several shader files, i have close to no knowledge of shaders so those errors doesn't make much sense to me. I hope it's easy to fixe!
     
  38. Elzean

    Elzean

    Joined:
    Nov 25, 2011
    Posts:
    584
    Still having issues, i'm the only one using it in unity 2017 ?
     
  39. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    sorry for the late reply – but i did not get any notification which happens from time to time...
    your errors all seem to be related to crossfading. unity changed the way it works or – better – the way you integrate it in a custom surface shader.

    you can easily fix this by editing the shaders.

    let's take the billboardshader e.g.:

    find:
    UNITY_APPLY_DITHER_CROSSFADE(IN)
    and comment it so it looks like this:
    // UNITY_APPLY_DITHER_CROSSFADE(IN)

    then find:
    #pragma surface surf StandardTranslucent vertex:BillboardVertInit nolightmap nodynlightmap keepalpha addshadow
    and add "dithercrossfade" so it looks like this:
    #pragma surface surf StandardTranslucent vertex:BillboardVertInit nolightmap nodynlightmap keepalpha addshadow dithercrossfade

    you will have to do so for all shaders that errors in unity 2017.
     
  40. Elzean

    Elzean

    Joined:
    Nov 25, 2011
    Posts:
    584
    Thanks! i will try this out :)
     
  41. Elzean

    Elzean

    Joined:
    Nov 25, 2011
    Posts:
    584
    @larsbertram1
    It seems to work fine but i still have some errors that pops:
    upload_2017-8-2_14-50-43.png

    Do you know what i should change ?
     
  42. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    the warning does not matter.
    as far as the error is concerned: simply try to comment line 269 in the cginc file.
     
  43. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    docsavage and Mister-D like this.
  44. fayers

    fayers

    Joined:
    May 10, 2017
    Posts:
    8
    Hello everyone,
    It's been a long time since I try to make a tree created with blender, but still nothing. I followed the letter every step, unity matters the object correctly, but when I start the scene everything stays fixed. For the moment I just wanted to try bending the trunk, but it did not go.
    I think I need a video, maybe on a blender, where every step is explained in detail and accurate, otherwise many like me will have more than some difficulty.

    Thank you.
     
  45. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    do you have set up the wind properly?
     
  46. fayers

    fayers

    Joined:
    May 10, 2017
    Posts:
    8
    Therefore, here is how I am
    I created an empty object (renamed tree) and trunk (renamed trunk_xw06). As you can see from the image they are related by hierarchy and both have pivotes at 0.0.0
    Cattura.JPG
    Regarding the color vertex, I left it on the trunk as default.
    Cattura1.JPG
    Now I export everything to Unity, having renamed the file as xyx_afsTREE11.xyz.fbx and that is the situation. Cattura2.JPG
    Cattura3.JPG
    Now, going to start the scene, everything is still, even trying to move the WindZone settings.
     
  47. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    "main wind" is set to: -1 (minus?)

    and your "trunk" element seems to be empty!?
    i assume that your "cylinder" has to be at the position of youe "trunk" element as afar as the hierarchy of your model is concerned.
     
  48. fayers

    fayers

    Joined:
    May 10, 2017
    Posts:
    8
    The main wind is now +1, but it does not change.
    In what sense "empty?"
    Is not it just like setting up the hierarchy?
    Would you be able to prepare a .fbx file on a blender so you can figure out how to set the geometry?
     
  49. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    if you have a look at the demo trees (e.g. baldinoboy'S jatoba which was modeled in blender as well) then you have an empty toot at level 0. level1 already is the trunk mesh.
     
  50. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,526
    Hi fayers,

    I have been meaning to make a few tutorials but time to do it has not been available. The first thing I can think here is the rotation. Both the root and trunk need to be x90, y00, z00 but be straight up still when exporting to Unity. This can be done by unparenting everything and rotations the trunk it edit mode x-90 and then in object mode x90. The empty object can just be rotated x90. Make sure you rotate the tree in edit mode using the pivot point at the cursor at 0,0,0. Now the trunk should be straight up with a rotation or x90, y00, z00. Can be parented by the root again.

    Everything after the trunk can be 0,0,0 rotation. Also I have not had success with the Custom tree importer and Blender after Blender 2.74. Also do not use apply transform when exporting the FBX.

    Writing this message on my phone away from my computer so sorry if there are errors in names or processes.