I gave some disc models and tips on how to find them, but in this Instructable we will go a bit further : we will use the powerful POV-Ray software and some other tools to create phenakistoscope discs from GIF files.
Follow these steps to learn how to create a customized disc !
Step 1: What We Will Do
We will select and convert a simple animated gif into a phenakistoscope disc. You will be able to add up to three gifs into a same disc !
Look at the attached example. The starting base is the animated robot gif, and the final result is the full disc. In fact, the process is more or less a picture format conversion. We will just extract the GIF frames and put them in a circle.
Step 2: Download the Required Tools
POV-Ray is a free raytracer software that works with plain text files. Of course, the main goal of this software is to create full-3D pictures (check out the gallery) but today we will use it to create a 2d flat picture. It works great too !
We will also have to use the FFMpeg converter software. It's a free software that can do an incredible amount of conversions (pictures, videos, sounds...). The direct download page is here. Download and unzip the program (no installation).
Download also the script that we will use for this project. In the zip file you will get the main Povray script and some examples :
Step 3: Search for a Nice Gif
The GIF is a picture format widely used on the web that can handle animations. We will choose a small gif as a starting point. But, watch out, not every GIF files can work. The GIF file should :
- have a small number of frames (we can't store a lot of frames on a disc (6...16))
- be in a loop (it's better, to have a smooth animation)
- be not too wide (to fit between the slots). A square is perfect, but a lightly tall gif can fit. (You can adjust the format into the script.)
- don't have a lot of details (because the disc is a bit small, and this animation system is not perfect)
- have a white or transparent background if possible
You can add up to three GIF files on the same disc (at different radius). Of course, they must have the same number of frames !
To find this kind of GIFs, the better is to ask your favorite web search engine. Search for "small gif" into google image for example.
Some websites are great, too. Check http://bestanimations.com/ for example.
For this project, we will create a Lion King themed disc, with the two attached files. Thanks Disney !!
Step 4: Prepare the GIF File
Ok, once you have selected a nice GIF file, the first step is to extract the frames into individual files. For this, we will use the FFMpeg software.
Open the directory where you unzip FFMpeg. You should see a batch file and four folders.
Paste your gif file(s) in this folder, then launch the batch file. Type the following command to start the conversion :
ffmpeg -i ..\filename.gif -ignore_loop true ..\filename%02d.png
For example, my first gif file is "simba1.gif", so the command is :
ffmpeg -i ..\simba1.gif -ignore_loop true ..\simba1%02d.png
Then press enter. The software reads your gif and extract the individual frames into PNG files. Look into the folder, you should see individual files like "simba101.png / simba102.png / ...". Copy all these files and paste them into the folder with the POV-Ray script file.
For the second GIF, just do the same. (Don't forget to copy the extracted frames into the POV script folder).
The two GIF files must have the same number of frames !!! Tip : if one gif have half frames than the previous one, just duplicate them. (Example : your first GIF have 12 frames. The second, 6. Just duplicate the 6 frames and rename them to have 6 mores frames, from 7 to 12. Ask me in the comments if you need help). In this case, the two have 12 frames, so it's OK.
To quit FFMpeg, just type exit in the command window and press Enter.
Step 5: Edit the POV-Ray File
Open POV-Ray and load the script file "phenakistiscope.pov". We have to adjust some parameters to have a nice picture.
You can add up to three set of frames on a same disc. We will use only two in this example. Each set of frame got the following parameters:
#declare Activate1 = true; //activate the level or not #declare PrefixeImage1 = "runner"; // pictures : runner01.png, runner02.png... #declare Scale1 = 0.25 ; //global scale of the object. Adjust if it doesn't fit correctly #declare VerticalOffset1 = 0.75; //distance between the center of the disc and the picture #declare AngularOffset1 = 0; //rotate around the disc axis for a few degrees? Use it to center the picture #declare Ratio1 = 250/500; //set the picture ratio. #declare Mirror1 = true; // mirror the frame or not
In our example, the frames prefix for the first set is Simba1, and we have 12 frames.
How to fill all these parameters ?
- we have 12 frames, so set the Nbframes variable to 12.
- we have two files, so set Activate1 and 2 at TRUE and leave Activate3 at FALSE.
- PrefixeImage : here we put the initial name of the gif (without extension). So PrefixeImage1 should be "Simba1" and PrefixeImage2 "Simba2"
- the Scales, Verticaloffet and Angularoffset : leave the actual values for the moment. We will check them later after the first rendering.
- Ratio : To get the format of our frames, just use a picture viewer or windows : For Simba1, the frame size is 187x141, and for simba2 it's 107x87. For the "Ratio" line, just enter 187/141 for Simba1 and 107/87 for Simba2. (width of the picture divided by the height)
- Mirror : leave them at true. Remember that we will see the animation trough a mirror, so we have to mirror the pictures.
So, here are some good parameters for this example :
#declare Activate1 = true; #declare PrefixeImage1 = "Simba1"; #declare Scale1 = 0.3; #declare VerticalOffset1 = 0.83; #declare AngularOffset1 = 0; #declare Ratio1 = 187/141; #declare Mirror1 = true; #declare Activate2 = true; #declare PrefixeImage2 = "Simba2"; #declare Scale2 = 0.27 ; #declare VerticalOffset2 = 0.55; #declare AngularOffset2 = 0; #declare Ratio2 = 107/87; #declare Mirror2 = true;
Once ready, click on the "Run" button or type Alt + G. The final disc should appears on the screen.
If the result is not correct (check the attached examples), you can :
- change the scale, by editing the Scale1 or Scale2 value;
- put an angular offset to center the frames between the slots (value AngularOffset, in degrees)
- translate a bit the frames (change the VerticalOffset values). The external circle has a radius of 1, so your offset values must be under this.
Just update a bit the values and render the picture ("Run" button). If the result still doesn't looks nice, try other values.
Note that the frames are mirrored : remember that you will see the reflection in the mirror. So we need to flip the frames on the paper to see Simba walking in the good direction !
You can also customize some other parameters :
#declare RayonEncoches = 0.7; Set the internal radius of the slots. #declare LargeurEncoches = 0.04; Set the width of the slots #declare Epaisseur = 0.003; General drawing thickness #declare TracerBordures = false; Set this to TRUE to add gray lines to see frames limits. (If you want to to see the frames boundaries)
But the default values works great.
Step 6: Render the Final File
Once you got a nice result, add the following parameters on the command-line (the textbox under the top toolbar):
-w1000 -h1000 +a
To set a big picture size (1000*1000 pixels) and turn on the anti-aliasing feature to get a smooth result (+a).
Again, click on "Run" to launch the rendering of the high-res version of the disc.
The final picture file is saved in the same folder.
Step 7: Finishing
Check again the main POV-Ray folder. The output image should be "phenakistiscope.png". (also attached here).
You can now edit it if you want (in a picture editor), or directly print it. (Import the picture into a text editor, or use any printing software). Again, it's better to print it on a strong sheet of paper. If your printer can't print on strong paper, just use regular paper and glue it on a strong sheet. Once done, carefully cut it and pin it on something to make it spin. Check out my other Instructable to learn more.
Have you created an amazing disc ? Share it in the comments !
Thanks for reading !!
Step 8: What About Videos ?
This script may work with a lot of GIF files. But if your favorite animation is in a Youtube video or similar you can extract a GIF file using some online tools.
Google "create GIF files from youtube" or search on Instructables website. Once you have the GIF file, just extract the frames and use the script as we do here.
Participated in the
Digital Life 101 Challenge