Radial blur in DirectX8

Started by
3 comments, last by digitalerr0r 21 years, 10 months ago
Hey, i was woundering if anyone knows about an article or source on how to make radialblur in DirectX8(like the tutorial on NeHe, using a texture as the "blur"). Thx =D
Advertisement
I do something similar (although not quite the same) In Real Time Rendering Tricks and Techniques in DirectX.

Basically, render each frame to a texture and then, don''t clear the back buffer, instead render the new texture semitransparently over the old scene. Unless your app is already fill limited, the cost is quite low.

In a fill limited app, it might be better to do it using vertex shader tricks or something geometry based.
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
its done exactly like in opengl.

// done in init
create a renderTarget texture. make sure its only 256x256 or so.

// done every frame
1. draw scene.
2. select texture as new renderTarget.
3. draw the scene to it.
4. select back buffer again.
draw the texture as a quad filling the screen using additive blending. a speed up can be had by using a vertex buffer that contains the entire set of zooms you will be doing (ie all the texture coordinate changes). this will allow a single call to DrawPrimitive() to draw the entire radial blur.


if you dont know how to create rendertarget textures, or select them. see the cubemap samples in the sdk, and look at the docs. i used nehe''s opengl tutorial, and so should you. the concept and algorithm are EXACTLY the same.
Yep - to clarify: the overall algorithm is the same, I just don''t specifically rotate to cause the exact same radial effect. It is a general motion blur that could be used as a radial effect with the proper rotation.

Depending on your hardware, you might be able to bump your texture size up quite a bit. On a GF3, I''m using a 1024x1024+ render target to support a full screen blur. The relative cost is almost nothing, but the particular app is *far* more geometry limited to begin with.

Things to watch out for:
* experiment with texture sizes to see what works for you. Your hardware and/or specific application will make big differences.
* make sure your Swap effect settings do not discard your old back buffer.
* as a person said, look for ways to batch up your calls as much as possible. In my app, I''m going for interframe motion blur, so I only render one new iteration per frame. You might want to render more.

Also, you can possibly get away with one iteration, but set your blending parameters to be more transparent. The overall effect is similar to multiple iterations per frame because you end up seeing more past frames on a single frame. That could possibly be much faster than multiple iterations per frame. It depends on the exact effect you are going for. I haven''t looked closely at the final effect from NeHe''s tutorial, but if you are just going for a radial blur, rotate the image and render once per frame, but adjust your transparency. high opacity will produce next to no blur at all, high transparency will produce a nice blurry/smeared effect.
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
Thx for all the help I recived, they''r taken with both hands
-DigitalErr0r

This topic is closed to new replies.

Advertisement