motion blur or slow motion
-
- Posts: 69
- Joined: Wed Dec 30, 2009 6:29 pm
- Location: peru
- Contact:
See Qrack's nail trails or read this for the basic idea ...
MH tutorial on simple motion blurs ...
http://forums.inside3d.com/viewtopic.php?p=16012
MH tutorial on simple motion blurs ...
http://forums.inside3d.com/viewtopic.php?p=16012
The night is young. How else can I annoy the world before sunsrise? Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
In gl_rmain.c, add this function above R_RenderView,
then in R_RenderView, after R_DrawViewModel() add
u have to make your oen cvar for motion blur of course...
The blur value sets the percentage of the alpha, depends on your FPS in-game, so around 75fps, 0.2 - 0.3 seems acceptable. 0.85, and you are in a drunk haze!
EDIT: Oh just looked at MH's code, may work faster.
Code: Select all
void R_RenderSceneBlur (float alpha, GLenum format)
{
extern int sceneblur_texture;
int vwidth = 2, vheight = 2;
float vs, vt;
if (alpha < 0.1)
alpha = 0.1;
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);
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);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
Code: Select all
if (gl_motion_blur.value)
{
R_RenderSceneBlur (gl_motion_blur.value, GL_RGB);
}
The blur value sets the percentage of the alpha, depends on your FPS in-game, so around 75fps, 0.2 - 0.3 seems acceptable. 0.85, and you are in a drunk haze!
EDIT: Oh just looked at MH's code, may work faster.