Search Unity

Fresnel on standard shader too strong

Discussion in 'General Discussion' started by Cascho01, Mar 27, 2015.

  1. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    Hi,
    I´ve seen that others also complain about the standard shaders fresnel is too strong.
    Here´s a screenshot of my project (also have a look at the grass):



    Please give us a parameter to tweak it, thanks!
     
    Last edited: Mar 27, 2015
    qq11013984, jbb1979 and Stardog like this.
  2. Aurecon_Unity

    Aurecon_Unity

    Joined:
    Jul 6, 2011
    Posts:
    241
    I know that 'everything has fresnel', but I have to agree - even with no smoothness or metallic objects can be quite shiny at incidental angles.

    I'm not sure exactly how accurate this is? If I walk around in real life, whilst everything does have fresnel, some materials only have very slight amounts that appear to be almost nothing to the eye. I can't replicate this in Unity...
     
    jbb1979 likes this.
  3. djweinbaum

    djweinbaum

    Joined:
    Nov 3, 2013
    Posts:
    533
    I agree. I made a thread about it and multiple people told me I needed to use normal and spec maps which I felt missed the point. There are some situations where I've been unable to control how insane the hotspots get.
     
    jbb1979 likes this.
  4. Aieth

    Aieth

    Joined:
    Apr 13, 2013
    Posts:
    805
    It is extremely accurate. Out of all the approximations and simplifying assumptions made in a real time renderer, Schlicks fresnel approximation comes miles closer to ground truth than anything else. If you want to reduce the visual effect of the fresnel then you should look into the gloss/roughness/smoothness (whatever Unity calls it) value. There will never be a slider to tweak the fresnel in a PBR renderer, nor should there.

    EDIT: That said, and based on the link in the first post in this thread, it does seem like the roughness range is clamped and therefore the effect of the fresnel can only be removed to some degree.

    EDIT2: What I'm saying is that you shouldn't blame the fresnel. If there is any issue it has nothing to do with the fresnel, but rather other parts of the BRDF.
     
    Last edited: Mar 28, 2015
    jbb1979 likes this.
  5. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    969
    Yes, this was discussed in the beta forum, take a look at this post.
     
    jbb1979 likes this.
  6. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    Of course I already have smoothness / gloss set to zero.
    It indeed looks like a clamping issue.
    So, what's the conclusion?
    How can we reduce the effect?
     
    jbb1979 likes this.
  7. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    969
    You can try doing what @ReJ suggested in the post i linked, only for the standard shader instead of just the terrain shader which is discussed there.

    This should give you more roughness, but it will no longer match marmorset toolbag.
     
    jbb1979 likes this.
  8. Frpmta

    Frpmta

    Joined:
    Nov 30, 2013
    Posts:
    479
    Can't seem to find any issue tracker complaint to upvote.

    This isn't a small issue. Unity basically just brought into its engine the main thing I hate about UE.
     
    jbb1979 likes this.
  9. MadJohny

    MadJohny

    Joined:
    Mar 8, 2013
    Posts:
    143
    Yep, my game has a look that should have like 0 fresnel, things look uglier in unity 5 than they did in unity 4.
     
    jbb1979 likes this.
  10. Charkes

    Charkes

    Joined:
    Apr 17, 2013
    Posts:
    228
    I agree but yet it's not fault of the fresnel but probably the BRDF itself as @Aieth said.

    They choose to use a normalized blinn-phong which is I think is part of the problem, I find it hard to represent rough surfaces with it and even more at grazing angles.

    Try maybe to activate GGX in UnityStandardConfig.cginc ( inside C:/Program File/Unity/Editor/Data/CGincludes/ ) :

    look for this line #define UNITY_BRDF_GGX 0 and change 0 to 1

    Code (CSharp):
    1. #ifndef UNITY_STANDARD_CONFIG_INCLUDED
    2. #define UNITY_STANDARD_CONFIG_INCLUDED
    3.  
    4. // Define Specular cubemap constants
    5. #define UNITY_SPECCUBE_LOD_EXPONENT (1.5)
    6. #define UNITY_SPECCUBE_LOD_STEPS (7) // TODO: proper fix for different cubemap resolution needed. My assumptions were actually wrong!
    7.  
    8. // Energy conservation for Specular workflow is Monochrome. For instance: Red metal will make diffuse Black not Cyan
    9. #define UNITY_CONSERVE_ENERGY 1
    10. #define UNITY_CONSERVE_ENERGY_MONOCHROME 1
    11.  
    12. // High end platforms support Box Projection and Blending
    13. #define UNITY_SPECCUBE_BOX_PROJECTION ( !defined(SHADER_API_MOBILE) && (SHADER_TARGET >= 30) )
    14. #define UNITY_SPECCUBE_BLENDING ( !defined(SHADER_API_MOBILE) && (SHADER_TARGET >= 30) )
    15.  
    16. #define UNITY_SAMPLE_FULL_SH_PER_PIXEL 0
    17.  
    18. #define UNITY_GLOSS_MATCHES_MARMOSET_TOOLBAG2 1
    19. #define UNITY_BRDF_GGX 1 // Change this to 1 and restart Unity 5
    20.  
    21. // Orthnormalize Tangent Space basis per-pixel
    22. // Necessary to support high-quality normal-maps. Compatible with Maya and Marmoset.
    23. // However xNormal expects oldschool non-orthnormalized basis - essentially preventing good looking normal-maps :(
    24. // Due to the fact that xNormal is probably _the most used tool to bake out normal-maps today_ we have to stick to old ways for now.
    25. //
    26. // Disabled by default, until xNormal has an option to bake proper normal-maps.
    27. #define UNITY_TANGENT_ORTHONORMALIZE 0
    28.  
    29. #endif // UNITY_STANDARD_CONFIG_INCLUDED
    30.  
    But how your map is setup ? Are you using a tonemapper ?
     
    jbb1979 and the_motionblur like this.
  11. Deleted User

    Deleted User

    Guest

    Agreed,

    After the first mess around with Unity 5, the standard shader and BRDF were the first things to be changed. I copied UE4's model (Lambertian diffuse) BRDF.

    https://de45xmedrsdbp.cloudfront.net/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf

    Aras has kindly provided information on how to do this:

    https://gist.github.com/aras-p/3d19b806d3fb7d386125
     
    jbb1979 and the_motionblur like this.
  12. the_motionblur

    the_motionblur

    Joined:
    Mar 4, 2008
    Posts:
    1,774
    Cool thing. How would one recreate this if he, say, had no idea of how to manually changeing a shader? :)

    Aras says "Change the shader to do different BRDF." like it's the most normal thing in the world. Though ... maybe it isn't for everybody. ;)
     
    jbb1979 likes this.
  13. Deleted User

    Deleted User

    Guest

    Well I didn't find it super easy, I followed what @Dolkar was doing a big thanks for his / her help:

    http://forum.unity3d.com/threads/the-wish-for-an-alternative-rendering-path.198539/

    I looked at how UE4 does it, I looked at various other threads and managed to come up with something. Had a couple of issues with shadows I needed to figure out.

    This bit needs updating but still relevant:

    http://docs.unity3d.com/Manual/SL-SurfaceShaderLighting.html

    If I ever manage to get some free time, I'll try and do a write up. It'd be nice if Unity actually did some tutorials on how to customise lighting and more advanced functions etc. within Unity 5.

    Would be super sweet.
     
    Last edited by a moderator: Apr 3, 2015
    jbb1979 and the_motionblur like this.
  14. the_motionblur

    the_motionblur

    Joined:
    Mar 4, 2008
    Posts:
    1,774
    Holy S*** ... I'll have to take a closer look at this when I get the time to. And if I understand enough of it, that is. ;)
    Thanks for the links and infos :)
     
    jbb1979 and (deleted member) like this.
  15. Jon-Huhn

    Jon-Huhn

    Joined:
    Jan 26, 2009
    Posts:
    85
    I realize this is an old thread, but this is still a major problem four years later. The degree of fresnel reflection may be accurate, but because what's actually being reflected is NOT physically accurate, the final visual effect is NOT correct, and in many cases looks horrible. Providing an override slider would have been such an easy thing to add.
     
  16. Frienbert

    Frienbert

    Joined:
    Nov 14, 2012
    Posts:
    112
    its still like that with the new hdrp and lwrp?
     
    GridWanderer and jbb1979 like this.