Quake3 rocket smoke effect in OpenGL
Yo,
I want to know how to make a quad always face the viewer, just like the smoke of the rockets in the Q3A. I''ve done this already, undoing all the transformations thet have been done to the Projection matrix in the reverse order, but I was wandering if there''s an easier way...
Thanks,
Nicodemus.
Nicodemus.----"When everything goes well, something will go wrong." - Murphy
Within a week or so, my particle system demo will be out and that has D3D source to do exactly what you are talking about.
But anyways, one way is to just transform the location of the smoke puff ( center ) into screen space. Then just use offsets in screen space ( after scaling for distance ) and pass the Verts in as Transformed and Lit.
Another is to get the Inverse of the View matrix and use that to transform the verts to screen space
Keeb
But anyways, one way is to just transform the location of the smoke puff ( center ) into screen space. Then just use offsets in screen space ( after scaling for distance ) and pass the Verts in as Transformed and Lit.
Another is to get the Inverse of the View matrix and use that to transform the verts to screen space
Keeb
> undoing all the transformations thet have been done to the > Projection matrix in the reverse order,
Eh, don''t u use gluProject ? What''s so difficult with it ?
Source would look like this:
x, y, z (Center of Quad in world space )
glGetDoublev ( GL_PROJECTION_MATRIX, projection );
glGetDoublev ( GL_MODELVIEW_MATRIX, modelview );
glGetIntegerv ( GL_VIEWPORT, viewport );
glUnProject ( x, y, z, modelview, projection, viewport, &mem[0], &mem[1], &mem[2] );
mem then holds the pojected coordinates in Screen-space
And then proceed with the second part posted by Keeb
Hope that helps
NextS
Eh, don''t u use gluProject ? What''s so difficult with it ?
Source would look like this:
x, y, z (Center of Quad in world space )
glGetDoublev ( GL_PROJECTION_MATRIX, projection );
glGetDoublev ( GL_MODELVIEW_MATRIX, modelview );
glGetIntegerv ( GL_VIEWPORT, viewport );
glUnProject ( x, y, z, modelview, projection, viewport, &mem[0], &mem[1], &mem[2] );
mem then holds the pojected coordinates in Screen-space
And then proceed with the second part posted by Keeb
Hope that helps

NextS
Assuming you use a matrix to define your camera:
your matrix can be conceptualized as 4 columns of vectors, X'', Y'', Z'' and Translation.
To make something be perpendicular to the camera draw it so that its 4 coords are:
(0, y'') (x'',y'')
(0,0) (x'', 0)
If you look at the source code for glquake you''ll see it works the same way.
If you want to see how to setup a project to use a matrix as a camera object see gldemo5 on my web site.
l8r
Ryan
--
Ryan Haksi
cryogen@infoserve.net
http://members.home.com/borealis/ryan.html
your matrix can be conceptualized as 4 columns of vectors, X'', Y'', Z'' and Translation.
To make something be perpendicular to the camera draw it so that its 4 coords are:
(0, y'') (x'',y'')
(0,0) (x'', 0)
If you look at the source code for glquake you''ll see it works the same way.
If you want to see how to setup a project to use a matrix as a camera object see gldemo5 on my web site.
l8r
Ryan
--
Ryan Haksi
cryogen@infoserve.net
http://members.home.com/borealis/ryan.html
>Eh, don''t u use gluProject ? What''s so difficult with it ?
No NextS, I wasn''t using gluProject, I was doing something like that:
glLoadIdentity;
glRotatef(45, 1, 1, 0);
glTranslatef(0, 0,-6); //quad position
glRotatef(-45, 1, 1, 0);
Now draw the quad
but I didn''t understand what Keebler said (sorry, using OGL for a month only
)... could you post some code?
Thanks for the answers,
Nicodemus.
No NextS, I wasn''t using gluProject, I was doing something like that:
glLoadIdentity;
glRotatef(45, 1, 1, 0);
glTranslatef(0, 0,-6); //quad position
glRotatef(-45, 1, 1, 0);
Now draw the quad
but I didn''t understand what Keebler said (sorry, using OGL for a month only

Thanks for the answers,
Nicodemus.
Nicodemus.----"When everything goes well, something will go wrong." - Murphy
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement