Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am playing around with the bloom shader from the XNA sample page, to do some glow shading. I am rendering primitive vector-ish squares of linelists/linestrips, on a background. However, I am facing a few problems.

With a black background and white squares, I can actually see the squares. However, with a white background and black squares, I can't see them at all.

Why is this happening, and is there any way of me fixing it?

Can I modify my bloom shader to also "glow" dark elements, if that's what is causing it?

share|improve this question
6  
Screenshots would help. –  Tetrad Jun 19 '11 at 22:45
3  
...as would the shader code or a link to it. –  Daniel Jun 19 '11 at 23:30
    
Could it be that the squares are small and bloom is turned up so high that it's covering the squares completely? –  CiscoIPPhone Jun 19 '11 at 23:31

1 Answer 1

up vote 2 down vote accepted

The function of a bloom filter:

  • Apply a threshold to the source image to extract bright colours.

  • Blur the result.

  • Composite the blurred effect over the source image.

Your problem is that the shader targets bright colours (greater than the threshold) when it ought to target dark colours (less than the threshold). As a result, the dark shapes are being covered by the blur effect on the white background. Solution: change the direction (> vs. <) of the test.

If you want bloom on shadows as well as lights, try:

(Colour < Shadow Threshold || Colour > Highlight Threshold)

But it probably won't look great.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.