SantaClaws@Posted: Mon Apr 04, 2005 12:58 am :
So, I've been trying to do a bloom in Doom 3 that works without HDR but gives a similar effect, and doesn't soften the entire scene... just the bright stuffs. I've gotten something I'm moderately satisfied with.

I haven't tested this widely. It requires support for VFP files, which means a DirectX9 level card. Let me know how it works for you if you meet the requirements.

Off:
Image

On:
Image

Off:
Image

On:
Image

Off:
Image

On:
Image

You can download it here:
http://www.phuce.com/uploads/doom3/bloom.zip
Extract this into a new mod folder (i.e. Doom3\bloom).

r_bloom 0 turns bloom off.
r_bloom 1 turns on a faster bloom, but it doesn't bloom nearly as well.
r_bloom 2 turns on the good bloom, that you see in the screenshots.

Note that I accidentally left it defaulting to r_bloom 1 in the code, so you'll probably want to change that to 2 in the console when you try it.

Also note that, as this is doing a lot of operations per pixel, you're definitely going to notice a drop in performance at higher resolutions. In 640x480 (my resolution, because my computer sucks), the performance drop is negligible.

There is a lot of work left to do on it, but the future changes are going to start drastically changing the way some of the stuff in Doom 3 works, and will require custom content to make any sense. So, I figured I would release it at this stage so people could mess around with it while it's still compatible with the normal game content. In the end I'd want to have something that does a bit better emulation of the >1.0 range of floating point buffers, and is able to isolate the lighting reflection from the bright unlit diffuse surfaces (like a whiteboard).

Because Doom 3 wasn't designed with this in mind, there are some places where it blooms a bit too much (such as the forehead of Swan when talking to Bertruger at the starting of the game).



SnoopJeDi@Posted: Mon Apr 04, 2005 1:10 am :
Cool...:)



c--b@Posted: Mon Apr 04, 2005 1:43 am :
Wow, congratulations on the subtle effect in the last two screens. Its a very nice effect.

Lets see how this baby runs.

EDIT: Im getting an error after/as its loading up the main menu.

Quote:
ERROR: couldn't load game dynamic library


I think thats the most relevant portion of the blue window that came up. I can post all of it if possible.



SantaClaws@Posted: Mon Apr 04, 2005 2:55 am :
That's... strange. I've never seen that error and can't find any good information on it. I've run it on all the computers I have access to, though, and I only have VC2005 installed on one of them, so I don't think it would be a library problem.

Just to confirm... you have:
- the latest version of Doom 3?
- extracted the zip file into its own mod folder?



kat@Posted: Mon Apr 04, 2005 3:43 am :
c--b wrote:
Wow, congratulations on the subtle effect in the last two screens. Its a very nice effect.

Lets see how this baby runs.

EDIT: Im getting an error after/as its loading up the main menu.

Quote:
ERROR: couldn't load game dynamic library


I think thats the most relevant portion of the blue window that came up. I can post all of it if possible.
@ c--b : are you running a 'patched' version of Doom 3?

@ santa : did you dev this for a 'patched' or 'unpatched' version of Doom 3?

I got a similar error to this not for Doom 3 but for a recently release mod for RtCW MP, it was becasue they had built ontop of the latest patch, which I didn't have. So once I updated the mod ran fine. The error said almost exactly the same thing as that above.



SantaClaws@Posted: Mon Apr 04, 2005 3:46 am :
Patched version of the SDK, yeah.



c--b@Posted: Mon Apr 04, 2005 3:59 am :
Im running a legal version of Doom 3, with the 1.1 Official patch applied (Windows XP pro).

Admittedly I pulled a stupid and copied the files into the base dir. But after a reinstall I put the files in there proper folder, and the same things happens upon loading the mod. Exept inside the Doom 3 console (Still the same error).



SantaClaws@Posted: Mon Apr 04, 2005 4:32 am :
Arg... the crappy thing is the error is so generic that I can't really debug it without being able to duplicate it here.

