Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
VDrift lighting, materials, textures
09-15-2013, 07:11 AM, (This post was last modified: 09-15-2013, 07:11 AM by NaN.)
#15
RE: VDrift lighting, materials, textures
Here the vdrift.brdf (specular only) to be used with Disney BRDF Explorer ( http://www.disneyanimation.com/technology/brdf.html ):
Code:
analytic

::begin parameters
float roughness 0.001 1 .1
float metallic 0.001 1 .1
color color 1 1 1
::end parameters


::begin shader

const float pi = 3.14159265358979323846;

vec3 Fresnel(vec3 f0, float cos_theta)
{
    float b = 1 - cos_theta;
    float b2 = b * b;
    return f0 + (1 - f0) * b2 * b2 * b;
}

vec3 VDriftBRDF(vec3 f0, float r, float nv, float nl, float nh, float vh)
{
    float a = r * r;
    float a2 = a * a;
    float d = nh * nh * (a2 - 1) + 1;
    float r1 = r + 1;
    float k = r1 * r1 / 8;
    vec3 f = Fresnel(f0, vh);
    return f * a2 / (4 * pi * d * d * (nl * (1 - k) + k) * (nv * (1 - k) + k));
}

vec3 BRDF( vec3 L, vec3 V, vec3 N, vec3 X, vec3 Y )
{
    vec3 f0 = mix(vec3(0.04), color, metallic);
    vec3 H = normalize(V + L);
    float nv = max(0.0, dot(N, V));
    float nl = max(0.0, dot(N, L));
    float nh = max(0.0, dot(N, H));
    float vh = max(0.0, dot(V, H));
    return VDriftBRDF(f0, roughness, nv, nl, nh, vh) ;
}

::end shader

Try to match some of the brdf samples from here Wink http://people.csail.mit.edu/wojciech/BRD...ase/brdfs/
Reply


Messages In This Thread
VDrift lighting, materials, textures - by NaN - 04-22-2013, 05:05 PM
RE: VDrift lighting, materials, textures - by NaN - 05-02-2013, 02:57 PM
RE: VDrift lighting, materials, textures - by NaN - 05-02-2013, 05:34 PM
RE: VDrift lighting, materials, textures - by NaN - 05-02-2013, 06:55 PM
RE: VDrift lighting, materials, textures - by NaN - 05-12-2013, 06:30 AM
RE: VDrift lighting, materials, textures - by NaN - 05-18-2013, 04:59 AM
RE: VDrift lighting, materials, textures - by NaN - 07-18-2013, 02:11 PM
RE: VDrift lighting, materials, textures - by NaN - 07-18-2013, 03:29 PM
RE: VDrift lighting, materials, textures - by NaN - 07-28-2013, 03:29 AM
RE: VDrift lighting, materials, textures - by NaN - 08-04-2013, 11:32 AM
RE: VDrift lighting, materials, textures - by NaN - 09-15-2013, 07:11 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)