a signal processing approach to fair surface design

15
1 A Signal Processing Approach To Fair Surface Design Report

Upload: basel-abu-sinni

Post on 12-Apr-2017

19 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: A Signal Processing Approach To Fair Surface Design

1

A Signal Processing Approach To Fair

Surface Design Report

Page 2: A Signal Processing Approach To Fair Surface Design

2

Overview .........................................................................................................................................3

Introduction ....................................................................................................................................3

Theory .............................................................................................................................................4

Laplacian Smoothing Algorithm .......................................................................................... 4

Taubin Smoothing Algorithm .............................................................................................. 4

Eigenvalues and Frequencies .............................................................................................. 5

Pass-band Region ................................................................................................................ 5

Constraints .......................................................................................................................... 6

Implementation ..............................................................................................................................7

Laplacian Operator .............................................................................................................. 7

Pass-band Region and Factors ............................................................................................ 7

Smoothing Operator ........................................................................................................... 7

Hard Interpolation Constraint............................................................................................. 8

Soft Interpolation Constraint .............................................................................................. 8

Hierarchal Constraint .......................................................................................................... 8

Eigen-decomposition Smoothing ........................................................................................ 9

Results, Conclusions and Discussions ........................................................................................10

Demo Manual ...............................................................................................................................15

Page 3: A Signal Processing Approach To Fair Surface Design

3

OVERVIEW

Taubin Smoothing is a tool for interactive free-form fair surface design. Taubin reduced the

problem of surface smoothing, or fairing, to low-pass filtering by generalizing classical discrete

Fourier analysis to two-dimensional discrete surface signals.

The suggested smoothing algorithm is a very simple surface signal low-pass filter algorithm that

applies to surfaces of arbitrary topology. This algorithm works in linear time and space

complexity.

By combining surface subdivision and different types of constraints, this algorithm proves to be

a very effective technique for surfaces of arbitrary topology. Some of the constraints can be

imposed without any modification of the algorithm, while others do require a modification to

be made.

The constraints presented here are Vertex location constraints, both soft interpolation and hard

interpolation as well as Hierarchal constraints. Other constraints suggested in the paper, such

as vertex normal constraints, were not implemented due to technical difficulties with Matlab to

interact and modify the normals in an quick, comfortable and intuitive way.

We will talk about each topic briefly and then present our implementation, results and finally a

“user manual” for our demo applet.

INTRODUCTION

Fourier analysis is a natural tool to solve the problem of signal smoothing. The space of signals –

functions defined on certain domain – is decomposed into orthogonal subspaces associated

with different frequencies, with the low frequency content of a signal regarded as subjacent

data, and the high frequency content as noise.

The problem lies in calculating such decompositions, which is computationally expensive the

larger the vertex count gets, therefore the algorithm Taubin suggested, approximates the result

through an iterative process which eliminates the high frequencies with each iteration.

The algorithm is based on the Laplacian Smoothing iterative algorithm which shifts each vertex

location, according to local information in that vertex, without changing the connectivity of the

mesh. But the simple Laplacian Smoothing process is followed by an undesired effect; shrinkage

of the mesh. To solve this, an opposite operation is applied to assist in preserving the overall

dimensions of the mesh.

Page 4: A Signal Processing Approach To Fair Surface Design

4

THEORY

LAPLACIAN SMOOTHING ALG.

Otherwise known as Gaussian filtering, the purpose of the algorithm is to reduce the rapid

changes of the curvature throughout the mesh.

The idea is to move a vertex 𝑣𝑖 along a certain vector, that vector is the Discrete Laplacian

operator applied on that vertex, denoted by ∆𝑣𝑖. Thus, the new vertex location is:

𝑣𝑖′ = 𝑣𝑖 + 𝜆∆𝑣𝑖

Where 0 < 𝜆 < 1 is a factor that will determine the strength of the smoothing,

Δ𝑣𝑖 = ∑ 𝑤𝑖𝑗(𝑣𝑗 − 𝑣𝑖)𝑗∈𝑖∗ where 𝑖∗ is the indices of the neighboring vertices of 𝑣𝑖, and 𝑤 is the weight

function.

(*)𝑤𝑖𝑗 must be positive and each row adds up to 1. Otherwise we won’t have control over the

smoothing, i.e. instead of attenuating the frequencies, some will be enhanced.

In the simple case of a closed curve and 𝑤𝑖𝑗 =1

|𝑖∗|, we get:

∆𝑣𝑖 =1

2(𝑣𝑖−1 − 𝑣𝑖) +

1

2(𝑣𝑖+1 − 𝑣𝑖)

In matrix form:

𝑣1 = (𝐼 − 𝜆𝐾)𝑣 Where K is the Laplace operator

As mentioned before, this step produces shrinkage as Gaussian filter isn’t low-pass filter.

TAUBIN SMOOTHING ALG.

To define a low-pass filter, an opposite step is introduced into the Laplacian algorithm, and so

we define our smoothing operator:

𝑓(𝐾) = (𝐼 − 𝜆𝐾)(𝐼 − 𝜇𝐾)

Where −1 < 𝜇 < −𝜆 is a new negative scale factor.

And therefore the new smoothing step is as follows:

𝑣1 = 𝑓(𝐾)𝑣

Of course, as before, this step can be iterated 𝑁 times and the result:

𝑣𝑁 = 𝑓(𝐾)𝑁𝑣

Page 5: A Signal Processing Approach To Fair Surface Design

5

EIGENVALUES AND FREQUENCIES

The eigenvalues of the Laplacian operator 𝐾 are the frequencies of the mesh. In this part, we’ll

show how the Taubin Smoothing algorithm helps eliminating the high frequencies and

preserving the lower ones.

We first look at our weight function 𝑊 which, as mentioned above, must hold that all its

elements are non-negative and each row sums up to 1. Such matrices are called stochastic

matrices, and since 𝑊 is symmetric, the eigenvalues of 𝑊, denoted as 𝑘𝑖𝑊, are real and hold

|𝑘𝑖𝑊| ≤ 1

And by 𝐾’s construction, the eigenvalues of 𝐾 hold

0 ≤ 𝑘1𝐾 ≤ 𝑘2

𝐾 ≤ ⋯ ≤ 𝑘𝑛𝐾 ≤ 2

Real, bonded below by 0, and above by 2

In the case where 𝑊 is not symmetric, its eigenvalues might not be real, and the behavior of

the fairing algorithm will depend on their distribution in the complex plane. Although if the

eigenvalues are very close to the real line, we can ignore their imaginary parts and the result of

the algorithm should be essentially the same as the symmetric case above.

By 𝑓(𝐾)’s construction

𝑓(𝑘𝑖) = (1 − 𝜆𝑘𝑖)(1 − 𝜇𝑘𝑖) The eigenvalues of 𝑓(𝐾)

PASS-BAND REGION

𝑓(𝑘) is a square function, since 𝑓(0) = 1 and 𝜆 + 𝜇 < 0, there is a positive 𝑘𝑝𝑏 called the pass-

band frequency which holds 𝑓(𝑘𝑝𝑏) = 1. And then

∀𝑘 ∈ [0, 𝑘𝑝𝑏], 𝑓(𝑘)𝑁 ≈ 1

Pass-band region is preserved and

∀𝑘 ∈ (𝑘𝑝𝑏 , 2], 𝑓(𝑘)𝑁 ≈ 0 for large enough 𝑁

By demanding 𝑓(𝑘) = 1 we find that

𝑘𝑝𝑏 =1

𝜇+

1

𝜆

To minimize the number of iterations, 𝑁, the smoothing strength factor 𝜆 must be as large as

possible while keeping ∀𝑘 ∈ (𝑘𝑝𝑏 , 2], |𝑓(𝑘)| < 1.

Page 6: A Signal Processing Approach To Fair Surface Design

6

CONSTRAINTS

Constraints enable us to have more control over the smoothing process, we present three types

of constraints, hard interpolation, smooth interpolation and hierarchal constraints. Hard

interpolation and hierarchal constraints demand no modification of the algorithm but modify

the neighborhood structure of the mesh. Soft interpolation will require a small modification of

the algorithm but does not change the neighborhood structure.

HARD INTERPOLATION CONSTRAINTS

Hard interpolation, or non-smooth interpolation, on a set of vertices can be imposed without

