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.

Smoothness (glossiness) from Substance has to be multiplied by 0.75 - is it always true?

Discussion in 'General Graphics' started by OskarSwierad, Mar 16, 2015.

  1. OskarSwierad

    OskarSwierad

    Joined:
    Dec 17, 2014
    Posts:
    25
    As mentioned by Wes McDermott here:
    "Unity still does a remapping of the smoothness map in their shader. This will result in Painter roughness being too smooth."
    https://forum.allegorithmic.com/index.php?topic=4335.msg20602#msg20602

    When is the flag UNITY_GLOSS_MATCHES_MARMOSET_TOOLBAG2 enabled?
    Is it always true (just used as an ifdef for convenience) or does it change for some platforms / situations?

    From builtin_shaders/CGIncludes/UnityStandardUtils.cginc:
    Code (csharp):
    1.  
    2. inline half RoughnessToSpecPower (half roughness)
    3. {
    4. #if UNITY_GLOSS_MATCHES_MARMOSET_TOOLBAG2
    5.    // from https://s3.amazonaws.com/docs.knaldtech.com/knald/1.0.0/lys_power_drops.html
    6.    half n = 10.0 / log2((1-roughness)*0.968 + 0.03);
    7.    return n * n;
    8.  
    9.    // NOTE: another approximate approach to match Marmoset gloss curve is to
    10.    // multiply roughness by 0.7599 in the code below (makes SpecPower range 4..N instead of 1..N)
    11. #else
    12.    half m = roughness * roughness * roughness + 1e-4f;   // follow the same curve as unity_SpecCube
    13.    half n = (2.0 / m) - 2.0;       // http://jbit.net/%7Esparky/academic/mm_brdf.pdf
    14.    n = max(n, 1e-4f);         // prevent possible cases of pow(0,0), which could happen when roughness is 1.0 and NdotH is zero
    15.    return n;
    16. #endif
    17. }
    18.  
     
  2. minhdaubu2

    minhdaubu2

    Joined:
    Jun 10, 2014
    Posts:
    72
    Yeah, i noticed it today and it really annoy me, the solution in Allegorithmic forum doesn't seem to be enough.
    Anyone has experiment to solve this problem?
     
  3. minhdaubu2

    minhdaubu2

    Joined:
    Jun 10, 2014
    Posts:
    72
    nobody care about this?
     
  4. cakeslice

    cakeslice

    Joined:
    Oct 18, 2014
    Posts:
    192
    Yeah, I would like some input from Unity devs about this.
     
    minhdaubu2 and Jim-Boddie like this.
  5. minhdaubu2

    minhdaubu2

    Joined:
    Jun 10, 2014
    Posts:
    72
    Should the Standard Shader add some "Rounghness intensity" control bar or an "Standard for substance"?
     
  6. OskarSwierad

    OskarSwierad

    Joined:
    Dec 17, 2014
    Posts:
    25
    minhdaubu2: Sure, a good fix, but in a long run - probably an unnecessary math operation and a confusing, app-specific setting :)

    BTW, a quote from Wes:
    http://steamcommunity.com/app/27339...0277373837/?insideModal=1#c618453594760401012
     
    minhdaubu2 likes this.
  7. minhdaubu2

    minhdaubu2

    Joined:
    Jun 10, 2014
    Posts:
    72