X-Git-Url: https://gitweb.ps.run/subsurface_scattering/blobdiff_plain/cedffd5cf24c1a3ed64161475c806c55135406be..c99ecda7bed596922125f6b1ef1ef2ae8f27703e:/shaders/fbo_frag.glsl?ds=sidebyside diff --git a/shaders/fbo_frag.glsl b/shaders/fbo_frag.glsl index 7463fc8..f92483e 100644 --- a/shaders/fbo_frag.glsl +++ b/shaders/fbo_frag.glsl @@ -16,19 +16,18 @@ void main() if (renderState == 0) { FragColor = texture(shadowmapTexture, TexCoords); } - // stencil buffer else if (renderState == 1) { FragColor = texture(irradianceTexture, TexCoords); } else if (renderState == 2) { - FragColor = texture(shadowmapTexture, TexCoords) * texture(irradianceTexture, TexCoords); - } - else if (renderState == 3) { + // sample calculated irradiance + // using Gaussian kernel to approximate light spread vec4 result = vec4(0, 0, 0, 1); for (int i = 0; i < 13; i++) { vec2 sampleCoords = TexCoords + samplePositions[i] * vec2(1.0/screenWidth, 1.0/screenHeight); - vec4 sample = texture(irradianceTexture, sampleCoords) - * texture(shadowmapTexture, sampleCoords); + //vec4 sample = texture(irradianceTexture, sampleCoords) + // * texture(shadowmapTexture, sampleCoords); + vec4 sample = texture(irradianceTexture, sampleCoords); vec4 weight = vec4(sampleWeights[i], 1); result += sample * weight; }