PDA

View Full Version : Is is the "Motion Blur" effect



pango
12-13-2004, 03:08 PM
I write below code to simulate a motion blur effect,but I always feel it is not good,and I can't find out where the problem is,so I post my code to hope some advise,thank!

//draw a normal quad
glColor4f[1.0f,1.0f,1.0f,1.0f];
glPushMatrix[];
setupMotionMatrix[ratio];
drawQuad[];
glPopMatrix[];

//draw motion blur effect
int drawTimes=10;//draw 10 transparent quad
float distance=0.01f;//motion ratio space
glEnable[GL_BLEND];
glBlendFunc[GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA];
glDisable[GL_DEPTH_TEST];
for[i=0;i<=drawTimes;i++]
{
float motionRatio=[float]i/[float]drawTimes;
float alpha=1.0f-[float]i/[float]drawTimes;
glColor4f[1.0f,1.0f,1.0f,alpha];
glPushMatrix[];
setupMotionMatrix[max[0,ratio-motionRatio*distance]];//draw previous motion quad
drawQuad[];
glPopMatrix[];
}

From my code,the final rendered image only has the direct blur effect,it is not perfect,so how to the betterment?

ZbuffeR
12-14-2004, 01:00 AM
Don't know, do you have screenshots ?
Triple check that setupMotionMatrix is working as you intended it.

Try with only 2 quads,current one and previous one.
What do you call direct blur effect ?

What kind of motion blur do you want to draw ? Long, multiframe lasting ? Or single frame, like in films ?

RAMman
12-14-2004, 03:57 AM
Why not use the accumulation buffer if you insist on drawing the geometry multiple times ? That is an very easy approach, which generates good motion blur. But it is too slow for more advanced scenes, like ingame scenes.
I have implemented and updated the motion blur paper from Nvidia GDC2003, and I got some resonable results out of that one. Its not 100% true motion blur, but it looks pretty good imho.
There is a screen here:
Motion blurred teapot (http://www.student.dtu.dk/~s001733/blurPot.jpg)

and the paper this method is based on is here:
Nvidia Motion Blur Paper (http://developer.nvidia.com/docs/IO/8230/GDC2003_OpenGLShaderTricks.pdf)

works for more advanced scenes than the teapot too ;-)