Adding bloom?
by Tyler Slabinski · in Technical Issues · 07/20/2008 (2:44 pm) · 12 replies
I have been doing some research on different graphic types, and I was wondering how I can add a small bit of bloom into my game, just to give it a more realistic look.
If you don't know what bloom is, it is a lighting effect that makes games look realistic, such as Legend of Zelda: Twilight Princess (twilight realm), Need for Speed: Most Wanted, Elder Scrolls: Oblivion, and the new game coming out: Legend of Spyro: Dawn of the Dragon.
Here is a movie that shows bloom effect:
Here, the movie is on the right of the screen.
If you don't know what bloom is, it is a lighting effect that makes games look realistic, such as Legend of Zelda: Twilight Princess (twilight realm), Need for Speed: Most Wanted, Elder Scrolls: Oblivion, and the new game coming out: Legend of Spyro: Dawn of the Dragon.
Here is a movie that shows bloom effect:
Here, the movie is on the right of the screen.
About the author
Working on prototype.
#2
07/20/2008 (2:56 pm)
I can't, TGEA is only directX, and Macs only use OpenGL...
#3
@Tyler: Look for the Modernization Kit, it was originally written for macs, and it uses OpenGL, so it should work for you.
07/20/2008 (3:36 pm)
@Raimonds: That's not entirely correct. The Torque Modernization Kit adds bloom effects (along with many other things) to missions.@Tyler: Look for the Modernization Kit, it was originally written for macs, and it uses OpenGL, so it should work for you.
#4
There are different ways of getting bloom to work. One implementation of mine is here
The elf-like character actually has, apart from sticky textures, a render-pipeline that uses a spherical harmonics based lighting shader, with a fullscreen post-process bloom effect.
07/20/2008 (8:03 pm)
Well, I've been working on a new post-processing framework for TGE. I had started out with my own shader implementation until I came across the MK. Unfortunately, some parts of the MK need major refactoring IMO. There are different ways of getting bloom to work. One implementation of mine is here
The elf-like character actually has, apart from sticky textures, a render-pipeline that uses a spherical harmonics based lighting shader, with a fullscreen post-process bloom effect.
#5
Just look at the beauty Todd Pickens made out with that kit
07/21/2008 (5:34 am)
Awesome! Never seen MK around, thanks for that info, Nathan!Just look at the beauty Todd Pickens made out with that kit
#7
@ Raimonds & Tyler: Your welcome, just make sure you post some of your eye-candy!
07/21/2008 (10:28 am)
@Koushik: Yeah, I don't think that it's been updated (Excepting your DTSBump resource) for over a year. It's still good, but it could use some updates.@ Raimonds & Tyler: Your welcome, just make sure you post some of your eye-candy!
#8
I will post on the official MK thread.
07/21/2008 (10:35 am)
I am having a hard time getting MK to work, there is this 1 error when I compile it...I will post on the official MK thread.
#9
Now for the 'eye-candy' you wanted:
Shiny and more realistic water:

Slight bloom effect:
07/21/2008 (4:19 pm)
Ok, I got MK to work!Now for the 'eye-candy' you wanted:
Shiny and more realistic water:

Slight bloom effect:
#10
Yeah, I spoke to Alex Scarborough, the guy who released it. I guess I might be taking it on board and adding some of my own changes to it. Like I mentioned, I've got some post-processing effects going, a few multi-pass shaders, reflections, fresnel refractions and stuff like that. You really want to see those... ;)
07/21/2008 (7:44 pm)
@nathan:Yeah, I spoke to Alex Scarborough, the guy who released it. I guess I might be taking it on board and adding some of my own changes to it. Like I mentioned, I've got some post-processing effects going, a few multi-pass shaders, reflections, fresnel refractions and stuff like that. You really want to see those... ;)
#11
I at least know about the water.
07/21/2008 (8:20 pm)
I need to find out how to add bloom with this, I don't really understand it...I at least know about the water.
#12
It would need two render passes. The first pass, you render everything as usual, to a texture. (I used an FBO because I wanted multiple targets for another test. For bloom-only, it might be overkill though.)
Bind the bloom shader (which I will describe in a bit) and pass the render texture as a 2D sampler. Once that is done, use it to render a full-screen quad. Thats it.
Well, as for the actual bloom shader itself. Here's how mine works:
1) Sample the texture (rendered texture bound) with the usual interpolated texture co-ordinates in the fragment shader.
2) Now run a loop to sample surrounding pixels randomly, within a certain radius/range. This range will determine the degree of blurriness, so to speak. I used hard-coded values, but you might want to use an std::rand() function and pass the variables as a uniform array. Store all the sampled values in an array for simplicity.
3) Now, add the samples over the actual sampled value in step 1, and average it over the number of samples used. In the screens I had posted earlier, I used 12 samples. You might want to use fewer if it runs real slow.
4) Once you get the average, raise the RGB components of the averaged value by a bloom strength value. This kinda determines the strength of the bloom. Hard to explain the effect, you might want to tweak it to suit your scene and see what it looks like. Again, this could also be uniform variable.
5) Now, the final value, is = (the original value sampled in (1) + (averaged value * a multiplier value to enhance the bloom)).
The multiplier value is used like a bias to prevent the colors from saturating - another variable to play around with.
Thats how I did it in those screenies.
07/21/2008 (8:52 pm)
Here's what I did for my blur. Its not based much on the MK, the GLSL shader manager is incomplete in many parts, so I had to use a separate hack.It would need two render passes. The first pass, you render everything as usual, to a texture. (I used an FBO because I wanted multiple targets for another test. For bloom-only, it might be overkill though.)
Bind the bloom shader (which I will describe in a bit) and pass the render texture as a 2D sampler. Once that is done, use it to render a full-screen quad. Thats it.
Well, as for the actual bloom shader itself. Here's how mine works:
1) Sample the texture (rendered texture bound) with the usual interpolated texture co-ordinates in the fragment shader.
2) Now run a loop to sample surrounding pixels randomly, within a certain radius/range. This range will determine the degree of blurriness, so to speak. I used hard-coded values, but you might want to use an std::rand() function and pass the variables as a uniform array. Store all the sampled values in an array for simplicity.
3) Now, add the samples over the actual sampled value in step 1, and average it over the number of samples used. In the screens I had posted earlier, I used 12 samples. You might want to use fewer if it runs real slow.
4) Once you get the average, raise the RGB components of the averaged value by a bloom strength value. This kinda determines the strength of the bloom. Hard to explain the effect, you might want to tweak it to suit your scene and see what it looks like. Again, this could also be uniform variable.
5) Now, the final value, is = (the original value sampled in (1) + (averaged value * a multiplier value to enhance the bloom)).
The multiplier value is used like a bias to prevent the colors from saturating - another variable to play around with.
Thats how I did it in those screenies.
Torque Owner Raimonds Zigurs
I am not sure if u can fake it in TGE 1.5.x by somehow changing render source code, but otherwise its impossible.
Tyler,, download TGEA demo and play around with it for a while, it provides nice bloom effects within a mission editor ;-)
Best of Luck,
-Ray