1
\$\begingroup\$

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.

Thanks

\$\endgroup\$

2 Answers 2

1
\$\begingroup\$

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.

\$\endgroup\$
2
  • \$\begingroup\$ 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? \$\endgroup\$ Commented Mar 8, 2014 at 5:16
  • \$\begingroup\$ @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. \$\endgroup\$
    – msell
    Commented Mar 8, 2014 at 6:17
2
\$\begingroup\$

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

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .