Re: [Algorithms] Blurring in HLSL
Brought to you by:
vexxed72
From: Jon W. <jw...@gm...> - 2009-06-16 21:17:31
|
Zafar Qamar wrote: > Hi All, > > Thanks for all the help you people have given me in the past. > > A question about blurring. > I want to do a soft blur in HLSL. Preferably in one-pass. > I've read lots of stuff but I want to know if anyone has managed to come > up with a solution that works in one-pass and achieves a soft blur, AND > is fast. > You can't do it in a single pass (as in: the forward pass when you render), because the output of blur is non-local, and the geometry pixel shader only has access to local information. Thus, it has to be done as a post-process, where you can use non-local (image-space) input. Second, you can calculate the Gaussian blur in a single post-processing pass if you want. It's no different from doing the horizontal and vertical in two different passes, except for the amount of math involved. If you do that, then you'll be using a large amount of pixel shader instructions compared to framebuffer writes, which will generally be slower than just doing two separate passes on render targets. All hardware is decent enough at fill rate compared to shader instructions that it doesn't make sense to try to do it in a single post-process pass. When we get a 1000:1 ratio of shader ops:framebuffer writes, that detemrination may change, but we're nowhere near there just yet :-) Sincerely, jw |