diff options
author | Dave Parks <davep@lindenlab.com> | 2023-02-17 14:55:06 -0600 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2023-02-17 14:55:06 -0600 |
commit | cd0944caa692e6440f85d21fa706636fc5e46e27 (patch) | |
tree | 7fa866ce998e4631db92a827c9bd67668b3309fe /indra/newview | |
parent | a91c970e3e74c911250fcc474577b414a7035f04 (diff) |
SL-19239 Redo integration of Sascha's radiance map filter.
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl | 17 | ||||
-rw-r--r-- | indra/newview/llreflectionmapmanager.cpp | 4 |
2 files changed, 8 insertions, 13 deletions
diff --git a/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl b/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl index e60ddcd569..b6f080739e 100644 --- a/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl @@ -127,14 +127,11 @@ vec4 prefilterEnvMap(vec3 R) vec3 V = R; vec4 color = vec4(0.0); float totalWeight = 0.0; - float envMapDim = u_width; - int numSamples = 4; - - float numMips = max_probe_lod; + float envMapDim = float(textureSize(reflectionProbes, 0).s); + float roughness = mipLevel/max_probe_lod; + int numSamples = max(int(32*roughness), 1); - float roughness = mipLevel/numMips; - - numSamples = max(int(numSamples*roughness), 1); + float numMips = max_probe_lod+1; for(uint i = 0u; i < numSamples; i++) { vec2 Xi = hammersley2d(i, numSamples); @@ -154,11 +151,9 @@ vec4 prefilterEnvMap(vec3 R) // 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 mip = roughness == 0.0 ? 0.0 : clamp(0.5 * log2(omegaS / omegaP) + 1.0, 0.0f, numMips); - //float mip = clamp(0.5 * log2(omegaS / omegaP) + 1.0, 0.0f, 7.f); - color += textureLod(reflectionProbes, vec4(L,sourceIdx), mip) * dotNL; + float mipLevel = roughness == 0.0 ? 0.0 : max(0.5 * log2(omegaS / omegaP) + 1.0, 0.0f); + color += textureLod(reflectionProbes, vec4(L, sourceIdx), mipLevel) * dotNL; totalWeight += dotNL; - } } return (color / totalWeight); diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp index 4377f26633..e760bc794c 100644 --- a/indra/newview/llreflectionmapmanager.cpp +++ b/indra/newview/llreflectionmapmanager.cpp @@ -94,7 +94,7 @@ void LLReflectionMapManager::update() if (!mRenderTarget.isComplete()) { - U32 color_fmt = GL_RGB16F; + U32 color_fmt = GL_RGB16; U32 targetRes = mProbeResolution * 2; // super sample mRenderTarget.allocate(targetRes, targetRes, color_fmt, true); } @@ -107,7 +107,7 @@ void LLReflectionMapManager::update() mMipChain.resize(count); for (int i = 0; i < count; ++i) { - mMipChain[i].allocate(res, res, GL_RGBA16F); + mMipChain[i].allocate(res, res, GL_RGBA16); res /= 2; } } |