https://powdertoy.co.uk/Discussions/Thread/View.html?Thread=21251, the STCK tool helps a lot
i use a mod, but you can control it in vanilla tpt, it depends on the order of the id of the particles, in debug mode you can see the "id" of each particle, lower ones go behind higher ones when stacked
How can you get the layered materials to be in a certain order?