diff options
author | Dave Parks <davep@lindenlab.com> | 2022-06-22 19:56:26 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2022-06-22 19:56:26 -0500 |
commit | 6540b4c480d1d4b4c8342a0d093d09f525485659 (patch) | |
tree | 530a9099da2fe2e730690c30be8b36122524394a /indra/newview/app_settings/shaders | |
parent | d0d1b832d4983f35ab29947eb6fda54a8aa48f8a (diff) |
SL-17600 Cubemap filter tuning.
Diffstat (limited to 'indra/newview/app_settings/shaders')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/interface/irradianceGenF.glsl | 9 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl | 6 |
2 files changed, 9 insertions, 6 deletions
diff --git a/indra/newview/app_settings/shaders/class1/interface/irradianceGenF.glsl b/indra/newview/app_settings/shaders/class1/interface/irradianceGenF.glsl index 2028509775..4d91395a1b 100644 --- a/indra/newview/app_settings/shaders/class1/interface/irradianceGenF.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/irradianceGenF.glsl @@ -70,11 +70,12 @@ SOFTWARE. #define PI 3.1415926535897932384626433832795 -float deltaPhi = PI/16.0; -float deltaTheta = deltaPhi*0.25; - void main() { + float deltaPhi = (2.0 * PI) / 11.25; + float deltaTheta = (0.5 * PI) / 4.0; + float mipLevel = 2; + vec3 N = normalize(vary_dir); vec3 up = vec3(0.0, 1.0, 0.0); vec3 right = normalize(cross(up, N)); @@ -89,7 +90,7 @@ void main() for (float theta = 0.0; theta < HALF_PI; theta += deltaTheta) { vec3 tempVec = cos(phi) * right + sin(phi) * up; vec3 sampleVector = cos(theta) * N + sin(theta) * tempVec; - color += textureLod(reflectionProbes, vec4(sampleVector, sourceIdx), 3).rgb * cos(theta) * sin(theta); + color += textureLod(reflectionProbes, vec4(sampleVector, sourceIdx), mipLevel).rgb * cos(theta) * sin(theta); sampleCount++; } } diff --git a/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl b/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl index 3fc227eae7..94fedce243 100644 --- a/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl @@ -68,7 +68,7 @@ SOFTWARE. uniform float roughness; -uniform int numSamples; +uniform float mipLevel; const float PI = 3.1415926536; @@ -130,6 +130,8 @@ vec3 prefilterEnvMap(vec3 R, float roughness) vec3 color = vec3(0.0); float totalWeight = 0.0; float envMapDim = 256.0; + int numSamples = 32/max(int(mipLevel), 1); + for(uint i = 0u; i < numSamples; i++) { vec2 Xi = hammersley2d(i, numSamples); vec3 H = importanceSample_GGX(Xi, roughness, N); @@ -148,7 +150,7 @@ vec3 prefilterEnvMap(vec3 R, float roughness) // Solid angle of 1 pixel across all cube faces float omegaP = 4.0 * PI / (6.0 * envMapDim * envMapDim); // Biased (+1.0) mip level for better result - float mipLevel = roughness == 0.0 ? 0.0 : max(0.5 * log2(omegaS / omegaP) + 1.0, 0.0f); + //float mipLevel = roughness == 0.0 ? 0.0 : max(0.5 * log2(omegaS / omegaP) + 1.0, 0.0f); color += textureLod(reflectionProbes, vec4(L,sourceIdx), mipLevel).rgb * dotNL; totalWeight += dotNL; |