Sorry about not specifying a new mod folder.



Renzatic@Posted: Mon Apr 04, 2005 8:21 am :
I haven't tested it out yet, but from what I've seen of the pics it looks damn awesome.



Oneofthe8devilz@Posted: Mon Apr 04, 2005 1:01 pm :
Dude ....... you did it...... you're the man !!!!!!

I have been waiting for someone to release this since I started working on my mod..... you're it ... you are THE ONE :D

It also perfectly works in multiplayer which was one of my biggest concerns.......

Give this man a chair and a drink :wink:



Dante_uk@Posted: Mon Apr 04, 2005 9:20 pm :
I just added your code to my test code for func_gravity.
The first thing I notice is a massive drop in FPS in my test map.

My test map is quiet bright already so it's not a good example.
I've got a GF5900nu card.
I was running windowed(always do for testing code changes) 1024x768

bloom0
Image

bloom2
Image

I'll test on some better maps.
I may port this (with my stuff, only got one source set with my winampmod, func_gravity, water code by inolen and idiom) to Linux tomorrow if I get time.



SantaClaws@Posted: Mon Apr 04, 2005 9:49 pm :
Glad to see you guys got it working.

Quote:
The first thing I notice is a massive drop in FPS in my test map.


Yeah, this is to be expected, especially using r_bloom 2 in 1024x768. With r_bloom 2 it is doing a LOT of extra work:

1) Save a copy of the current render before the screen has been bloomed.
2) Per fragment: Isolate areas to be bloomed.
3) Capture current render to texture for next pass.
4) Per fragment: gaussian blur horizontally, 17 samples (current fragment. and 8 fragments on the left and right).
5) Capture current render to texture for next pass.
6) Blur vertically, 17 samples and combine with pre-bloom texture.

Just counting texture sampling, that's an additional 36 texture reads per pixel per frame.

r_blur 1 shouldn't drop your FPS so much, but it doesn't blur nearly well because it's only doing a 1 pass blur and combine, sampling only 8 fragments in a diamondish shape around each fragment.

Ideally the material could adjust the amount of blur depending on a user setting, without having to resort to the r_blur 1 method, but I haven't implemented anything like that yet.

If you know VFP syntax, you can easily modify the amount of sampling it's doing per blur pass in the files bloomBlurX.vfp and bloomBlurY.vfp, but make sure to adjust the multipliers accordingly or the blur won't be averaged out correctly.



ViPr@Posted: Mon Apr 04, 2005 10:02 pm :
what does per fragment mean? and i cannot see any blooms. i see a difference between the screenshots but no bloom effect.



Mordenkainen@Posted: Mon Apr 04, 2005 10:24 pm :
ViPr wrote:
what does per fragment mean? and i cannot see any blooms. i see a difference between the screenshots but no bloom effect.


A fragment is a pixel or pixel sample. What do you mean you can't see any blooms?

SantaClaws: Nice job, there's a bit of overbright in GUIs though. I don't know if the performance hit is acceptable to most people though. I get a 15fps drop in the default timedemo (46 to 31fps) which is still reasonable for me I guess.

Btw, the side effects of swan's forehead looks much reduced with the glossmap shader so you might want to include that in your mod.



SantaClaws@Posted: Mon Apr 04, 2005 11:15 pm :
Quote:
and i cannot see any blooms. i see a difference between the screenshots but no bloom effect.


Do you mean you can't see where it's blooming in the screenshot? Check out the top edge of the chair in that example. You can see the light bleeding past the edge of the model.

Quote:
Nice job, there's a bit of overbright in GUIs though.


Yeah, unfortunately I can't find a way to avoid that using the default Doom 3 assets. That's one of the things I think can be fixed using custom assets.

What I am planning on doing with custom assets is scaling the normal, non-blooming color range down from 0.0-1.0 to 0.0-0.9. Then, additive textures and lights will have the ability to bring the high end of these textures up from 0.9 to 1.0 (a crappy emulation of the >1.0 in floating point textures), and I'd isolate anything that was greater than 0.9 and bloom it. Then, in the last pass, everything would be scaled back up again so the white point was 1.0 again.

This could be done with Doom 3 as is, except for one big problem - the GUI doesn't use a default VFP file. The world uses interaction.vfp, so I can scale down most of the view using that, but none of the GUIs in the world have a way to do it... so they'd glow even then.

In a custom project you could design the GUIs so that the color range was 0.0-0.9, but it would be a ton of work to do that with the existing Doom 3 assets.

Quote:
I get a 15fps drop in the default timedemo (46 to 31fps) which is still reasonable for me I guess.


Yeah, it's a decent drop, but this is basically the equivalent of running bloom in "Ultra" mode. Out of curiosity, how much does your FPS cange in the timedemo when you use r_bloom 1?



c--b@Posted: Tue Apr 05, 2005 1:12 am :
A few questions, is it possible to apply the bloom effect sparingly on select surfaces (Sun, moon)? I think that might be a better solution if preformance is a problem, or if your mod/map has a primarily dark environment.

Also, if possible could people list what video cards and which drivers each of you are using?



SantaClaws@Posted: Tue Apr 05, 2005 1:24 am :
Quote:
A few questions, is it possible to apply the bloom effect sparingly on select surfaces (Sun, moon)? I think that might be a better solution if preformance is a problem, or if your mod/map has a primarily dark environment.


You could restrict the fragment program to a specific material by specifying it as a stage, but I'm not sure if you'd be able to do a multipass method in that situation. You'd probably be restricted to doing the equivalent of r_bloom 0.

However... in the case of multi layered sky dome, if you applied it only to a rear texture with a sun and blue sky on it (or something), you would probably be better off using a softening method instead of trying to isolate the bright colors for blooming. You could get a better bloom if you weren't worrying about isolating a color range.

Since the blue sky surrounding the sun wouldn't have much noise, blurring the whole area, toning it down, and adding it on top of the real texture would get you a really good result. This is actually what I had when I first started working on this shader, and it looked very nice, but I didn't think the soft look worked well with the general Doom 3 world.



Esperti@Posted: Tue Apr 05, 2005 3:39 am :
please make this for Doom 3 ROE I would love to play it on the EX



Mordenkainen@FIXME failed to extract: Doom3world • View topic - Bloom

Doom3world

The world is yours! Doom 3 - Quake 4 - ET:QW - Prey - Rage
It is currently Wed Jan 09, 2008 3:50 am

All times are UTC




Post new topic Reply to topic  [ 85 posts ]  Go to page 1, 2, 3, 4, 5  Next
Author Message
 Post subject: Bloom
PostPosted: Mon Apr 04, 2005 12:58 am 
Offline
picked up a pistol

Joined: Thu Nov 07, 2002 8:17 pm
Posts: 59
Location: Las Vegas, NV, USA
So, I've been trying to do a bloom in Doom 3 that works without HDR but gives a similar effect, and doesn't soften the entire scene... just the bright stuffs. I've gotten something I'm moderately satisfied with.

I haven't tested this widely. It requires support for VFP files, which means a DirectX9 level card. Let me know how it works for you if you meet the requirements.

Off:
Image

On:
Image

Off:
Image

On:
Image

Off:
Image

On:
Image

You can download it here:
http://www.phuce.com/uploads/doom3/bloom.zip
Extract this into a new mod folder (i.e. Doom3\bloom).

r_bloom 0 turns bloom off.
r_bloom 1 turns on a faster bloom, but it doesn't bloom nearly as well.
r_bloom 2 turns on the good bloom, that you see in the screenshots.

Note that I accidentally left it defaulting to r_bloom 1 in the code, so you'll probably want to change that to 2 in the console when you try it.

Also note that, as this is doing a lot of operations per pixel, you're definitely going to notice a drop in performance at higher resolutions. In 640x480 (my resolution, because my computer sucks), the performance drop is negligible.

There is a lot of work left to do on it, but the future changes are going to start drastically changing the way some of the stuff in Doom 3 works, and will require custom content to make any sense. So, I figured I would release it at this stage so people could mess around with it while it's still compatible with the normal game content. In the end I'd want to have something that does a bit better emulation of the >1.0 range of floating point buffers, and is able to isolate the lighting reflection from the bright unlit diffuse surfaces (like a whiteboard).

Because Doom 3 wasn't designed with this in mind, there are some places where it blooms a bit too much (such as the forehead of Swan when talking to Bertruger at the starting of the game).


Last edited by SantaClaws on Mon Apr 04, 2005 8:15 am, edited 5 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 04, 2005 1:10 am 
Offline
Captured the Flag

Joined: Thu Jan 06, 2005 7:56 pm
Posts: 1880
Location: 127.0.0.1
Cool...:)

_________________
Check out Classic Doom 3!
Support OmegaDrive


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 04, 2005 1:43 am 
Offline
missed 400 shots
User avatar

Joined: Tue Aug 17, 2004 5:08 am
Posts: 481
Location: Edmonton, Alberta
Wow, congratulations on the subtle effect in the last two screens. Its a very nice effect.

Lets see how this baby runs.

EDIT: Im getting an error after/as its loading up the main menu.

Quote:
ERROR: couldn't load game dynamic library


I think thats the most relevant portion of the blue window that came up. I can post all of it if possible.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 04, 2005 2:55 am 
Offline
picked up a pistol

Joined: Thu Nov 07, 2002 8:17 pm
Posts: 59
Location: Las Vegas, NV, USA
That's... strange. I've never seen that error and can't find any good information on it. I've run it on all the computers I have access to, though, and I only have VC2005 installed on one of them, so I don't think it would be a library problem.

Just to confirm... you have:
- the latest version of Doom 3?
- extracted the zip file into its own mod folder?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 04, 2005 3:43 am 
Offline
"...mostly harmless?!"
User avatar

Joined: Thu Nov 08, 2001 11:00 pm
Posts: 4940
Location: UK, York
c--b wrote:
Wow, congratulations on the subtle effect in the last two screens. Its a very nice effect.

Lets see how this baby runs.

EDIT: Im getting an error after/as its loading up the main menu.

Quote:
ERROR: couldn't load game dynamic library


I think thats the most relevant portion of the blue window that came up. I can post all of it if possible.
@ c--b : are you running a 'patched' version of Doom 3?

@ santa : did you dev this for a 'patched' or 'unpatched' version of Doom 3?

I got a similar error to this not for Doom 3 but for a recently release mod for RtCW MP, it was becasue they had built ontop of the latest patch, which I didn't have. So once I updated the mod ran fine. The error said almost exactly the same thing as that above.

_________________
ImageCo-Admin - Modelling and modding tutorials and tips


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 04, 2005 3:46 am 
Offline
picked up a pistol

Joined: Thu Nov 07, 2002 8:17 pm
Posts: 59
Location: Las Vegas, NV, USA
Patched version of the SDK, yeah.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 04, 2005 3:59 am 
Offline
missed 400 shots
User avatar

Joined: Tue Aug 17, 2004 5:08 am
Posts: 481
Location: Edmonton, Alberta
Im running a legal version of Doom 3, with the 1.1 Official patch applied (Windows XP pro).

Admittedly I pulled a stupid and copied the files into the base dir. But after a reinstall I put the files in there proper folder, and the same things happens upon loading the mod. Exept inside the Doom 3 console (Still the same error).


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 04, 2005 4:32 am 
Offline
picked up a pistol

