Here i'm going to show you my quick and dirty method for creating animations and rendering them using Cinema 4d.
The Process
1. Draw 3d models in processing.
2. Export an obj for each frame.
3. Load objs into Cinema 4d.
4. Sequentially hide and unhide the models each frame creating the animation.
5. Render it all out.
ObjExporterrr
I have tried out many libraries for exporting objs in processing. The best i found was the
obj exporter / octane render library by
muehlseife. The main thing it provided better than other libraries was accurate co-ordinates for the center of the exported model, the model itself sits at 0,0,0 and doesn't have a mysterious center floating somewhere nearby.
I modified the library slightly (3 lines), just so that you can choose what the filename is allowing you to put "###" somewhere so it creates sequentially numbered models for each frame.
If you download the original there are great examples on how to use it. Just remember to add the filename to the constructor like this;
oct = new octaneRenderer(this,"filename###");
One this to note is that in order for the model to be centered, the library does a translation before exporting so you need to make sure you haven't already done a translation which will affect this. For example, i normally translate everything to the center so i can see whats going on. Something like this;
void draw() {
background(0);
translate(width/2,height/2)
if(exportObj){ //<- export if mouse was pressed
oct.exportObj();
oct.setMaterial("globe",100,100,100,255);
oct.setObject("Globe");
exportObj = false;
} else { //<- If not exporting translate to the center
translate(width/2,height/2)
}
renderGlobe();
}
Importing into Cinema 4d
This is a pain because of Cinema 4d's bad support of objs.
The best way is to use
Riptide Pro which is a plugin an supports batch import of objs into the same scene. A free way is to use Cinema 4d's Content Browser to navigate to where your objs are and drag and drop them into your scene and hit enter loads of time.
Creating the animation in Cinema 4d
In order to make the animation you need a different obj visible every frame. This would be a very tedious process but I found a c4d with and xpresso script which does this for you. You can get it here.
import-mesh-xpresso.c4d
Now the models are sorted alphabetically so you will need them to be in order after they are sorted. The way to do this is have "###" in the filename so processing numbers them, eg, filename001, filename002, filename003. Make that there are 0s in the otherwise filename9 will be after filename89, if that makes sense.
Once all your objs are in Cinema 4d and in the right order you select them all and drag them
into the object called blender. This object has all the scripting. Remember
into not under.
Then render it out :)
This took a lot of trial and error and a LOT of googling so hopefully this will help anyone looking to do something similar to me.
I've got a few questions about raytracing in processing. I've started using the P5SunflowAPIAPI library as it seems like the most recent and compatible.
P5SunfflowAPIAPI
So i compiled a little test sketch to render out some thing pretty, looks like this in opengl;