Jump to content
Sign in to follow this  
catyp

Particle Z-Ordering?

Recommended Posts

The picture says it all, but I'll try to explain.

I'm trying to get all particles for a particle effect sorted according to their depth regardless of which emitter they come from. It's easy to sort them within a given emitter, so in the picture below all the green particles are in the right order relative to other green particles. However the z-buffer seems to render all particles from e.g. emitter_green below all particles from e.g. emitter_yellow, regardless of which particles are actually closer to the camera. Switching the emitters' order in the list, or changing the sort bias of their materials, changes which emitter is always on top, but the particles still aren't sorted by depth when emitters overlap.

So my question is: is it possible to get all the particles sorted properly, and if so how?

nn67.jpg

P.S. I think it might be possible to make a (better) rainbow by just copying the tire track code, but I've come across the particle order thing a couple of times now so I got curious :-)

Share this post


Link to post
Share on other sites

Hi, yes, if you select SORT then they should order correctly, though it is slightly more intensive, so keep that in mind :)

You'll find the checkbox right next to where you select the particle texture.

If you need any more help, surely let me know!

Share this post


Link to post
Share on other sites

Hi, sorry I should have been clearer. I have tried the "sort" checkbox but it doesn't seem to do what I want. If I check "sort" on all of the emitters that still doesn't completely sort all the particles. Any ideas?

This is what I'm getting:

pj9f.jpg

Share this post


Link to post
Share on other sites

Hmm, sorry but I'm not quite sure I understood the problem from the images with all the ticks and crosses. Could you please explain what the problem is in each image? Sorry, just not catching on :)

By the way, if you send me the contents of the particle in a code tag here, I will be able to directly view it here. Simply open it in a text editor and copy/past the entire contents.

Share this post


Link to post
Share on other sites

The short answer:

The bottom right image is behaving unexpectedly.

The long answer:

In the top two images sorting is turned off and the particles are not sorted. This makes sense.

In the bottom two images sorting is turned on, but the particles are only sorted if you look at them from a certain angle. If you look at them from the wrong angle (bottom right image) they aren't sorted properly, even though the "sort" checkbox is checked. I.e. the bottom right image should be perfectly sorted like the bottom left image, but it isn't.

Here's the .ptc file, anyway. Hopefully you can spot where I'm going wrong.

VelAffection        "0"


$EmitorDef          "Rainbow Red"
Shader              "particle/misc/dot"
ShapeType           "0"
ShapeSize           "0 0 0"
Offset              "-3.2 -12 -14"
Angles              "180 0 0"
ConeAngle           "360 0 0"
Velocity            "1.5"
VelocityRND         "0"
RotMultiplier       "0"
SizeMultiplier      "6.5"
StretchMultiplier   "1"
RandomRotDir        "0"
RandomAngle         "1"
VelAngle            "0"
Restitution         "-1"
LifetimeShortening  "0"
Sort                "1"
Wind                "0"
AirResistance       "0"
AirResistanceRND    "0"
GravityMultiply     "0"
GravityMultiplyRND  "0"
LOD                 "0"
MaxNum              "1100"
BirthRate           "55"
BirthRateRND        "0"
BirthRateVel        "0"
LifeTime            "2"
LifeTimeRND         "0"
LifetimeByAnim      "0"
AnimOnce            "0"
RandFrame           "0"
AnimFPS             "0"
PointSprites        "0"
EffectTime          "10"
Repeat              "1"
Spring              "0"


ColorR 2
0.000000 1.000000
1.000000 1.000000

ColorG 2
0.000000 0.000000
1.000000 0.000000

ColorB 2
0.000000 0.000000
1.000000 0.000000

Alpha 2
0.000000 1.000000
1.000000 1.000000

RotationSpeed 2
0.000000 0.000000
1.000000 0.000000

Size 2
0.000000 1.000000
1.000000 1.000000

ColorRMast 2
0.000000 1.000000
1.000000 1.000000

