Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

[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,524
    Awesome! So you should be good using the CTI LOD Shaders, which are the high quality ones.

    Not sure how the wind is handled but when you get to testing it check if there are issues with the wind and the voxel terrain placed trees. If there is an issue attaching the CTI Wind for LOD Trees script to the windzone gameobject should fix it.
     
    Zimnel likes this.
  2. Talavaj

    Talavaj

    Joined:
    Sep 22, 2013
    Posts:
    41
    I have been using CTI to great success, pleased with the tessellation too, looks great and seems to perform well at level 7.
    trees.jpg

    I just wanted to ask about the cost of using CTI materials on motionless objects such as sticks, small grass and pinecones.
    I'm using wind from script for my foliage but I have noticed that doing so results in all sorts of distortions on meshes not imported as CTI trees.
    I have all the textures on an atlas and I would like to use just one material if possible, I know I can just import these meshes as cti trees and just set wind and flutter to 0 which will stop the script wind deforming them, but how costly would that be? (assuming one trunk/leaf object per mesh I guess)
    Would I be better off just creating a separate material without wind from script and importing the meshes as plain models using the cti material, rather than nested cti trees?
     
    florianalexandru05 likes this.
  3. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,859
    there are extra costs of course: you pay for the fat vertex data altho you do not need it (uv, uv2, uv3 and vertex colors). and you pay for the complex vertex shader which does the wind animation.
    it would be best to write your own shader.
     
  4. swredcam

    swredcam

    Joined:
    Apr 16, 2017
    Posts:
    128
    I am having some trouble with trees created in Blender and used in Unity. I can't seem to find a repeatable recipe that works every time. One tree will work perfectly and the next will take hours of extra time, unfortunately I can't really even tell what I am correcting when I get a tree to work. The issue is with the trunk, in Unity it seems to be getting shaded along the wrong axis, so instead of seeing a trunk that pivots at the base and waves with the wind, instead the texture wraps and unwraps around the tree mesh itself. The appearance ranges from some translucence to almost a fabric-like texture on the trunk.

    The only workaround I have for this is to always start with a known good tree and then edit it to a new tree design. Even when doing that though, sometimes the tree gets corrupted and from that point on it is difficult to fix. In other words the tree will render fine with wind, trunk texture leaves etc at some point, then after some mods the trunk will have the rolling texture.

    Has anyone seen this before? I should mention I have read Baldinoboy's blender recipe post above as well as all the CTI docs. I am not using FBX export, instead I work with the blend files directly in the Unity assets folder structure.
     
  5. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,524
    Hey @swredcam, Sent a PM so we can fix this. Any other Blender users please let us know if you came accross this issue.
     
  6. swredcam

    swredcam

    Joined:
    Apr 16, 2017
    Posts:
    128
    I'm using the billboard creation scene -- which is a great little tool -- but I am finding that the created billboards do not follow any rotation added to the final LOD in a scene. So if I rotate an LOD in X or Z, the billboard does not follow. Is that the way it should behave?

    Also, to follow up on my question above re Blender, Baldinoboy was very helpful (thank you!). I believe my problem was somewhat related to applying the transform (CTRL-A in Blender) and assigning new materials in Unity. It does seem to me that Blender+CTI+Unity is a fairly flaky combination. The results can be great but there are many opportunities to have issues. I still appreciate this asset but when used with Blender, prepare for some frustration.
     
  7. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,859
    yes, unfortunately trees may only be rotated around the y axis.
     
  8. larsbertram1

    larsbertram1

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

    i updated my old oak package now using cti trees.
    they use a slightly modified leaf shader which i hope will land in the next cti update as well.

     
  9. florianalexandru05

    florianalexandru05

    Joined:
    Mar 31, 2014
    Posts:
    1,758
    My final version of the pack with CTI, I'm really happy with this.

     
    Last edited: Mar 4, 2019
    larsbertram1 likes this.
  10. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,238
    Those look great! Are you planning to update any of your conifers as well?
     
  11. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,859
    not at the moment...
     
  12. GotAThing

    GotAThing

    Joined:
    Jan 10, 2019
    Posts:
    14
    Hi any news on HDRP compatibility?
    iv recently updated my project to test out the new system. seems great and makes sense to use HDRP for what im currently working on apart from CTI trees dont render. :(
    Any news/timeframe would be great so i can decide what to focus on for now
     
  13. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,859
    i assume that the final HDRP version will be presented at GDC next week and published shortly afterwards.
    then i will start on porting the shaders.
     
  14. GotAThing

    GotAThing

    Joined:
    Jan 10, 2019
    Posts:
    14
    Thanks, that sounds promising. Il keep an eye out for updates :)
     
  15. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,238
    Would it be possible to disable some features of CTI for a "light" version, for lesser hardware? Our trees look fantastic but have ended up being too heavy for mid-range and lower hardware...
     
  16. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,859
    some features may already be disabled in the material inspector by turning them off.
    but the real costs are not produced by the shaders but the overdraw trees and especially leaves create.
    and if you are using vegetation studio pro and indirect instancing things get even worse as trees do not get sorted --> more overdraw.
    you can think of using a prepass depth shader for the leaves (does not really help on dx11 tho), do way better shadow caster culling then vs pro offered last time i looked into it and make billboards kick in earlier.
     
  17. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,238
    Okay. So those features are Leaf Turbulance and Animate Normal: Normal Rotation? Would enabling Fade Out Translucency help too? And can we disable those at runtime (based on quality levels), or do we need to make an alternate material?

    And with VSP, you'd recommend not choosing Indirect Instanced?
     
  18. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,859
    those are shader features. so you need an extra material.
    no, not really. and it would corrupt the visuals.
    you will have to play around and test, sorry...
    using instanced indirect will make the trees render pretty fast regarding the "visible" trees as far as the cpu is concerned. but it may just kill your gpu: no sorting, a lot of overdraw and absolutely no optimization when it comes to render the up to 4 shadow cascades – as it fully bypasses the built in rendering. the ideal would be low res shadow caster textures (to safe bandwidth) and proxy geometry (like always using lod2 or lod3 as shadow casters), but all this is not supported by vs pro as far as i know.

    simplifying the vertex shader by disabling some features may give you a few fps here and there. but in case you really need a speed up lowering the texture resolutions and making the billboards kick in way earlier should be the most successful approach.
     
    gecko likes this.
  19. florianalexandru05

    florianalexandru05

    Joined:
    Mar 31, 2014
    Posts:
    1,758
  20. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,859
    congrats!
     
    florianalexandru05 likes this.
  21. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,859
  22. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,524
    Looks awesome @larsbertram1! Love the work you are doing with CTI for these latest trees! CTI 4?
     
  23. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,859
    CTI 4.
     
    gecko likes this.
  24. florianalexandru05

    florianalexandru05

    Joined:
    Mar 31, 2014
    Posts:
    1,758
    Looks awesome, might try for ref and learning!
     
  25. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,859
    thanks. 90% of the credits go to Unity's demo team for doing the textures and original models.
     
    florianalexandru05 likes this.
  26. florianalexandru05

    florianalexandru05

    Joined:
    Mar 31, 2014
    Posts:
    1,758
    They're nice, I tried them out!! Pretty useful for some templates or some more variety. Think I'll use them for testing, or maybe taking screenshots.
     
  27. florianalexandru05

    florianalexandru05

    Joined:
    Mar 31, 2014
    Posts:
    1,758
    So I have this thick tree that has a few branches baked in to planes that use the leaf shader and I was wondering if there is any way to make them not affected by wind at all. I set them to vertex color black and they still move a little. Would giving the wind strength (example 0.001) tags help?

    Ok I tried it, I guess it doesn't. The best way is to import the tree as a non-tree and it will not have wind. Please let me know if I missed something though.
     
    Last edited: Mar 25, 2019
  28. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,524
    Hey @florianalexandru05,

    What should work for a branch is vertex black, and tags to the branch mesh being _xw00_xt00_xlp00

    That should make it stay completely still, besides it moving with the parent.
     
    florianalexandru05 likes this.
  29. florianalexandru05

    florianalexandru05

    Joined:
    Mar 31, 2014
    Posts:
    1,758
    Thanks that works fine! :)
     
  30. Fer00m

    Fer00m

    Joined:
    Feb 28, 2014
    Posts:
    170
    Hey :)
    I'm re-doing vertex normals for my trees and have some issues with LOD Leaves and custom vertex normals. It seems like it completely ignores them.

    1. is the how the normals look in Blender, 2. is LOD Leaves shader, 3. is Tree Creator Leaves Optimized Tumbling shader. Lowering view dependency slightly mitigates the sharp shadows, but it still looks quite bad. Is there any solution to this?
     
    florianalexandru05 likes this.
  31. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,859
    custom vertex normals are tricky – and not really supported in case you have single sided geometry and use vface to flip them on back faces: if you smooth out the normals on the front faces e.g. by using normals from a sphere you will get nice and smooth lighting for the front faces. lighting on the backfaces however will become worse. see animation attached.

    this is what the LOD leaves shader does by default. version 301 (that ships with the conifers) lets you set normal accuracy to 0.0 so the shader won't flip the normals but use front face normals on back faces as well.
    this is what e.g. speed tree does. doing so however will cause a lot of false specular highlights.

    the tree creator leaves optimized shader needs double sided geometry. so you can actually bake 2 normals "per vertex": one for the front faces, one for the backfaces.

    you can use the LOD shader with double sided geometry as well. simply set culling to "back".
    this should be fine for such a simple tree.


    smoothed_vface.gif
     
    Fer00m likes this.
  32. Fer00m

    Fer00m

    Joined:
    Feb 28, 2014
    Posts:
    170
    Thanks for quick and detailed answer! I'll try remaking the trees with double sided geometry.
     
  33. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,859
    did they not have double sided geometry? how did the tree creator shader work then?
     
  34. Fer00m

    Fer00m

    Joined:
    Feb 28, 2014
    Posts:
    170
    I have no idea :) But the CTI tree creator shader visible on the 3rd screenshot also has culling option and it's set to Off. I can send you the .fbx and processed CTI mesh asset if you want to take a look.
     
  35. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,859
    oh, i totally forgot about that :)
    then it renders back faces just like front faces as it does not use vface --> would equal "back face normela accuracy = 0.0" and single sided geometry.
     
    Fer00m likes this.
  36. Fer00m

    Fer00m

    Joined:
    Feb 28, 2014
    Posts:
    170
    I checked it with v301 shaders and it works great! Do you plan on expanding these with VSP snow feature?
     
  37. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,859
    we will see...
     
  38. nbac

    nbac

    Joined:
    Jul 7, 2015
    Posts:
    267
  39. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,859
    are you kidding?
     
  40. nbac

    nbac

    Joined:
    Jul 7, 2015
    Posts:
    267
  41. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,859
    i updated my old birch trees package now using cti.

     
  42. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    130
    Hi @larsbertram1,

    I'm very pleased with the results of my CTI trees, however I'm now having a major issue with Veg Studio Pro, and wanted to ask you first.

    The trees work fine when manually placed as a gameobject in the world, LODs and all. However, something about the shader doesn't play nice with VegStudioPro.

    First (solved), the trees seem to all render at camera's origin (which results in a large number of trees overlapping eachother). (Solved by switching from Instanced Indirect in VSP)

    Secondly, it seems VegStudioPro has it's own billboard generator, which while nice, seems to omit any use of the bark shader, so you get trunk-less billboards. I'd rather use my CTI generated billboards but not sure if this is an option.

    Finally, I seem to be lacking the nice fade between LODs while using VS. This seems like a setting I'm probably missing.

    If you're not sure about these issues I'll try the creator of VegStudio but wanted to see if you had any experience/advice about these issues. I REALLY do need to use their system and would hate to lose all my nice CTI shader/LOD options
     
    Last edited: May 8, 2019
  43. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,859
    which version of the shaders do you use? try to download the free conifers and check the 301 shaders: they have been successfully tested with vspro and indirect instanced rendering.
    sounds as if you are using very old cti shaders... latest official ones (shipping with cti) have a hidden property in the material which says _IsBark in order to tell vspro's billboard shader to not cutoff bark.
     
  44. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,859
    @Noogy i just realized that i have never updated the original package to support instanced indirect rendering as used by vegetation studio pro. sorry for that.
    i have just submitted an update which should land at the asset store within the next 48h.
     
  45. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    130
    Ah, thanks! Yeah I was attempting to update the package and wasn't seeing any change. I'm also still having the trunk issue but I'll keep looking at it.

    BTW, do you know if there's any lighting limitations with indirect instancing? I use a second directional world light to simulate backlighting and improve the look of the scene, however it seems the only way I can get the trees to accept this light is through normal rendering mode (no instanced or instanced indirect).
     
  46. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,859
    nope.
    but do not use a 2nd directional light because that is pretty expensive.
     
  47. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,859
    oh, i forgot: do you use forward rendering? there used to be limitations when using forward rendering – at least on dx11. but i think that has changed with some of the latest updates of unity. i am not sure which version actually fixed this. but why do you use forward?
     
  48. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    130
    Interesting, yeah I was currently using forward simply because I was leveraging performance over lighting quality, but I'll probably move to deferred. I have tried it and for some reason am having lots of problems with the leaf shader... extremely bright in VSP, and invisible in standard gameObjects (except when it's attempting to crossfade to the next LOD).

    I'm also having trouble with the Bark not rendering in VSP's billboard generator. I do see the _IsBark bool in the Bark shader so I'm nor sure what's up. Attempted to clean and rebuild with no success.
     
  49. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,859
    you may have to update the leaf shader (unity 2018.2 and above).

    btw. updated cti is available now.
     
  50. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    130
    Thanks @larsbertram1, the update seemed to work! And I was able to solve all the lighting issues with your included package updates.

    I guess smooth cross-fading no longer works? And I'm still having trouble with those missing billboard trunks, but maybe that's a VSP thing.