After reading maximiles post here: http://www.slembcke.net/forums/viewtopic.php?f=6&t=78 I felt inspired to create something similar but use the python chipmunk wrapper pymunk (found at http://pymunk.googlecode.com/) instead to see if it at all is possible to create something that demanding in realtime from the python wrapper. The balls are rendered as metaballs to create a more watery effect than just spheres. r,g,s seen in the video is metaball constants, l is the number of balls in the scene. The radius of the balls is 3 to 6. The gray value is the FPS but as I recorded with fraps it doesnt say much about the performance without recording..
In the second video, the simulation is rendered in 5 fps and then adjusted afterwards. On my computer, a P4 3GHz, the scenes are realtime (30+fps) up to about 800 balls when I don't record.
The videos can be seen here:
http://video.google.com/videoplay?docid ... 4855944985
and
http://video.google.com/videoplay?docid ... 3312119261
More pseudo-fluids, this time with python with pymunk
-
- Posts: 206
- Joined: Tue Aug 21, 2007 3:12 pm
- Contact:
More pseudo-fluids, this time with python with pymunk
http://www.pymunk.org - A python library built on top of Chipmunk to let you easily get cool 2d physics in your python game/app
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: More pseudo-fluids, this time with python with pymunk
Very cool. Out of curiosity, how fast is it without rendering?
Also, you should give your line segments a bevel radius to help prevent balls from escaping.
Also, you should give your line segments a bevel radius to help prevent balls from escaping.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 206
- Joined: Tue Aug 21, 2007 3:12 pm
- Contact:
Re: More pseudo-fluids, this time with python with pymunk
In a scene with a bix box with the water in the bottom like in the end of the second video:
~1000 balls: about 10-15 fps with rendering, 20-25 without.
~800 balls: about 25-30fps with rendering, 150+ without.
There are a big drop between ~800 and ~1000 balls as you can see from the numbers.. If the balls are in the air/moving/more free the fps is higher.
~1000 balls: about 10-15 fps with rendering, 20-25 without.
~800 balls: about 25-30fps with rendering, 150+ without.
There are a big drop between ~800 and ~1000 balls as you can see from the numbers.. If the balls are in the air/moving/more free the fps is higher.
http://www.pymunk.org - A python library built on top of Chipmunk to let you easily get cool 2d physics in your python game/app
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: More pseudo-fluids, this time with python with pymunk
Did you edit the hash parameters?
I think the table size for the spatial hash defaults to 1000 slots. That might be the issue.
I think the table size for the spatial hash defaults to 1000 slots. That might be the issue.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 206
- Joined: Tue Aug 21, 2007 3:12 pm
- Contact:
Re: More pseudo-fluids, this time with python with pymunk
Yep, I do a cpSpaceResizeActiveHash(self._space, dim=15, count=10000) in the start of the simulation. I remember that when I tested my way to this value it didn't seem to matter that much how big count is.
I did some new tests after having read you post:
dim 10, count 10 give 7 fps for 1030 balls no rendering
dim 10, count 1000 give 19 fps for 1030 balls no rendering
dim 15, count 10000 give 20-21 fps for 1030 balls no rendering
and with different dimensions:
dim 1, count 10000 ~2.5 fps
dim 10, count 10000 ~18 fps
dim 15, count 10000 20-21 fps
dim 100, count 10000 ~15 fps
I did some new tests after having read you post:
dim 10, count 10 give 7 fps for 1030 balls no rendering
dim 10, count 1000 give 19 fps for 1030 balls no rendering
dim 15, count 10000 give 20-21 fps for 1030 balls no rendering
and with different dimensions:
dim 1, count 10000 ~2.5 fps
dim 10, count 10000 ~18 fps
dim 15, count 10000 20-21 fps
dim 100, count 10000 ~15 fps
http://www.pymunk.org - A python library built on top of Chipmunk to let you easily get cool 2d physics in your python game/app
-
- Posts: 157
- Joined: Mon Aug 20, 2007 12:53 pm
- Location: London, UK
- Contact:
Re: More pseudo-fluids, this time with python with pymunk
Looks really nice. I like the metaball rendering.
Who is online
Users browsing this forum: No registered users and 6 guests