Skip to content

Commit

Permalink
Initial upload
Browse files Browse the repository at this point in the history
  • Loading branch information
fedackb committed Jun 15, 2019
1 parent 8830df2 commit c1234d0
Show file tree
Hide file tree
Showing 9 changed files with 1,884 additions and 1 deletion.
76 changes: 75 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,75 @@
# mesh-fairing
# **Mesh Fairing**

![fairing](https://user-images.githubusercontent.com/8960984/59396054-36e85880-8d44-11e9-873b-d8aa2293b2d5.gif)

This Blender addon provides an alternative smoothing operation. Conventional smoothing has a tendency to cause pinching, bumps, and other undesirable artifacts; however, mesh fairing results in a smooth-as-possible mesh patch.

# **Installation**

![download](https://user-images.githubusercontent.com/8960984/59553680-ab461600-8f55-11e9-8332-8f617fb40965.png)

1. Download the zip archive.

![preferences](https://user-images.githubusercontent.com/8960984/59553683-ae410680-8f55-11e9-91e9-0009257f0abb.png)

2. Install the downloaded file.

3. Enable the addon.

4. Install SciPy Python module.

Blender ships with NumPy, but it is *highly* recommended that users install SciPy. Mesh fairing with the latter is much faster and less prone to crashing. If you encounter any issues during the automated installation process, consider attempting manual installation: https://blender.stackexchange.com/questions/56011/how-to-use-pip-with-blenders-bundled-python/56013#56013

# **Location**

Mesh fairing is available in both *Sculpt* and *Edit* modes of the *3D Viewport* panel.

![fairing-menus](https://user-images.githubusercontent.com/8960984/59396675-18379100-8d47-11e9-8146-93c5b6ba5077.png)

# **Tool Options**

Mesh fairing displaces affected vertices to produce a smooth-as-possible mesh patch with respect to a specified continuity constraint.

* **Continuity:** Determines how inner vertices blend with surrounding faces to produce a smooth-as-possible mesh patch

* **Position:** Change in vertex position is minimized.

* **Tangency:** Change in vertex tangency is minimized.

* **Curvature:** Change in vertex curvature is minimized.

Mode-specific options also exist to affect the outcome of mesh fairing.

### **Sculpt Mode** ###

* **Invert Mask:** If this option is enabled, mesh fairing is applied to masked vertices; otherwise, only unmasked vertices are affected.

### **Edit Mode** ###

* **Triangulate:** Triangulates affected region to produce higher quality results

# **Usage Examples**

Here are a few examples that demonstrate the usefulness of mesh fairing:

1. Blend between sections of geometry.

![blend](https://user-images.githubusercontent.com/8960984/59396662-09e97500-8d47-11e9-93a4-eb9d47ef007d.png)

2. Remove surface features.

![feature-removal](https://user-images.githubusercontent.com/8960984/59397232-11aa1900-8d49-11e9-9fee-d54181dc2e0b.gif)

3. Create interesting shape keys.

![shape-key](https://user-images.githubusercontent.com/8960984/59396649-00600d00-8d47-11e9-838d-77d3b1a06c81.gif)

# **Credits**

* **Addon Author:** Brett Fedack

* **David Model:** 3D scan of Michelangelo's David provided by [Scan the World](https://www.myminifactory.com/object/3d-print-head-of-michelangelo-s-david-52645) initiative

* **Monkey Model:** Suzanne is Blender's mascot who we've all come to know and love.

* **Other:** Special thanks to Jane Tournois whose mesh fairing implementation for [CGAL](https://github.com/CGAL/cgal/blob/master/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/fair_impl.h) proved highly instructive in designing this addon
86 changes: 86 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# ##### END GPL LICENSE BLOCK #####

bl_info = {
'name' : 'Mesh Fairing',
'description' : 'Continuity based smoothing tool',
'author' : 'Brett Fedack',
'location': (
'Sculpt mode: Sculpt menu, Edit mode: Vertex menu'
),
'version' : (1, 0),
'blender' : (2, 80, 0),
'category' : 'Mesh'
}

import logging

if 'bpy' not in locals():
import bpy
from . import operators
from . import preferences
from . import ui
else:
import imp
imp.reload(operators)
imp.reload(preferences)
imp.reload(ui)

classes = (operators.MESH_OT_fair_vertices,
operators.MESH_OT_fair_vertices_internal,
operators.SCULPT_OT_fair_vertices,
operators.SCULPT_OT_fair_vertices_internal,
operators.SCRIPT_OT_install_module,
preferences.MeshFairingPreferences)


def register():

# Configure the logging service.
logging_format = (
'[%(levelname)s] ' +
'(%(asctime)s) ' +
'{0}.%(module)s.%(funcName)s():L%(lineno)s'.format(__package__) +
' - %(message)s'
)
logging.basicConfig(
level = logging.DEBUG,
format = logging_format,
datefmt = '%Y/%m/%d %H:%M:%S'
)

# Initialize the linear algebra solver.
linalg.init()

# Register this Blender addon.
for cls in classes:
bpy.utils.register_class(cls)

# Add mesh fairing operators to existing menus.
bpy.types.VIEW3D_MT_edit_mesh_vertices.append(ui.draw_vertex_menu)
bpy.types.VIEW3D_MT_sculpt.append(ui.draw_sculpt_menu)


def unregister():

# Remove mesh fairing operators from existing menus.
bpy.types.VIEW3D_MT_edit_mesh_vertices.remove(ui.draw_vertex_menu)
bpy.types.VIEW3D_MT_sculpt.remove(ui.draw_sculpt_menu)

# Unregister this Blender addon.
for cls in reversed(classes):
bpy.utils.unregister_class(cls)
Loading

0 comments on commit c1234d0

Please sign in to comment.