On Mon, Aug 17, 2009 at 11:34 AM, Hugo Arts <[email protected]> wrote:

> This is definitely true, however if you keep the amount of snow
> particles constant but increase the resolution
> you will see big performance hits. There is a classic performance
> trade-off, with solution number 1 being independent of the screen
> resolution and solution two being independent of the number of
> particles. The right approach definitely depends on the use case, and
> I think it's definitely worth trying both and comparing them.

I just realized, solution two might actually be better.  It will start out
much faster, and it's speed will converge to the speed of solution 1 as the
number of particles increases.  If you really wanted to get fussy, particles
that have hit the ground could be dropped out of the simulation--something
that's impossible with solution one.  Also, instead of computing the ground,
a simple array of height values could be substituted, so that each particle
tests against that.  Of course, all this would have to be implemented
intelligently; i.e., clever numpy tricks.

The most overkill solution is to use the GPU.  A simple framebuffer object
and shader could update and draw all the particles basically instantly.

> It's an interesting example of how different algorithms lead to vastly
> different performance characteristics.

With the same visual result.

Ian

Reply via email to