Random sprite from sheet per GPU particle in Cascade

Hi ! Nice that someone else is trying this stuff :slight_smile:

Hmm it was a while since I did this, but for starters we want numbers between 0 and 8 instead of 0 and 2 for both x and y right. We start with a random value from ParticleRandom in the range 0-1. The scalar of 1.99 above should become 7.99 I think, giving the Y-adjustment as an integer 0-7. The later division with 2.0 becomes a division with 8.0. Then there’s the problem of getting the fraction that I used for X-value to map to 0-7 as well. It starts off as 0-0.99, so maybe multiply by 8 and use floor?

The problem is getting two independent random numbers from one, that’s why I tried using the whole number for Y and the fraction for X. Not completely sure that it really works as I think it does, but it looked alright for 2x2.

Just going through it now I kinda feel maybe my solution is not the best :slight_smile: Please post if you find a better one, also adding parameters for the dimensions seems like a good idea… Good luck!