Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

[Released!] Custom tree importer

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

  1. Talavaj

    Talavaj

    Joined:
    Sep 22, 2013
    Posts:
    41
    Yup!
    Works perfectly now with the include, no fluttering bark weirdness.
     
  2. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,847
    fine!
     
  3. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    80
    Hi Lars, small update. I'm not sure what changed but I no longer have the light limit problem with URP. I had to reimport CTI and apply all the proper updates but it's performing fantastically.

    I was wondering, is there any way to add a shader option to fade out leaf geometry as it becomes perpendicular to the camera view? I'm generally happy with the stylized look I've got, but that would be the last piece of the puzzle. Thanks.
     
  4. swredcam

    swredcam

    Joined:
    Apr 16, 2017
    Posts:
    118
    Can anyone suggest any tips or a tutorial on creating normal maps that will work in CTI? I think I am having issues packing the different channels. All I really want is normals but I am getting a very shiny surface in addition to the texture that the normal provides. I have photoshop but I'm not clear on how to get the right values in the right channels.
     
  5. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,847
    it is straight forward:
    (bark texture)
    1. take a regular normal map.
    2. copy its red channel into alpha.
    3. set the red channel to a constant value like 51. this defines the specular!
    4. set the blue channel to 255. this is ambient occlusion.
    important: make sure the texture is imported with sRGB texture unchecked.
     
    gecko likes this.
  6. swredcam

    swredcam

    Joined:
    Apr 16, 2017
    Posts:
    118
    Thank you Lars. That helped but my issue turned out to be with the albedo for the bark. I had an alpha that was 100% and the bark was smooth. I'm still figuring out the topic of packing obviously. Thanks again!
     
  7. gavriloP

    gavriloP

    Joined:
    Mar 25, 2018
    Posts:
    7
    Now that the HDRP is out of preview I finally started to experiment with it. I found out that with the latest Unity 2019.30f6 with HDRP 7.2 the shaders seem to work but the scene view flickers to black if the post processing is on in that scene view. In game view it seems to work fine. BTW are you planning to update the bark array shader too? Oh and I'm talking about the demo HDRP scene.
     
  8. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,847
    this should be fixed soon. or do it yourself:
    open the bark shader and find:
    normalOut.z = sqrt( 1 - dot(normalOut.xy , normalOut.xy ) );
    repalce it with:
    normalOut.z = sqrt( saturate( 1 - dot(normalOut.xy , normalOut.xy )) );
     
    Last edited: Feb 20, 2020
    florianalexandru05 likes this.
  9. gavriloP

    gavriloP

    Joined:
    Mar 25, 2018
    Posts:
    7
    Thanks! That did the trick!
     
  10. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,847
    fine!
     
  11. Talavaj

    Talavaj

    Joined:
    Sep 22, 2013
    Posts:
    41
    I have been experiencing some very weird behavior with latest version of cti in unity 2017.1.
    Firstly, it seems that enabling instancing on cti materials actually makes the performance a lot *worse* on some occasions, secondly, some of my plants move in unison when instancing on the materials is *disabled*.

    Basically, all the plants sway across the terrain as if they are part of a large chunk, with the pivot of the swaying being an arbitrary point in the middle of the plant cluster.
    If it helps, this happens with the LOD1 in plants imported as terrain trees, but not with LOD0 or when the plants are placed by hand.
    It also happens only during play, not in the scene view.

    Have you experienced anything like this?
    In any case, it's not a real issue, since instancing seems to work fine in most other occasions, it's just weird that it happens with some plants but not others, which have seemingly the same tags and LOD structure.
     
    Last edited: Feb 20, 2020
  12. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,847
    nope, anybody else?
     
  13. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,394
    Very strange. Been a while since I used 2017 so can not do any in depth testing. Would say round up the usual suspects.

    Make sure no static batching, try disabling dynamic batching in Player Settings.

    Check if LOD/wind fade is enabled on the shader. Maybe an error on that in 2017? Disable if it is enabled.

    Can not think of much more than that for this issue.
     
    florianalexandru05 likes this.
  14. florianalexandru05

    florianalexandru05

    Joined:
    Mar 31, 2014
    Posts:
    1,193
    So it's gotta be something to do with the buggyness of Unity 2017?! I didn't have this issue either but 2017 have been doing some weird stuff for me two but they work in other version.
     
    Last edited: Feb 21, 2020
    Baldinoboy likes this.
  15. Talavaj

    Talavaj

    Joined:
    Sep 22, 2013
    Posts:
    41
    Never figured out the issue.
    Nevertheless, I can't imagine why I would need to disable instancing for now, so it's fine.

    This is what I'm working on.
    CTI looks great, as always!

    Scr3.jpg
     
    Last edited: Apr 18, 2020
  16. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,394
    Wow! Very beautiful scene man
     
  17. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,847
    looks great – but i will never understand why the top branches of fir trees should point downwards :)
     
  18. Talavaj

    Talavaj

    Joined:
    Sep 22, 2013
    Posts:
    41
    Hah, admittedly, they shouldn't.
    But I frankly don't like the look of sparse, sad Christmas tree-looking treetops of large/old conifer trees, and I liked what they did with their trees in Days Gone, so I went with something similar.
     
  19. nu51313932

    nu51313932

    Joined:
    Oct 28, 2016
    Posts:
    46
    I try many way but Blenedr export doesn't work. The CTI do not create the CTI file from fbx that export from Blender 2.8
     
  20. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,847
    i am not a blender user... do you get any errors in the console?
     
  21. nu51313932

    nu51313932

    Joined:
    Oct 28, 2016
    Posts:
    46
    No error . I just drag and drop fbx in Unity asset folder . THe unity just download it.

    Btw which software do you use to make a 3d model?
     
  22. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,847
    have you named the fbx properly? like "MyTest_afsTREE.fbx"?
    then you should get a prompt in the console that the importer has been triggered.
     
  23. nu51313932

    nu51313932

    Joined:
    Oct 28, 2016
    Posts:
    46
    I try to put _afsTREE infront or behind or _afsTREE alone but it does't work. I used to make it work long time ago but in Blender 2.8 may have the problem with exporting

    I wil try again soon with older version of blender. Is it automatic convert if I put the name afsTree like this?
     
  24. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,847
    the importer looks for assets containing "_afsTREE".
     
  25. nu51313932

    nu51313932

    Joined:
    Oct 28, 2016
    Posts:
    46
    Yes I follow the guide . But it still doesn't work.

    Can you test my fbx file? I have a simple object.
     
  26. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,847
    i can.
     
  27. nu51313932

    nu51313932

    Joined:
    Oct 28, 2016
    Posts:
    46
  28. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,847
    i justed checked the first model.
    and i got the following error in the console:
    Your Model contains too many/too little materials or bark and leaf materials are not named properly.

    checking the tree in maya showed that the leaf and bark materials aren't named properly.
    so rename your materials and try again :)
     
  29. nu51313932

    nu51313932

    Joined:
    Oct 28, 2016
    Posts:
    46
    Hello again.

    My tree is work now but got a problem. Why when main wind intensity value is higher. the leaf and the branch move separate too far from the trunk? I use Unity 2019.3

    here is my tree
    https://drive.google.com/file/d/1wjHmT7gT0cU6kkk04PZxDFkqp2sJEbxZ/view?usp=sharing
     
    Last edited: Mar 19, 2020
  30. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,847
    sorry, but i do not have to time to look into your files, but you may have to freeze the transforms to get it working properly.
     
  31. nu51313932

    nu51313932

    Joined:
    Oct 28, 2016
    Posts:
    46
    oh thank you.
     
  32. nu51313932

    nu51313932

    Joined:
    Oct 28, 2016
    Posts:
    46
    Hello. I work in Maya the tree is work great with the Importer even I don't freeze the transformation of child.
    But in Blender . The child don't link with parent. When the wind blow. Leave and brach will separate from trunk even I freeze all transform.

    Any idea to solve this?
     
  33. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,394
    Probably a rotation issue. Blender is fun to get the rotation right in Unity. What I do and it works most of the time is have the empty gameobject 'root' rotated x90 y00 z00 and the rest of the tree reset rotation and scale reset to 0,0,0(CTRL+A). If doing the rotation to the root make sure to unparent the trunk and then reparent after the gameobject is rotated.

    Rotation issues tend to be the biggest problem I come across with Blender to CTI
     
    nu51313932 likes this.
  34. nu51313932

    nu51313932

    Joined:
    Oct 28, 2016
    Posts:
    46
    tahnk you so much. I will try it soon

    And can you share your fbx export setting?
     
    Last edited: Mar 27, 2020
  35. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    80
    Last edited: Apr 4, 2020
  36. nu51313932

    nu51313932

    Joined:
    Oct 28, 2016
    Posts:
    46
    It work perfectly!! Thank you for share your experience and tip.
     
  37. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,394
    Glad it worked!

    Sorry did not see this question. I just use the default settings with Selected Only enabled. Just in case you have lights or additional objects in the file.
     
  38. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    80
    Hi @larsbertram1 , sorry to bump this but I'm still having issues with URP shadow cascades and the CTI shaders. I was wondering if it's related to this issue here: https://forum.unity.com/threads/shadow-cascades-weird-since-7-2-0.828453/

    Or possibly here: https://forum.unity.com/threads/shadow-artifact-on-grass-with-urp-fix-included.844777/#post-5709928

    Visually it looks like a non-shaded blocky strip where a shadow cascade transition occurs. This is with the latest versions of URP, and unfortunately isn't being resolved with subsequent iterations. Thanks.
     
    Last edited: Apr 17, 2020
  39. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,847
    i will have to look if i ever updated ctito urp 7.2. and above. i doubt...
     
    Noogy likes this.
  40. GotAThing

    GotAThing

    Joined:
    Jan 10, 2019
    Posts:
    9
    Hi, im having issues with bark normals... having the normal strength above 0 causes vissible seams and wierd lighting.
    i suspect its down to how im generating the UV map for the bark. im currently modeling my trunk then marking seams and unwrapping in bits. i guess i should be starting with a simple cylinder that is unwrapped to use a tilable texture, is this correct?
    Any guidance on proper workflow for bark UVs would be great :)
     
  41. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,847
    hmm, creating several uv shells should be fine. but you have to make sure that your tangents are fine in case you use normals. do oyu let unity create proper mikkt space tangents on import?
     
  42. GotAThing

    GotAThing

    Joined:
    Jan 10, 2019
    Posts:
    9
    Yes tangents are set to calculate mikktspace
     
  43. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,847
    how do the normals look in the frame debugger?
     
  44. GotAThing

    GotAThing

    Joined:
    Jan 10, 2019
    Posts:
    9
    I may have fixed it. had some issues with my initial normal bake, so fixed this in blender.
    Now if i import as a standard normal map it seems to work correctly.
    using non srgb or Normal Map (GA) Occlusion (B) maps causes issues tho. is this expected in HDRP?
    All working as far as i can tell anyway so im happy, thanks for the help :)
     
  45. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,847
    fine!
     
  46. DrInternet

    DrInternet

    Joined:
    Apr 6, 2014
    Posts:
    97
    I_see_what_you_did_there.jpg
    And I must say it's a really cool trick to not add any more keywords and I wish more developers would do that. Keyword limit has been my problem for a few years now. Introducing local_shader_features may be a scalable solution but it's also a very bad solution as it doesn't change much; part of asset developers don't know about it, another part doesn't care, yet another part doesn't update their assets anymore. And converting shader featurs to local manually after every asset update is a pain in the ass. I don't really know how maximum shader limit affects performance, but I would rather see it set to some very large value that's little likely to hit (like i.e. 2048 or smth).

    Anyway back to CTI:
    I have added "use wind from script" feature to CTI tree creator shaders and it seems to work. So unless there is some limitation I'm not aware of, I propose adding it to the next update of CTI.
     
  47. RPowers

    RPowers

    Joined:
    May 14, 2015
    Posts:
    114
    Is anyone else seeing these types of shader errors with Universal RP 7.3.1? I've tried deleting my Library folder and reopening my project, but that didn't work.
     

    Attached Files:

  48. RPowers

    RPowers

    Joined:
    May 14, 2015
    Posts:
    114
    I figured out that I need to replace "com.unity.render-pipelines.lightweight" with "com.unity.render-pipelines.universal" in all the files in the Shaders folder. Well I did that but I get another strange shader message in my bark shader, so somethings still not right. Has anyone seen this error before? Now I'm really stuck. upload_2020-5-8_22-56-48.png
     
    florianalexandru05 likes this.
  49. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,095
    With our CTI trees set up with Vegetation Studio Pro, I'd like to use VSP billboard tree wind, but those billboards move out of sync with the CTI mesh tree wind, so the mesh<>billboard transition is jarring. I asked Lennart and he said: "The wind on the billboards are based on the HD wind algorithm found in the HD.Lit shader. The same as NatureManufacture uses for their trees. If the tree uses another wind math it will not be synced." What does CTI use? I see in the CTIShaderController for VSP, there is a line: BillboardHDWind = true,...so I thought it would work... any insight on how to make the mesh and billboards in sync with the wind movement?
     
  50. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,847
    cti does not use the hd wind.
    so you will have to hack the vsp billboard shaders to sync mesh and billboard trees based on the wind implementation in the original cti billboard shaders.
     
unityunity