Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!

We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.

Decouple simulation and rendering: Interpolate particles

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 B_old   Members   -  Reputation: 665


Posted 03 June 2014 - 09:02 AM

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?


#2 L. Spiro   Crossbones+   -  Reputation: 13949


Posted 03 June 2014 - 09:19 AM

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, 06 June 2014 - 04:03 AM.

It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#3 B_old   Members   -  Reputation: 665


Posted 04 June 2014 - 01:28 AM

I see. Thanks for the input!

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.