SolidParticleSystem "DepthSort"

Sorting depth does not work correctly with transparent texture

You need to call setParticles.

Not working

here’s a working example (I hope) :

No (

Looks correct to me. Remember this is particle sort - not facet sort.

It is hard to determine with a picture, though. It looks right on my device.

I just saw your video. That does look odd even for particle sort.

This could still just be due to the closest distance to the camera switching between the two particles.

Just looked at video again and that striped building looks like it should stay behind the solid building.

Maybe this is a bug. Jerome should be able to tell us.

There might be a recent change in BJS that caused this. Try the stable version of BJS on the PG.

BSJ v.4.0.3 (macOS 10.15.2 - Safari 13.0.4 / Google Chrome 79.0.3945.88)

Since those are close together, I still think this might not be a bug.

It is normal ? )

Can I sort in update (updateParticle) ?

I’ll have a look after the 6th of january.
The last change in the SPS was the multimaterial that can affect the particle depth sort. But I tested it and at the time of the PR, the depth sort was still working great. Maybe there’s a bug.

Checking some close buildings is not that easy because the sort is done at particle level (so from the particle center, not the particle closest facet to the camera). Considering the particle centers, I can’t see a bug in the pictures of buildings that you posted.

In your video, this looks like a bug… although I can’t read the code :wink:

You can’t sort them in the updateParticle() method. Actually, the sort only reorder the particles in a side appart array, then the VBO (indices array) is recomputes from this order, something that is not accessible from updateParticle()

I don’t think there’s a bug
in your example, you set the depth sort to false at the line 61, what I just commented out

This component is not suitable for production (

without alpha works fine!

Yep, this is the expected behavior : sort at the particle level. This may help some users for some needs.
If it doesn’t fit your needs as it works, you could either use the depth sort at the facet level from the FacetData feature (Use Facet Data - Babylon.js Documentation ) or any other method that you could find in this article : Transparency and How Meshes Are Rendered - Babylon.js Documentation


And here it does not work correctly)

without material alpha Good !

Babylon get well soon)

The problem of transparency throughout Babylon

With facet data depth sort enabled (more CPU intensive) :

not correct

This isn’t specific to Babylon.

If you use alpha material (material.alpha = value), we see a problem with sorting
The video shows incorrect operation of transparent objects

You just have the same issue at facet level instead of particle level.