Skip to content

Gradient domain processing for signals (and geometry) on meshes

Notifications You must be signed in to change notification settings

mkazhdan/ShapeGradientDomain

Repository files navigation

<title>Shape Gradient Domain (V1.0)</title>

Shape Gradient Domain (Version 1.0)

links description executables examples notes changes
LINKS
SGP 2009 Paper, SIGGRAPH 2016 Paper
Windows (x64) Executables
Source Code


DESCRIPTION
The code is comprised of two executables.

  • ShapeGradientDomain: [SGP 2009]

    This code performs gradient domain processing on signals defined on a mesh, where the signal can be either a color-field represented as a color per vertex or is the position of the vertices themselves.. The code supports both sharpening and smoothing of the signals through the solution of a screened-Poisson equation. Specifically, given an input signal F, it solves for the signal G minimizing:

    E(G) = α⋅||F-G||2 + ||β⋅∇F - ∇G||2
    where α is the value-fitting weight, and β is the gradient scale factor.
    The code supports inhomogenous processing by allowing the user to replace the Riemannian metric, g, given by the embedding, with a metric that adjusts to the curvature of the surface in two ways.
    1. Anisotropic Processing: Given orthonormal principal curvature directions, the (idenity) metric is replaced with:
      Id. + ε⋅Κ2 where Id. is the identity matrix and Κ2 is the diagonal matrix whose entries are the squares of the principal curature values and ε is the curvature weight.
    2. Isotropic Processing: Given orthonormal principal curvature directions, the (identity) metric is replaced with:
      ( 1 + ε⋅tr(Κ2)/2)⋅Id. where tr(Κ2) is the total curvature (the sum of the squares of the principal curvatures) and ε is the curvature weight.
    The curvature is estimated using the surface normals. If none are provided, the vertex normals are estimated as the area-weighted sum of adjacent triangle normals.
  • Normal Smooth: [SIGGRAPH 2016]

    This code performs multiple iterations of harmonic smoothing of the surface normals. As with the code above, this amounts to minimizing:

    E(G) = γ⋅||F-G||2 + ||∇G||2
    where γ is the value-fitting weight.

    If no normals are provided, the vertex normals are estimated as the area-weighted sum of adjacent triangle normals.

Note that when β is set to zero the two executables differ in that the first emaulates harmonic flow from the input geometry to Euclidean three-space (allowing the variation at a vertex to occur in any direction) while the second emulates harmonic flow from the input geometry to the two-sphere (constrainting the variation at a vertex to occur in the tangent space of the associated normal).
Shape Gradient Domain Processing:
    --in <input geometry>
    This string specifies the name of the input geometry, represented in PLY format.
    [--out <ouput geometry>]
    This string specifies the name of the output geometry, represented in PLY format.
    [--vWeight <value interpolation weight>]
    This floating point value gives the weight for value interpolation (α).
    The default value for this parameter is 104.
    [--gScale <gradient scale>]
    This floating point value gives the scale factor for the target gradient field (β).
    The default value for this parameter is 1.0.
    [--kWeight <curvature weight>]
    This floating point value gives the curvature weight for adjusting the metric (ε).
    The default value for this parameter is 0.0.
    [--useColors]
    If this flag is enabled, the signal to be processed is the per-vertex color field. Otherwise, it is the vertex positions.
    If the flag is enabled and the input file does not contain per-vertex colors, colors will be assigned from the normals.
    [--aniso <clamp type>]
    If specified, this integer value specifies the type of clamping to use for anisotropic filtering. This type of filtering scales the metric tensor along the principal curvature direction as a function of the associated principal curvature value. The three valid values for this parameter are:
    • 1: No clamping
    • 2: Positive clamping (only scale if the curvature is positive)
    • 3: Negative clamping (only scale if the curvature is negative)
    [--verbose]
    If this flag is enabled, the code will output processing information.

Normal Smoothing:

    --in <input geometry>
    This string specifies the name of the input geometry, represented in PLY format.
    [--out <ouput geometry>]
    This string specifies the name of the output geometry, represented in PLY format.
    [--iters <iterations>]
    This integer value specifies the number of smoothing iterations that are to be performed..
    The default value for this parameter is 1.
    [--vWeight <value interpolation weight>]
    This floating point value gives the weight for value interpolation (γ).
    The default value for this parameter is 104.
    [--verbose]
    If this flag is enabled, the code will output processing information.

NOTES
  • The code requires a numberical solver and supports either Eigen or CHOLMOD. There are visual studio project files and Makefiles for both. (The code should be easy to interface with Eigen. CHOLMOD promises to be trickier.)
    If you are using Eigen and your implementation is backed by Intel's Math Kernel Library (see discussion here), use the "Eigen.MKL" Makefile/VS project to take advantage of the more efficient solver. (The different versions of the Windows executables are similarly compiled with the different solvers.)

EXAMPLES
  • Smoothing/sharpening without metric modification
    • When the gradient scale (β) is set to a value smaller than 1, the gradients are dampened and the geometry is smoothed.
    • When the gradient scale (β) is set to a value larger than 1, the gradients are amplified and the geometry is sharpened.
    • As the value interpolation weight (α) is increased, the results better preserve the input gometry, and the smoothing/sharpening is restricted to the higher frequencies.
  • Smoothing with metric modification
    • Since the input geometry is noisy, a direct estimation of curvature would result in large curvature estimates everywhere, resulting in metric amplification everywhere, thereby nullifying the effects of smoothing.
      To mitigate this, we first run an initial pass of normal smoothing (γ=1).
    • As the value of the curvature weight (ε) is increased, the metric around sharp features is amplified, making it harder for the signal to diffuse across the features and resulting in edge-preserving smoothing.
    • As the anisotrpic metric modification allows diffusion along direction of low curvature, these results exhibit a bit more smoothing near crease regions.

CHANGES

HOME

About

Gradient domain processing for signals (and geometry) on meshes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published