Skip to content
Snippets Groups Projects
Commit 5b76744d authored by Alexander Gauggel's avatar Alexander Gauggel
Browse files

[#82] Minor shader adjustments

parent 2c2c2184
No related branches found
No related tags found
1 merge request!70Resolve "Voxel cone tracing"
This commit is part of merge request !70. Comments created here will be created in the context of that merge request.
...@@ -40,11 +40,11 @@ vec3 cookTorrance(vec3 f0, float r, vec3 N, vec3 V, vec3 L){ ...@@ -40,11 +40,11 @@ vec3 cookTorrance(vec3 f0, float r, vec3 N, vec3 V, vec3 L){
float NoL = clamp(dot(N, L), 0, 1); float NoL = clamp(dot(N, L), 0, 1);
float NoV = clamp(abs(dot(N, V)), 0, 1); // abs to account for wrong visibility caused by normal mapping float NoV = clamp(abs(dot(N, V)), 0, 1); // abs to account for wrong visibility caused by normal mapping
vec3 F = fresnelSchlick(NoH, f0); vec3 F = fresnelSchlick(NoH, f0);
float D = GGXDistribution(r, NoH); float D = GGXDistribution(r, NoH);
float G = GGXSmithShadowing(r, NoV, NoL); float G = GGXSmithShadowing(r, NoV, NoL);
return (F * D * G) / max(4 * NoV * NoL, 0.000001); return (F * D * G) / max(4 * NoV * NoL, 0.00001);
} }
float roughnessToConeAngleDegree(float r){ float roughnessToConeAngleDegree(float r){
...@@ -75,8 +75,8 @@ void main() { ...@@ -75,8 +75,8 @@ void main() {
vec3 B = cross(N_geo, T) * passTangent.w; vec3 B = cross(N_geo, T) * passTangent.w;
mat3 TBN = mat3(T, B, N_geo); mat3 TBN = mat3(T, B, N_geo);
normalTexel = normalTexel * 2 - 1; normalTexel = normalTexel * 2 - 1;
vec3 N = TBN * normalTexel; vec3 N = normalize(TBN * normalTexel);
vec3 L = lightInfo.L; vec3 L = lightInfo.L;
vec3 V = normalize(cameraPos - passPos); vec3 V = normalize(cameraPos - passPos);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment