User panel stuff on forum
Index  ‹  Client Talk  ‹  motion blur
  4 posts on 1 page  1
Client Talk
2012-02-03, 19:08
Member
357 posts

Registered:
Mar 2006
Seems new games (almost all) have a motion blur when u move the mouse.
For me i like it cause it hides the screen tearing of my 225 maxfps on a 75hz lcd monitor.
So, I submit some code to ezquake devs for this addition.

Spike wrote the bulk of this years ago on the QuakeSource forum, i just tweaked it

void R_RenderSceneBlur (float alpha, GLenum format)
{
extern int sceneblur_texture;
int vwidth = 2, vheight = 2;
float vs, vt;

alpha = bound(0.1, alpha, 0.9);

while (vwidth < glwidth)
{
vwidth *= 2;
}
while (vheight < glheight)
{
vheight *= 2;
}

glViewport (glx, gly, glwidth, glheight);

GL_Bind(sceneblur_texture);

// go 2d
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity ();
glOrtho (0, glwidth, 0, glheight, -99999, 99999);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity ();

vs = ((float)glwidth / vwidth);
vt = ((float)glheight / vheight) ;

glDisable (GL_DEPTH_TEST);
glDisable (GL_CULL_FACE);
glEnable(GL_BLEND);

glColor4f(1, 1, 1, alpha);//<-- alpha of blur

glBegin(GL_QUADS);
glTexCoord2f(0, 0);
glVertex2f(0, 0);
glTexCoord2f(vs , 0);
glVertex2f(glwidth, 0);
glTexCoord2f(vs , vt);
glVertex2f(glwidth, glheight);
glTexCoord2f(0, vt);
glVertex2f(0, glheight);
glEnd();

glEnable(GL_DEPTH_TEST);
glDepthMask(1);
glColor3f (1,1,1);
glDisable (GL_BLEND);

glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();

glCopyTexImage2D(GL_TEXTURE_2D, 0, format, glx, gly, vwidth, vheight, 0);

// glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}

I call it from r_renderview like so
if ((cl.stats[STAT_HEALTH]< 0) && (gl_deathblur.value))
{
R_RenderSceneBlur (gl_deathblur.value, GL_RED);
}
else
{
if ((gl_hurtblur.value)&&(cl.hurtblur > cl.time))
{

R_RenderSceneBlur (gl_hurtblur.value, GL_RGB);
}
else
{
if ((cl.items & IT_INVULNERABILITY) && (gl_nightmare.value))
{
R_RenderSceneBlur (gl_nightmare.value, GL_RED);
}
else
{
if (gl_motion_blur.value)
{
R_RenderSceneBlur (gl_motion_blur.value, GL_RGB);
}
}
}
}

Though it might need to be tweaked to fit in ezQuake....
2012-02-03, 19:32
News Writer
646 posts

Registered:
Mar 2006
Consider this post my THUMBS UP for this code.

It would be good for video makers who are too lazy to do post processing, and perhaps for live streaming as well (unless someone can tell me how to enable vsync on the capture card only, and not on my monitor)
2012-02-03, 20:50
Member
121 posts

Registered:
Mar 2006
yeah i used motionblur for my vid too, but i had to capture to 400..900 fps to make it smooth. (i also reduced the motionblur layer to like 18% to make it not too blurry)
2013-07-07, 02:44
Member
357 posts

Registered:
Mar 2006
i didnt want to create a new thread
but since my netQuake engine is cousin to FuhQuake
anything u see in this vid will cut/paste into ezQuake
http://www.youtube.com/watch?v=uBFVmF-u1LU&hd=1
  4 posts on 1 page  1