mirror of
https://github.com/lubosz/overte.git
synced 2025-04-19 07:37:54 +02:00
Post tuesday review, clean up
This commit is contained in:
parent
d128af48db
commit
7f5e22d0eb
2 changed files with 24 additions and 30 deletions
|
@ -132,31 +132,22 @@ vec3 evalAmbientSphereGlobalColorScattering(mat4 invViewMat, float shadowAttenua
|
|||
|
||||
vec3 fragLightDir = -normalize(getLightDirection(light));
|
||||
|
||||
vec3 bentNormalHigh = normalize((blurredCurvature.xyz - 0.5f) * 2.0f);
|
||||
vec3 bentNormalLow = normalize((diffusedCurvature.xyz - 0.5f) * 2.0f);
|
||||
vec3 midNormal = normalize((blurredCurvature.xyz - 0.5f) * 2.0f);
|
||||
vec3 lowNormal = normalize((diffusedCurvature.xyz - 0.5f) * 2.0f);
|
||||
float curvature = unpackCurvature(diffusedCurvature.w);
|
||||
|
||||
if (showDiffusedNormal()) {
|
||||
return diffusedCurvature.xyz;
|
||||
return bentNormalLow * 0.5 + vec3(0.5);
|
||||
return lowNormal * 0.5 + vec3(0.5);
|
||||
}
|
||||
if (showCurvature()) {
|
||||
float curvatureSigned = unpackCurvatureSigned(diffusedCurvature.w);
|
||||
return (curvatureSigned > 0 ? vec3(curvatureSigned, 0.0, 0.0) : vec3(0.0, 0.0, -curvatureSigned));
|
||||
}
|
||||
vec3 rS = bentNormalHigh;
|
||||
|
||||
vec3 bendFactorSpectrum = getBendFactor();
|
||||
// vec3 rN = normalize(mix(normal, bentNormalLow, bendFactorSpectrum.x));
|
||||
vec3 rN = normalize(mix(bentNormalHigh, bentNormalLow, bendFactorSpectrum.x));
|
||||
vec3 gN = normalize(mix(bentNormalHigh, bentNormalLow, bendFactorSpectrum.y));
|
||||
vec3 bN = normalize(mix(bentNormalHigh, bentNormalLow, bendFactorSpectrum.z));
|
||||
vec3 bentNdotL = evalScatteringBentNdotL(fragNormal, midNormal, lowNormal, fragLightDir);
|
||||
|
||||
vec3 NdotLSpectrum = vec3(dot(rN, fragLightDir), dot(gN, fragLightDir), dot(bN, fragLightDir));
|
||||
|
||||
//return 0.5 * (NdotLSpectrum + vec3(1.0));
|
||||
// --> Look up the pre-integrated curvature-dependent BDRF textures
|
||||
vec3 brdf = fetchBRDFSpectrum(NdotLSpectrum, curvature);
|
||||
vec3 brdf = fetchBRDFSpectrum(bentNdotL, curvature);
|
||||
|
||||
// The position of the pixel fragment in Eye space then in world space
|
||||
|
||||
|
@ -267,31 +258,22 @@ vec3 evalSkyboxGlobalColorScattering(mat4 invViewMat, float shadowAttenuation, f
|
|||
|
||||
vec3 fragLightDir = -normalize(getLightDirection(light));
|
||||
|
||||
vec3 bentNormalHigh = normalize( (blurredCurvature.xyz - 0.5f) * 2.0f );
|
||||
vec3 bentNormalLow = normalize( (diffusedCurvature.xyz - 0.5f) * 2.0f );
|
||||
vec3 midNormal = normalize((blurredCurvature.xyz - 0.5f) * 2.0f);
|
||||
vec3 lowNormal = normalize((diffusedCurvature.xyz - 0.5f) * 2.0f);
|
||||
float curvature = unpackCurvature(diffusedCurvature.w);
|
||||
|
||||
if (showDiffusedNormal()) {
|
||||
return diffusedCurvature.xyz;
|
||||
return bentNormalLow * 0.5 + vec3(0.5);
|
||||
return lowNormal * 0.5 + vec3(0.5);
|
||||
}
|
||||
if (showCurvature()) {
|
||||
float curvatureSigned = unpackCurvatureSigned(diffusedCurvature.w);
|
||||
return (curvatureSigned > 0 ? vec3(curvatureSigned, 0.0, 0.0) : vec3(0.0, 0.0, -curvatureSigned));
|
||||
}
|
||||
vec3 rS = bentNormalHigh;
|
||||
|
||||
vec3 bendFactorSpectrum = getBendFactor();
|
||||
// vec3 rN = normalize(mix(normal, bentNormalLow, bendFactorSpectrum.x));
|
||||
vec3 rN = normalize(mix(bentNormalHigh, bentNormalLow, bendFactorSpectrum.x));
|
||||
vec3 gN = normalize(mix(bentNormalHigh, bentNormalLow, bendFactorSpectrum.y));
|
||||
vec3 bN = normalize(mix(bentNormalHigh, bentNormalLow, bendFactorSpectrum.z));
|
||||
|
||||
vec3 NdotLSpectrum = vec3(dot(rN, fragLightDir), dot(gN, fragLightDir), dot(bN, fragLightDir));
|
||||
|
||||
//return 0.5 * (NdotLSpectrum + vec3(1.0));
|
||||
// --> Look up the pre-integrated curvature-dependent BDRF textures
|
||||
vec3 brdf = fetchBRDFSpectrum(NdotLSpectrum, curvature);
|
||||
vec3 bentNdotL = evalScatteringBentNdotL(fragNormal, midNormal, lowNormal, fragLightDir);
|
||||
|
||||
vec3 brdf = fetchBRDFSpectrum(bentNdotL, curvature);
|
||||
|
||||
// The position of the pixel fragment in Eye space then in world space
|
||||
|
||||
|
@ -332,7 +314,7 @@ vec3 evalSkyboxGlobalColorScattering(mat4 invViewMat, float shadowAttenuation, f
|
|||
//vec3 debugNdotL = 0.5 * (NdotLSpectrum + vec3(1.0));
|
||||
//return vec3(debugNdotL.z, curvature, 0.0 );
|
||||
|
||||
return vec3(color);
|
||||
return vec3(color);
|
||||
}
|
||||
<@endfunc@>
|
||||
|
||||
|
|
|
@ -150,6 +150,18 @@ float unpackCurvature(float packedCurvature) {
|
|||
return abs(packedCurvature * 2 - 1) * parameters.curvatureInfo.y + parameters.curvatureInfo.x;
|
||||
}
|
||||
|
||||
vec3 evalScatteringBentNdotL(vec3 normal, vec3 midNormal, vec3 lowNormal, vec3 lightDir) {
|
||||
vec3 bendFactorSpectrum = getBendFactor();
|
||||
// vec3 rN = normalize(mix(normal, lowNormal, bendFactorSpectrum.x));
|
||||
vec3 rN = normalize(mix(midNormal, lowNormal, bendFactorSpectrum.x));
|
||||
vec3 gN = normalize(mix(midNormal, lowNormal, bendFactorSpectrum.y));
|
||||
vec3 bN = normalize(mix(midNormal, lowNormal, bendFactorSpectrum.z));
|
||||
|
||||
vec3 NdotLSpectrum = vec3(dot(rN, lightDir), dot(gN, lightDir), dot(bN, lightDir));
|
||||
|
||||
return NdotLSpectrum;
|
||||
}
|
||||
|
||||
|
||||
|
||||
<@endfunc@>
|
||||
|
|
Loading…
Reference in a new issue