ColorGMast 2
0.000000 1.000000
1.000000 1.000000

ColorBMast 2
0.000000 1.000000
1.000000 1.000000

AlphaMast 2
0.000000 1.000000
1.000000 1.000000

RotationSpeedMast 2
0.000000 1.000000
1.000000 1.000000

SizeMast 2
0.000000 1.000000
1.000000 1.000000

BRateMast 2
0.000000 1.000000
1.000000 1.000000


$EmitorDef          "Rainbow Orange"
Shader              "particle/misc/dot"
ShapeType           "0"
ShapeSize           "0 0 0"
Offset              "-3.2 -8 -14"
Angles              "180 0 0"
ConeAngle           "360 0 0"
Velocity            "1.5"
VelocityRND         "0"
RotMultiplier       "0"
SizeMultiplier      "6.5"
StretchMultiplier   "1"
RandomRotDir        "0"
RandomAngle         "1"
VelAngle            "0"
Restitution         "-1"
LifetimeShortening  "0"
Sort                "1"
Wind                "0"
AirResistance       "0"
AirResistanceRND    "0"
GravityMultiply     "0"
GravityMultiplyRND  "0"
LOD                 "0"
MaxNum              "1100"
BirthRate           "55"
BirthRateRND        "0"
BirthRateVel        "0"
LifeTime            "2"
LifeTimeRND         "0"
LifetimeByAnim      "0"
AnimOnce            "0"
RandFrame           "0"
AnimFPS             "0"
PointSprites        "0"
EffectTime          "10"
Repeat              "1"
Spring              "0"


ColorR 2
0.000000 1.000000
1.000000 1.000000

ColorG 2
0.000000 0.492754
1.000000 0.492754

ColorB 2
0.000000 0.000000
1.000000 0.000000

Alpha 2
0.000000 1.000000
1.000000 1.000000

RotationSpeed 2
0.000000 0.000000
1.000000 0.000000

Size 2
0.000000 1.000000
1.000000 1.000000

ColorRMast 2
0.000000 1.000000
1.000000 1.000000

ColorGMast 2
0.000000 1.000000
1.000000 1.000000

ColorBMast 2
0.000000 1.000000
1.000000 1.000000

AlphaMast 2
0.000000 1.000000
1.000000 1.000000

RotationSpeedMast 2
0.000000 1.000000
1.000000 1.000000

SizeMast 2
0.000000 1.000000
1.000000 1.000000

BRateMast 2
0.000000 1.000000
1.000000 1.000000


$EmitorDef          "Rainbow Yellow"
Shader              "particle/misc/dot"
ShapeType           "0"
ShapeSize           "0 0 0"
Offset              "-3.2 -4 -14"
Angles              "180 0 0"
ConeAngle           "360 0 0"
Velocity            "1.5"
VelocityRND         "0"
RotMultiplier       "0"
SizeMultiplier      "6.5"
StretchMultiplier   "1"
RandomRotDir        "0"
RandomAngle         "1"
VelAngle            "0"
Restitution         "-1"
LifetimeShortening  "0"
Sort                "1"
Wind                "0"
AirResistance       "0"
AirResistanceRND    "0"
GravityMultiply     "0"
GravityMultiplyRND  "0"
LOD                 "0"
MaxNum              "1100"
BirthRate           "55"
BirthRateRND        "0"
BirthRateVel        "0"
LifeTime            "2"
LifeTimeRND         "0"
LifetimeByAnim      "0"
AnimOnce            "0"
RandFrame           "0"
AnimFPS             "0"
PointSprites        "0"
EffectTime          "10"
Repeat              "1"
Spring              "0"


ColorR 2
0.000000 1.000000
1.000000 1.000000

ColorG 2
0.000000 1.000000
1.000000 1.000000

ColorB 2
0.000000 0.000000
1.000000 0.000000

Alpha 2
0.000000 1.000000
1.000000 1.000000

RotationSpeed 2
0.000000 0.000000
1.000000 0.000000

Size 2
0.000000 1.000000
1.000000 1.000000

ColorRMast 2
0.000000 1.000000
1.000000 1.000000

ColorGMast 2
0.000000 1.000000
1.000000 1.000000

ColorBMast 2
0.000000 1.000000
1.000000 1.000000

AlphaMast 2
0.000000 1.000000
1.000000 1.000000

RotationSpeedMast 2
0.000000 1.000000
1.000000 1.000000

SizeMast 2
0.000000 1.000000
1.000000 1.000000

BRateMast 2
0.000000 1.000000
1.000000 1.000000


$EmitorDef          "Rainbow Green"
Shader              "particle/misc/dot"
ShapeType           "0"
ShapeSize           "0 0 0"
Offset              "-3.2 0 -14"
Angles              "180 0 0"
ConeAngle           "360 0 0"
Velocity            "1.5"
VelocityRND         "0"
RotMultiplier       "0"
SizeMultiplier      "6.5"
StretchMultiplier   "1"
RandomRotDir        "0"
RandomAngle         "1"
VelAngle            "0"
Restitution         "-1"
LifetimeShortening  "0"
Sort                "1"
Wind                "0"
AirResistance       "0"
AirResistanceRND    "0"
GravityMultiply     "0"
GravityMultiplyRND  "0"
LOD                 "0"
MaxNum              "1100"
BirthRate           "55"
BirthRateRND        "0"
BirthRateVel        "0"
LifeTime            "2"
LifeTimeRND         "0"
LifetimeByAnim      "0"
AnimOnce            "0"
RandFrame           "0"
AnimFPS             "0"
PointSprites        "0"
EffectTime          "10"
Repeat              "1"
Spring              "0"


ColorR 2
0.000000 0.000000
1.000000 0.000000

ColorG 2
0.000000 1.000000
1.000000 1.000000

ColorB 2
0.000000 0.000000
1.000000 0.000000

Alpha 2
0.000000 1.000000
1.000000 1.000000

RotationSpeed 2
0.000000 0.000000
1.000000 0.000000

Size 2
0.000000 1.000000
1.000000 1.000000

ColorRMast 2
0.000000 1.000000
1.000000 1.000000

ColorGMast 2
0.000000 1.000000
1.000000 1.000000

ColorBMast 2
0.000000 1.000000
1.000000 1.000000

AlphaMast 2
0.000000 1.000000
1.000000 1.000000

RotationSpeedMast 2
0.000000 1.000000
1.000000 1.000000

SizeMast 2
0.000000 1.000000
1.000000 1.000000

BRateMast 2
0.000000 1.000000
1.000000 1.000000


$EmitorDef          "Rainbow Blue"
Shader              "particle/misc/dot"
ShapeType           "0"
ShapeSize           "0 0 0"
Offset              "-3.2 4 -14"
Angles              "180 0 0"
ConeAngle           "360 0 0"
Velocity            "1.5"
VelocityRND         "0"
RotMultiplier       "0"
SizeMultiplier      "6.5"
StretchMultiplier   "1"
RandomRotDir        "0"
RandomAngle         "1"
VelAngle            "0"
Restitution         "-1"
LifetimeShortening  "0"
Sort                "1"
Wind                "0"
AirResistance       "0"
AirResistanceRND    "0"
GravityMultiply     "0"
GravityMultiplyRND  "0"
LOD                 "0"
MaxNum              "1100"
BirthRate           "55"
BirthRateRND        "0"
BirthRateVel        "0"
LifeTime            "2"
LifeTimeRND         "0"
LifetimeByAnim      "0"
AnimOnce            "0"
RandFrame           "0"
AnimFPS             "0"
PointSprites        "0"
EffectTime          "10"
Repeat              "1"
Spring              "0"


ColorR 2
0.000000 0.079710
1.000000 0.079710

