Shock Wave Special Effect

Started by
2 comments, last by GremlinX 20 years, 5 months ago
I''m trying to do a shockwave special effect in DX. I''ve tried doing a textured quad and scaling it, but width of the "ring" gets larger. The shockwave should basically move outwards and get larger, but the ring width should remain the same... shouldn''t be this hard! Any thoguhts would be great. Thanks, Jon
Binary Fortress Softwarehttp://www.binaryfortress.com
Advertisement
Heh, do a lazy bastard and add a fade effect so it looks like the wave is dispersing.
Yeah, the width of the ring in reality would get larger, becuase some particals are moving faster then others. Adding the fade really helps.

But what am I talking about, in reality wouldnt the shockwave be a sphere?
ill give you a viable technique and leave the implementation to you.


what you need to do is to create a circle of triangles.

the easiest way to do this is by using the;

x = d(sin(angle))
z = d(cos(angle))

where Y(height expression) is constant.(but not necessarily)
where X = X world space coord
where Z = Z world space coord.


imagine yourself staring into the positive Z axis.


as you rotate, you stop in equal degree offsets. lets say you rotate 20 degrees each step.

so step = 20 degrees.

you need to determine a thickness for your ring, lets put it at 5 units.

so thickness = 5

you also need to determine a size for your shockwave, lets say we pick 30.

so d(which means distance from your center point) = 30 units.

here's our formulas;

X = (d)*(sin(angle + step));    //outer ring XZ = (d)*(cos(angle + step));    //outer ring ZX = (d - thickness)*(sin(angle + step)); //inner ring XZ = (d - thickness)*(cos(angle + step)); //inner ring Z 


loop thru and create your circular mesh.

by increasing or reducing your step variable, you can draw smoother or less detailed circles.

next set up your render state, i recommend additive blending.

to expand it, you need to scale it up as you pass thru render cycles.

finally make sure and fade it out as it gets larger.


voila.


Dredd



[edited by - Dreddnafious Maelstrom on November 6, 2003 3:50:41 PM]
"Let Us Now Try Liberty"-- Frederick Bastiat

This topic is closed to new replies.

Advertisement