Remesh modifier produces artifacts in sharp mode
Open, Needs TriagePublic


System Information
Linux 4.14.6-1-ARCH
Nvidia Quadro1200M

This, however, seems to be a systematic problem and should be evident independent of the system.

Blender Version
Broken: 2.79 (076616898bff0acfc2336351ee975bd0fef944b2)
Worked: none

Short description of error
Remesh modifier produces degenerate primitives.

Exact steps for others to reproduce the error
Create, e.g., a torus with 200 major segments and 150 minor segments. Apply remesh modifier in sharp mode with octree depth >= 6. Primitives will become degenerate or even overlap each other (see attached blend file).

Proposed solution
I've looked into this bug and discovered that there is a problem when solving the QEF (quadratic minimization problem) using the Moore-Penrose pseudoinverse for dual contouring. According to the dual contouring paper (link) and the according supplemental material (link) the threshold for truncating singular values should be absolute and around 0.1 (however I found a threshold of 0.01 working best for me).

I've attached a patch resolving this issue.

I would further suggest to instead of passing dynamic Eigen matrices (MatrixXf) to the psuedoInverse function passing static Eigen matrices (Matrix3f). In this way the data structure lives on the stack and no allocation calls have to be made in the function. This should improve the performance of the algorithm and is also included in the patch.