ColorG 2
0.000000 0.079710
1.000000 0.079710

ColorB 2
0.000000 1.000000
1.000000 1.000000

Alpha 2
0.000000 1.000000
1.000000 1.000000

RotationSpeed 2
0.000000 0.000000
1.000000 0.000000

Size 2
0.000000 1.000000
1.000000 1.000000

ColorRMast 2
0.000000 1.000000
1.000000 1.000000

ColorGMast 2
0.000000 1.000000
1.000000 1.000000

ColorBMast 2
0.000000 1.000000
1.000000 1.000000

AlphaMast 2
0.000000 1.000000
1.000000 1.000000

RotationSpeedMast 2
0.000000 1.000000
1.000000 1.000000

SizeMast 2
0.000000 1.000000
1.000000 1.000000

BRateMast 2
0.000000 1.000000
1.000000 1.000000


$EmitorDef          "Rainbow Indigo"
Shader              "particle/misc/dot"
ShapeType           "0"
ShapeSize           "0 0 0"
Offset              "-3.2 8 -14"
Angles              "180 0 0"
ConeAngle           "360 0 0"
Velocity            "1.5"
VelocityRND         "0"
RotMultiplier       "0"
SizeMultiplier      "6.5"
StretchMultiplier   "1"
RandomRotDir        "0"
RandomAngle         "1"
VelAngle            "0"
Restitution         "-1"
LifetimeShortening  "0"
Sort                "1"
Wind                "0"
AirResistance       "0"
AirResistanceRND    "0"
GravityMultiply     "0"
GravityMultiplyRND  "0"
LOD                 "0"
MaxNum              "1100"
BirthRate           "55"
BirthRateRND        "0"
BirthRateVel        "0"
LifeTime            "2"
LifeTimeRND         "0"
LifetimeByAnim      "0"
AnimOnce            "0"
RandFrame           "0"
AnimFPS             "0"
PointSprites        "0"
EffectTime          "10"
Repeat              "1"
Spring              "0"


ColorR 2
0.000000 0.246377
1.000000 0.253623

ColorG 2
0.000000 0.000000
1.000000 0.000000

ColorB 2
0.000000 1.000000
1.000000 1.000000

Alpha 2
0.000000 1.000000
1.000000 1.000000

RotationSpeed 2
0.000000 0.000000
1.000000 0.000000

Size 2
0.000000 1.000000
1.000000 1.000000

ColorRMast 2
0.000000 1.000000
1.000000 1.000000

ColorGMast 2
0.000000 1.000000
1.000000 1.000000

ColorBMast 2
0.000000 1.000000
1.000000 1.000000

AlphaMast 2
0.000000 1.000000
1.000000 1.000000

RotationSpeedMast 2
0.000000 1.000000
1.000000 1.000000

SizeMast 2
0.000000 1.000000
1.000000 1.000000

BRateMast 2
0.000000 1.000000
1.000000 1.000000


$EmitorDef          "Rainbow Violet"
Shader              "particle/misc/dot"
ShapeType           "0"
ShapeSize           "0 0 0"
Offset              "-3.2 12 -14"
Angles              "180 0 0"
ConeAngle           "360 0 0"
Velocity            "1.5"
VelocityRND         "0"
RotMultiplier       "0"
SizeMultiplier      "6.5"
StretchMultiplier   "1"
RandomRotDir        "0"
RandomAngle         "1"
VelAngle            "0"
Restitution         "-1"
LifetimeShortening  "0"
Sort                "1"
Wind                "0"
AirResistance       "0"
AirResistanceRND    "0"
GravityMultiply     "0"
GravityMultiplyRND  "0"
LOD                 "0"
MaxNum              "1100"
BirthRate           "55"
BirthRateRND        "0"
BirthRateVel        "0"
LifeTime            "2"
LifeTimeRND         "0"
LifetimeByAnim      "0"
AnimOnce            "0"
RandFrame           "0"
AnimFPS             "0"
PointSprites        "0"
EffectTime          "10"
Repeat              "1"
Spring              "0"


