Jump to content

[Question] Particle Rendering Quirks


RespectableCow
 Share

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

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

Recommended Posts

So, it seems like particles from llParticleSystem are only rendered when the client camera is within 4m of the emitter. My question is: What? That can't be right. Right?

I'm trying to develop a way to simulate hanging wires. I was given the brilliant suggestion to use the particle system with a ribbon mask. It's a great setup, because a target position mask combined with a drop pattern (and a little negative acceleration) generates a very nice curve that is low LI while remaining highly scalable and configurable. The only issue is making sure to manage particle count. Oh, and that you need to be practically eating it with your camera to render it out!

Again, that can't be right. While I feel like I remember plenty of times where I have witnessed particle effects from much farther than 4 paltry meters, that limited range doesn't make sense for much of anything. Water feature? Only if you're swimming in it. Fireworks? Better be strapped to them. Tire tracks? Not without getting run over first. And yet, 100%, absolutely, I see my particles disappear when I move my camera more than 4m away from them. Another scripter reported the same behavior on their end. I tested this on SL Viewer 6_6_16_6566955269 (non-PBR) and Alchemy's 7_0_1_2198 (PBR) and experienced no change in behavior. On LL's Viewer, I bumped up all the graphics settings (including particle count and draw distance) to maximum and experienced no change in behavior. I performed some script tests, too, to see if it perhaps related to a specific mask or pattern being used, but it doesn't seem like it to me. However, I'm not a real programmer, so those tests were in no way exhaustive or conclusive.

Has this always been a thing? I can't imagine it has. I recall a few years ago that a scripter working on a HUD was using the particle system to display certain HUD elements over a wearer's head for others to see. Think of it like if you had a scripted poker game, and when you showed your hand it displayed your cards over your head as particles. It wasn't that, but it was basically that. There is no way that had a 4m range back then. That wouldn't have been useable, and we used that feature often. There has to be something me and the others are missing. Does anyone know what's going on?

image.png

Link to comment
Share on other sites

Particles are culled based on their size, and even if ribbon particles discard their Y-size during rendering, it's still a part of the equation.

If I render a ribbon particle between two things with its size set to the minimum <0.03125, 0.03125, 0>, they disappear just a couple meters away. If I set them to <0.03125, 1, 0> instead, they stay visible until roughly the distance they reach 1 pixel size.

  • Thanks 2
Link to comment
Share on other sites

Additionally, emitter size also plays a factor. If the emitter prim is so small that it gets culled, so too will the particles it produces.

But the solution here is as Frionil suggests: increase the particle size. Since you're using a ribbon, you can ramp of the Y size without visually affecting the ribbon. A value of 5.0 will make it visible out to a considerable distance (from my very quick test).

In cases where you aren't using ribbons, the other option would be to use a particle texture that has its edges padded with empty/transparent space. That would create the illusion of a smaller particle.

Amusing tangent: when I opened this thread the original post appeared with a forum timestamp of "7 minutes ago" while Frionil's response appeared with a timestamp of "2 hours ago". Thanks daylight savings!

Edited by Fenix Eldritch
  • Thanks 3
Link to comment
Share on other sites

6 hours ago, Frionil Fang said:

Particles are culled based on their size, and even if ribbon particles discard their Y-size during rendering, it's still a part of the equation.

If I render a ribbon particle between two things with its size set to the minimum <0.03125, 0.03125, 0>, they disappear just a couple meters away. If I set them to <0.03125, 1, 0> instead, they stay visible until roughly the distance they reach 1 pixel size.

This is exactly it! And as @Fenix Eldritch writes, the particle size in those other scenarios is the reason my other 'tests' also showed the particles disappearing. I am so glad I'm not going crazy or switched realities into the 4m particle range universe!

The reason that I thought this behavior was normal and unavoidable is because the LSL Wiki says this about PSYS_PART_RIBBON_MASK:

Quote

Particle textures are stretched (or squeezed) to join their right edges to their predecessor's left. Ribbon 'width' is controlled by the 'x' values of start and end scale. (The 'y' values are ignored. The distance between particles controls the 'length' of each ribbon segment).

Bold added. "Ignored" has a strong meaning, here. My assumption was that no input in the Y value of the supplied vector would be read, at all. In truth, it seems that the Y value is ignored specifically regarding the width in a very visual sense, but it is definitely not ignored by the client's rendering code. When I tested other masks without ribbon, I did supply a 1k particle for science, but either I had incorrect assumptions about the default size, or I forgot to comment out the PSYS_PART_START_SCALE.

The Wiki has been an awful jumping in point for someone like me who has never used particles, but I'm still surprised behavior like this went unmentioned, unless it did, but I don't yet understand where it said that.

Either way, thank you both for the good answers and thank goodness there were some and they were easy!

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

5 hours ago, RespectableCow said:

The Wiki has been an awful jumping in point for someone like me who has never used particles, but I'm still surprised behavior like this went unmentioned, unless it did, but I don't yet understand where it said that.

I didn't actually see mention of particle size culling at all on the wiki, so I added a caveat. Also changed the wording on the ribbon Y-size being ignored.

To be honest it was news to me too until today but kind of makes sense (if the ribbon particles were to use their actual size for culling they wouldn't be consistent, lower framerates would make them visible for longer distances, they'd start flickering near the culling limit since not every segment ends up the exact same length, etc.)

  • Thanks 1
Link to comment
Share on other sites

  • 2 weeks later...

Since reading this thread I was having a play with ribbon particles, and now I have a question :)

So I made a thing on a string, where the thing moves around fairly quickly, while anchored to a fairly static thing (me). I set ribbon with a target by uuid of the moving thing.

With PSYS_PART_TARGET_LINEAR_MASK set it is a very tight string which is ok, but I would rather have a little sag in it.

So I have been trying out PSYS_PART_TARGET_POS_MASK which does give that kind of effect, but it is too slow to keep up with the moving object so it looks a bit like crazy elastic chasing the object. I have been tinkering with the other stuff and watching the effect, but can't find settings that targets the position a bit more efficiently.

So I wondered what am I missing, or is target pos mask just not meant to be speedy?

Link to comment
Share on other sites

38 minutes ago, Atomic Infinity said:

So I wondered what am I missing, or is target pos mask just not meant to be speedy?

If possible, I would have the speedy thing emit the particles, a short PSYS_PART_MAX_AGE and a relatively low PSYS_SRC_BURST_RATE (lower is better visuals, worse performance hit on observers)

  • Thanks 2
Link to comment
Share on other sites

Got any hints for the setting to stop the ribbon flickering at the target?

Wiki says it joins the particles at their edges, but I can't seem to get the last particle to actually hold steady at the target so its like the string is flickering for the last half metre. I have tried more/less particles, more/less burst rate, more/less age, but am not getting anywhere :(

edit : the target is closest to me, so it's not culling by distance or size

Edited by Atomic Infinity
Link to comment
Share on other sites

27 minutes ago, Atomic Infinity said:

Got any hints for the setting to stop the ribbon flickering at the target?

Wiki says it joins the particles at their edges, but I can't seem to get the last particle to actually hold steady at the target so its like the string is flickering for the last half metre. I have tried more/less particles, more/less burst rate, more/less age, but am not getting anywhere :(

edit : the target is closest to me, so it's not culling by distance or size

The flickering you see is caused by the behavior described in the wiki.

Ribbon particles are always connected to each other, regardless of distance. The last/oldest particle, which has arrived at the target, is only connected to the particle that will come after it. When its lifetime ends, the ribbon "chain" gets shorter because one particle has been removed. More burst rate and lifetime helps, but the flickering section grows with distance.

One solution would be to use two particle systems, going both ways. That way the flickering is hidden by the other ribbon chain.

Another solution might be getting LL/TPVs to change how ribbon particles are rendered, so that the oldest particle is also attached to the target, similar to the newest particle. That would probably cause a straight line between the source/target until enough time has passed for the particles to travel their actual path.

Edited by Wulfie Reanimator
  • Thanks 2
Link to comment
Share on other sites

2 hours ago, Atomic Infinity said:

Got any hints for the setting to stop the ribbon flickering at the target?

Wiki says it joins the particles at their edges, but I can't seem to get the last particle to actually hold steady at the target so its like the string is flickering for the last half metre. I have tried more/less particles, more/less burst rate, more/less age, but am not getting anywhere :(

edit : the target is closest to me, so it's not culling by distance or size

I just hid the flickering bit inside another prim.

Like @Wulfie Reanimator said, the flickering is caused by the last ribbon in the chain dying. Even though you say it doesn't help, it seemed to me that using more particles reduces the flicker, because it shortens the length of each segment, so the segment dying is less visible.

However, I still found that the speed of the particles (being derived from their lifespan over the distance in their path to the target, as opposed to particle "speed" or velocity) has the most noticeable effect. Keep in mind that if you are using a target mask, the particles will travel from the emitter to the target by the end of their life, so particles with a shorter lifespan travel faster to compensate. I was able to get a steady ribbon of particles with a ribbon distance of probably 10m with a lifespan of ~5s. But if my ribbon was 50m, for instance, I would theoretically need 500% more particles to get the same effect, otherwise, my segments would get longer, and their deaths would therefore be much easier to spot.

Another potential solution, which I haven't yet tried, is using an interpolation scale mask (PSYS_PART_INTERP_SCALE_MASK) and setting the end scale X value to some non-zero number, perhaps close to the start scale values. In theory, that should make the end of the ribbon blocky instead of coming to a point and might disguise some of the flicker from the particle shrinking while dying. However, I'm not sure if that will have any effect on a ribbon particle.

Edited by RespectableCow
  • Thanks 1
Link to comment
Share on other sites

56 minutes ago, RespectableCow said:

The reason I bring this up is because if the particle system is biased (I don't know if it is or not) toward lifespan and burst count, for instance, it may override the values for speed and size.

Using TARGET_POS_MASK or TARGET_LINEAR_MASK is pretty straightforward: the particles reach their destination object in exactly the number of seconds of their lifetime. Size and velocities do not matter (and ribbon particle size doesn't matter for segment length in the first place); if they're diverted from their path by velocity, they will just move faster towards the target.

Since the last segment dies when it reaches the target, that causes the flicker, and the only particle setting that directly affects the amount of flickering is the lifetime. Beyond that, shortening the distance or making sure the particles have as little velocity as possible when reaching the target (not having the target move, less gravity or no wind, etc.) are the only options.

Edited by Frionil Fang
more specific
  • Thanks 1
Link to comment
Share on other sites

2 minutes ago, Frionil Fang said:

Using TARGET_POS_MASK or TARGET_LINEAR_MASK is pretty straightforward: the particles reach their destination object in exactly the number of seconds of their lifetime. Size and velocities do not matter (and ribbon particle size doesn't matter for segment length in the first place); if they're diverted from their path by velocity, they will just move faster towards the target.

Since the last segment dies when it reaches the target, that causes the flicker, and the only thing that affects the amount of flickering is the lifetime.

Good to know!

I edited that whole part out of my post, because I realized like you just said that the 'length' of the ribbon isn't affected by the X scale, but rather it controls the 'thickness'. I didn't want to bother refactoring my logic to reflect that when the rest of it was probably wrong, anyway, so I just snipped it.

Link to comment
Share on other sites

Thanks all for the details - it is making more sense to me now too :)

Changing speed and rates was making differences to my flickering but I guess it may well come down to a mix with my viewer frame rate as well at some point.

My best looking static ribbon is indeed with a long particle lifespan, so now I get it that this puts more particles in the line, and as such the last particle is smaller to minimize flicker. 👍

Though with lots of particles in the ribbon, I then come back to target pos mask having a lot of 'slack', so maybe I will need to linear mask instead, to cope with the speed my object goes.

 

I am not in-world to try it, but would it be correct to say this about a targeted ribbon?

(burst count / burst rate) * max age  =  number of particles in the ribbon

distance in metres to travel / max age = speed of particles in m/s

Edited by Atomic Infinity
extra question :)
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 210 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...