What is a flamethrower?
1. Something that throws flames.2. A weapon used in first-person shooters, ideal for crowd control.
Inspiration
|
|
Return to Castle Wolfenstein: Enemy Territory |
|
|
Unreal II |
Approach
For every frame, if the mouse button is down, create a flame object and add it to the list. Loop through all the objects in the flame list and do the following:
- As the flame is coming out of the weapon, set the size to very small and the color to blue.
- As the flame progresses, change the color from blue to red, and make the billboard larger.
- When flame reaches the end of its lifespan, begin the fadeout animation and change the alpha accordingly.
When a flame object dies out, create a smoke object and append it to the list. Loop through all the objects in the smoke list and do the following:
- Move the smoke billboard upward at a random speed.
- Decrease the alpha value until the smoke object dies out.
- Randomly rotate the billboard.
Concepts
Skyboxes
Skyboxes are created by mapping six textures to a large cube. The key is to
clamp the texture to the edge instead of repeating, to remove seams.
Billboarding
Billboards are quads that always face the camera. The idea is to create a
a change-of-basis matrix and multiply it with the modelview matrix.
The change-of-basis matrix can be constructed by getting a unit vector from
the eye to the object's center, and crossing this with the global up vector. You
then cross the new u vector with the the original w vector to get the v vector.
These three vectors form your orthonormal basis, and you need to multiply its transpose
with the modelview matrix.
FPS Camera movement
To create FPS-like movement, you need to map the xy coordinates of the mouse
to theta and phi values of a spherical coordinate system. To get your direction
vector, you simply convert from spherical coordinates to cartesian.
Screenshots
Smoke rises from the ground where it was just charred
Flying through a nice smoke cloud
A nice smooth flame
Dense smoke