any modification of the algorithm. Hard interpolation of a vertex prevents it from shifting from

its location during the smoothing process.

Solely based on the fact that a vertex 𝑣𝑖 without neighbors holds that ∆𝑣𝑖 = 0, imposing hard

interpolation on a vertex 𝑣𝑖 is fairly simple. Simply consider 𝑣 to have no neighbors, then

𝑣𝑖1 = 𝑣𝑖 + 𝜆Δ𝑣𝑖 = 𝑣𝑖

SOFT INTERPOLATION CONSTRAINTS

Soft interpolation, or smooth interpolation, offers a solution to perhaps an issue of hard

interpolation where the mesh loses it smoothness around the constrained vertices. It takes a

different approach to enforce a vertex’s location.

Based on applying a smooth deformation on the faired mesh, to restore the constrained

vertices back to their original location. When imposed on a vertex 𝑣𝑖, the new smoothing step is

defined as:

𝑣𝐶𝑁 = 𝑣𝑁 + (𝑣𝑖 − 𝑣𝑖

𝑁)𝐹𝑛𝑖𝐹𝑖𝑖−1

Where 𝐹 = 𝑓(𝐾)𝑁 and 𝐹𝑛𝑖𝐹𝑖𝑖−1 is our smooth deformation, (𝐹𝑛𝑖𝐹𝑖𝑖

−1)𝑖

= 1 which holds the interpolatory

constraint (𝑣𝐶𝑁)𝑖 = 𝑣𝑖

HIERARCHAL CONSTRAINTS

Same as hard interpolation, hierarchal interpolation does not require a modification of the

algorithm but of the neighborhood structure of the mesh. We assign to each vertex 𝑣𝑖 a label 𝑙𝑖

and then define the neighborhood structure as follows:

𝑗 ∈ 𝑖∗ ⟺ (𝑖, 𝑗) ∈ 𝐸 ∧ 𝑙𝑖 ≤ 𝑙𝑗

Page 7: A Signal Processing Approach To Fair Surface Design

7

IMPLEMENTATION

LAPLACIAN OPERATOR

getEdgeLengthWeights.m, getNeighorWeights.m, getK.m

We start by defining our Laplacian operator

𝐾 = 𝐼 − 𝑊

Where 𝑊 can be chosen to be either the inverse length of edges (𝑤𝑖𝑗) =‖𝑝𝑖−𝑝𝑗‖

−1

∑ ‖𝑝𝑖−𝑝ℎ‖−1ℎ∈𝑖∗

, or the

neighbor(uniform) weights (𝑤𝑖𝑗) =1

|𝑖∗|

PASS-BAND REGION AND FACTORS

getLambdaMiu.m

The easiest way to achieve control over the smoothing process, is to choose a pass-band

frequency 𝑘𝑝𝑏 first and deduct the values 𝜆 and 𝜇 from it. To do that we tend to solve the

following non-linear equation system

