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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

[Released!] Custom tree importer

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

  1. mikejm_

    mikejm_

    Joined:
    Oct 9, 2021
    Posts:
    346
    Just for the record or anyone else having this "bug" from Blender, I learned the issue. There is something called a "parent inverse": https://docs.blender.org/manual/en/latest/scene_layout/object/editing/parent.html

    So you have to be careful in Blender because you won't see this "hidden matrix" but if it gets created during your parenting (based on settings presumably I haven't figured out the nuance to yet), you cannot see it in your hierarchy or object panels. However, it does become evident on FBX export when it is applied.

    When I take the project with the bark object that keeps rotating -90 on export, if I click that bark (which shows 0 rotation at rest) and go Object > Apply > Parent Inverse, suddenly the -90 rotation becomes visible on the x axis. Then I can go Object > Apply > Rotation and now it is truly set to zero.

    Without doing the Apply Parent Inverse first, there is still a hidden rotation in there. So not exactly a bug. Just a strange design where they are hiding a potential rotation as the "Parent Inverse" rotation. If Blender was better designed, I think this would be visible on a panel somewhere instead of just hiding it completely.

    So if things are rotating weird, or you're not sure, Apply Parent Inverse to anything that is misbehaving then Apply Rotation.

     
    florianalexandru05 likes this.
  2. florianalexandru05

    florianalexandru05

    Joined:
    Mar 31, 2014
    Posts:
    1,758
    CTI 2022 bark shader seems to be broken in URP! Also, HDRP HLSL doesn't work anymore aside from the share graph shaders, which is still fine at least.

    CTI urp errors.jpg
     
  3. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,858
    i will skip the hlsl versions completely as they just need tooo much work.
    attached 2 urp versions for 2022.3 lts.
    14_plus package uses shader graph shaders and should be future proof (plus).
    2023 package contains latest hlsl version.
     

    Attached Files:

  4. florianalexandru05

    florianalexandru05

    Joined:
    Mar 31, 2014
    Posts:
    1,758
    It works, thanks a lot man you're a life saviour!! Yah I agree, it's really hard to maintain...
     
  5. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,178
    If you get errors on the latest version of Unity/URP about not finding a 4 parameter version of DirectBDRF, open the file "CTI URP Lighting.hlsl" in the includes folder, and find the following function:

    Code (CSharp):
    1. half3 LightingPhysicallyBasedWrapped(BRDFData brdfData, half3 lightColor, half3 lightDirectionWS, half lightAttenuation, half3 normalWS, half3 viewDirectionWS, half NdotL)
    2. {
    3. //NdotL is wrapped... not correct for specular
    4.     half3 radiance = lightColor * (lightAttenuation * NdotL);
    5.     return DirectBDRF(brdfData, normalWS, lightDirectionWS, viewDirectionWS) * radiance;
    6. }
    Change it to specify false for the last parameter (Don't do specular):


    Code (CSharp):
    1. half3 LightingPhysicallyBasedWrapped(BRDFData brdfData, half3 lightColor, half3 lightDirectionWS, half lightAttenuation, half3 normalWS, half3 viewDirectionWS, half NdotL)
    2. {
    3. //NdotL is wrapped... not correct for specular
    4.     half3 radiance = lightColor * (lightAttenuation * NdotL);
    5.     return DirectBDRF(brdfData, normalWS, lightDirectionWS, viewDirectionWS, false) * radiance;
    6. }
     
  6. LeraEclera

    LeraEclera

    Joined:
    Feb 12, 2023
    Posts:
    5
    Hi all, i have
    "Shader error in 'CTI/URP Billboard': invalid subscript 'shadowCoord' at line 178 (on d3d11)"
    on Unity 2021.3.7f1.
     
  7. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,858
    for URP 14 and above CTI uses shader graph. a little bit less powerfull but easier to maintain.
    you will fidn a proper package attached.
     

    Attached Files:

    LeraEclera likes this.