Author Topic: Bloom Shader  (Read 9558 times)

0 Members and 2 Guests are viewing this topic.

Offline blackhole

  • Still not over the rainbow
  • 29
  • Destiny can suck it
    • Black Sphere Studios
While messing around with motion blur, I stumbled on a technique for a realtime bloom shader. This shader takes a single texture as input, nothing else - this texture should be the entire rendered scene, minus the GUI (standard post processing procedure, make sure the texture does not wrap its UV coordinates). The shader has 4 passes, 2 parameters (fblur/fextend) and was written in HLSL, but since its purely picture modification should be easy to port to GLSL.

Because this shader only needs a single frame of information, I was able to insert screenshots and process them to give an accurate depiction of what they would look like in-game. This bloom technique was invented on my own and built without the use of tutorials; however, its entirely possibly that something similar has been done elsewhere. You will notice that the shader does not bloom excessively - only something that is really bright is bloomed, everything else is left alone. The following screenshots were taken with an fblur value of 3.0, and an fextend value of 0.007.


Original pic (Massive explosion situation):


Bloom applied:



Original pic (Subspace warpin situation):


Bloom applied:



Original pic (Dark situation):


Bloom applied:



Original pic (Beam and engine glow situation):


Bloom applied:


Now, please, get postprocessing working before VasudanAdmiral's head explodes! Once you get postprocessing implemented I'll convert the whole thing to GLSL and let you guys screw with it however you want.

EDIT: I added two more parameters - bloom subtraction and final subtraction. Bloom subtraction lets you adjust the power of the bloom, and final subtraction is for general lightness correction. These parameters are set to 0 for the purpose of the above screenshots.
« Last Edit: January 07, 2008, 06:28:55 pm by blackhole »

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Does bloom take care of the problem when a large capship is hit by missiles, and the billboarded texture intersects with the hull? (So you see the explosion plane get cut off as it goes 'inside' the hull)
-C

 

Offline blackhole

  • Still not over the rainbow
  • 29
  • Destiny can suck it
    • Black Sphere Studios
It would probably help to hide the problem, send me a screenie so we can find out :P

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
It would probably help to hide the problem, send me a screenie so we can find out :P

Note the missile impacts on the right side of the screen:

[attachment deleted by ninja]
-C

 

Offline blackhole

  • Still not over the rainbow
  • 29
  • Destiny can suck it
    • Black Sphere Studios
If you want it to be more then 2% accurate, could you upload a PNG or otherwise lossless screenshot? Bloom really doesn't like artifacts.

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Apparently the 216 KB PNG fills the upload folder :p

The source is the BtRL video, so I can't get a lossless version of the same screenshot. It's not a big deal anyway, I'm just curious.
-C

 

Offline blackhole

  • Still not over the rainbow
  • 29
  • Destiny can suck it
    • Black Sphere Studios
All it seems to do, at least with that pic, is make the ship look kickass :P


 

Offline BlackDove

  • Star Killer
  • 211
  • Section 3 of the GTVI
    • http://www.shatteredstar.org
This could be really cool.

In moderate amounts.

A bit less than the screenshots.

Like, a lot less.

Still, great job. I'd like to be able to use it (whenever possible).

 

Offline DaBrain

  • Screensniper
  • 212
    • Shadows of Lylat board
I'd make both values adjustable in the launcher via commandline.

Yes, postprocessing will improve the graphics even more.
I like that it doesn't simply bloom everything.

Blooming would slightly help a bit with our praticle->hull->intersection problem. At least bright particles would cover the ugly seam a little bit.
--------------------------------------------------
SoL is looking for a sound effect artist
Please PM me in case you want to apply
---------------------------------
Shadows of Lylat - A Freespace 2 total conversion
(hosted by Game-Warden)
----------------------------------

 

Offline CP5670

  • Dr. Evil
  • Global Moderator
  • 212
Yes, this could greatly improve the look of the game if used correctly. It's good to see that it does not affect the backgrounds, unlike that old ATI bloom shader (this is why I never use it much even though my card supports it).

 

Offline Turambar

  • Determined to inflict his entire social circle on us
  • 210
  • You can't spell Manslaughter without laughter
i'd prefer to hold out on simple bloom until we get full on HDR-controlled bloom.  i've always found it to look much cleaner.

unless of course that's what this is...
10:55:48   TurambarBlade: i've been selecting my generals based on how much i like their hats
10:55:55   HerraTohtori: me too!
10:56:01   HerraTohtori: :D

 
 :eek2:  holly... 
