   Producing Blur
  Hi.Could anyone provide me with some info on how to go about blurring with DirectX 8? (Preferbably in Visual Basic 6). I want to create an affect similar to the blurring affect used in Perfect Dark (N64) after being tranquilized/punched. Any ideas?luke88   
  I haven't played that game, so I can't say for definite...But usually this is achieved via "post processing" and pixel shaders. Create a render target texture, apply a blur filter and then render the results back as a screen-aligned quad.The blurring filter can be done by multiple lookups in a single pass, but I can't remember how good the SM1 shaders are at that. You could also do it using a "jittered" blurring approach where you render to a texture and then re-render it (as a screen-aligned quad) a number of times each with a slightly different offset.hthJack   ;  Unfortuantely, my graphics card does not support pixel shaders. That jittered blurring way sounds much for straight forward anyway. Could you go into it in a little more detail, please? Or perhaps there is a tutorial somewhere?   ;  I'm not aware of any tutorials - I thought of that one as I was typing [smile]Although, jittered rendering isn't exactly a new thing so it's likely that I thought of it because I've read about it somewhere. Google might know.Are you okay with the render-to-texture and screen-aligned-quad parts?As soon as you have your image in that format then you can do all sorts of funky post-processing tricks - with or without shaders. Pretty much limited by the algorithms you can imagine!My idea was, for example, to render it 9 times with a grid offset:•|•|•-+-+-•|•|•-+-+-•|•|•(where each • is the location of a render)If you offset each of the 9 renders by 1 pixel you should get a slight blurrin.. increase the distance (say +3, +5...) and you might get a more obvious blur. Animate the blurring offsets and it might look a bit crazy (similar to the effec you describe?).hthJack   ;  In Perfect Dark (N64) you get a blurry trail of images when you're punched.  The way to do this would be to keep each image on the screen when rendered, and render the new image on top with a low alpha, gradually increasing until your sight is restored and the alpha is 1.  No idea how you'd do that in DX8 though, I haven't used it.   ;Quote:Original post by luke88Hi.Could anyone provide me with some info on how to go about blurring with DirectX 8? (Preferbably in Visual Basic 6). I want to create an affect similar to the blurring affect used in Perfect Dark (N64) after being tranquilized/punched. Any ideas?Gah!  That blur is EVIL!!!  There is nothing more annoying that lighting some dude up in PD, then have him charge you and punch your lights out.  And then it even is blurry when you respawn!  Jeez!Anyways, the post-processing approach will be much better here, like JJ recommended.  How the AP described it really *is* how it's done, but that is pretty inefficient, because it takes loads of memory (to store all the old renders) and takes tons of DIP calls and fillrate (to render them all).Are you familiar with the Counterstrike:Source flash blur?  Basically, it's just like Perfect-Dark's, except that it only blurs in 1 frame.  This is a much more acceptable way to do it (performance wise) and it looks pretty much the same.   ;Quote:Original post by Anonymous PosterThe way to do this would be to keep each image on the screen when rendered, and render the new image on top with a low alpha, gradually increasing until your sight is restored and the alpha is 1.  No idea how you'd do that in DX8 though, I haven't used it.I haven't seen it in Perfect Dark, but the usual way of doing motion blur is to save a copy of the old frame, draw the new frame normally, then draw the old frame on top with an alpha of 0.5 (or less).That's a little different than what the AP wrote (but I think it is what he meant), and it isn't inefficient, as circlesoft wrote.[Edited by - JohnBolton on December 14, 2005 4:41:44 PM];  Ah, thanks. Sounds fairly simple. How could I go about implementing this?So I'd have to copy the frontbuffer to memory, then apply it to a quad that covers the screen? But I have no idea how to change the alpha. Does anyone have any code that you could show me?[Edited by - luke88 on December 14, 2005 4:09:08 PM]