how to do a brightpass properly

Started by
13 comments, last by 21st Century Moose 11 years, 3 months ago
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
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.

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

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
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)
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

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?
Sorry, my post sounds like I'm assuming you don't know what you're doing, that's not the case...

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

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.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

This topic is closed to new replies.

Advertisement