I am working on something that kinda falls into both -
btw - my bloom script is not working in upbge - do you have a upbge compatible bloom that is clampable?
this works in vanilla bge
uniform sampler2D bgl_RenderedTexture;
const float BRIGHT_PASS_THRESHOLD = 0.55;
const float BRIGHT_PASS_OFFSET = 0.01;
#define blurclamp 0.001
#define bias 10.8
#define KERNEL_SIZE 6.0
vec2 texcoord = vec2(gl_TexCoord[0]).st;
vec4 bright(vec2 coo)
{
vec4 color = texture2D(bgl_RenderedTexture, coo);
bool threshMult = 0.0;
if (((color.r > 0.5) || (color.r == 0.0)) &&
((color.g > 0.5) || (color.g == 0.0)) &&
((color.b > 0.5) || (color.b == 0.0)))
{
threshMult = max(max(color.r, color.g), color.b);
}
color = max(color - BRIGHT_PASS_THRESHOLD, 0.0) * threshMult;
return color / (color + BRIGHT_PASS_OFFSET) * 5.0;
}
void main(void)
{
vec2 blur = vec2(clamp( bias, -blurclamp, blurclamp ));
vec4 col = vec4( 0, 0, 0, 0 );
for ( float x = -KERNEL_SIZE + 1.0; x < KERNEL_SIZE; x += 1.0 )
{
for ( float y = -KERNEL_SIZE + 1.0; y < KERNEL_SIZE; y += 1.0 )
{
col += bright( texcoord + vec2( blur.x * x, blur.y * y ) );
}
}
col /= ((KERNEL_SIZE+KERNEL_SIZE)-1.0)*((KERNEL_SIZE+KERNEL_SIZE)-1.0);
gl_FragColor = col + texture2D(bgl_RenderedTexture, texcoord);
}