Joined: Thu Nov 07, 2002 8:17 pm
Posts: 59
Location: Las Vegas, NV, USA
Arg... the crappy thing is the error is so generic that I can't really debug it without being able to duplicate it here.

Sorry about not specifying a new mod folder.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 04, 2005 8:21 am 
Offline
fired 300 rounds
User avatar

Joined: Sat Oct 02, 2004 11:13 pm
Posts: 376
Location: Georgia
I haven't tested it out yet, but from what I've seen of the pics it looks damn awesome.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 04, 2005 1:01 pm 
Offline
fired 300 rounds
User avatar

Joined: Fri Dec 12, 2003 8:49 am
Posts: 362
Location: Kassel / Germany
Dude ....... you did it...... you're the man !!!!!!

I have been waiting for someone to release this since I started working on my mod..... you're it ... you are THE ONE :D

It also perfectly works in multiplayer which was one of my biggest concerns.......

Give this man a chair and a drink :wink:

_________________
I got six little friends and they all run faster than you ;)

Check out my mods:
eCoop and 5.56mm Full Metal Jacket...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 04, 2005 9:20 pm 
Offline
found a secret
User avatar

Joined: Sun Nov 10, 2002 12:21 pm
Posts: 574
Location: UK
I just added your code to my test code for func_gravity.
The first thing I notice is a massive drop in FPS in my test map.

My test map is quiet bright already so it's not a good example.
I've got a GF5900nu card.
I was running windowed(always do for testing code changes) 1024x768

bloom0
Image

bloom2
Image

I'll test on some better maps.
I may port this (with my stuff, only got one source set with my winampmod, func_gravity, water code by inolen and idiom) to Linux tomorrow if I get time.

_________________
My Doom3 Stuff-
"The Large print giveth and the small print taketh away" - Tom Waits


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 04, 2005 9:49 pm 
Offline
picked up a pistol

Joined: Thu Nov 07, 2002 8:17 pm
Posts: 59
Location: Las Vegas, NV, USA
Glad to see you guys got it working.

Quote:
The first thing I notice is a massive drop in FPS in my test map.


Yeah, this is to be expected, especially using r_bloom 2 in 1024x768. With r_bloom 2 it is doing a LOT of extra work:

1) Save a copy of the current render before the screen has been bloomed.
2) Per fragment: Isolate areas to be bloomed.
3) Capture current render to texture for next pass.
4) Per fragment: gaussian blur horizontally, 17 samples (current fragment. and 8 fragments on the left and right).
5) Capture current render to texture for next pass.
6) Blur vertically, 17 samples and combine with pre-bloom texture.

Just counting texture sampling, that's an additional 36 texture reads per pixel per frame.

r_blur 1 shouldn't drop your FPS so much, but it doesn't blur nearly well because it's only doing a 1 pass blur and combine, sampling only 8 fragments in a diamondish shape around each fragment.

Ideally the material could adjust the amount of blur depending on a user setting, without having to resort to the r_blur 1 method, but I haven't implemented anything like that yet.

If you know VFP syntax, you can easily modify the amount of sampling it's doing per blur pass in the files bloomBlurX.vfp and bloomBlurY.vfp, but make sure to adjust the multipliers accordingly or the blur won't be averaged out correctly.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 04, 2005 10:02 pm 
Offline
Rage is my middle name

Joined: Tue Jan 18, 2005 6:51 pm
Posts: 956
what does per fragment mean? and i cannot see any blooms. i see a difference between the screenshots but no bloom effect.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 04, 2005 10:24 pm 
Offline
King of the Hill
User avatar

Joined: Mon Nov 04, 2002 10:50 pm
Posts: 1312
Location: PT, EU
ViPr wrote:
what does per fragment mean? and i cannot see any blooms. i see a difference between the screenshots but no bloom effect.


A fragment is a pixel or pixel sample. What do you mean you can't see any blooms?

