Jump to content

  • Log In with Google      Sign In   
  • Create Account


Stopping my skybox from "Blooming out"


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 ic0de   Members   -  Reputation: 804

Like
0Likes
Like

Posted 16 November 2012 - 04:05 PM

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.

Attached Thumbnails

  • bloomingOut.png

you know you program too much when you start ending sentences with semicolons;


Sponsor:

#2 Steve_Segreto   Crossbones+   -  Reputation: 1475

Like
0Likes
Like

Posted 16 November 2012 - 07:51 PM

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.

#3 ic0de   Members   -  Reputation: 804

Like
0Likes
Like

Posted 16 November 2012 - 10:15 PM

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.


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.

you know you program too much when you start ending sentences with semicolons;


#4 MrOMGWTF   Members   -  Reputation: 433

Like
0Likes
Like

Posted 17 November 2012 - 02:28 AM

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);


#5 bzroom   Members   -  Reputation: 646

Like
0Likes
Like

Posted 17 November 2012 - 04:37 AM

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.

#6 eppo   Crossbones+   -  Reputation: 2312

Like
0Likes
Like

Posted 17 November 2012 - 06:46 AM

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?

#7 InvalidPointer   Members   -  Reputation: 1371

Like
0Likes
Like

Posted 18 November 2012 - 07:42 PM

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.

#8 Koehler   Members   -  Reputation: 228

Like
1Likes
Like

Posted 19 November 2012 - 11:48 AM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS