Image to Mesh RhinoPython Script

Image to Mesh RhinoPython Utility

Download from Github

Image to Mesh is a RhinoPython script that converts bitmap images into a mesh in Rhino. Pixel brightness gets mapped into Z displacement. The script will average multiple images together based on brightness per pixel, but all images used must have the same dimensions. Images larger than 1000 pixels in X or Y will produce meshes with a high polygon count.

This tool is good for producing a pre-sculpt mesh for programs like ZBrush, Meshmixer or Blender. Performing planar intersections on the mesh can be useful for vector tracing, but curves need to be rebuilt and optimized. Version 1.0.0.7 includes a Grasshopper definition perform the intersection and rebuild curves.

Instructions:

Using Image to Mesh

1. Find an image you want to mesh, or a set of multiple images that all have the same dimensions. 

2. Use the “RunPythonScript” Command in Rhino 

3. Open “ImagetoMesh_cmd.py” in the Image To Mesh folder 

4. Define the number of images to operate on and an output Z depth for the mesh. 

5. For each image you load, you will see an image weight window then a final preview window appear.

6. If you use multiple images, you can set a weight to control how much they factor into the output mesh. Each pixel in the set of input images is weighted and then averaged to produce one output. 

Computational Vector Tracing with Grasshopper

1. Optional: Use the “MergeAllCoplanarFaces” command in Rhino to reduce mesh face count 

2. Find the “Input Mesh Component”. Right click the component and select “Set one Mesh” in the menu. In Rhino, you can now “Hide” your mesh. 

3. Use the “Plane Z Level” slider to adjust a plane intersecting with the mesh 

4. When you’re happy with the intersection curves, right click the “Intersection Curves” component and “Bake” the curves into Rhino 

5. Select your curves in Rhino (SelLast command works right after you Bake). In Grasshopper, right click the “Rebuild Curves Input” and select “Set Multiple Curves” 

6. If Show Rebuild Points is True, Red points show the discontinuities (the points where the curves are split); and White points show the output curve control points.

7. Adjust the parameters to reduce point count as much as possible while preserving desired geometry. The curves are split at points where the change in angle between points is greater than the Discontinuity Filtering Angle Threshhold, so increasing this angle reduces sharp corners. Curves are split at these points and then the individual segments are rebuilt with a control point count multiplied by the Rebuild Density Factor. 

Tags:

Leave a comment