First normal mapping and now blooming?  How do you all think up the code for all this? There is no way you just wake up one morning and suddenly say,  "I think I'll just add bloom effects to FSO"  Do you all work for game companies and thus know all the latest secrets?  I mean, really, this is all just amazing.

That battlestar was impressive to begin with.  Now it would rival any official game that would ever come out.  You guys should be more careful.  Heck, your rivaling the CG in the miniseries/tv-show.
« Last Edit: January 07, 2008, 02:02:01 pm by Darklord42 »

 

Offline n0s

  • 24
  • happy to have FS2O
thats just stunning great lookin!!

like darklord said... you are heros, doing this in your spare-time :D

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
First normal mapping and now blooming?  How do you all think up the code for all this?

Not having shaders was a big barrier to what we could do graphics wise. From the sound of it the materials system is the other big barrier.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline blackhole

  • Still not over the rainbow
  • 29
  • Destiny can suck it
    • Black Sphere Studios
Quote
i'd prefer to hold out on simple bloom until we get full on HDR-controlled bloom.  i've always found it to look much cleaner.
HDR controlled bloom is always better, but that involves implementing an HDR pipeline, which is not easy. My bloom is using what I call fake HDR, which is when I basically take the scene and screenblend the whole thing on to itself to create the HDR. The actual bloom shader uses traditional HDR techniques (only blooming values above 1.0f). When I implement this shader into my 2D graphics engine I'll be using an HDR buffer to control it, sending it an HDR texture, and simply removing my fake HDR. The same could apply for FSO.

Quote
I'd make both values adjustable in the launcher via commandline.
Now there's four, and possibly more values, to adjust the intensity, falloff and any other variables I can throw in without going over the 64 instructions limit :P

Quote
A bit less than the screenshots.
The shader is fully customizable so that the bloom amounts can be adjusted to just the right amount. That, however, is up to you guys :D

Quote
There is no way you just wake up one morning and suddenly say,  "I think I'll just add bloom effects to FSO"
Actually it was 2:25 PM in the afternoon, and I said "I think I'll code a bloom shader."  :p Its really not that hard, you just need to have the proper technique 'n all.
« Last Edit: January 07, 2008, 06:43:47 pm by blackhole »

 

Offline DaBrain

  • Screensniper
  • 212
    • Shadows of Lylat board
falloff and any other variables I can throw in without going over the 64 instructions limit :P

Oh, instruction limit? Where does that come from?
--------------------------------------------------
SoL is looking for a sound effect artist
Please PM me in case you want to apply
---------------------------------
Shadows of Lylat - A Freespace 2 total conversion
(hosted by Game-Warden)
----------------------------------

 

Offline blackhole

  • Still not over the rainbow
  • 29
  • Destiny can suck it
    • Black Sphere Studios
All shaders of pixel shader 2.0 have an instruction limit of 72 and an arithmatic operator limit of 64 (or something like that) per pass. Pixel shader 3.0 raises this limit, but its still there. I usually prefer to write shaders in pixel shader 2.0 for compatability reasons. Besides, if you've got more then 64 operators, thats a seriously GPU heavy shader.

 

Offline Turambar

  • Determined to inflict his entire social circle on us
  • 210
  • You can't spell Manslaughter without laughter
well apparently the shaders only work on SM3.0 cards and up, so if it's heavy, the cards that would be running it could probably handle it.

Real HDR is something i'd really like to see
10:55:48   TurambarBlade: i've been selecting my generals based on how much i like their hats
10:55:55   HerraTohtori: me too!
10:56:01   HerraTohtori: :D

 
Very nice, but a little over-done in the screenies. HDR is nice, but like gaming, too much is a bad thing (unless it's FSO :nod:)

    |[===---(-         
    ||
 =(||==)_
    ||_____|
 =(||==)
    ||                   
    |[===---(-                             

"Take my love. Take my land. Take me where I cannot stand. I don't care, I'm still free. You can't take the sky from me. Take me out to the black, tell them I ain't comin' back. Burn the land boil the sea, you can't take the sky from me. There's no place I can be since I've found Serenity. But you can't take the sky from me." - Ballad of Serenity

  

Offline blackhole

  • Still not over the rainbow
  • 29
  • Destiny can suck it
    • Black Sphere Studios
I'd like to see some HDR myself, but that would involve recoding the entire rendering pipeline to handle HDR. Not fun.

And its not HDR, its BLOOM. Yes, too much bloom is a bad thing, which is why my bloom shader doesn't bloom everything. :P