Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

particle_sort_depth

The depth key a sprite emitter's back-to-front sort orders its particles by: particle_depth_key(pos, cam, near, far, bucket_count) files a particle into one of bucket_count depth buckets, numbered far to near, so ascending keys walk the population back to front.

The distance is radial, from the camera position, because a particle draws as a quad turned to face the camera. Buckets are spaced logarithmically between near and far, so each spans a constant ratio of depth: resolution is finest close to the camera, and one key space covers a scene of any size.

particle_sort_key (the radix path's key pass) and particle_sort_local (the one-dispatch path) both include it, so the two paths order a population by the same keys.