3d swarm

hi.

re-did an old piece ( http://forum.openframeworks.cc/t/experimenting-with-boids–flow-fields/811/0 ) as an experiment to play with lights in opengl. so instead of using flat ribbons it uses 3d forms that resemble worms.

you can find a video here : http://www.vimeo.com/1478512

and the source here: http://www.rui-m.com/OF/slugs/src.zip

it uses a perlin noise class with the original TRON CODE!! it can be found here http://www.flipcode.com/archives/Perlin-…-lass.shtml

it uses the vector math addon and the 3dutils addon for the lights and camera, you can read more about it here: http://forum.openframeworks.cc/t/ofx3dutils-so-far-only-camera-and-lights/944/0

thats a lot of links :slight_smile:

thanks

rui

p.s. i ran into some trouble with lights. sometimes i get weird dark spots on the slugs. i disguised them by setting the ambient color, but wasn’t able to solve the problem. its probably something with the shape normals, but i tried calculating them in different ways and always got that problem. maybe someone who knows more about opengl knows how to solve it?

Dude that is sick! and beautiful. Very robo-organic plant being thing!
BTW I almost got that perlin code going on. Right now I am trying to finish ofxFiducialFinder and then I will finish the noise stuff. As soon as I get the fiducial stuff done it should take me but a few days to get the noise stuff taken care of. I’m interested to see if you get any performance boost from it. Plus I think you will enjoy all the fBm musgrave noise stuff I got going on in there. really cool for fractals and such.

ding

really nice! thanks for sharing the swarming / boiding code, I might need it for some future projects!

thanks :slight_smile:

@moka glad you find it useful, but i should add that the in that code, the way it uses the perlin to rotate a velocity vector is adapted from this robert hodgin source which can be found here: http://www.flight404.com/blog/?p=113

and also… everyone of those worms/slugs/whatever are formed by disks which rotate so that they are allways facing the disk in front of them. for that i used a piece of code which can be found here http://processing.org/discourse/yabb-be-…-1170790832

i’ll add these links to the source :slight_smile:

hey, this is really nice

the perlin noise code from Mr Perlman’s homepage is great huh :wink:

hi damian.

yea collision detection would be great and its something i would really like to implement. i was just googling about it and it seems to be a really wide subject.
i’ve never done collision detection on anything more complex than a sphere. i was thinking about treating each disk that composes the swarms as if it where a sphere or divide the swarms into boxes and detect if any point is inside the shape. that should be rather fast but not very accurate. or maybe i should use a physics library, like bullet or something?
has anyone ever done something like this that could give me some pointer?

thanks

very nice indeed! am quite curious to see how you constructed the mesh… thanks for putting the source up… will check out and see :stuck_out_tongue:
http://g-ecx.images-amazon.com/images/G-…-0110.L.jpg

http://en.wikipedia.org/wiki/Marching-cubes
(theres links to source and demos here)

just looking around I found another cool link.
http://local.wasp.uwa.edu.au/~pbourke/g-…-olygonise/

ding

@memo the mesh is quite simple, each “worm” is constructed by a succession of disks, each disk contains points. the mesh is connected by several quad strips that connect each point on one disk to the corresponding point on the disk next to it. thats basically it
flat shading was used on purpose, just thought it looked more interesting than smooth shading :slight_smile:

thanks

rui

re collision:

yes, you could treat all the discs like spheres - or easier, treat them all like circles in the same plane and do square overlap tests - well, easier if you can work out the maths to put them all in the same plane :wink:

anyway it’s certainly do-able.

d