Particle Script .PRT

by Christoph Kubisch

Content

Definition

A particlesystem script allows easier setup of particles and defines how they behave. Particles are always drawn last within a scene.

When a script is used, the emitter, or source partile for trails, will hand over following fixed attributes:

Depending on this information the values defined in a script are relative to.

Emitter & Particle must be defined in a script, the rest is optional

Variances are computed as followed:
out = random between [in-variance,in+variance]
Agefx are uint 0-99 = 0%-99% of lifetime
Agetextures are not loaded into resource textures, but only for initialization. If you want to change the values afterwards, use api calls on the particlesystem

The header is necessary
current layout version:
luxinia_ParticleSys_v120

Syntax

All commands are case sensitive and closed by ; or "newline". A keyword and its arguments may not span multiple lines.
<id> ranges from 0 to 7
<vector4> is (float,float,float,float)
<bool> is 1 = true, 0 = false

Branching

You can do branching with following commands. Enclose the branches in curly brackets { }

The condition string can be set from luxinia API with resource.condition, or it may be part of a "define" in the Cg Compiler string.
You can also negate a statement with !<condition string>.
Be aware that the parser is not fully rock solid, so at best use COMMAND{<newline> <what><newline> }<newline> , when problems occur.

Annotations & Comments

You can add annotations anywhere in the file and later query them after load. Anything between the two will become part of the annotation, so use with caution.

// comment until lineend

// multi-line annotation

<<_ "A"    
test = a * b
// this will be part of annotation as well
blahblubb
_>>

/* block commenting ...
<<_ "B"; min=25,max=90 _>>;    
//inlined annotation but ignored, due to active block comment
*/

C-style comments with // and /*...*/ may not start within command & keywords. So start comments always after ; in a line that contains command words.

Content


Example

luxinia_ParticleSys_v110
RenderFlag{
    // this is a comment blah
    blendmode VID_ADD;
    sort;
}

Emitter{
    type VID_POINT;    
    size 10;
    spread (0,45);
    rate 170;
    velocity 30;
    count 100;
    maxoffsetdist 200;
    /*    blockcomment
        ...
    */

}
Particle{
    type VID_POINT;
    size    1;
    life    5000;
}
Texture{
    numtex 2;
    TEX 0    "test0.jpg";
    TEX 50    "test1.jpg";
}

Color{
    numcolor 1;
    RGBA    100 (1.0,0.3,0.3,0.5);
}
Forces{
    gravity 1000 (0.0,-10.0,0.0) 5;
}
SubSystem{
    trail "blubb.prt" 500 VID_DIR 40 100;
} 

Content


RenderFlag

they are applied to all particles and are optional.

Content

Emitter

How the particles are emitted is defined in here. What you define is just the default emitter. During runtime when you create new emitters you can change their type and properties individually.

Mandatory:

Optional

Content

Particle

This defines the appearance of the particle and certain variances to it.

Mandatory

Optional

Age-Based Effects

Content

Color

In here the color of the particles are set. If no color is set default will be white.

Mandatory

Optional

Content

Texture

Same as color, if non is set we assume no texture given textures cannot have texshaders applied, and must all be same size,same format. Mind that depending on graphics card errors can come up with too many squence images.

Mandatory:

Optional

the pixelrow within the texture, in (RGB/RGBA textures R is used)

Content


Forces

Forces influence the particle motion, maximum is 32 forces per system.

There are more force types creatable by Luxinia Api such as

Standard forces:

Optional

Content

SubSystem

With this other particle systems can be generated, maximum 8. The subsystems are drawn as listed after the original system, however if combinedraw flag is set they will get drawn with a single call.

Content

History

1st Draft 20.6.2004
This is just a basic idea about functionality. Depending on how hard it will be to do all, and how fast things can be done, the actual system may change. Also its not sure how the Trail system is done, it may done completely different, ie code uses point emitters from a different particle system.

2nd Draft 21.6.2004
Some more changes, mostly moving variables from code into the script to make them fixed. Also throwing the old trail out and instead added a subsystem of particles that will be loaded and controlled by this system.

3rd Draft 8.6.2004
Minor fiddling with the subsystems, mostly just changing minor stuff. It is yet unsure how force turbulences will look like. The other uncertainty is particles' directions

4th Draft 20.9.2004
subsystems can now be thrown into the same sorted drawlist using "combinedraw" flag

5th Draft 22.9.2004
added particle rotation

6th Draft 27.9.2004
added texture sequence

7th Draft 22.12.2004
vectors are packed in () and separated by ,

8th Draft 13.1.2005
added rotation age effect

9th Draft 28.1.2005
use of VID blendmodes

10th Draft 04.4.2005
added flipdirection percentage

11th Draft 11.6.2005
die on backplane

12th Draft 14.6.2005
added start offset, point sprites, point smoothing and pointparams

14th Draft 10.8.2005
added MATERIAL as texture type

15th Draft 6.9.2005
trails allow any emitter type now

16th Draft 12.11.2005
removed delay in forces, for simplicity / better parallelism

17th Draft 10.3.2006
removed magnets, those are handled by lua

18th Draft 13.3.2006
changed the way forces are dealt with, timed forces are back

19th Draft 4.6.2006
agebased effects can now be read from the texture

20th Draft 14.6.2006
added originoffset vector for billboards

21st Draft 20.6.2006
particle mesh instancing added

22nd Draft 10.8.2006:
added "preprocessor" branching

23rd Draft 11.9.2007:
added layer renderflag

24th Draft 24.1.2008:
proper block commenting with #{ ... #}

25th Draft 23.4.2008:
commenting now in C-Style, along with raised version number // and /* ... */

26th Draft 18.5.2008:
annotation system added

Content