ColorR 2
0.000000 0.492754
1.000000 0.492754

ColorG 2
0.000000 0.000000
1.000000 0.000000

ColorB 2
0.000000 1.000000
1.000000 1.000000

Alpha 2
0.000000 1.000000
1.000000 1.000000

RotationSpeed 2
0.000000 0.000000
1.000000 0.000000

Size 2
0.000000 1.000000
1.000000 1.000000

ColorRMast 2
0.000000 1.000000
1.000000 1.000000

ColorGMast 2
0.000000 1.000000
1.000000 1.000000

ColorBMast 2
0.000000 1.000000
1.000000 1.000000

AlphaMast 2
0.000000 1.000000
1.000000 1.000000

RotationSpeedMast 2
0.000000 1.000000
1.000000 1.000000

SizeMast 2
0.000000 1.000000
1.000000 1.000000

BRateMast 2
0.000000 1.000000
1.000000 1.000000

Share this post


Link to post
Share on other sites

Cheers, will look into it tomorrow. I think I get what you are referring to now.

Share this post


Link to post
Share on other sites

Well, sorry for the delay, got time to look at it today. I understand what you mean, it is a slight annoyance. It appears that within the particle effect you have to manage sorting, but theoretically it should sort correctly between multiple effects. Speaking of which, what are you trying to achieve? I am sure we can help you with it :)

Share this post


Link to post
Share on other sites

Ah yes, I'm trying to achieve a few different things. I'm making an addon which takes the example-addon-buggy and replaces its thrusters with custom particle effects. I've finished three different kinds of buggy so far (bubbles, popcorn, and rainbow) but I keep having trouble displaying the particles correctly. I'll show you some examples and hopefully you can help me figure out a better way of doing it :)

leuy.jpg

Figure 1: Rainbow Buggy.

The rainbow looks perfect in Figure 1.

6eao.jpg

Figure 2: Rainbow Buggy from wrong angle.

In Figure 2 the rainbow colours are ordered backwards. This is what I was asking about in my first post.

hej0.jpg

Figure 3: Popcorn Buggy with 2 graphical glitches.

In Figure 3 the candied popcorn has the same problem. Each different colour has a different emitter so everything ends up in the wrong order. If there was only red popcorn, for example, it would all be ordered perfectly, but then it would look kind of boring.

Also in Figure 3, the popcorn particles (e.g. bottom left orange particle) get cut off by the ground and you can only see the top half. I've tried changing the "sorting group" from "translucent" to "overlay" in the Material Editor. This does stop the particles getting clipped by the ground, but unfortunately it makes the popcorn visible through all solid objects (rocks, buggy, etc.). Ground clipping also happens with a bubble particle effect (not pictured), but it's much less obvious there.

2gkq.jpg

Figure 4: Rainbow Buggy with 2 graphical glitches. (Left) Good weather. (Right) Bad weather. (Inset) Close-up of water in front of rainbow.

In Figure 4 there is a rainbow effect created by placing one very large particle in the distance. As you can see, the new weather effects (which look amazing!) turn the rainbow brown in the right-half of the image. I think the rainbow is so far away that it's getting obscured by fog. I can't figure out how to make it look bright and colourful even in bad weather.

Lastly, the inset in Figure 4 shows another example of my z-buffer problem from Figures 2 & 3. The rainbow seems to be rendered on top of the water particles, even though the rainbow is very far away. The rainbow uses a different .ptc file than the water, so I can't figure out how to have the rainbow always at the back.

---

In conlusion:

With three different particle effects I've had trouble displaying particles in the right order. (The other issues with ground clipping and fog are much more minor.) I know I probably shouldn't be trying to make effects this complicated before the modding tutorials are released, but I've been having a lot of fun learning how to make an addon and seeing what the limits of the particle system are.

Any advice you could offer would be much appreciated.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×