Author Topic: A new bloom effect  (Read 4760 times)

0 Members and 1 Guest are viewing this topic.

Offline The E

  • He's Ebeneezer Goode
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Coming soon to a MediaVPs release near you, a new, more detailed bloom effect.

A few pics to show it in action:

Reference bloom off:


Bloom level 50:


Level 100:


Level 150:


Level 200:


If you want it yourself, save the following text as blur-f.sdr in mediavps_3612/data/effects.

Code: [Select]
varying float blurSize;

uniform sampler2D tex;

#define BLUR_SIZE_DIV 3

// Gaussian Blur
// 512x512 and smaller textures give best results
// 2 passes required
void main()
{
// Echelon9 - Due to Apple not implementing array constructors in OS X's
// GLSL implementation we need to setup the arrays this way as a workaround
float BlurWeights[6];

BlurWeights[5] = 0.0402;
BlurWeights[4] = 0.0623;
BlurWeights[3] = 0.0877;
BlurWeights[2] = 0.1120;
BlurWeights[1] = 0.1297;
BlurWeights[0] = 0.1362;

vec4 sum = texture2D(tex, gl_TexCoord[0].xy) * BlurWeights[0];

#ifdef PASS_0
for (int i = 1; i < 6; i++) {
sum += texture2D(tex, vec2(clamp(gl_TexCoord[0].x - float(i) * (blurSize/BLUR_SIZE_DIV), 0.0, 1.0), gl_TexCoord[0].y)) * BlurWeights[i];
sum += texture2D(tex, vec2(clamp(gl_TexCoord[0].x + float(i) * (blurSize/BLUR_SIZE_DIV), 0.0, 1.0), gl_TexCoord[0].y)) * BlurWeights[i];
}
#endif

#ifdef PASS_1
for (int i = 1; i < 6; i++) {
sum += texture2D(tex, vec2(gl_TexCoord[0].x, clamp(gl_TexCoord[0].y - float(i) * (blurSize/2), 0.0, 1.0))) * BlurWeights[i];
sum += texture2D(tex, vec2(gl_TexCoord[0].x, clamp(gl_TexCoord[0].y + float(i) * (blurSize/2), 0.0, 1.0))) * BlurWeights[i];
}
#endif

gl_FragColor = sum;
}


This needs to be saved as post-v.sdr:

Code: [Select]
varying float blurSize;
uniform float bsize;

void main()
{
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_Position = gl_Vertex;

gl_FrontColor = gl_Color;
gl_FrontSecondaryColor = vec4(0.0, 0.0, 0.0, 1.0);

blurSize = 1.0 / bsize;

 // Check necessary for ATI specific behavior
 #ifdef __GLSL_CG_DATA_TYPES
gl_ClipVertex = (gl_ModelViewMatrix * gl_Vertex);
 #endif
}
« Last Edit: July 01, 2011, 07:33:42 am by The E »
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline Commander Zane

  • 212
  • Spoot Knight of Anvils
This looks awesome, though I fear it'll look bad on my system at certain angles when / if the bloom is rendered as vertical lines.

 

Offline The E

  • He's Ebeneezer Goode
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Shaders and pictures have been updated. Force refresh if you can't see them
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline Kolgena

  • 211
Looks really good. Much better than the old effect, IMO, if only because the vertical striping artifacts are gone now. That, and much less over saturation than before, as far as I can tell.

 

Offline MetalDestroyer

  • Starwars reborn!
  • 210
Is there a way to increase lighting generated from the glowmaps ?
I don't really like bloom effect in most time since it increase all lighting sources.

I tried to change the value of the flag spec_point  but, I don't notice any radical change.

 

Offline Rodo

  • Custom tittle
  • 212
  • stargazer
    • Steam
amazing, will test it with FSport in a couple of days then :D
el hombre vicio...

 

Offline Thaeris

  • Can take his lumps
  • 211
  • Away in Limbo
E, is there any particular difference in this new feature and the FAXX feature you highlighted a few days ago? I do see FAXX in the screenshots as well...
"trolls are clearly social rejects and therefore should be isolated from society, or perhaps impaled."

-Nuke



"Look on the bright side, how many release dates have been given for Doomsday, and it still isn't out yet.

It's the Duke Nukem Forever of prophecies..."


"Jesus saves.

Everyone else takes normal damage.
"

-Flipside

"pirating software is a lesser evil than stealing but its still evil. but since i pride myself for being evil, almost anything is fair game."


"i never understood why women get the creeps so ****ing easily. i mean most serial killers act perfectly normal, until they kill you."


-Nuke

 

Offline MetalDestroyer

  • Starwars reborn!
  • 210
E, is there any particular difference in this new feature and the FAXX feature you highlighted a few days ago? I do see FAXX in the screenshots as well...

FXAA is a rendering method for anti-aliasing when you have post processing render.

 

Offline Commander Zane

  • 212
  • Spoot Knight of Anvils
Ohmygod the bloom effect isn't ugly on my screen anymore.
Outstanding work!
:jaw:

 

Offline The E

  • He's Ebeneezer Goode
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
E, is there any particular difference in this new feature and the FAXX feature you highlighted a few days ago? I do see FAXX in the screenshots as well...

They're very diferent. FXAA is an antialiasing filter that you can use if hardware antialiasing doesn't work with postprocessing for you. This is a new bloom shader, one that makes the bloom effect less susceptible to the "banding" effect it exhibited previously.

Is there a way to increase lighting generated from the glowmaps ?
I don't really like bloom effect in most time since it increase all lighting sources.

I tried to change the value of the flag spec_point  but, I don't notice any radical change.

No, the bloom effect cannot differentiate between lighting generated by reflections and lighting generated by glowmaps.
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline Sushi

  • Art Critic
  • 211
Will this go into the built-in shaders?

Any reason for it not to?

 

Offline The E

  • He's Ebeneezer Goode
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Yes, it will. No reason for it not to.
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline Snail

  • SC 5
  • 214
  • Posts: ☂
Does this work with those ATI cards?

 

Offline The E

  • He's Ebeneezer Goode
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Yes. Or No. Depends on what you mean by those.
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline Commander Zane

  • 212
  • Spoot Knight of Anvils
All of them. :P

11.4 with 5870 works for me without quarrel as far as I know.