14 May 2020 |
kyren | particles can have random deaths, so either their ttl can be lower or maybe collide with something, so it's not so clean that I can just copy the whole thing | 03:04:21 |
kyren | but, mostly particles will die predictably, so my other strategy is to do a ring buffer somehow where the tail of the ring buffer gets incremented as particles die | 03:04:44 |
kyren | but doing that and coordinating everything with particles that can spawn particles (think trails) is kind of hard | 03:05:00 |
kyren | so I just wanted to make it work by using sorting | 03:05:06 |
cwfitzgerald | tbh I still thing OIT is the way to go here | 03:05:14 |
cwfitzgerald | there are some like 2N drawcalls ways of doing OIT | 03:05:26 |
kyren | it won't help they need to be sorted even without transparency | 03:05:27 |
cwfitzgerald | wym? | 03:05:38 |
kyren | this is in 2d, there's no z buffer or z layer at all | 03:05:49 |
kyren | I mean I could introduce it but that's a whole thing | 03:06:05 |
cwfitzgerald | well that's it, you sorta have yourself a thing here | 03:06:30 |
cwfitzgerald | I don't think any of those solutions will be particularly pretty | 03:06:39 |
cwfitzgerald | what determines the order they need to be drawn at | 03:06:47 |
cwfitzgerald | * what determines the order they need to be drawn in | 03:06:51 |
kyren | what order they're spawned in | 03:06:57 |
kyren | either new in front or new in back, either one works though new in back is maybe better | 03:07:20 |
cwfitzgerald | tbh adding a integer depth buffer is probably going to be your best bet | 03:07:58 |
kyren | and using OIT | 03:08:14 |
cwfitzgerald | assuming you need partial transparency, yeah | 03:08:25 |
kyren | I'm really close to a solution, I actually have a solution I just don't like it very much | 03:08:37 |
kyren | and I was trying to find an easier quicker solution with gpu sorting | 03:08:48 |
kyren | that solution seems actually more complex than the other solution I have | 03:08:57 |
cwfitzgerald | what's your current solution | 03:09:05 |
kyren | okay the solution that I have in mind (but have not implemented) is to make the particle buffer a ring buffer, but the details get messy | 03:09:30 |
kyren | so a particle would have to have a max ttl independent of whether it's really alive | 03:09:47 |
kyren | if you spawn 10 particles, after the max ttl you know those particles are dead, so that gives you a way of popping off of the back of the ring buffer | 03:10:10 |
kyren | if they die earlier oh well, that's wasted space | 03:10:32 |
kyren | updates happen in place in this system | 03:10:41 |
kyren | pushes push to the end of the ring buffer, popping happens after the max ttl for any particle | 03:10:55 |
kyren | but the details are messy | 03:10:59 |