Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Question Weird highlighting on vegetations backside

Discussion in 'High Definition Render Pipeline' started by scyxiaoh, Dec 1, 2023.

  1. scyxiaoh

    scyxiaoh

    Joined:
    Dec 20, 2016
    Posts:
    8
    Hi all,

    I have a problem with the lighting on my tree's backside.

    issue1.jpg

    issue2.jpg

    What are these and how do I fix it? The environment is the HDRP terrain demo scene on Unity 2022.3.13f1. The trees are using the default HDRP Speedtree shader. I already checked that they have nothing to do with smoothness and thickness.
     
  2. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    596
    In PBR the theory has a Hardcoded Fresnel value of ~0.5 which accounts for something like 90% of materials, but there is still a range to that if you wanted something 'ground truth', so no matter what the directional light always casts that 0.5 number as well and it does it within the specular pass which includes smoothness values tok

    When you're looking at an inf flat plane which branches usually are, once you hit acute angles the Fresnel is at 100% an infinitely thick plane, so naturally it pretty much maximises the pixel value, and add the other pass still back on top, ( this includes mesh normal angles to buy the way)

    The spec pass can only be turned off fully or in a scene by scene basis in HDRP, but by doing so you also rid of roughness pass so it's not always ideal and will break PBR, which if that a stipulation not to in you project you may have to think about which direction is best.

    It has been a thing in unity HDRP since the beginning really, I think URP has a kill slider now, or it was in progress.

    Some ways you could approach blending in the results.

    Check your branch normal mesh angles, usually spherical re projection is used here, which could potentially - remove or dampen acute angles, this is probably the most used technique here

    Contact shadows, if your project allows it, this can sometimes fill this area some

    Turning off specular on the directional light or system wide ( my least recommended approach as imo you'll be purposely breaking PBR for the "wrong reason"). generally I'm interested in seeing people's responses to this, and if Unity have any plans or best practices for this as it probably is a troublesome problem for technical reasons too.
     
  3. scyxiaoh

    scyxiaoh

    Joined:
    Dec 20, 2016
    Posts:
    8
    Thank you for the brief explanation!

    These trees in screenshot actually already applied normal puffiness re-projection. I found trees have the best front-side looking with the normal puffiness and the 'None' Double-Sided mode. But that makes the worst Fresnel issue. My tree is like a sphere under this Fresnel effect xD.

    I found a related thread and the Unity staff mentioned a trick in https://forum.unity.com/posts/9040003/. Is this trick currently usable or it's still not released?
     
    HIBIKI_entertainment likes this.
  4. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    Definitely looks like manipulated mesh normals, try to set the normals to "Calculate" instead of "Import" in the model settings of your tree meshes.
     
    HIBIKI_entertainment likes this.
  5. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    596

    As Boxo mentions 2022 HDRP specular switch is for the specular shader ls only ( this is the "trick)
    Seb (Unity} said this trick has been made available only because there's a reusable "sum" in the existing shader, there is otherwise no room on the Gbuffer to make another pass or change it because of the technical constraints ( possibly the fixed 0.5.

    We discuss all this quite regularly with Boxo and unity as well.

    Definitely worth checking what seb (lazy) said too and see if unity can recalculate some if your Speedtree settings isn't giving you the results you need either ( which is also a shame ).

    Seb ( lazy) is also a really switched on user and often tinkers deeply into systems

    In HDRP you can use the pipeline debugger to preview the full screen normals whilst comparing different mesh normal set ups, you might be able to find best case easier that way too, but unfortunately it does look like it's a limitation here to stay and may just have to be compensated/ mitigated where possible.
     
  6. scyxiaoh

    scyxiaoh

    Joined:
    Dec 20, 2016
    Posts:
    8
    This normal manipulation is intended to make the tree have a puffy looking.
     
  7. scyxiaoh

    scyxiaoh

    Joined:
    Dec 20, 2016
    Posts:
    8
    Current normal set up already gives the best looking for most angles of view, it only looks horrible when the tree is between the camera and the sun. Sadly we can't use contact shadow because we are a city builder game and need grass to blend with terrain at a top-down view. I really hope that Unity can give us a way to do some hackings on this, like disable or decrease the fresnel specular per material or per shader. :(
     
    HIBIKI_entertainment likes this.
  8. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    It's intended to cheaply imitate translucency for shaders that don't support it (eg. URP Lit), but HDRP Lit properly supports translucency, so mesh normal manipulation is not needed here and will lead to incorrect lighting.
     
    Last edited: Dec 2, 2023
  9. scyxiaoh

    scyxiaoh

    Joined:
    Dec 20, 2016
    Posts:
    8
    I don't agree with that. Most AAA games do this manipulation too. It does improve how it looks.

    I got some comparisons:

    Comparison1.jpg

    Comparison2.jpg

    Comparison3.jpg
     
  10. SebLazyWizard

    SebLazyWizard

    Joined:
    Jun 15, 2018
    Posts:
    234
    Not sure if your trees are modeled with the manipulated normals in mind or if it's just a translucency / diffusion settings issue, it's hard to tell with such small images.

    My tree assets look perfectly fine with non-manipulated mesh normals.
    trans.JPG
     
    Last edited: Dec 3, 2023
  11. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    596
    Another point to inject here it is to ensure you lighting passes are up to date to whether that's realtime screen space baked GI/reflections/ambience etc. I'm sure this case has already been considered, just thought I would mention it to cover basis