Introduction: Turn a 2D Image Into a 3D Model
Ever want to take a 2D image and turn it into a 3D model? This instructable will show you how with a free script and Fusion 360.
What You'll Need
Fusion 360 (Mac / Windows)
What You'll Do
- Download and install Fusion 360. Click here to sign up for free as a Hobbyist / Enthusiast / Startup or as a Student or Educator.
- Get a quick orientation of the user interface.
- Download and install a script that will let you turn a 2D image into a 3D surface.
- Use the script to create a 3D surface for CNC milling.
Step 1: Why Fusion 360?
Fusion 360 is pretty much all I use nowadays in terms of 3D software. FULL DISCLOSURE: Fusion 360 is an Autodesk product, and Instructables is an Autodesk company, so this might seem like a biased choice. That's not exactly the case, and here's why:
- It's easy to learn. The UI has been carefully designed from the ground up to be clean, minimal, and simple. You can go from zero knowledge about 3D modeling to making simple objects in an afternoon.
- It's powerful. Once you get through the basics, there's really no limit to the complexity of the things you can design with it. It's easy to create simple models with it, but there's nothing holding you back from modeling a fully articulated gas engine if you want to.
- It's cross-platform. It's available on Mac and PC, and it's proven to be very stable on both platforms in my experience.
- It's great for CNC. Fusion has a super sophisticated CAM environment that lets you create all kinds of tool paths, which we'll get into later. It's really awesome to have the CAD and CAM together in the same program, because when you change your model, the tool paths update automatically.
- It's free. If you make less than $100K per year using it, you just renew with a startup license every year and keep using it free of charge.
- It's not a web app. Though all your files are backed up on the cloud and rendering is taken care of there, you don't have to rely on a high-speed internet connection to use the program.
I've been 3D modeling for over 13 years, and I can tell you honestly that this program is perfect for the kind of work I do: furniture, toys, machines, household products, etc. It makes digital fabrication a breeze, especially laser cutting.
There are a number of other programs out there that could be used to produce the same results, and if you're comfortable with something else (especially if you've already paid for it), there's no reason why you shouldn't stick with it. But if you haven't spent any money or invested time in another program, believe me when I say you won't be sorry you went with Fusion 360.
Step 2: Get Fusion for Free
If you haven't already, go to the Tools and Materials lesson in the CNC Class and follow the instructions there to download and install Fusion for free as a hobbyist / student / educator.
Step 3: The Fusion Interface
Fusion 360 has a great Youtube channel with lots of helpful videos. If you're the type of person who likes to learn software by going through every function it can perform, this channel is a good place to start. The overview here should get you pretty well oriented to the interface and give you an idea of how the program works.
But before we dive into a full-fledged 3D model, I'll quickly run through the interface.
PRO TIP: Use a 3-button mouse! It's so much easier than using a trackpad.
- Application bar: Access the Data Panel, file operations, save, undo and redo.
- Profile and help: In Profile, you can control your profile and account settings, or use the help menu to continue your learning or get help in troubleshooting.
- Toolbar: Use the Toolbar to select the workspace you want to work in, and the tool you want to use in the workspace selected.
- ViewCube: Use the ViewCube to orbit your design or view the design from standard view positions.
- Browser: The browser lists objects in your design. Use the browser to make changes to objects and control visibility of objects.
- Canvas and marking menu: Left click to select objects in the canvas (the space where you make your models). Right-click to access the marking menu. The marking menu contains frequently used commands in the wheel and all commands in the overflow menu.
- Timeline: The timeline lists operations performed on your design. Right-click operations in the timeline to make changes. Drag operations to change the order they are calculated.
- Navigation bar and display settings: The navigation bar contains commands used to zoom, pan, and orbit your design. The display settings control the appearance of the interface and how designs are displayed in canvas.
Step 4: Canvas Navigation
There are three ways to manipulate the view of your design:
- Navigation Bar
- Wheel button on a mouse
The navigation bar is positioned at the bottom of the canvas. It provides access to navigation commands. The menus on the right end control Display Settings and Layout Grid options.
To start a navigation command, click a button on the navigation bar.
- Orbit: A set of commands that rotate the current view.
- Look At: Views faces of a model from a selected plane.
- Pan: Moves the view parallel to the screen.
- Zoom: Increases or decreases the magnification of the current view.
- Fit: Positions the entire model on the screen.
Set of commands that enables you to specify desired visual style, visibility of objects, or camera settings, for example.
Grid and Snaps
Commands that allow you to specify increments, grid settings, and show / hide the layout grid.
Viewports are windows that display your design. You can show up to four viewports in the canvas at once. Displaying multiple viewports allows you to work in one view and see the changes from other camera positions.
Use the ViewCube to rotate the camera. Drag the ViewCube to perform a free orbit. Click faces and corners of the cube to access standard orthographic and isometric views.
Mouse: Use mouse shortcuts to zoom in/out, pan the view and orbit the view.
- Scroll middle mouse button to zoom in or zoom out.
- Click and hold the middle mouse button to pan the view.
- Shift Key + middle mouse button to orbit the view.
Trackpad: If you have a Mac with a touchpad or an Apple Magic Mouse, you can use multi-touch gestures to navigate the view.
Step 5: Image-2-Surface Script
"Script" is shorthand for a bit of code that you can plug into the program to give it a new tool that wasn't included by the software developer. There are dozens of scripts that allow you to do some pretty awesome things.
To translate a 2D bitmap image to a 3D surface for CNC milling, we're going to use the Image-2-Surface (updated 03 / 2018) script written by Hans Kellner.
The script is very simple. All it does is translate the value (level of lightness or darkness) of a bitmap image to the height of a point on a mesh surface. The white parts of an image will be the highest points, and the black parts will be the lowest points. This script will work with any photo, but I find it's best to use grayscale images because it's easier to predict what it will look like in 3D.
INSTALL THE SCRIPT
First, download the Zip file attached belo and unzip it in a location of your choice. I would advise keeping it some place other than the Downloads folder, or any other folder that is regularly cleaned out.
To load the script in Fusion, follow these steps:
- Start Fusion 360 and then select the ADD-INS > Scripts and Add-Ins... menu item.
- The Scripts and Add-Ins dialog will appear and display the My Scripts and Sample Scripts folders.
- Select one of the My Scripts folders, then click on the + icon near the top of the dialog.
- Locate the Image2Surface.js file in the folder you copied, select it, and click Open. The script should now be installed and ready to be run.
Step 6: Use the Image 2 Surface Script
RUN THE SCRIPT
After opening Fusion, I save the untitled file with a new name.
With my file saved, and the Workspace set to MODEL, I go to ADD-INS > Scripts and Add-Ins... I select Image2Surface from the list and click Run.
When you've selected your image, click OK and you'll get the Image2Surface script dialog. Here's a breakdown of the settings and what they mean. There's a lot of technical jargon that we won't get into here, but I find that a good place to start learning about this kind of thing is to just play around with the settings and see what happens. The settings shown in the screenshot below seem to yield the best results.
You may want to invert your image depending on what it is. When your settings are dialed in, click OK, and the script will make the surface. IMPORTANT: Export format must be set to OBJ in order for the surface to be usable for CNC work later.
Is Fusion freezing or crashing when you try to run the script? Chances are, your image is too large. Keep it under 300 X 300 pixels and it shouldn't be a problem. The smaller the image, the faster the processing.
If the script isn't behaving as described even though you followed the instructions, I would suggest looking at this thread on the Autodesk Knowledge Base: https://knowledge.autodesk.com/support/fusion-360...
Usually when a script isn't working, it's because it wasn't installed properly.
Step 7: Convert Surface to T-Spline Geometry
The surface the script creates is a Polygon Mesh surface. This type of surface is made up of facets with edges and points. If you zoom in, you'll see that there are no curved surfaces.
This type of geometry can't be used to make g-code toolpaths, so we'll need to convert it to T-Spline geometry. A t-spline is a type of NURBS geometry that works with control points that affect a flexible surface.
You're going to need a T-Spline geometry to create your CNC tool path, so click the CREATE > Create Form tool from the menu. This tool takes you into the SCULPT workspace.
Next, click UTILITES > Convert and select Mesh Body in the Selection Filter. Now click the mesh surface that the script created and click OK. Now it's time to be patient and let the program do its work converting the surface to a T-Spline body- it might take a couple of minutes.
Click FINISH FORM and Fusion will go back to the MODEL workspace.
PLACE THE SURFACE WITHIN A BLOCK
In order to better visualize what you're going to cut out on the CNC, it's a good idea to create a solid form. First, select the surface in the Bodies folder in the BROWSER on the left-hand side of the screen. Then Right-Click anywhere on the screen and select Move from the menu.
Looking at the surface from the side, rotate it 90º so that the top of the surface is facing up.
The size of the surface is based completely on the original bitmap image, so now you'll need to scale it to fit the actual size of the piece you want to cut out. To do this, make sure the body is selected in the BROWSER and go to MODIFY > Scale in the menu. Click Point and select the model origin.
NOTE: You may need to turn on Origin in the browser in order to see it.
Looking at the surface from the Top view, change the Scale Factor so that the surface fits within the size of the piece you want to cut out. I'm going to use a 3" X 3" piece of wood, so I'm looking for a scale factor that will give me a SURFACE that's just slightly BIGGER than 3" X 3". I can see how big it is on the layout grid.
Now that the surface is in place, create a box to represent the material to be cut out. I'm using a 3" X 3" X .76" square, so I go to CREATE > Box and click the model origin as my starting point. The box command asks for a width, a depth, and a height, which you can enter by typing a number and pressing Tab.
I can see that the surface to be cut is actually taller than the material to be cut, so not I need to scale the surface down in the Y dimension. I use the Scale tool again, and change Scale Type to Non Uniform. This option will let you scale in any dimension independently. For Y Distance, Choose a number that gives you some breathing room for the surface to fit within the block.
To move the surface closer to the top of the block, Right - Click > Move the surface up in the Y direction so that it's just below the top of the block.
CREATE A SOLID SURFACE
With both the block and the surface in place, go to MODIFY > Replace Face. Like every other tool in Fusion, it tells you what it needs to work. First, select the Source Face, which in this case is the top surface of the block. Then, click Select under Target Faces and select the surface you just converted from the original mesh. Click Okay, then turn off the original body in the BROWSER and you'll see the finished surface that you'll be making on the CNC.
SHOW US WHAT YOU GOT
If you gave it a try, please post your results here!
Tip 9 months ago on Step 5
The Fusion 360 Image2Surface download in the article contains an outdated version. Please download the current version from the Github site:
Select the "Code" button near the top and then "Download Zip".
1 year ago on Step 1
I just read your advice about Fusion 360 and you’ve convinced me. Thank you. I just started browsing around, wondering how I was going to decide which platform to learn on when I found this tutorial. Thanks for that :)
Question 2 years ago
Hi, When trying to create a solid surface I am getting the following error message "Error: The face(s) could not be replaced.
Try changing the face selections. For Edit Face operations, avoid making changes where other faces connect smoothly."
Do you have any idea why this is happening and how to fix it. Thanks.
2 years ago on Step 7
hi thanks for a post , is possible do that but with google skechtup ?? , i ask this because with fusion 360 2.0.99 , i not find many things you describe in this tutorial , example model , in resize i dont have a inputbox for scale mmmm, i am not much practic of fusion 360 , and i suppose your version is not last
Reply 2 years ago
I’m an ignoramus when it comes to Sketchup- haven’t used it since I learned Fusion in 2014. The UI has changed since I made this, but all the functions work the same.
I’d recommend going to the Guthub page linked above and asking the guy to translate it to python.
2 years ago
Nope, won't load a .js file, so I guess image2 surface is not usable, so how about a tutorial that is this good, but with a Python-based solution as it seems from the other comments, that is all that works now.
Question 2 years ago
The latest version of Autodesk Fusion 360 no longer support js scripts, and they are now only supporting py scripts. Are you planning to port your script to python?
If not, do you know of any python scripts that do the same?
Answer 2 years ago
maybe you can use HoruCNC. It is written in python and can create 3D relieves from a given image. https://github.com/freegroup/HoruCNC
2 years ago
Whenever I use the replace face it loads for awhile and then freezes
Question 2 years ago
Can anyone verify that this script still works with the latest Fusion?
When I use the script to generate my mesh (from a thin "lightning bolt"), the script creates a triangle mesh.
When I attempt to Convert Quad Mesh to T-SPline, it fails citing that my mesh is not a quad mesh: "Warning: Mesh to T-Spline conversion aborted."
This happens with both a tiny 2500 polygon mesh and the larger one that threw the attached error message.
3 years ago
when trying to upload any image, fusion 360 says "Image2Surface Script Failed : the relative resourceFolder path not found". what can I do?
Reply 2 years ago
I suggest first installing GitHubToFusion360 in the Fusion360 AddIn Marketplace, then installing the script at https://github.com/hanskellner/Fusion360Image2Surface via that plug in.
Question 5 years ago
I have been trying to install the image2 surface script but it shows "A single script or add-in cannot be identified in the selected folder.Please organize your programs so each script or add-in is in its own folder". Can you help me to figure out this??
Answer 4 years ago
I also had this problem. I got around it by renaming utils.js to utils.js.old. I installed the script as he said, then went back and returned the file to its original name (utils.js).
Reply 3 years ago
3 years ago on Step 5
I get a addin error when trying to install the script in Fusion 360, 2019. When I select the folder for the unzipped file it says " A single script or add in cannot be identified....
6 years ago
So you are saying that the box created must be smaller than the contoured object AND the contoured object is then scaled to fit the smaller box?
Reply 4 years ago
The contour surface must be have all its edges extending outside the box. Whether you scale the surface or size the box to fit it is up to you. Usually you want to cut the contour at a certain size, so you set the box to that size and then scale the surface to fit.
Reply 6 years ago
Basically the box keeps the same width and depth and whatever the shape of the surface is that cuts through it gets stamped onto the top face of the box. The surface doesn't scale, the overhanging edges just get cut off.
Question 4 years ago
I was curious because I am new to all this, what is a script? I have an image of a C-17 aircraft I am trying to make 3d.