Ribbon Particles in Second Life

These have been the works for some time. The server side was completed earlier this year. The Wiki was updated in the spring. But, we have not had a viewer that could display the particles. That is about to change. We should get a RC Viewer tomorrow, Friday. And as usual that might not happen.

Server Beta Meeting 2013-37 - Particle Demo Object

Server Beta Meeting 2013-37 – Particle Demo Object

Or you can go here now: Ribbon Viewer. If you choose to get and use this viewer, turn off all automatic updates. And leave them turned off until you reinstall the main viewer. This means if you have the main viewer installed, disable ‘willing to RC’ and auto-update. Then install this viewer.

Realize you will most likely break your current install pipeline until you do a default install of an RC or the main viewer. So, install at your risk.

This version is not likely to be up to date with other viewer updates and fixes. It is very likely behind. So, if you do try it out, get the RC version from the pipeline tomorrow.

Do NOT call support if you are using this viewer!!!

There is new particle stuff coming along with ribbons. Part of the new stuff is particle glow. Maestro Linden says, “The new particle glow options are pretty simple; if you look at the wiki page, we’ve just added PSYS_PART_START_GLOW and PSYS_PART_END_GLOW, which take a float in the 0.0 to 1.0 range.

It basically looks the same as the prim glow setting on prims.

I have not gotten to play with these particles yet. I just downloaded the viewer and haven’t even gotten it installed. I’m giving you what was discussed at the Server Beta user group meeting today. You can stumble your way through at the same time I am stumbling along.

Ribbons

As Maestro explained, “Basically the server was just set to understand the PSYS_PART_RIBBON_MASK’ constant and allow storing it as a particle system parameter.” This is why the server side of the feature was completed long ago. There just wasn’t a whole lot to that part.

Particle Demo Object

Particle Demo Object

However, on the view side new render stuff had to be added to take advantage of OpenGL’s particle/sprite features. For instance the viewer needs Linden Scripting Language (LSL) functions so users can enable the particles.

Also, there is some things that had to be changed to allow the particles to be rendered. I think these particles do NOT work if you have the basic shaders disabled. Is there anyone running without the shaders?

Maestro says, “The ‘ribbon’ effect is really cool too. it’s implemented as one of the PSYS_PART_FLAGS, PSYS_PART_RIBBON_MASK.

They can blend!”

DEmoObj2_001

Particle Demo as seen via Ribbon Particle Viewer

If you look at the ‘Particle Blending’ section of the LSL function llParticleSystem() Notes you’ll see that Maestro has tried to paraphrase OpenGL documentation. See the main  glBlendFunc documentation at http://www.opengl.org/sdk/docs/man/xhtml/glBlendFunc.xml  for a technical insight to particle blending settings. This is not for the non-techie. Getting this figured out and working is where we are now. Tutorials will come later.

Particle blending takes 2 parameters, PSYS_PART_BLEND_FUNC_SOURCE and PSYS_PART_BLEND_FUNC_DEST and each of those takes one of the 8 ‘values’ listed underneath. So there are actually 8*8 = 64 blend options!

Maetro says, “…you can do crazy things like have particles invert the thing behind it.” I think that means color invert rather than turn upside down. But, I’m not sure.

Maestro gave us the DEMO object that they used for testing during development. It is a stack of two columns of cubes spaced out vertically. The object includes a script shown here:

list validBFOptions = [
"PSYS_PART_BF_ONE", PSYS_PART_BF_ONE,
"PSYS_PART_BF_ZERO", PSYS_PART_BF_ZERO,
"PSYS_PART_BF_DEST_COLOR", PSYS_PART_BF_DEST_COLOR,
"PSYS_PART_BF_SOURCE_COLOR", PSYS_PART_BF_SOURCE_COLOR,
"PSYS_PART_BF_ONE_MINUS_DEST_COLOR", PSYS_PART_BF_ONE_MINUS_DEST_COLOR,
"PSYS_PART_BF_ONE_MINUS_SOURCE_COLOR", PSYS_PART_BF_ONE_MINUS_SOURCE_COLOR,
"PSYS_PART_BF_SOURCE_ALPHA", PSYS_PART_BF_SOURCE_ALPHA,
"PSYS_PART_BF_ONE_MINUS_SOURCE_ALPHA", PSYS_PART_BF_ONE_MINUS_SOURCE_ALPHA
];

integer curSourceOpt = PSYS_PART_BF_ONE;
integer curDestOpt = PSYS_PART_BF_ONE;
integer curSourceLink;
integer curDestLink;

