Jump to content
  • Advertisement
Sign in to follow this  
Tasche

how to do a brightpass properly

This topic is 2105 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

ello, been off the forums (and off my hobby) for a while, now back at it :)

so im trying to write a bloom/glow/whateveryouwantocallit shader for my app along the lines of this page:

http://kalogirou.net/2006/05/20/how-to-do-good-bloom-for-hdr-rendering/

okeys... got stuff working now, still looks kinda crappy :D

parameters used:
-gauss blur sigma: 0.84
-gauss blur domain: -3*sigma to 3*sigma; codomain normalized to sum = 1
-gauss kernel samples: 15 (on all targets)
-highpass filter funtion: inputColor-(0.5,0.5,0.5)
-target sizes: B0:512x256, B1: 256x128, B2: 128:64
-scene texture size: 1280x720
-combine blur targets function: blurAccum = B0+B1+B2
-combine bloomtexture with scene: finalColor = blurAccum*0.5+scene*0.5

EDIT: ha i actually found my old thread:
http://www.gamedev.net/topic/612541-understanding-theory-of-bloom-effect/

that one wasn't quite answered completely so feel free to comment on that too :)

EDITEDIT: updated the original post to reflect the progress Edited by Tasche

Share this post


Link to post
Share on other sites
Advertisement

Physically, all you need is "input * fraction", but on my last project we used "(input - threshold) * fraction".
If you're working with HDR data, then you should avoid saturate too.

There's a lot of other details that will contribute to how 'sucky' the final effect looks -- e.g.
• are you using HDR inputs? Are the blur passes done with HDR data? Which texture formats are used?
• whether you're compositing the result before or after tone-mapping(if using HDR)
• which compositing function is used.
• how the blurring passes work.

Also, it's quite likely that the 'brightpass' texture will look quite ugly, even if the final effect looks good. You need to evaluate it as a whole.

Edited by Hodgman

Share this post


Link to post
Share on other sites

ok very nice, thanks alot Hodgman, this is very helpful.

ill post some feedback as soon as i get this done down to the last pass, maybe some screenshots...

 

as for testing purposes im not using HDR calculations.

 

actually, all those question in your bullets, thats stuff ive been asking myself too :), except for the blurring used; ill go with the one discribed in the link, maybe use different size kernels.

but il cross those bridges when i get there :P

 

to add anything to this topic i really need to get the whole effect going first i guess, so ill be posting back on friday probably

 

again, thx for the input.

 

cheers,

    tasche

Share this post


Link to post
Share on other sites
okeys... got stuff working now, still looks kinda crappy :D

parameters used:
-gauss blur sigma: 0.84
-gauss blur domain: -3*sigma to 3*sigma; codomain normalized to sum = 1
-gauss kernel samples: 15 (on all targets)
-highpass filter funtion: inputColor-(0.5,0.5,0.5)
-target sizes: B0:512x256, B1: 256x128, B2: 128:64
-scene texture size: 1280x720
-combine blur targets function: blurAccum = B0+B1+B2
-combine bloomtexture with scene: finalColor = blurAccum*0.5+scene*0.5

i played with the values, but not too much (only thing that can be changed in runtime is sigma and domain range, rest is hardcoded atm)
esp. the combining of the blurs and the final add to the scene are probably really lame, but its just preliminary testing
if anyone knows any good values, or how to come up with those other than trial and error, or has anything else to add, feel free to post

EDIT: removed screenshots Edited by Tasche

Share this post


Link to post
Share on other sites
Don't you need some light areas in your sample image to bring out the bright pass? Also, your last image didn't work (for me)

hm im not sure i understand you correctly, but i have a light source, the sun. effectively, its just a color_of_the_terrain * lightmap_value, nothing too fancy. however if you notice my brightpass calculation, any color with at least one component above 0.5 will write to the highpass texture. i was just too lazy to post a SS, but the highpass has content. but true, its probably not the best scene to do bloom effect testing on :D

Share this post


Link to post
Share on other sites
There's no sun in your sample screenshot though, it's a fairly mid-dark landscape. If you looked at that in real life, you wouldn't expect any bloom because there are no light areas for the light to bleed through. The whole idea of bloom is give the illusion that light is effectively bleeding out over objects that are occluding the light source.

Think of standing in a room with a window and looking at the sun, the light from the sun will appear to bloom over the edges of the window. The idea is that you bright pass your scene to mask out areas darker than your brightness threshold, apply a blur to that bright pass and then modulate it with the original scene. Is that what you're trying to achieve?

Share this post


Link to post
Share on other sites

okeys, i removed the screenshots because ppl kinda got hung up on those, they were actually just meant for ppl who are bored :)

what i actually wanted to hear are some comments on the used parameters and functions, if anyone cares to comment.

 

especially interested in comments from people who have tried doing bloom in their project, since they must have faced the same questions (more or less)

i am still aware that in the end, its a matter of taste, i'm just interested in seeing how other people decided on those things.

also, maybe the mod (Hodgman) maybe wants to give me some good links on where (and if) to use HDR (like some pros and cons, or generally how much it actually affects visual quality, stuff i found so far just goes about explaning the technique, not the intended results)

 

the bold text is for tl;dr :)

 

thanks in advance

Share this post


Link to post
Share on other sites

I've tried a few different approaches before, but right now my preferred one is this: don't do a brightpass at all.  Instead, raise the original colour to some power, greyscale the result, then multiply the original colour by that result.  I find that it gives a nice smooth transition between boomed parts of the scene and non-bloomed parts, and preserves the original colour balance perfectly.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!