DX11.Particles COLOR -weird behaviour-

Hi guys! Just fiddling around with particles, wondering if this is a bug:

I got an array of emettitors of particles (8x8 for now), my plan is to give each flux a different color.
As you can see in the screenshot, when I use 2, 4, 8, 16 or 32 different colors everything works.


when I try with 64 colors it goes banana!

where is the problem?

ParticlesColor.v4p (27.4 KB)

atm you are using the color buffer to set the colors of all active particles each frame. the [16] color buffer will wrap while coloring all [5760] particles. that’s why it works with multiples of your grid dimensions.

it should also work with 8x8 and 64 colors imo. thing is, on GPU there is no guaranteed order of the elements being processed. maybe that’s the reason why the colors glitch. CS thread size is also 64 maybe that’s got something to do with it=?

use the advanced buffer to set color on spawn:

ParticlesColor2.v4p (27.4 KB)

oooo thanks! exactely what I was looking for