Introduction: Make a 3D Model From Pictures
Without having an expensive 3D scanner I found a way to take pictures and make a 3D model with completely free software.
In this Instructable I will take you through creating your own small scale picture taking studio to using the free software to create and edit your model.
Step 1: Creating Your Small Scale Picture Studio
I got the idea for the picture studio from another Instructable but creating it was out of my abilities. So I found a simple alternative.
What you'll need:
2 - 2"x1"x8' pieces of wood
1 x 1 1/2" narrow hinge
Something to cut the wood
Wood glue and/or nails
1 - 22"x28" Black or white posterboard
4 - Thumbtacks
1 - Rotating turntable display
Some way to cut a small round hole in the paper.
1. Creating your base
I have created a wooden base that is tall enough so that you can get pictures of the lower portions of whatever it is you want to model and does not capture your background.
You will need to cut your pieces of wood into:
3 x 22"
1 x 20 1/2"
2 x 15 5/8"
4 x 12 7/8"
1 x 4"
After cutting all of your pieces of wood you will need to make your bottom and back of the base.
I have attached the plans the I used. If you use smaller paper you won't need as large of a base.
2. Putting it all together
I started by screwing the back together so that I remembered to put a gap for the hinge. I also used self tapping screws which allowed me to avoid predrilling. I also used some wood glue as lubricant to get the pieces in place and for a little extra strength.
3. Getting your backdrop on
This was much simpler than the previous two steps. I started by measuring where the center of the turntable and then measured out those dimensions to the posterboard. Using a razor I cut a star that was large enough for the shaft on the turntable. To measure the shaft of the turntable I used digital calipers. Next, push under the tabs created inwards using a pencil. With that pencil run it around the inside of the circle to smooth it out making it easier for the turntable to actually turn.
4. Making it all work
Simply, you just use a light to get the turntable going. A headlamp fit perfectly under the paper. Once you get the turntable spinning use some tacks to hold the paper on the frame.
Step 2: Taking Your Pictures
1. Setting up your station.
I used a light that had five lamps so that my model was adequately lighted.
My model is a ~2.5 inch tall vinyl Mal from a Loot Crate.
NOTE: When choosing your model, use one that has a texture or a lot of contrast on it.
2. Getting you pictures
To get the pictures of my model I used my phone burst function. Using a higher quality camera will result in a higher quality model. There are a few pieces of metadata that my iPhone does not save (i.e. focal length). Though I am not saying that an iPhone will not work.
The turntable spins between one revolution every 15 to 30 seconds.
Start taking pictures close to the base of your model, ensuring that the whole thing is visible in each frame. Once it has gone one full revolution move the camera up about 2/3 of the way up while continuing the bust mode. Again, after one whole revolution move the camera up so the top of the model is visible. If you models top has a lot of detail to it you want to take extra pictures of those complex parts. These extra pictures are essential in the first piece of software used
I ended with just over 600 pictures. Quality models can be created with as few as 50 photos. It all depends on what you're taking pictures of.
3. Saving your Pictures
Move your pictures from whatever you took them on to your computer. The important part here is that you put them in their own folder. Now inside that folder you will want to put another folder that you will work in. Copy all of your pictures and put them inside the second folder.
Doing this allows you to keep your originals and delete everything in the second folder when you need to run the first program for a second or third time.
NOTE: I took pictures using both the white and black poster board and the white produced a better model in the software. If you have both colors, I'd recommend spending the couple extra minutes switching out the poster board and taking the extra pictures. You can then decide for yourself which ones you want to use.
Step 3: Programs
For the remainder of steps you will be using a computer. All of the programs are free/open source and should not come with any additional, unwanted, applications.
The programs that will be used are
I find Visual SfM be be better than AutoDesk's 123D Catch because you do not have limited number of pictures. Its a very robust program and the settings can be adjusted to meet your needs. Though there are dozens of SfM programs out there.
MeshLab is the only thing I've come across as an in-between for Visual SfM and Blender.
Blender is a program that I have only touched the surface with. It is used to create 3D images for movies,TV and graphic design.
There is a walkthrough video that explains everything you will be doing. Cleaning up your model in Visual SfM is easier to do than MeshLab.
NOTE: I am using a Windows OS and thus installation instructions will be different. I cannot provide information on how different using each program is, though I assume they are very similar.
Step 4: Using the First Program: Visual SFM
Visual SFM was created by Changchang Wu while he completed his postdoc at the University of Washington Seattle. He has gone on to bigger things, like work for Google.
I have found using a mouse easiest. Left click will select buttons and pictures and move the thumbnails and your model around. Right click will rotate your model around the origin (Green, Red and Blue lines making a right angle corner). Your roller will zoom in and out for everything.
To get the best view of your model, move it so the origin is somewhere inside and then rotate around. The program rotates around the origin and if the model is close you could lose sight and spend some time finding it.
You can download VisualSFM from ChangChang Wu's website. The program runs on Windows (32/64 bit), Mac and Linux. Each one has specific installation instructions. Following those instructions is highly recommended. I personally use Windows and found that the program downloads as a zip file with everything included. Extract everything into its own folder. Once extracted you should put it in your documents folder.
NOTE: It needs to have "write" privileges and putting it inside your "Program File" folder doesn't allow that. I found that out the hard way when my pictures kept creating weird models.
The program comes with 3/4 of what you need to get to the next step. You now need to download three more programs and one file. Be sure to download the appropriate items for your operating system (i.e. 32 or 64 bit version). From here you will need to get cmvs.exe, pmvs2.exe, genOption.exe and pthreadVC2.dll. Save or move these files into the same location as VisualSFM.exe.
2. Getting Started
To run the program all you will need to do is run VisualSFM.exe, its the only one in the folder with an individualized icon. The log window (separate window on the right) will have a running log of each process that occurs.
Running this program is pretty simple and has only 4 buttons you need to worry about.
NOTE: I would do a run through with 20 or less photos first so get acquainted and everything dialed in.
a. Uploading your files.
You can use either the "File->Open+ Multiple Images" or the third button from the left that looks like a blue Folder with a plus sign. This will open a browser window looking for pictures. Direct it to the location of the pictures you took of your model. Select all of your pictures and hit "Open". This will show thumbnails of each picture uploaded. You can zoom out to view all the pictures. There may be some empty picture frames because the program is designed to save memory. You can upload these missing pictures by using "SfM->More Functions->Update Point Color" and once its done use "SfM->More Functions->Update Thumbnails".
b. Computing Missing Matches
Easiest way to do this is clicking the sixth button from the right that looks like four different colored arrows pointing away from a middle point. This process will take varying amounts of time depending on computer power and virtual memory (RAM).
c. Compute 3D (Sparse) Cloud Reconstruction
The 3D Reconstruction is the immediately right button to the previous. It looks like two arrows pointing right, red on top of blue. This creates a fun visual showing all the matching points between pictures and starts putting them in 3D space. Once the 3D reconstruction finishes it will show a point cloud with all the pictures from the angle they were taken from.
During this process you can run into the program thinking you used two different cameras and it will create two different point clouds (hopefully you will only have one). With the main Visual SFM window selected, hit the "Up" button on your keyboard to switch between point clouds. Look through however many you have and find the one that is most complete and then delete the others. Deleting a point cloud or model is done by: "SfM->Delete Selected Model" which is second from the bottom of the list.
To get some, or all, of those cameras from the remaining models you will: "SfM->More Functions->Find More Points". Now push the button that looks identical to the previous one but has a plus sign too, red arrow on top of a blue one with a red plus sign. This is the "Resume 3D Reconstruction" button. DO NOT HIT THE PREVIOUS BUTTON because you will have to repeat this whole step again. Repeat this two or three more times to get all of your cameras and to get better matches between pictures.
d. Editing your settings to allow for one output file.
In the same folder as the Visual SFM program there should be a file named "nv.ini". Visual SFM pulls all of its settings to run from here. If you are using a large number of files, like I am, I needed to change one number to get a single output file. You should be able to open the file with a text (.txt) editor. Look for the line "param_cmvs_max_images" and change the number to something large than the number of pictures you have.
e. Run Dense Cloud Reconstruction
The button for this is the fifth from the right and is four different colored letter, CMVS. The button will open a window and ask where you want to save the next set of data files. Make sure that you have directed it to your second folder and then give it any name that you see fitting. Hit save and it will start doing its thing. This step takes a decent amount of time to complete so grab a book and some tea and enjoy the warmth you computer will put off. This runs through all the matching points again and find even more points to create an even more elaborate point cloud.
f. Viewing and cleaning up your Dense point cloud
Once the previous operation has finished you will just need to hit your "Tab" key to see the results. Here you can see that the dense reconstruction looks almost exactly like your model, just with a few extra spurs of points. To remove these extra spurs and clean up your model press "F1" and then select your points. Everything that is inside the rectangle will be selected. Press "Delete" and the selected points will be removed. Continue this until you are happy.
I'd recommend deleting the obvious random groups of points and any other feature you do not want in your end result. This part can be a rabbit hole if you're a perfectionist. Don't think that you have to make it perfect right now, Blender is a great tool for editing your end result.
After you have cleaned your point cloud up and you're happy with the end result you need to save. To do this: "SfM->Save NView Match" and give it a filename and make sure it saves as a .nvm file.
Step 5: Using the Second Program: MeshLab
Left click will select buttons and is used to rotate your model. Clicking on the three rings (red, green and blue). The red and blue rings are for vertical rotation and the green is horizontal. The center button moves the model around in space and the roller ball zooms in and out.
MeshLab has a cool feature for explaining what everything does. All you need to do is move your cursor over a feature you are using and it will give an explanation of how to use it.
2. Getting Started
MeshLab can be started like any other program installed on your computer. Just find the icon on your desktop or in your programs folder.
a. Opening your Project
Click on the second icon from the left (folder with three horizontal papers). Navigate to [filename].nvm.cmvs/00 folder, choose "bundle.rd.out" and hit open. It then opens another window where you need to choose "list.txt", then hit open. It may take a minute or two to open this file, depending on how many pictures you used.
b. Importing Dense Point Cloud
Once it opens you will need to delete the point cloud and import your cleaned up dense point cloud. To do this you need to hit the "Layers" button, seventh from the left (several sheets of horizontal paper). It will open a window on the right side of the screen. Right click on "[filename].0.ply", where a menu will appear, and choose "Delete Current Mesh". Your sparse point cloud will disappear. You now need to click on the third button from the left (folder with arrow going in), navigate to the file you saved in the last step from Visual SfM and open it.
c. Scaling the Model
The point cloud has a size to it but that size is not a 1:1 ratio. To get it there you must measure a specific part on your model. Now you can measure it in the program using the "Measuring Tool", which looks like a yellow rolled up fabric tape measure near the middle of the tool bar. Once you click the button you will need to find, if possible, the exact same points on your model you originally measured (zooming in or out may be required). The program will create a line, and a number, on your second click. You now need to get this measurement and your original to be the same. To do this you will get a ratio of how different they are. Divide your original measurement by the measurement in the program to get a ratio that you will need to increase your model by (I originally measured in inches but had to convert it to millimeters to get an appropriate ratio). Click on "Filters->Normals, Curvatures and Orientation->Transform: Scale". In the window that pops up you will need to input the ratio you found into any of the top three boxes (X, Y or Z). If your ratio is greater than 100 you will need to move the slider all the way to the right, input the ratio to the right of the number in the box and then delete the "100". Hit apply and your model will either move or disappear. This is because the orientation that you were viewing your model is no longer applicable to the new size of the model. Zoom out and move your model to an orientation where you can see it. Now remeasure and repeat the process until you are happy with the size . If you want to make your model larger than the original you can then multiply your ratio by that amount (i.e. 1/8, 1/2, 2x).
d. Creating a Mesh
On the menu bar, click "Filter->Point Set->Surface Reconstruction: Poisson". This will open a prompt window where you should change the parameters of "Octree Depth" to 10. The "Solver Divide" and "Samples Per Node" needs to be played with to create a decent mesh. "Samples Per Node" helps create a smoother mesh, as you can see in the screenshots. I'm choosing to use 4 "Samples Per Node". Next, right click on the first item in the Layers menu and delete it. Lastly, we need to delete Non-Manifold edges, "Filters->Selection->Select non Manifold Edges". When I do this I get an error message because I got a solid body
NOTE: The model I chose did not create a very good mesh to use. Sorry.
e. Exportin Mesh
The last thing you will be doing in MeshLab is saving it so that you can use it in Blender. The button for this looks like the typical save button of a floppy disk. Change the name of the file so that you can redo anything if needed. I took out the ".0" between the filename and .ply.
The most comprehensive tutorial videos that I have found are by Mister P. The videos go from basic to advanced uses within the program.
Step 6: Using the Third Program: Blender
Left click will select buttons but otherwise useless. Right click moves your model around in space. The roller ball zooms in and out and the middle button rotates your view. If your model is in an odd position, you will need to use the "Rotate" button under the "Tools" ribbon on the left side of the screen.
You can download Blender from their website. The program runs on Windows (32/64 bit), Mac and Linux. Like MeshLab, Blender also installs like any other program.
2. Getting Started
After the installation, find the Blender icon on your desktop or in your programs.
a. Deleting the "Cube"
When you first start Blender there is a default Cube there. In top right there is a "View" list. You should see "Cube in the tree, right click and "Delete". Do this for the Camera and Lamp too.
b. Importing your model
Now you will import the file from MeshLab. Go to "File->Import->Stanford(.ply)". Navigate to where you saved your model, click on it and then hit "Import PLY" in the top right.
c. Sculpting your model
Now comes the fun part (subjective)! Depending on how much work you want to put in, your model can be really cleaned up and looking like the original. It really helps if your mesh accurately reflects your original model. You will need to change the "Interaction Mode" to "Sculpt". To do this you will find the drop down menu on the bottom left of the program. It is next to three buttons and above the timeline. Blender has a lot of different sculpting tools to use. There are ones that add or take away things on your model and ones that smooth out or manipulate it. I like thinking of this process as if you're using clay in the shape of your mesh...and digital. Each tool has a radius and strength that you can change. To change them you can either hold left click and move your mouse left and right or to click where the number is and enter an amount.
Hopefully your model comes out looking just the way you want it. From here you can save it as several different formats for whatever you need, such as 3D printing. You can also import the file into other programs, like SolidWorks, for further manipulation.
There are a lot of Blender tutorials out there and a quick YouTube search will get you just about anything you need. The most recent version of Blender (2.72) has pretty good video tutorial by BornCG. I would really recommend looking at their videos if you have any issues sculpting your model.
Step 7: Some Future Projects
One project that has been in my mind for the last year is making In-Ear-Monitors. After spending a lot of time researching different speakers to use and finally finding a cable that has a mic on it I can make this project.
Another is to take pictures of the outside of a building that I find really interesting and then getting a model of it for myself. This can even be expanded upon to create custom dollhouses or scenes for action figures.
I am also hoping to use this process to make some holiday bobble-heads. Figuring out how to change out the body for different times of the year but keeping the same head.
There are always situations coming up where a customized items are needed to complete tasks, or spur creativity in the office.
A 3D printer is the only thing holding these projects back.
I have added another models that I made while trying to figure out what to write in this Intructable.
In-Ear-Monitor - I got the idea for this from another Instructable but I wanted to be able to remove the little speakers inside so getting it 3D printed seemed like my best bet. To start I made a mold of my ear using a kit. After a few attempts I found out that the mold needed some sort of texture or pattern for a really accurate point cloud and mesh. For this I used a DSLR that I borrowed and took 116 photos.