• Advertisement
Sign in to follow this  

Decouple simulation and rendering: Interpolate particles

This topic is 1327 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

If simulation and rendering run at different frequencies it can be useful to interpolate between two simulation steps during rendering for smooth animations.

For moving meshes I simply interpolate the transformation on the CPU before sending to the GPU.

 

For particles, which I simulate entirely on the CPU, I'm less sure about a good strategy.

Currently I keep the particle array from the previous simulation frame around and send both to the GPU where I do the interpolation. I figured doing this on the GPU is faster even though I'm sending twice the data over now. Does this make sense or would you do the interpolation on the CPU as well?

 

I have two arrays of particle structs. One for the previous and the other for the current frame. Before each simulation frame I just copy the array. I send them to the GPU as two separate buffers. Would it be smarter to store it as one interleaved array?

 

Particle rendering is currently not a bottleneck for the scenes I have (at least not the number of particles), but I would like to set it up somewhat sane. How would you handle this?

Share this post


Link to post
Share on other sites
Advertisement
Particles are not really part of the logical simulation of the game; they are really just there to be rendered (not accounting for very rare simulations in which particles may have physics, but little changes in the high-level domain as they are still updated per-frame on the GPU (most typically)).

As such the most common practice is to update them every frame on the CPU (or GPU if you want to get fancy), not every logical tick.
Updating particles is typically a very basic process, so the gains you get by interpolating, which is only slightly less basic, are overshadowed by the bandwidth you consume by sending 2 streams.

Double-buffering and updating every frame (not every logical tick) are the most common strategies. Particles aren’t part of the simulation and should be updated every render.


L. Spiro Edited by L. Spiro

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement