rich_is_bored@Posted: Sun Jun 20, 2004 5:15 am :
Particles & Shapes

Introduction

When writing particle scripts you use shapes to describe the source or velocity of a particle system. These parameters aren't very straight forward and it can be quite confusing trying to figure them out as you go. Here's my attempt at clearing things up.

Shapes and Their Parameters

In Doom 3 the shapes available are lines, spheres, boxes, cylinders, cones, planes, gaussian blobs and points. Let's go over each shape and it's parameters. We will use the command initialVelocity in these examples.

Point

Image

...Definition: This shape defines a point in space using x, y and z coordinates.

...Syntax:
Code:
initialVelocity ( shape, x, y, z)

...Example:
Code:
initialVelocity ( point, 0, 0, 0)



Line

Image

...Definition: This shape defines two points in space using separate x, y and z coordinates. Both points form a line.

...Syntax:
Code:
initialVelocity ( shape, x1, y1, z1, x2, y2, z2)

...Example:
Code:
initialVelocity ( line, -10, -10, -10, 10, 10, 10)


Sphere (Does not work as intended)

Image

...Definition: This shape defines a point in space using x, y and z coordinates. Two radius are defined to form two spheres. Particles are spawned between these two spheres.

...Syntax:
Code:
initialVelocity ( shape, x, y, z, r1, r2)

...Example:
Code:
initialVelocity ( sphere, 0, 0, 0, 10, 20)


NOTE: For some reason, even in Id's particle effects, the sphere shape doesn't really draw a sphere at all. Instead it draws a diagonal line.

If you try using it yourself though you see that the parameters do work in the manner posted above, it just doesn't draw a sphere like it suggests. Perhaps it's a bug or the code is incomplete?

Box

Image

...Definition: This shape defines two points in space using x, y and z coordinates. The points represent two opposite corners that are used to form a box.

...Syntax:
Code:
initialVelocity ( shape, x1, y1, z1, x2, y2, z2)

...Example:
Code:
initialVelocity ( box, -10, -10, -10, 10, 10, 10)


Cylinder

Image

...Definition: This shape defines two points in space using x, y and z coordinates. Two radius are defined to form two cylinders. Particles are spawned between these two cylinders.

...Syntax:
Code:
initialVelocity ( shape, x1, y1, z1, x2, y2, z2, r1, r2)

...Example:
Code:
initialVelocity ( cylinder, 0, 0, -30, 0, 0, 30, 30, 60)


Cone

Image

...Definition: This shape defines two points in space using x, y and z coordinates. Two radius are defined to form two cones. Particles are spawned between these two cones.

...Syntax:
Code:
initialVelocity ( shape, x1, y1, z1, x2, y2, z2, r1, r2)

...Example:
Code:
initialVelocity ( cone, 0, 0, -30, 0, 0, 30, 30, 60)


Gaussian Blobs (Does not work as intended)

Image

...Definition: This shape defines two points in space using x, y and z coordinates. Two radius are defined to form two spheres. (At the moment, the game will only accept the parameters for a single point and radius.) These spheres are used to form a blob similar to a nurbs surface.

...Syntax:
Code:
initialVelocity ( shape, x, y, z, r)

...Example:
Code:
initialVelocity ( blob, 0, 0, 0, 20)


NOTE: This shape behaves nothing like the diagram above and the syntax, although correct, cannot possibly form the shape in the diagram.

As you can see from the syntax above, you can only define a single point and radius. This means that if blob was used in this manner it would create a sphere because there are no other points to influence the shape.

I've tried all sorts of things to input a second point and radius but to no avail. The game will reject any blob shape with more than 4 parameters.

This isn't all. Blob can't even draw a sphere correctly. Instead you get a shape like this from a single point.

Image

Again, I'm guessing it's a bug or the code is incomplete.

Plane

Image

...Definition: This shape defines three points in space using x, y and z coordinates. The fourth point is calulated and a plane is formed.

...Syntax:
Code:
initialVelocity ( shape, x1, y1, z1, x2, y2, z2, x3, y3, z3 )

...Example:
Code:
initialVelocity ( plane, 0, 0, -10, 0, 50, -10, 50, 0, -10 )


NOTE: Each successive points' position is in relation to the last point. For instance if the absolute position of point 1 is 0,0,0; point 2 is 0,10,10; and point 3 is 0,10,20; then the parameters would be...

Code:
initialVelocity( plane, 0, 0, 0, 0, 10, 10, 0, 0, 10 )


Conclusion

Hopefully this is enough to familiarize you with the shape parameters and in conjunction with bullet's particle tutorials you should be well on your way to creating unique particle effects.

Comments and critiques are welcome.



bullet@Posted: Sun Jun 20, 2004 6:14 am :
I was thinking of doing one like this, but you did a much better job than I could have with your 3D representations. One thing though: you left out the Gaussian Blob. I have a bunch of notes on the thing laying around here that I could type up if anyone's interested in using it.



rich_is_bored@Posted: Sun Jun 20, 2004 7:00 am :
Gaussian Blob? What?! :?

Is there an example in the alpha or is this a shape you discovered by toying with particle scripts?

Yes, you need to type up your notes or send them to me so I can figure out how to update this. ;)

EDIT: I see your post on Gaussian Blobs and noticed that I left out Cones. Cones have been added and I'll wait on your input before I add blobs since I have no idea what parameters would be passed.



BNA!@Posted: Sun Jun 20, 2004 4:12 pm :
Oh a nice one again rich!

Can't wait to see the fully documented SDK for Doom³ - with the interconnection of scripteable particles, levels, animations and gamelogic one should be able to provide real complex setups in a map.

Just can't wait :)

Edit:
This is the old list of the particle syntax, just in case someone doesn't know where all the database entries are.



7318@Posted: Sun Jun 20, 2004 6:56 pm :
perticles are great, but i feel something missing (ok i know it's an alpha and that there are lots of commands that we just don't know...) i feel that the alpha perticles need a little bit more of randmoness effects, i mean, what would be cool would be that every particle could go to a direction diferent from the other (just to create cloud/smoke efects) and you could have wind and gravoitry efects (i mean something like, gravity1 and gravity2) so the particles could be more complex, or that you could interactuate more with the shader... but, let's see how it evolves to the final build of the game! :)



rich_is_bored@Posted: Sun Jun 20, 2004 9:57 pm :
I've added the section on Gaussian Blobs even though it seems that it does not behave as intended.

I guess the reason the sphere and blob do not work correctly is because we are dealing with the alpha. Hopefully this gets ironed out before the retail release.



rich_is_bored@Posted: Sun Jun 20, 2004 10:46 pm :
Added the section on planes. The parameters are damn confusing on that one. Why did they make all the coordinates relative on this shape yet absolute on the rest of the shapes? It would have been easier if they were all absolute.