Moleculars physics

NEWS ! : FAST (30 times faster with more features) COMPILED C BETA VERSION RELEASED ON MY BLOG!

Hi,

I start this thread to share with the community my experience about my first script I did just for fun.
It’s a kind of log of my experience too. Hope you have fun to check my progress and eventualy use my script than I have fun to construct and play with it!

History: In 1999 , at 15years old on my really fast 200mhz :wink: I find a little program where you can create 2d particles , called atoms. You can give to these ‘‘atoms’’ different property and make links between them to make different material. You can create 2d shaped react like water , jello , ice and many others thing. You can tears solid shape if to much force is applied. In my memory the apps is very cool … and I never find it again after ( if somebody find it , let’s me know.) 2009-2010 I see what Thiago Costa did with XSI and the powerfull ICE node programming and it’s seem to be near that what the old software does but in 3D. August 2011 , I’m starting to learn python for XSI and start to play with Blender API. I’m starting my script with GameEngine and it’s rigidbody physics.

I find on this website: http://en.myinventions.pl/index.php?page=BlenderSpringsAndDampers how to create my own spring/damping constraint. This research give v01 and v02 below. But I see really fast the maximum of rigibody object BGE can handle. After 15 000objects , the memory goes too high (and I have a computer with 24Gb of ram) and crash.

In september 2011 I change the way I want to did it and start to apply the same formula on particles(v15 and more). Blender can easy handle millions of particles without crashing. That begin to be interesting. My biggest problem now is I cannot have access to subframe with particles by python. I send a private message Jahka and he tell me it’s not possible to access subframe particles loop for now. But I simulate subframe by stretching the timestep. Not really practical but it’s work.

My Blog about the project:
http://pyroevil.com/category/scripts-addons/molecular-script/

Docs:

Download Page:

Sources (github):

VIDEO:

NEWCloth test[720p]:

NEWHair test[720p]:

Beta version trailer[720p]: https://youtu.be/_5QkPnPDcfc Cube of wet sand[720p]

Rope Simulation[720p]

Pasta Machine !!!:

Link at bird test:

[720p] Compilation of test with links integration:


[720p] test

with simple collision and mass reaction:

[720p] First test with self collision:

old with my own verlet python particles system:[B]

v10[HD1080p] 64 000 particles with collision response and friction:[/B]
http://www.youtube.com/watch?v=fdcwM33kxWQ

v07[HD1080p] 16 000 particles with Polygon collision (rendered on renderfarm.fi):

http://www.youtube.com/watch?v=cKIYcrJUf_w

v06[HD720p] 250 000 particles with Self-Collision gridhashing system:

v05[HD720p] Collision with friction and air-damping:

v04[HD720p] First verlet integration with inelastic self collision:

old with blender particles system:
v029[HD720p] Empty Pumpkin ~50 000 particles:

v026[HD720p] Suzan ~212 000 particles:
<a href=“http://www.youtube.com/watch?v=oE112EzvDQs” target="_blank">
https://youtu.be/oE112EzvDQs

v017[HD720p] Cube ~69 000 particles:

v015 [HD720p] Cube ~32 000 particles:

old with BGE rigidbody:
v01:


v02:

The source code of my script and more details about my first script journey is coming soon. Hope a get help from more experimented coders too ( optimization or better way to do thing) ! :slight_smile: All comments are welcome !

“If I create this thread at the wrong place, just let’s me know… because I don’t find a WIP script in the coding section.”

1 Like

file is too big i cannot upload 67 MB

i’ll see if can find a way to explained this !

but easy to run

just run it with Alt-A and it will fill the bowl with the little spheres

hope it helps

67mb file ?

Sorry , I don’t really understand :frowning:
I don’t share any files for now in this thread. :confused:

Wow this looks really cool!

Wonder why you don’t have any comments…

I’m really interested in trying your script.

Keep up the good work!

Students & school organizations can get benefited through Vriti Infocom, Noida products like Classroom Tests Series, online revision packages, student management system,student acquisition assistance etc to make their vision successful.http://www.vriti.com/corporate/services1.jsp

Ok … I write some ouput to try finding what going one with the subframe bugs.
After the last subframe of the frame1 , the prev_location stay the same for ever !
And the velocity reset to the last velociy of the frame1 for every next full frame !

just take a look on this console output:

http://www.pasteall.org/25674/text

I upload a new video on youtube with 69 000 particles simulation this time !

I just finished watching the last video and all I can say is WOW!

Pyroevil, this looks really great and very much like Lagoa for XSI Ice.

I thought that this “molecular-type” of particles could already be achieved with the current SPH-particles and springs, without using any code, but after a long time of testing it seems not (sad).

What feels a little awkward to me is that it takes 5000 simulation frames for a 90 frame sequence, is there any solution to that?

Great work!

Thanks Peddie!

