Stopping my skybox from "Blooming out"

Started by
6 comments, last by Koehler 11 years, 5 months ago
I recently made a new skybox which is brighter than my old one. I have encountered a problem where my bloom shader sees my bright skybox and blurs it beyond recognition. I somehow need to keep the effect where the bright sky bleeds onto the edges of the mountains without my sky exploding onto itself. Anyone have any idea how to prevent this?

btw. I'm using OpenGL.
Advertisement
Can you post the pixelshader for your bloom effect? Is there a threshold you can increase for the blooming? It seems like many pixels in your new skybox are brighter (closer to (1,1,1,1) ) and trigger the blooming threshold because of that.
Can you post the pixelshader for your bloom effect? Is there a threshold you can increase for the blooming? It seems like many pixels in your new skybox are brighter (closer to (1,1,1,1) ) and trigger the blooming threshold because of that.[/quote]

Yes it does have a threshold (even controllable from the in game GUI). However changing the threshold would affect everything not just the skybox. Anyway here is my code:


#version 120
uniform sampler2D color_texture;
uniform float level;
varying vec2 vTexCoord;
void main(void)
{
vec4 sample = texture2D(color_texture, vTexCoord);
if((0.2126*sample.r) + (0.7152*sample.g) + (0.0722*sample.b) > level)
{
float brightenRatio = 1.0 / max(max(sample.r, sample.g), sample.b);
sample.r *= brightenRatio;
sample.g *= brightenRatio;
sample.b *= brightenRatio;
}
else
{
sample.r = 0.0;
sample.g = 0.0;
sample.b = 0.0;
}
sample.a = (0.2126*sample.r) + (0.7152*sample.g) + (0.0722*sample.b);
gl_FragColor = sample;
}


I think I have a solution though, I can do a masked blend when I compose the final image and whatever pixels are skybox will not be copied onto the new image.
Well don't use if's, because that method looks shitty. There is hard jump from black to white. This is how you make a soft threshold:

vec3 colorThresholded = max(0.0, color - vec3(threshold)) * (1.0 / threshold);
you may want to go so far as to mask the skybox, you may use one of the channels of your GBuffer, or a stencil buffer, or something to indicate which pixels of the screens should be eligible for bloom.

blooming the sky is an intutive way to make a homogenous look to the effect. but your artists will likely want more control over what the player sees, even in the extremely bright sky.

We haven't added masking yet, but we want to. we want to mask other post effects.
If you mask out the sky when applying the bloom, the environment will no longer blend into the sky, causing an irregularity around edges.
Can't you simply lower the brightness of the sky so it's more adjusted to the rest of the scene before blooming?
As an aside, this is why regular bloom sucks as opposed to true HDRi :(
clb: At the end of 2012, the positions of jupiter, saturn, mercury, and deimos are aligned so as to cause a denormalized flush-to-zero bug when computing earth's gravitational force, slinging it to the sun.
Just set a stencil bit when you draw your skybox, and stencil test for that bit being unset when applying bloom. If you've got the same depth/stencil buffer attached, you'll apply bloom to everything else, while leaving your skybox untouched.

This topic is closed to new replies.

Advertisement