I haven´t written about Py4D for quite a while now…
In the meantime, Maxon has first announced a cooperation with – and now the acquisition of Sebastian Rath´s praised python implementation for Cinema4D.
So finally – Cinema4D meets Python!
Let´s celebrate with some cool experiments!
If you are new to this blog or Py4D – a short introduction:
Py4D enhances C4D with a standard Python interpreter that provides access to the C4D SDK and allows to easily code platform indepentent scripts and plugins that control or extend C4D.
Basicly the same as COFFEE, C4D´s own scripting language, but Py4D has two major advantages:
- It follows the C++ SDK more closely and implements it further than COFFEE does.
- It is a easy to pickup, widely known language with a huge community and tons of existing code and librarys.
While C4D is a mighty tool in itself, this powerful scripting interface enables the user to work with external data, automate processes or build his own tools.
Being more the C++ type when it comes to plugin development and C4D, I enjoy being able to solve small problems just by hacking a few lines of code into the script manager.
I also prototype most of my plugins in Py4D before I start developing in C++ – it´s just more convenient.
The step of compiling for every test takes much more time in the long run.
So here´s the meat:
Four simple examples how to have a good time with Py4D and some particles…
Everyone requires C4D R11.5, the Thinking Particles module and the actual version of Py4D.
Update: All files have been updated to work with the R12 version of Cinema 4D.
Click the images for a preview.
This is a Py4D port of the Sagan experiment I did in flash <- check out this link, it´s fun
A good and simple first step with particles - position vectors get parsed from a CVS database and from a galaxy of suns… “My God. It’s full of stars!”
Hint: this example might be the best to start with, as it includes comments – the others don´t, because they use pretty much the same pattern.
Just download the package, load the scene and change the path to the CSV file within the “file” user data field of the Py4D Tag.
A very simple adaptation of a 2D “physic engine” – works only with spheres.
The direction of gravitation is animated to make this a little more interesting.
This is simply a revival of the Py4D Boids post – same beast, but updated to the Py4D release version.
The script creates a flocking boids swarm, that behaves according to the rules outlined by Craig Reynolds.
4. Strange Attractor
Again just the script from the original strange attractor post, but ported to the final SDK.
View the final rendering and the original post – you can use the Strange Attractor Finder to locate your very own, chaotic attractor!
Here´s the scene file.
Python and Cinema4D are a great team and Py4D is THE alternative to COFFEE.
I hope this gives everybody who is interested in Py4D and controlling particles, a small head start, some inspiration or at least something fun to play with
Thanks to Sebastian for suggestions, support – and of course Py4D.