{𝑘𝑝𝑏 =

1

𝜆+

1

𝜇

𝑓(1) = −𝑓(2)

The system was solved using Matlab’s fsolver with the initial guess 𝜆0 = 0.5 , 𝜇0 = −0.5.

For most meshes, a value of 𝑘𝑝𝑏 in the region [0.01,0.1] produced best results.

SMOOTHING OPERATOR

getfK.m, applySmoothing.m

Finally, we can define our smoothing operator

𝑓(𝐾) = (𝐼 − 𝜆𝐾)(𝐼 − 𝜇𝐾)

We’ve also added the option to get the Laplacian smoothing operator 𝑓(𝐾) = (𝐼 − 𝜆𝐾)

Applying the operator is simple, the result of the smoothing after 𝑁 iterations is as mentioned

before 𝑣𝑁 = 𝑓(𝐾)𝑁𝑣

Page 8: A Signal Processing Approach To Fair Surface Design

8

HARD INTERPOLATION

applySmoothing.m

We can easily impose hard interpolation on a set of vertices by resetting the corresponding

rows in the Laplacian 𝐾 to zeros. Then 𝑓(𝐾) must be recalculated and applying smoothing is

same as before 𝑣𝑁 = 𝑓(𝐾)𝑁𝑣.

SOFT INTERPOLATION

applySmoothing.m

First, we calculate the difference 𝑣𝑚 − 𝑣𝑚𝑁 where 𝑚 is a set of the constrained vertices indices

and 𝑣𝑚 = 𝑣(𝑚, : ) is the set of constrained vertices. Then we tend to solve the following linear

system

𝐹𝑚𝑚𝑦𝑚 = (𝑣𝑚 − 𝑣𝑚𝑁)

Where 𝐹 = 𝑓(𝐾)𝑁 and 𝐹𝑚 = 𝐹(𝑚, 𝑚)

Finally, the smoothed result is

𝑣𝐶𝑁 = 𝑣𝑁 + 𝐹𝑦𝑛

HIERARCHAL CONSTRAINTS

hierarchizeAM.m

Here, we seek to modify The Adjacency Matrix 𝐴𝑀 of our mesh to fulfil the hierarchy levels

specified by the label 𝑙.

First, we extract all the indices (𝑟𝑖, 𝑐𝑖) where 𝐴𝑀𝑟𝑖𝑐𝑖= 1 and rebuild the matrix using Matlab’s

sparse with the parameters (𝑟, 𝑐, 𝑙𝑟 ≤ 𝑙𝑐) meaning we basically zero out neighboring vertices

which don’t fulfil the hierarchy condition.

Finally, a recalculation of 𝑓(𝐾) is needed and smoothing proceeds as normal.

Note: in the code we are assigning the result to a different matrix called hierarchizedAM, this is so we

can later revert back to the original adjacency matrix of the mesh.

It is also worth mentioning that this type of constraint is independent of the latter two, they can be

combined together to get both effects.

Page 9: A Signal Processing Approach To Fair Surface Design

9

EIGEN-DECOMPOSITION SMOOTHING

applySmoothingEigs.m

The straight forward way to eliminate high frequencies from a mesh is calculating the eigen-

decomposition of the Laplacian operator:

𝐾 = 𝑉𝐷𝑉𝑇 Where 𝑉 is the eigenvectors of 𝐾, and 𝐷 is a diagonal matrix where the eigenvalues are on the diagonal

Using Matlab’s eigs function, we calculated the first 𝑚 eigenvalues diagonal matrix 𝐷𝑚 and

their corresponding eigenvectors 𝑉𝑚 and then the smoothed result is

𝑣𝑛−𝑚 = 𝑉𝑚𝑉𝑚𝑇𝑣

Smoothing using this method to receive a significantly smoothed result can be very efficient

due to the fact we will need to calculate a small number of eigenvalues and eigenvectors, but

computation time increases drastically as 𝑚 increases.

Page 10: A Signal Processing Approach To Fair Surface Design

10

RESULTS, CONCLUSIONS AND

DISCUSSIONS

Partially noisy sphere

Left to right: Original model, after 10 non-shrinking smoothing steps, after 50 steps,

after 200 steps.

It can be seen that there’s barely difference between smoothing with 50 steps and 200

in this case, it can be said that the process has converged. Also, even after 200

smoothing steps, the model didn’t shrink nor was its general shape altered, i.e. the right

side, where the noise was, still can be noticed to be different than the left side.

CT scan

Left to right: Original model(Spine - First Lumbar Vertebra), the original model voxelized

to emulate a CT scan model, voxelized model smoothed 100 steps.

Here, we were able to achieve a beautiful and fine visualization of the bone using

Taubin Smoothing.

We noticed that through this process of emulating a scan and smoothing it, not only can

we achieve a higher detail mesh, but also a clean and organized one as well.

Can Voxelization and Taubin Smoothing be used as a remeshing technique?

1. Voxelize the mesh 2. Remove interior polygons created from voxelization 3. Smooth

Page 11: A Signal Processing Approach To Fair Surface Design

11

Wine Glass

Left to right: Original low-poly wine glass, after Subdivision and Laplacian Smoothing,

after Subdivision and Taubin Smoothing, Phong Shaded.

Taubin Smoothing’s advantages and Laplacian Smoothing’s disadvantages are clear in

this example.

While attempting to achieve a good looking wine glass by subdividing and smoothing,

we saw that the best results were achieved by switching between Laplacian and Taubin

Smoothing steps, which in a way felt like sculpting.

This has led us to ask if we could incorporate Taubin Smoothing, Laplacian smoothing as

well as the aforementioned constraints as a sculpting tool set. The user can select parts

of the mesh and apply combinations of the tools to alter the mesh shape.

For example, we sculpted this glass out of the same low-poly wine glass from above:

Page 12: A Signal Processing Approach To Fair Surface Design

12

Face

Left to right: Original low-poly face, Smoothed with no constraints, smoothed with hard

interpolatory constraints on features(eyes, nose, lips and chin).

Same as before we can use different kinds of constraints and smoothing methods to

design the mesh as we like. For example, using hard and hierarchal constraints, we were

able achieve an interesting looking mesh structure

Page 13: A Signal Processing Approach To Fair Surface Design

13

Hard Vs. Soft Interpolation

Left to right: Original model(Sphere with spikes), Smoothed with Hard Interpolation

applied to the tips of the spikes on the sides, Smoothed with Soft Interpolation.

Hard interpolation’s disadvantage can be seen here as smoothing process was not

useful for the interpolated points, whereas in Soft Interpolation we have achieved both

the interpolatory constraint and a smooth mesh around the interpolated points.

Hierarchal Constraints

Right to left: original model, smoothed, smoothed with hierarchal constraints applied.

The vertices on the edges of the model were set to one hierarchy level higher than the

rest.

We can see that, due to the hierarchal neighborhood structure, vertices of the highest

hierarchy level (the edges) were smoothed like a curve and the three triangles were

rounded into circles.

Page 14: A Signal Processing Approach To Fair Surface Design

14

Eigendecomposition smoothing

Left to right: Original, 𝑚 = 10, 30, 100, 200, 325

This mesh is made up of 2903 vertices which indicates that there is an equal number of

eigenvectors.

As can be seen here, at around 𝑚 = 200, noise starts to build up at parts where there’s

high curvature values(eyelids, ears and horns). We believe that is due to the instability

of Matlab’s eigs function. We have also found that for all models, noise starts to get

noticed at 𝑚 ≈ 0.1 ∙ |𝑉| and builds up as 𝑚 increases.

Page 15: A Signal Processing Approach To Fair Surface Design

15

DEMO MANUAL

To run the demo, call the script file Demo.m

1. Taubin: Smoothing method selection. Checked - Taubin. Unchecked – Laplacian.

2. Load OFF/Export OFF/Export OBJ: Load meshes and export meshes as .off or .obj files.

3. Edge Lengths/Uniform: Select weight function.

4. Kpb: Set pass-band frequency 𝑘𝑝𝑏, Enabled only in Taubin Smoothing mode.

5. Subdivide: Subdivide mesh.

6. Select vertices: Use slider to select vertices(will be colored in red).

7. Add as hierarchy level/Revert AM(*): Increment 𝑙(hierarchy level) of selected vertices.

Revert AM – restore original adjacency matrix(reset hierarchy levels)

8. Add as constraints/Smooth Interpolation: Set interpolatory constraints on the selected

vertices. Smooth Interpolation – checked for Soft interpolation. Unchecked for Hard

interpolation (*Cannot combine soft with hard, only the last selection set is valid!)

9. Smooth once/Auto smooth: Apply one step or automatically apply 100 steps of

smoothing. The iteration count is displayed under the buttons.

10. Eigs smooth: Use slider to set the level of smoothing with lowest being no

smoothing(𝑚 = |𝑉|).(**)

11. Draw Mean: Visualize Mean Curvature function on the mesh

12. Reset: Reset mesh to original data. Removes also constraints and resets hierarchy levels.

(*) Make sure there aren’t any vertices in some hierarchy level with no neighbors in the

same or higher level. Otherwise, these loner vertices will start moving toward the origin

with each smoothing step because in case of no neighbors, ∆𝑣𝑖 = −𝑣𝑖.

(**) Set the slider to max(𝑚 = 0) and press Eigs smooth to get an “inflating” animation of

the mesh from 𝑚 = 0 to 𝑚 = 0.1 ∙ |𝑉|. On first call to Eigs smooth, please wait for all

eigenvectors to be calculated.