Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
VDrift lighting, materials, textures
07-18-2013, 02:11 PM, (This post was last modified: 07-18-2013, 03:19 PM by NaN.)
#10
RE: VDrift lighting, materials, textures
I've got the disney(GGX) brdf running with current vdrift material system, just to see the differences... roughness value 1.0 (smooth) and specular reflectance 0.5

Current brdf without clearcoat (gl2 renderer)
[Image: W8VSTx1.jpg]

Update: Disney brdf (GGX) without clearcoat (gl2 renderer)
[Image: m5maNdb.jpg]

Disney brdf (GGX) without clearcoat max roughness (gl2 renderer)
[Image: IhtbWvt.jpg]

I am plugging roughness here directly into the brdf, which is not exactly correct, need to use some mapping like disney guys maybe.

Math:
Code:
// Fresnel term F [f0, 1]
// Schlick: F(f0, hv) = f0 + (1 - f0) * (1 - hv)^5
vec3 F(const vec3 f0, const float hv)
{
    return f0 + (vec3(1) - f0) * pow(1 - hv, 5);
}

// Microfacet normal distribution D [0, 1]
// Statistical distribution of surface normals
// ag (width) determines shape, ag -> 0 dirac delta
// GGX: D(nh, ag) = ag^2 / (pi * (nh^2 * (ag^2 - 1) + 1)^2)
float D(const float nh, const float ag)
{
    float ag2 = ag * ag;
    float nh2 = nh * nh;
    float s = (nh2 * (ag2 - 1) + 1);
    float s2 = s * s;
    return ag2 / (PI * s2);
}

// Shadow masking function G [0, 1]
// Needed to maintain energy conservation of D
// ag (width) determines shape, ag -> 0 box function
// GGX: G = G1(nv, ag) * G1(nl, ag) with G1(x, ag) = 2 / (1 + sqrt(ag^2 / x^2 - ag^2 + 1))
float G(const float nv, const float nl, const float ag)
{
    float ag2 = ag * ag;
    float nl2 = nl * nl;
    float nv2 = nv * nv;
    return 2 / ((1 + sqrt(ag2 / nl2 - ag2 + 1)) * 2 / (1 + sqrt(ag2 / nv2 - ag2 + 1)));
}

vec3 BRDF(const vec3 fd, const vec3 f0, const float hv, const float nv, const float nl, const float nh, const float roughness)
{
    return fd / PI + D(nh, roughness) * F(f0, hv) * G(nv, nl, roughness) / (4 * nl * nv)
}
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)