Search Unity

Please help to fix crazy fresnel.

Discussion in 'Shaders' started by Almakos, Dec 21, 2015.

  1. Almakos

    Almakos

    Joined:
    Dec 13, 2013
    Posts:
    179
    Hey guys,
    Is there any way to solve nasty white fresnel/specular edges on the model?
    In substance painter or in marmoset model looks alright. But Unity adds this strong fresnel and it ruins everything.
    Any way to get rid of it through shader config?
    Thank you
    Unity_vs_SubstancePainter.jpg
     
  2. PeterHann

    PeterHann

    Joined:
    Apr 9, 2013
    Posts:
    22
    Make sure you got deferred rendering HDR and linear space enabled in Unity, if that doesn't help - edit your Metallic map/alpha contrasts in Photoshop manually
     
  3. Almakos

    Almakos

    Joined:
    Dec 13, 2013
    Posts:
    179
    Sorry forgot to mention this is a mobile game
    so no linear and no deferred

    What would be great if I could multiply all those fresnel highlights by something black. similar to what occlusion map is doing Occlusion.gif I hope this GIF will illustrate occlusion effect in action

    any advice which files I can look into tweaking?
    I've already got official shaders archive from unity website
    but it's really complicated to figure out where is this "fresnel" value coming from and how to do any changes to it

    Thank you
     
  4. PeterHann

    PeterHann

    Joined:
    Apr 9, 2013
    Posts:
    22
    the fresnel comes from the standard shader reflecting the default "sky". check your lightning setting especially "Reflection Intensity" all so if you got a Reflection Probe in your scene you can adjust reflection intensity there too. "Ambient Intensity" is another important tweak value in your lightsettings - it's not the shader - all so for mobile you might just bake thouse AO values into your diffuse map - I know it's not the "right" way to do PBR but may help to archive your goals.
     
  5. Almakos

    Almakos

    Joined:
    Dec 13, 2013
    Posts:
    179
    my character does use reflection probe and I am aware of highlights in probe, they are very important to add "depth" to the look of character
    if I dial probe intensity down, then character becomes "flat" which is something to avoid
    albedo map already has some occlusion baked in, but what I've noticed is that occlusion map in standard shader is actually very helpful because it overwrites specularity

    so ideally what I'd like to get is to have effect similar to rim light shader which can contract from fresnel highlights similar to what current occlusion map does....if that makes sense ^^'
    sorry it's a bit hard to explain
    but first two pictures illustrate the issue pretty well I think

    and thank you for your advice
     
  6. PeterHann

    PeterHann

    Joined:
    Apr 9, 2013
    Posts:
    22
    Is there in any case the alpha from your metallic map missing? I don't have much more Ideas - had similar issues at the beginning but I just tweaked the things I already mentioned to get it right - the Hot Rod model here in this shot was made this way: substance painter => unity 5.2.3 plus some minor adjustments on the metallic map in Photoshop MadMiles 2015-12-20 07-17-39-54.jpg
     
  7. Almakos

    Almakos

    Joined:
    Dec 13, 2013
    Posts:
    179
    Smoothness map is in place and values are as I want them to be. But at some angles reflection probe is giving this very shiny edge to my model
    And I am surprised nobody else finds this strange. Because as an artist I have not many ways to deal with those nasty edges
    Thank you for your help OnklPeta
     
  8. PeterHann

    PeterHann

    Joined:
    Apr 9, 2013
    Posts:
    22
    Sure - hope you find yourself something that works for you - good luck :)
     
  9. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    So there's a couple things that could be happening.

    The normal map texture in Unity looks much lower res than the one in substance which is breaking up the fresnel in substance. I would suggest looking at the texture settings to make sure they're not being scaled down and turn on trilinear and cranking up anisotropic. Anisotropic filtering might not be possible for mobile, but this is just for testing to see if we can get it to look like substance.
     
  10. Almakos

    Almakos

    Joined:
    Dec 13, 2013
    Posts:
    179
    They both are 1K maps in Substance Painter and Unity
    Here is a little GIF to show difference between Aniso Levels Filtering.gif
    As you can see on global level things stay pretty much the same...

    I know that this highlight which comes from reflection probe might seem a bit extreme, but it does add depth to the way characters look and I like it from some angles like here (not perfect but ok):
    Ok_angle.jpg
    However there are some angles which look unacceptable:
    not_ok_angle.jpg

    i would like to mention that the very first comparison screenshot in this thread was taken with same skyboxes and similar setting for both Painter and Unity
    And at roughly same angle. But you can see how much different the effect looks

    Thanks guys
     
  11. Almakos

    Almakos

    Joined:
    Dec 13, 2013
    Posts:
    179
    Here is an interesting find:
    I wonder if it's Unity's side problem or Substance Painter's
    Metallics_vs_Specular.gif

    I've exported maps for Metallic way and Specular way from Substance Painter
    and created two versions using Unity's Standard shader with metallic workflow and specular
    As you can see rim edge is quite different

    However this just partially solves my issue.
    Would be good to have control over this fresnel/rim thing