Fix for issue 179: HDR + shadow does not work (jme3)

Hi! This is my first time contributing to any open-source project, so forgive me if I screw up the procedure :frowning: .



The shadow-mapping function in engine/build/classes/Common/ShaderLib/Shadow.glsllib assumes that any value over 1.0 it returns will be automatically clamped by GLSL. This doesn’t happen when HDR is turned on, so as a result any area that the shadowmap camera doesn’t see ends up being brighter than it should be.



Here’s a fix:



[patch]@@ -99,6 +99,7 @@



float Shadow_GetShadow(in SHADOWMAP tex, in vec4 projCoord){

  • return Shadow_DoDither_2x2(tex, projCoord) + Shadow_BorderCheck(projCoord.xy);
  • return clamp(Shadow_DoDither_2x2(tex, projCoord) + Shadow_BorderCheck(projCoord.xy), 0.0, 1.0);

    }

    [/patch]
2 Likes

Thanks! fixed