SantaClaws: Nice job, there's a bit of overbright in GUIs though. I don't know if the performance hit is acceptable to most people though. I get a 15fps drop in the default timedemo (46 to 31fps) which is still reasonable for me I guess.

Btw, the side effects of swan's forehead looks much reduced with the glossmap shader so you might want to include that in your mod.

_________________
Beyond3D.com | Learn something today? Why not write an article about it on modwiki.net?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 04, 2005 11:15 pm 
Offline
picked up a pistol

Joined: Thu Nov 07, 2002 8:17 pm
Posts: 59
Location: Las Vegas, NV, USA
Quote:
and i cannot see any blooms. i see a difference between the screenshots but no bloom effect.


Do you mean you can't see where it's blooming in the screenshot? Check out the top edge of the chair in that example. You can see the light bleeding past the edge of the model.

Quote:
Nice job, there's a bit of overbright in GUIs though.


Yeah, unfortunately I can't find a way to avoid that using the default Doom 3 assets. That's one of the things I think can be fixed using custom assets.

What I am planning on doing with custom assets is scaling the normal, non-blooming color range down from 0.0-1.0 to 0.0-0.9. Then, additive textures and lights will have the ability to bring the high end of these textures up from 0.9 to 1.0 (a crappy emulation of the >1.0 in floating point textures), and I'd isolate anything that was greater than 0.9 and bloom it. Then, in the last pass, everything would be scaled back up again so the white point was 1.0 again.

This could be done with Doom 3 as is, except for one big problem - the GUI doesn't use a default VFP file. The world uses interaction.vfp, so I can scale down most of the view using that, but none of the GUIs in the world have a way to do it... so they'd glow even then.

In a custom project you could design the GUIs so that the color range was 0.0-0.9, but it would be a ton of work to do that with the existing Doom 3 assets.

Quote:
I get a 15fps drop in the default timedemo (46 to 31fps) which is still reasonable for me I guess.


Yeah, it's a decent drop, but this is basically the equivalent of running bloom in "Ultra" mode. Out of curiosity, how much does your FPS cange in the timedemo when you use r_bloom 1?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 05, 2005 1:12 am 
Offline
missed 400 shots
User avatar

Joined: Tue Aug 17, 2004 5:08 am
Posts: 481
Location: Edmonton, Alberta
A few questions, is it possible to apply the bloom effect sparingly on select surfaces (Sun, moon)? I think that might be a better solution if preformance is a problem, or if your mod/map has a primarily dark environment.

Also, if possible could people list what video cards and which drivers each of you are using?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 05, 2005 1:24 am 
Offline
picked up a pistol

Joined: Thu Nov 07, 2002 8:17 pm
Posts: 59
Location: Las Vegas, NV, USA
Quote:
A few questions, is it possible to apply the bloom effect sparingly on select surfaces (Sun, moon)? I think that might be a better solution if preformance is a problem, or if your mod/map has a primarily dark environment.


You could restrict the fragment program to a specific material by specifying it as a stage, but I'm not sure if you'd be able to do a multipass method in that situation. You'd probably be restricted to doing the equivalent of r_bloom 0.

However... in the case of multi layered sky dome, if you applied it only to a rear texture with a sun and blue sky on it (or something), you would probably be better off using a softening method instead of trying to isolate the bright colors for blooming. You could get a better bloom if you weren't worrying about isolating a color range.

Since the blue sky surrounding the sun wouldn't have much noise, blurring the whole area, toning it down, and adding it on top of the real texture would get you a really good result. This is actually what I had when I first started working on this shader, and it looked very nice, but I didn't think the soft look worked well with the general Doom 3 world.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 05, 2005 3:39 am 
Offline
picked up 75 health

Joined: Wed Sep 08, 2004 3:25 am
Posts: 99
Location: My Room
please make this for Doom 3 ROE I would love to play it on the EX

_________________
Buddha....BOOM!
It came up durring a round in Halo PC


Top
 Profile  
 
 Post subject: