Pages

Saturday, June 19, 2010

Tiny Smoke

So Patti asked me how to make smoke that is tiny and have it look good too. Well I have a stock script I use to base my particles off of. You can see it below. As it is set up now, the script below will produce a tiny smoke plume. They trick to creating tiny particles is using a texture that has been shrunk down, meaning there is only something in the middle and the rest is alpha. The scripted size of particles can only get so small, that is to say I think the smallest they can be is 0.03. Below that and they won't even be rendered.

Below the particle script is a rotation script, you can throw that in the prim or combine it with the top script; it will make the prim rotate.

float maxsysage = 0.0;
float maxspeed = 0.02;
float minspeed = 0.02;
float burstrad = 0.0;
integer burstcount = 20;
float burstrate = 0.01;
float outangle = 0.1;
float inangle = 0.001;
vector omega = <0.0,0.0,0.0>;
vector startcol = <1.0,>;
vector endcol = <.0, 0.0, 0.>;
float startalph = 0.1;
float endalph = 0.00;
vector startscale = <0.04,0.04,0.04>;
vector endscale = <.00,0.00,0.00>;
float maxage = 4.0;
vector accel = <0.0,>;
string texture = "cb722f94-f87a-2a53-e6df-0f5f03ce6f6d";

integer flight;
integer pilot;

ParticlesOn()
{
llParticleSystem([PSYS_PART_FLAGS,
PSYS_PART_INTERP_COLOR_MASK |
PSYS_PART_INTERP_SCALE_MASK |
PSYS_PART_FOLLOW_SRC_MASK |
PSYS_PART_FOLLOW_VELOCITY_MASK |
PSYS_PART_EMISSIVE_MASK,
PSYS_SRC_PATTERN,
PSYS_SRC_PATTERN_ANGLE,
PSYS_PART_START_COLOR, startcol,
PSYS_PART_START_ALPHA, startalph,
PSYS_PART_END_COLOR, endcol,
PSYS_PART_END_ALPHA, endalph,
PSYS_PART_START_SCALE, startscale,
PSYS_PART_END_SCALE, endscale,
PSYS_PART_MAX_AGE, maxage,
PSYS_SRC_ACCEL, accel,
PSYS_SRC_TEXTURE, texture,
PSYS_SRC_BURST_RATE, burstrate,
PSYS_SRC_INNERANGLE, inangle,
PSYS_SRC_OUTERANGLE, outangle,
PSYS_SRC_BURST_PART_COUNT, burstcount,
PSYS_SRC_BURST_RADIUS, burstrad,
PSYS_SRC_BURST_SPEED_MIN, minspeed,
PSYS_SRC_BURST_SPEED_MAX, maxspeed,
PSYS_SRC_MAX_AGE, maxsysage,
PSYS_SRC_OMEGA, omega ]);
}

ParticlesOff()
{
llParticleSystem([PSYS_PART_FLAGS,
PSYS_PART_INTERP_COLOR_MASK |
PSYS_PART_INTERP_SCALE_MASK |
PSYS_PART_FOLLOW_SRC_MASK |
PSYS_PART_FOLLOW_VELOCITY_MASK |
PSYS_PART_EMISSIVE_MASK,
PSYS_SRC_PATTERN,
PSYS_SRC_PATTERN_ANGLE,
PSYS_PART_START_COLOR, startcol,
PSYS_PART_START_ALPHA, startalph,
PSYS_PART_END_COLOR, endcol,
PSYS_PART_END_ALPHA, endalph,
PSYS_PART_START_SCALE, startscale,
PSYS_PART_END_SCALE, endscale,
PSYS_PART_MAX_AGE, 0.01,
PSYS_SRC_ACCEL, accel,
PSYS_SRC_TEXTURE, texture,
PSYS_SRC_BURST_RATE, burstrate,
PSYS_SRC_INNERANGLE, inangle,
PSYS_SRC_OUTERANGLE, outangle,
PSYS_SRC_BURST_PART_COUNT, burstcount,
PSYS_SRC_BURST_RADIUS, burstrad,
PSYS_SRC_BURST_SPEED_MIN, minspeed,
PSYS_SRC_BURST_SPEED_MAX, maxspeed,
PSYS_SRC_MAX_AGE, 0.01,
PSYS_SRC_OMEGA, omega ]);
}

default
{
state_entry()
{
llSetTimerEvent(0.0);
llParticleSystem([]);
ParticlesOn();
}

on_rez(integer sparam)
{
llResetScript();
}

link_message (integer sender, integer num, string msg, key id)
{
if (num == 0 && msg == "flameon")
{
ParticlesOn();
}
if(num == 0 && msg == "flameoff")
{
ParticlesOff();
}
}
}

default
{
state_entry()
{
llTargetOmega(<0,0,1>,PI,0.20);
}

}