Sorting depth does not work correctly with transparent texture
https://www.babylonjs-playground.com/#2FPT1A#335
You need to call setParticles.
https://doc.babylonjs.com/how_to/solid_particles#transparency-concerns
Not working
https://www.babylonjs-playground.com/#2FPT1A#336
https://playground.babylonjs.com/#EPBTB7#3
hereβs a working example (I hope) : https://www.babylonjs-playground.com/#2FPT1A#337
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.
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
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
https://playground.babylonjs.com/#EPBTB7#6
in your example, you set the depth sort to false at the line 61, what I just commented out
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
The problem of transparency throughout Babylon
With facet data depth sort enabled (more CPU intensive) : https://playground.babylonjs.com/#EPBTB7#7
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.