Yes , it’s similar than Lagoa! I work with a friend knows Tiago Costa, the creator Lagoa. Me and this friend did friendly competition and make similar simulation , my friend in Lagoa and me with my script. My script is slower than Lagoa but it’s normal. My friend find my simulation great because you really feel the mass. Anyway Lagoa have really more complex features then my script. And the force of Lagoa is you can make many thing interact each other like cloth and fluid. I’m far a way of the real thing like Lagoa.

And yes , SPH is not the same. I already done the test you probably did. SPH have force to simulate surface tension of fluid and you shape goes always round at the end.

And for the “5000 simulation frames for 90renders frame” problem, I try many ways to find a workround but nothing do the job correctly. I ask on Blender Artist and BlenderQA amd nobody answer me … no comment … nothing. :frowning:
I think it’s a bug and I report it in the bug tracker.

Thanks peddie for you support :slight_smile:

I see alot of potential here, but unless you publish your code to github, svn etc so we can follow it and even contribute to it , it will be hard for you to get any serious feedback from the python wizards .

When we come against a speed problem in python we do the following

  1. profile, using the profiling tools of blender it will be easy to find accuretly which functions and which code exactly performs slower than our expectation

  2. We go back to our code to decide : a) is it our fault b) is it blender’s fault c) is it python fault

  3. if (a) we improve our code if (b) we try to work around blende’s limitation via cheating if © python is slow because is dynamic, using static types makes things much faster, static types can be achieved via the array module, via numpy , or via ctypes , cython and other similar tools

  4. If the problems persist we ask for the contribution of more experienced wizards.

In short -> Publish your code in a version controlled system (github /svn ) and then we can discuss with no misunderstanding and no speculations.

Thank Kilon.
For now the speed is not really my big problem. Subframe bug is more important for me now.
I’m a newbie in coding. I never worked with a SVN or GitHub and don’t know the process.

Thank again and I check for GitHub soon.

Github websited contains detailed instruction how to set it up, basically you create an account, a public key for authorisation of your computer and then a public repo where your source code and all your commits are stored. Commit is actually the description of the changes you made to your code.

From there on you can use this GUI client http://www.syntevo.com/smartgit/index.html , i use both smartgit and github and they very ease to use. From there on each commit of your code is just a press of a button (sync). Setup should take you no more than 10 minutes , commits should take you more than 10 seconds .

Github will offer both downloads for your users , links to your source code , tools to compare diffirent versions of your code and a detailed history of your code commits (changes). All that tools work automatically they need no setup and they are very easy to use. There is also wiki function, and even a forum kind for bugs and issues that your users may experience.

If you need help for anything you will find me and most of the python wizards (from wizard masters to apprentices) at #blenderpython in irc.freenode.net , any irc client can take you there. We await you for any , questions, help or random idea. Dont worry about being new to coding, does not matter , python is pure magic, python is pure fun. If you enjoy it you do it right.

Seriouly , thank again Kilon !

I a bit more understanding why I don’t receive answer or comment for my little project.

My pleasure, I hope I see you soon at #blenderpython would love to chat with you.

Any news Pyroevil? I really wish for more demo videos of your script.

Don’t worry Peddie :wink: It’s just because I did a lot of unsuccessfull (for me,I am a little perfectionist) simulation. I try to did a huge one with 250 000 particles but it’s not easy and it’s take 3 to 5 days to simulate. And I try to figure out if it’s easy to do a low resolution simulation first and get a similar result if you increase the number of particles after that. I launch a test with suzan today, I hope the effect is cool!

A new video with suzan and 212 000 particles:

v26:

WOW!

This is really starting to look more than awesome…! I’ve been watching this thread every day since your last post, and it definitively was worth it!

I’m a little scared of the simulation times though, do you have any further ideas of how to make them shorter? The script should probably be coded directly in C, tied to the SPH-particles(springs), for best performance…

What is your future plans with this script?

Did you get any help in the #blenderpython chat?

Keep up the good work!

Yes , simulation time is really high.
I don’t know how many slower if I compare to my friend simulation in Softimage with Lagoa. My plan is probably check the performance if I code some part with cython to create C python module like suggested by Kilon.

For forum , SVN and other things I don’t have a lot of time because I’m the fathers of two beautiful kids :).
It’s why I don’t post news everyday. I know it’s a bit frustrated for people like what I did. I have the same feeling about KaiKostack and Phymec script where I waiting for new stuff about weeks … or months. But I understand he probably have is own good reason like me.

My first fear is to lost my motivation someday about my little toys. My second fear is to lost the lineflow about my script if I include more experimented coder in the project and just lost any motivation and time to understand how people modify it to get better result.

But don’t worry , I don’t plan for now to keep it for myself and I check for svn solution and I want to put the source available for everyone.

That is very good to hear, and totally understandable!

Keep up the awesome work (as long as there is motivation)!

Take care.