Search Unity

Weird "shading" on tree leaves.

Discussion in 'High Definition Render Pipeline' started by Avi3ator, Feb 3, 2021.

  1. Avi3ator

    Avi3ator

    Joined:
    Feb 29, 2016
    Posts:
    64
    Hello! My leaves turn white in the sunlight. Im using HDRP and the trees from book of the dead. Subsurface scattering is turned off.

     
  2. ProGameDevUser

    ProGameDevUser

    Joined:
    Mar 17, 2018
    Posts:
    115
    Hi! Did you manage to solve this problem?
     
  3. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    Those tree meshes have manipulated normals at their leaves, you need to recalculate them.
     
  4. Deleted User

    Deleted User

    Guest

    Just assign the foliage diffusion profile in the material of the leaves...that does the job
     
  5. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    Nope, that won't fix it.
    it's correct that there's no diffusion profile applied, but that only fixes the greenish transmission, not the incorrect lighting on directly lit surfaces, which is caused by the mesh normals.
     
  6. ProGameDevUser

    ProGameDevUser

    Joined:
    Mar 17, 2018
    Posts:
    115
    How?) Is it in the model import settings?
     
  7. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    Yes, set Normals to "Calculate", that should fix it.
     
    ProGameDevUser likes this.
  8. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    509
    Most likely you won't be able to fix it, it comes from the PBR specular shading.
    The only way to fix it now is to go to the directional light and disable affect specular.

    With forward path, the shader can be changed to disable this spec shading, there there is not way (not that I know of) to disable it on the shader level.
     
  9. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    It's definitely caused by the mesh normals in this case, I had the same issues with those trees from the book of the dead and recalculating the normals fixed it.
     
  10. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    509
    Not always. Here I have the unity plane, so the normals are correct.
    Here is how it looks from the front:
    upload_2021-12-14_19-25-11.png

    And here is on the back:
    upload_2021-12-14_19-25-51.png

    Directional Light - Affect Specular disabled:
    upload_2021-12-14_19-26-41.png
     
  11. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    509
  12. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    If you crank up the normal map strength to over 1 the lighting is incorrect too (if the normal map is correctly baked and matches it's source mesh), so that behaviour is expected.
     
  13. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    509
    Agree ;) But still, the option to completely disable the spec would be nice too.
     
  14. ProGameDevUser

    ProGameDevUser

    Joined:
    Mar 17, 2018
    Posts:
    115
    Hi! Actually, I'm here because of these highlights on the shaders to Tve))) How can we contribute to fixing this problem as soon as possible?
     
  15. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    509
    Hey, well there are a few options on our side and a few on unity side:

    On our side with tve:
    1. Better meshes and normal maps
    2. Reduce the Main Normal Intensity on the material
    3. Play with Render Normals - set them to Flip or Mirror
    4. In BIRP/URP, I added an option to Disable Specular on the material

    On unity side:
    1. In HDRP, Disable Affect Specular on the directional light
    2. If something like this is implemented: https://github.com/Unity-Technologies/Graphics/pull/2556
    This could be added as a toggle same as the Affect Spec on the material.

    The biggest problem right now is that some assets are created in BIRP with a Blinn Phong shading, especially stylized assets, and Blinn Phong doesn't have the PBR implementation of specular highlight, so no issues there. As soon as you convert some assets to HDRP Subsurface Scattering, based on the mesh normals and normal map, you might see these artifacts.

    I just got the Terrain Sample Asset Pack from the unity store, and some of the meshes still have these issues.
    upload_2021-12-14_22-2-16.png

    But the normal map isn't the best (way to exagerated)
    upload_2021-12-14_22-3-1.png
    compared to some better normal maps
    upload_2021-12-14_22-3-35.png

    And all go away by disabling this option. As a tradeoff, I would like to be able to use this on the material.
    upload_2021-12-14_22-5-16.png
     
    Last edited: Dec 14, 2021
    ProGameDevUser likes this.
  16. ProGameDevUser

    ProGameDevUser

    Joined:
    Mar 17, 2018
    Posts:
    115
    Thanks! It feels like Unity Technologies does not understand how much these reflections spoil the graphics, we are waiting for corrections...
     
  17. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    509
    I don't think it is unity fault, I think that minimum reflectance value of 0.04 for dielectric specular is the standard implementation of PBR in many engines, probably in all of them, I don't know all the technical details. But since there are options to disable it, it would be nice to have it ;)
     
  18. ProGameDevUser

    ProGameDevUser

    Joined:
    Mar 17, 2018
    Posts:
    115
    As mentioned above, a good option is to recalculate the normals, but there are assets where trees are represented only by meshes without .fbx file and such a function disappears, changing the material settings to different normal map modes also fails to get rid of, disabling specular at dir light is also a bad idea because lighting completely disappears from many important areas)))
     
    BOXOPHOBIC likes this.
  19. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    509
    I know, I'm dealing with this every day :D
     
  20. ProGameDevUser

    ProGameDevUser

    Joined:
    Mar 17, 2018
    Posts:
    115
    WE NEED MORE TOPICS AND MAYBE THE DEVELOPERS WILL HEAR US AAAAAAA!!!11 :D
     
  21. DEEnvironment

    DEEnvironment

    Joined:
    Dec 30, 2018
    Posts:
    437
    book of the dead trees yes do have some poor vertex tangents and vertex normals

    @ProGameDevUser
    actually, it's easier to recalculate from .mesh format than FBX as FBX cannot be save at run time requiring an extra step in saving the re-baked data

    we made a few tools to do this within unity as it's such a common problem
     
  22. ProGameDevUser

    ProGameDevUser

    Joined:
    Mar 17, 2018
    Posts:
    115
    Can you tell me more?) What kind of tools?
     
  23. DEEnvironment

    DEEnvironment

    Joined:
    Dec 30, 2018
    Posts:
    437
    it's a set of small mesh tools i included with our asset
    Scripts & Tools – De Environment

    useful for rebake normals and tangents to gain visually correct environment lighting
    it will work on any mesh you select and bake except perhaps speed tree billboards as they don't use anything we can access

    as common mesh issues can make even the best shaders look incorrect my goal by providing this was to reduce possible support questions due to problems caused by others and impower our users to fix easily within unity
    this does not fix every problem issue such as texture compressions but is just one more tool in the kit to improve workflow

    i also included tools for bake AO and a tool to bake vertex colors for our wind setup
    this is on sale now for 50% off
    DE Environment | VFX Shaders | Unity Asset Store
     
    ProGameDevUser likes this.
  24. ProGameDevUser

    ProGameDevUser

    Joined:
    Mar 17, 2018
    Posts:
    115
    Thank you very much! This will be very useful in any project
     
  25. DEEnvironment

    DEEnvironment

    Joined:
    Dec 30, 2018
    Posts:
    437
    Yes its very powerful
    for formats like .mesh .obj just bake and it's fully saved into the mesh
    for FBX formats to permanently save just one extra step is needed use the free Unity FBX tool from package manager to save it permanently

    when you use select the parent object it will detect everything under it
    take care in case you bake a unity cube or something i added a reset button just incase you do that


    cheers enjoy
     
    ProGameDevUser likes this.