Jump to content

I need a particle script that displays a texture


jabeds
 Share

You are about to reply to a thread that has been inactive for 3815 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts


jabeds wrote:

I need  a particle script that displays a texture so that the image shows the same to an avatar from all sides.

Not sure what you mean by that. Particles are simply 2D images that always rendered facing the viewer's camera. So they should appear the same from all sides by default???

Link to comment
Share on other sites

How about this:

default {    state_entry() {        string texture = llGetInventoryName(INVENTORY_TEXTURE, 0);        llParticleSystem([                    PSYS_PART_FLAGS, PSYS_PART_EMISSIVE_MASK,                    PSYS_SRC_PATTERN, 4,                    PSYS_PART_START_ALPHA, 1.0,                    PSYS_PART_END_ALPHA, 1.0,                    PSYS_PART_START_COLOR, <1.0,1.0,1.0>,                   PSYS_PART_END_COLOR, <1.0,1.0,1.0>,                   PSYS_PART_START_SCALE, <1.0, 1.0, .0>,                   PSYS_PART_MAX_AGE, 1.20,                    PSYS_SRC_MAX_AGE, 0.00,                    PSYS_SRC_ACCEL, <0.0,0.0,0.0>,                    PSYS_SRC_ANGLE_BEGIN, 0.00,                    PSYS_SRC_ANGLE_END, 0.00,                    PSYS_SRC_BURST_PART_COUNT, 8,                   PSYS_SRC_BURST_RADIUS, .75,                    PSYS_SRC_BURST_RATE, 0.10,                    PSYS_SRC_BURST_SPEED_MIN, 0.00,                   PSYS_SRC_BURST_SPEED_MAX, 0.00,             PSYS_SRC_OMEGA, <0.00,0.00,0.00>,            PSYS_SRC_TEXTURE, texture            ]);    }    changed(integer c) {        if (c & CHANGED_INVENTORY) llResetScript();    }}

 Put the script together with a texture in some prims inventory.

Link to comment
Share on other sites

In fact, inworld I see that is all you need:

Rez a prim, make it transparent, put this script into it after changing "UUID of texture" to the key of your texture asset.

default{    state_entry()    {        llParticleSystem([            PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_DROP,            PSYS_SRC_TEXTURE, "UUID of texture"            ]);    }}

Does that suit your needs?

Link to comment
Share on other sites

When displaying a static image it is good practice to limit the amount of work peoples' viewers have to do -

PSYS_PART_MAX_AGE, 30.0 <-- then each image particle will last the maximum 30 seconds

PSYS_SRC_BURST_PART_COUNT, 1 <--- and you only need to generate one at a time

PSYS_SRC_BURST_RATE, 29.0 <-- 'just before' the previous one fades out

 

Link to comment
Share on other sites

Peter's recommendations are spot on, and here's how I've done it in the past...

default {    state_entry() {        llParticleSystem([                    PSYS_PART_FLAGS, PSYS_PART_EMISSIVE_MASK,                    PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_DROP,                    PSYS_PART_START_ALPHA, 1,                    PSYS_PART_END_ALPHA, 1,                    PSYS_PART_START_COLOR, <1,1,1>,                   PSYS_PART_END_COLOR, <1,1,1>,                   PSYS_PART_START_SCALE, <1,1,1>,                   PSYS_PART_END_SCALE, <1,1,1>,                   PSYS_PART_MAX_AGE, 30,                    PSYS_SRC_MAX_AGE, 0,                    PSYS_SRC_ACCEL, <0,0,0>,                    PSYS_SRC_ANGLE_BEGIN, 0,                    PSYS_SRC_ANGLE_END, 0,                    PSYS_SRC_BURST_PART_COUNT, 1,                   PSYS_SRC_BURST_RADIUS, 0,                    PSYS_SRC_BURST_RATE, 29,                    PSYS_SRC_BURST_SPEED_MIN, 0,                   PSYS_SRC_BURST_SPEED_MAX, 0,             PSYS_SRC_OMEGA, <0,0,0>,            PSYS_SRC_TEXTURE, llGetInventoryName(INVENTORY_TEXTURE, 0)            ]);    }}

You must be careful about your choice of particle texture. Anything with translucency (a pixel alpha value that's not zero or 255) will reveal the trick, as at the 29 second mark, you'll have two copies of the texture overlaying each other. The result will be that, for one second, the translucent pixels will be twice was opaque as for the other 29. You may not notice this around the antialiased edges of an opaque thing on a transparent background, but it'll be very obvious for almost anything else.

ETA: Internal upscaling of low resolution textures might exacerbate this effect.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3815 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...