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 have googled this to death, and I still don't quite understand it.

I'm trying to create a glow effect in XNA using HLSL. A long time ago I was able to do it the way most people suggest which is by sampling the pixels from a texture, however I've always been curious about how you can make it more advanced so that you could do things like set the glow distance and stuff. If I recall from back when I was creating something like this in a similar project, there was always a limit as to how much I could sample before the computer couldn't handle it, hence limiting the glow distance. I wanted to know if there was a more sophisticated way of doing it, one that would have no glow distance limit? And I'm not referring to lighting ground textures either, the idea I have in my head is to have a set of vertices that all join together to create a LineList (for this example lets say they create a cube), so you have very thin lines creating a shape, and then you can set a glow on this object that has no limit to its distance, kinda like how Photoshop works I guess.


share|improve this question

2 Answers 2

up vote 1 down vote accepted

You can create arbitrary blur effects by first fourier transforming the image, applying the blurring and then transforming it back. This is how Futuremark's 3DMark 11 does it (Whitepaper) and possibly some other modern 3D engines as well. There is also a video of the effect here and explanation of the process. Unfortunately I didn't find any ready-made implementation of this with source code, but you can try searching for FFT bloom.

share|improve this answer
What is the benefit of FFTing the image? The image would still be the same size and I would have to go through it correct? –  bluejamesbond Mar 8 at 5:16
@mk1 Blurring in frequence domain is a simple operation, see Convolution. This reduces the complexity of abritrary sized blur to O(1) per pixel. This doesn't include the complexity of the Fourier transformation though, which is heavier than a traditional blur with a small blurring kernel. –  msell Mar 8 at 6:17

As you said, the way "most people suggest" to implement bloom is via postprocessing. It's clear from your question that you're somewhat aware of postprocessing's limitations. Extend the glow to unlimited distance, and your GPU will grind to a halt. On the other hand, you will hit the edge of the screenspace eventually, so "unlimited" is a misnomer.

Unfortunately, that 2nd part of your question is not answerable. "Should I try to do X?" is not suitable for Q&A format. Of course it is possible to create a large structure around an object (geometry shaders, modeling extra vertices, etc.) Exactly how you should do it is up to you.

That said, perhaps you don't need to reinvent the wheel. If you can create a custom version of bloom that fills the whole screen, then you won't have to constantly generate new geometry when you want to draw brightly lit objects. (That line list method sounds like a maintenance nightmare to me; I advise against it.)

If I recall correctly, the XNA sample project for a bloom effect already features the ability to adjust the intensity. Have you tried to build on that feature?

enter image description here

share|improve this answer

Your Answer


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.