I was interested if anyone has played around with implmenting HDR in jme, via lwjgl.
I know JOGL now has support for it in their latest release.
this is fakehdr.frag … an implementation of hugo elias's article on exposure.
picked it up from a chinese forum and translated their comments with google:-)
but if you read hugo's article you will understand what it's attempting.
//Hugo points out, exposure is according to enters the lens the light decides.
// exaggerates one image after us, should use the float16 form preserves.
// but if regarding one is not float16 form Rendertarget, we may take
//After periphery color average takes the decision exposure factor,
// below shader code should say is extremely cheats on labor and materials.
//But the effect has a liking for is alright.
uniform sampler2D texture;
//blur, is takes the multi- distant places picture element comes
const float blurfactor = 45.0;//12.5;
//const float expfactor = 0.08;
uniform float expfactor = 0.08;
// one picture element correspondence float size. I use the texture is 1024, own calculates
const float cdelp = 0.0009765625;
// looks the code
const float sharpness = 0.01;
vec4 xposure (vec4 cl, float e)
return (exp (expfactor) - exp (expfactor-e)) * cl;
void main ()
float delp = blurfactor* cdelp;
vec4 texColor = texture2D (texture, vec2 (gl_TexCoord [ 0 ].s, gl_TexCoord [ 0 ].t));
// makes the current position color and periphery blur,
//calculates exposure time and calculates the final color unifies, the weight is different,
// final color is.
vec4 color = texColor*2.0 / 22.0;
color += texture2D (texture, vec2 (gl_TexCoord [ 0 ].s+delp, gl_TexCoord [ 0 ].t+delp)) *5.0 /22.0;
color += texture2D (texture, vec2 (gl_TexCoord [ 0 ].s+delp, gl_TexCoord [ 0 ].t-delp)) *5.0 /22.0;
color += texture2D (texture, vec2 (gl_TexCoord [ 0 ].s-delp, gl_TexCoord [ 0 ].t-delp)) 5.0 /22.0;
color += texture2D (texture, vec2 (gl_TexCoord [ 0 ].s-delp, gl_TexCoord [ 0 ].t+delp)) 5.0 /22.0;
float e = color.r * 0.3 + color.g * 0.59 + color.b * 11;
// figured out exposure
gl_FragColor = xposure (texColorsharpness + color (1-sharpness), e);
Can't seem to figure out how to update the params in realtime.