Home Technical Talk

Glossiness/Roughness for Schlick - How to do it?

polycounter lvl 12
Offline / Send Message
Ace-Angel polycounter lvl 12
Hey to all,

I was wondering if there is any way you could move the Specular Highlight additively from the light Vector for a Schlick?

An example of what I mean:
gWhNm.jpg

The white is the object, the Grey is the traditional spec from the Light Vector position. I would like to achieve something like Yellow, in which I essentially 'compress' or tighten the term.

Any tips? Cheers!

Replies

  • Drew++
    Options
    Offline / Send Message
    Drew++ polycounter lvl 14
    What kind of specular model are you using this Schlick fresnel with?

    "standard", it's
    schlick.png
    float base = 1.0 - dot(V, H);
    float exponent = pow(base, 5.0);              
    float fresnel = exponent + F0 * ( 1 - exponent );
    
    You might try to divide that last bit by a value, to get a 'roll off'

    Here's a Kelemen Szirmay-Kalos brdf/specular w/ schlick
    float Specular( float3 V, float3 N, float3 L, float4 eccentricity, float rollOff, float4 weight )
    {
       float spec = 0;
       
       float cosne = dot( V, N );
       float cosln = dot( N, L );
       
       if( cosln > 0 )
       {
          float3 h = L + V;
          float3 H = normalize( h );
       
          float coseh = dot( H, V );
          float cosnh = dot( H, N );
          
          float cosnhPow2 = cosnh * cosnh;
          float ta = sqrt( 1 - cosnhPow2 ) / cosnh;
    
       
          float cosnhPow4 = cosnhPow2*cosnhPow2;
          float4 eccPow2 = eccentricity * eccentricity;
          
          float4 pH = exp( -( ta * ta )  / ( eccPow2 ) ) / ( eccPow2 * cosnhPow4 );
          
          // This Schlick Fresnel is a bit different than a standard Schlick imo...
          float cosehPow = pow( 1 - coseh, 5.0 );
                   
          float Ff = cosehPow + ( 1 - cosehPow ) / rollOff; // Rolloff might be what you need ;)
          
          float4 specCoeff = max ( ( pH * Ff ) / dot( h, h ), 0 );
          
          spec = saturate( cosln ) * dot( specCoeff, weight );
                   
       }
       
       
       return spec;
    }
    
  • Ace-Angel
    Options
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Cheers Drew, you're awesome as always :D
  • Will Faucher
    Options
    Offline / Send Message
    Will Faucher polycounter lvl 12
    Sorry. I had to.

    fap-schlick-schlick-female-l.png
  • equil
    Options
    Offline / Send Message
    and no one laughed.

    - - - -

    i wonder if you want behaviour like this?
    specularroughness.png

    i think that's just using a szirmay-kalos geometry/masking term ( dot(L+V,L+V) ).
  • Ace-Angel
    Options
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Actually Equil, that would be very useful indeed, however, the only way I was able to get that effect (the one in the second row column) is my Multiplying a Phong Specular by a Schlick and clamping it by a Lambert, with a really high constant value to bring back the 'brightness'.

    I tried sampling the May-Kalo shader and it's terms, but none of them seem to behave the way that way.
Sign In or Register to comment.