feat: add pbr support
This commit is contained in:
@@ -83,6 +83,18 @@ vec3 calculateLight(Light light, vec3 fragPos, vec3 n, vec3 v,
|
||||
return (diffuse + specular) * light.color * light.intensity * attenuation * NoL * occlusion;
|
||||
}
|
||||
|
||||
// Analytic approximation of the split sum environment BRDF (Karis, "Physically Based Shading on Mobile").
|
||||
// Used to light the flat ambient term with the same specular response as the lights.
|
||||
vec3 envBRDFApprox(vec3 f0, float roughness, float NoV)
|
||||
{
|
||||
const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);
|
||||
const vec4 c1 = vec4(1.0, 0.0425, 1.04, -0.04);
|
||||
vec4 r = roughness * c0 + c1;
|
||||
float a004 = min(r.x * r.x, exp2(-9.28 * NoV)) * r.x + r.y;
|
||||
vec2 ab = vec2(-1.04, 1.04) * a004 + r.zw;
|
||||
return f0 * ab.x + ab.y;
|
||||
}
|
||||
|
||||
// blue -> green -> red, used to visualise how many lights a tile has
|
||||
vec3 lightHeatmapColor(uint lightCount)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user