Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


low-frequency 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
4 replies to this topic

#1 phantomus   Members   -  Reputation: 623

Like
0Likes
Like

Posted 11 January 2007 - 08:48 PM

I have a problem, not too bad but I would like some opinions anyway: For a realtime ray tracer, I want a simple particle effect. As it is rendered using a ray tracer, the frame rate is really low: Typically 10 on my dual core laptop, but perhaps lower on other systems. The particle effect is a simple fountain, so the particles move along a curve. Question is: How do I simulate the particles under these circumstances? I suppose it's virtually impossible to guarantee the exact same path at each framerate, but how do I get something that is at least more or less the same? I would for example like to guarantee the fountain height to be in a certain range, regardless of framerate. One of the ways I thought of is: Do multiple 'simulation steps' until the simulation frequency exceeds a minimal framerate. This is probably the simplest way. Any other thoughts?

Sponsor:

#2 Thr33d   Members   -  Reputation: 382

Like
0Likes
Like

Posted 12 January 2007 - 06:56 AM

Fix your timestep (Gaffer on Games)

It comes highly recommended (planning to use it in my game - not using it yet)


He recommends fixing your timestep (locking it to a certain times per second) then interpolating the values (giving a very slight delay: ~1 timestep)

-M

p.s. He addresses several approaches, including the one you suggest :)

#3 Ravyne   GDNet+   -  Reputation: 8193

Like
0Likes
Like

Posted 12 January 2007 - 07:33 AM

Definately use the intermediate time steps. Its straight forward and should yield good results. Since these physics simulation calculations should be much quicker in comparison to rendering each frame, this should cause minimal decrease in framerate.

If you want to go with the fixed-timestep route, which is a good one, I'd set the simulation rate at 30-50 hz. when you've got your frame-time, just chose the last simulation and the next, then interpolate between the two. Linear is easiest and would give accurate enough results, but you could probably do even better by taking the previous 2 or 3 simulations into account, as some cost to performance.

#4 eq   Members   -  Reputation: 654

Like
0Likes
Like

Posted 12 January 2007 - 11:10 PM

Use an analytical position for you particle i.e:

Constants:
G = Gravity vector, typically (0, -9.82, 0)

For each spawned particle, keep the following:
t0 = Birth time of particle
P0 = Position vector at birth
V0 = Initital velocity

Analytically getting the position of the particle at the given time t:
P(t) = P0 + V0 * dt + (G * dt * dt / 2) where dt = t - t0

Or more optimized:

P(t) = P0 + dt * (V0 + G * dt) where GH = G / 2 (Calculated when gravity changes, typically just once).

I typically use this in vertex shader code etc, that way you can let the gpu worry about the particles, all the CPU need to do is to spawn them etc.





#5 phantomus   Members   -  Reputation: 623

Like
0Likes
Like

Posted 14 January 2007 - 08:38 PM

Thanks a lot for the replies! These are some very good options.




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.



PARTNERS