Jump to content

View more

View more

Image of the Day

Working on an auto spawn system. #gamedev #indiedev #screenshotsaturday https://t.co/Mm2kfekz7b
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Decouple simulation and rendering: Interpolate particles

4: Adsense

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   

689
Like
0Likes
Like

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   Members   

25455
Like
3Likes
Like

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.


#3 B_old   Members   

689
Like
0Likes
Like

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.