default
{

state_entry()
   {
   integer necessary_prim_count = 1 + llGetListLength(validBFOptions);
   if(llGetNumberOfPrims() < necessary_prim_count)
      {
      llSay(0, "Error: need at least " + (string)necessary_prim_count + " prims.");
      return;
      }
   llSetAlpha(0.0, ALL_SIDES);
   integer i;
   // prims for PSYS_PART_BLEND_FUNC_SOURCE controls
   for(i = 0; i < llGetListLength(validBFOptions); i += 2)
      {
      string label = llList2String(validBFOptions, i);
      llSetLinkPrimitiveParamsFast(i/2 + 2, [PRIM_POSITION, <-1, 0, i/4.0>,
         PRIM_SIZE, <0.2, 0.2, 0.2>, PRIM_COLOR, ALL_SIDES, <0,1,0>, 1.0,
         PRIM_ROTATION, ZERO_ROTATION, PRIM_GLOW, ALL_SIDES, 0.0,
         PRIM_NAME, llList2CSV([label, llList2Integer(validBFOptions,i + 1), "S"]),
         PRIM_TEXT, label, <0,1,0>, 1.0
      ]);

   if(i == 0)
      {
      curSourceLink = i/2 + 2;
      llSetLinkPrimitiveParamsFast(curSourceLink, [PRIM_GLOW, ALL_SIDES, 1.0]);
      }
   }
// prims for PSYS_PART_BLEND_FUNC_DEST controls
   for(i = 0; i < llGetListLength(validBFOptions); i += 2)
      {
      string label = llList2String(validBFOptions, i);
      llSetLinkPrimitiveParamsFast(i/2 + 2 + llGetListLength(validBFOptions)/2,
         [PRIM_POSITION, <1, 0, i/4.0>,
         PRIM_SIZE, <0.2, 0.2, 0.2>, PRIM_COLOR, ALL_SIDES, <1,0,0>, 1.0,
         PRIM_ROTATION, ZERO_ROTATION, PRIM_GLOW, ALL_SIDES, 0.0,
         PRIM_NAME, llList2CSV([label, llList2Integer(validBFOptions,i + 1), "D"]),
         PRIM_TEXT, label, <1,0,0>, 1.0
      ]);

   if(i == 0)
      {
      curDestLink = i/2 + 2 + llGetListLength(validBFOptions)/2;
      llSetLinkPrimitiveParamsFast(curDestLink, [PRIM_GLOW, ALL_SIDES, 1.0]);
      }
   }

   llSay(0, "Touch to tweak particle parameters.");
   }

   touch_start(integer total_number)
      {
      integer link = llDetectedLinkNumber(0);
      if(link != LINK_ROOT)
         {
         list linkParse = llCSV2List(llGetLinkName(link));
         string linkType = llList2String(linkParse, 2);
         integer newBFValue = llList2Integer(linkParse, 1);
         if(linkType == "S")
            {
            llSetLinkPrimitiveParamsFast(curSourceLink, [PRIM_GLOW, ALL_SIDES, 0.0]);
            curSourceLink = link;
            llSetLinkPrimitiveParamsFast(curSourceLink, [PRIM_GLOW, ALL_SIDES, 1.0]);
            curSourceOpt = newBFValue;
            }
         else if(linkType == "D")
            {
            llSetLinkPrimitiveParamsFast(curDestLink, [PRIM_GLOW, ALL_SIDES, 0.0]);
            curDestLink = link;
            llSetLinkPrimitiveParamsFast(curDestLink, [PRIM_GLOW, ALL_SIDES, 1.0]);
            curDestOpt = newBFValue;
            }
         }

      llParticleSystem([
         PSYS_SRC_TEXTURE, "5521c74f-bd37-e88e-1180-e94b0dd22db2",
         PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_EXPLODE,
         PSYS_PART_BLEND_FUNC_SOURCE, curSourceOpt,
         PSYS_PART_BLEND_FUNC_DEST, curDestOpt
         ]);

      llSay(0, "New particle system:"
      + "\nPSYS_PART_BLEND_FUNC_SOURCE = " + llList2String(validBFOptions, llListFindList(validBFOptions, [curSourceOpt]) - 1)
      + "\nPSYS_PART_BLEND_FUNC_DEST = " + llList2String(validBFOptions, llListFindList(validBFOptions, [curDestOpt]) - 1)
      );
   }
}

You can get a full perm working copy of the demo object here. I don’t guarantee how long it will be there. When it annoys me enough I’ll remove it.

If you touch one of the green boxes, you set the PSYS_PART_BLEND_FUNC_SOURCE  setting and the red boxes correspond to the PSYS_PART_BLEND_FUNC_DEST  setting. All the results will look the same unless you have a viewer that supports it.

Meastro explains, “Some of the combinations are somewhat silly, For example, if both _SOURCE and _DEST are set to PSYS_PART_BF_ZERO, then the result will always be solid black.”

Meastro’s test viewer has syntax highlighting for these new particle parameters. So checking for syntax highlighting might be a good litmus test for a Ribbon Particle capable viewer.

Maestro recommends using the drop pattern when first playing with ribbon particles. ‘Explode’ looks bad with ribbons.

Maestro thinks ribbon particles will be really nice for things like vapor trails or you can do cool effects like a ‘swoosh’ when you swing a sword. See image. You could fake a ‘rope’ between the points pretty easily. Maestro thinks it would be like the current state-of-the-art particle ropes/chains in SL, except there would be no gap between particles in the stream.

Early adopters will be playing with these new particles this weekend.

4 thoughts on “Ribbon Particles in Second Life

  1. Some TPVs will add it in fast, others see stability as being more important. I urge content creators not to use these until all viewers have them.

    I know that won’t stop you, but like with the botched materials rollout where people were making things to sell before the Lindens wven finished it. Don’t.

    Triage on bug lists will be EXTRA low.

  2. Pingback: Second Life Bits 2015 Week 11 | Nalates' Things & Stuff

Leave a Reply

Your email address will not be published. Required fields are marked *