Using OpenSCAD and Gimp to make 3d objects for video

If you have ever wanted to add your 3D models to a video here is a simple method to do that.

3 min read
By Bob
Using OpenSCAD and Gimp to make 3d objects for video

I made a short example in OpenSCAD to change the color of the .stl file and the rotation so I could output the animation still frames:

Here is the code:

Path_to_STL_File="";
Path_to_DXF_File="";
/*[Animate]*/
STL= true;
DXF= false;
Rotate_x=0;//[-360:.01:360]
Rotate_y=0;//[-360:.01:360]
Rotate_z=360;//[-360:.01:360]
/*[Color]*/
red = 255;//[0:255]
green = 255;//[0:255]
blue = 0;//[0:255]
transparency = 1;//[0:.01:1]


module animate_stl(){
if (STL)
color([red/255,green/255,blue/255],transparency)
rotate([Rotate_x*$t,Rotate_y*$t,Rotate_z*$t])
import(Path_to_STL_File);
}

module animate_DXF(){
if (DXF)
color([red/255,green/255,blue/255],transparency)
rotate([Rotate_x*$t,Rotate_y*$t,Rotate_z*$t])
rotate([90,0,0])
linear_extrude(1,convexity=5)
import(Path_to_DXF_File);
}

animate_stl();
animate_DXF();

It helps to change the background in OpenSCAD to a solid color because it is going to be erased, I changed it to black and disabled the axes and scale markers:

I set the frames per second and steps to a low number just to try out a simple animation, then selected the dump pictures box and the pictures were saved to the folder where the OpenScad file resides:

Next I imported them into GIMP so I could remove the background:

I selected all of the files using shift and clicking on each one, then all files loaded into GIMP :

In Gimp I went to Select>By Color and selected the background. You'll notice I forgot to change the background color to black in OpenSCAD so I had to go back,change it and export the pictures again.

Now I can select the black back ground by color and press the delete key and it gets deleted.

Next I went to Layer>Transparency>Add Alpha Channel:

Then hit the delete key again and this leaves a transparent back ground:

I had to do this for each frame:

Now I can save the files and import them into my video editing software, here I am using OpenShot:

I won't go into detail on using OpenShot in this post, but I highly recommend giving it a try if you are new to making videos, it's really easy to learn and has excellent features.

OpenShot Video Editor | Free, Open, and Award-Winning Video Editor for Linux, Mac, and Windows!
OpenShot is an award-winning free and open-source video editor for Linux, Mac, and Windows. Create videos with exciting video effects, titles, audio tracks, and animations.

Here is a simple video I made with the infinity plays logo and the hub from the examples above:

0:00
/

and an animated gif: