ExtrudeNet: Unsupervised Inverse Sketch and Extrude for Shape Parsing
|
|
Abstract
Sketch-and-extrude is a common and intuitive modeling process in computer aided design. This paper studies the problem of learning the shape given in the form of point clouds by inverse sketch-and-extrude. We present ExtrudeNet, an unsupervised end-to-end network for discovering sketch and extrude from point clouds. Behind ExtrudeNet are two new technical components: 1) an effective representation for sketch and extrude, which can model extrusion with freeform sketches and conventional cylinder and box primitives as well; and 2) a numerical method for computing the signed distance field which is used in the network learning. This is the first attempt that uses machine learning to reverse engineer the sketch-and-extrude modeling process of a shape in an unsupervised fashion. ExtrudeNet not only outputs a compact, editable and interpretable representation of the shape that can be seamlessly integrated into modern CAD software, but also aligns with the standard CAD modeling process facilitating various editing applications, which distinguishes our work from existing shape parsing research.
ExtrudeNet Structure
rBezierSketch
rBezierSketch is designed with the following benifits in mind.
- Compatible with industry standards as it is a simple form of NURBS
- It can represent straight lines, circles and free-form curves in a uniform representation
- It represent a star-convex set and will not self intersect
- It can be constraint to generate only C1 continuous sketch
Sketch2SDF
We present a numerical method for computing the SDF of simple parametric sketches. The method is general. While it applies to the rational cubic Bézier curves here, it also works for other parametric curves. This method also yields good gradients which is friendly for deep learning applications.
The SDF of a sketch is defined by the Distance-Field DF(p), the smallest distance from a given testing point p to the curve, multiplied by a sign SIGN(p) which indicates whether the testing point p is inside or outside of the sketch.
We first sample a set of sample points from the curve
$$
S =\left\{\left(x(\frac{i}{n}),y(\frac{i}{n})\right)\mid i=0,1,\cdots,n\right\}
$$
and the distance field can be approximated by
$$
DF(p)= \underset{s\in S}{\min} \|s-p\|_2
$$
the normal of each sample point is computed
$$
N(t) = \left(\frac{d y(t)}{dt}, -\frac{d x(t)}{dt}\right)
$$
the sign can be computed as follow
$$
SIGN(p)= \frac{N(CT(p))\cdot (C(CT(p))-p)}{\|N(CT(p))\cdot (C(CT(p))-p)\|_2 + \epsilon}
$$
put them together, the final sdf is equal to
$$
SDF_s(p) = SIGN(p) \times DF(p).
$$
Extrusion
We first transform the testing point p back to a point p' by reversing the transformations that transform the XY-plane to the target sketch plane. Then we compute the signed distance of p' with respect to the upright extrusion shape whose base lies on the XY-plane
If the testing point is inside the extruded shape
$$
SDF_i(p') = \max(\min(SDF_s((p'_x, p'_y)), h-p'_z, p'_z), 0)
$$
otherwise
$$
SDF_o(p') = -[
(\min(h-p'_z,0))^2+(\min(p'_z,0))^2
\mbox{} +(\min(SDF_s((p'_x, p'_y)),0))^2 ]^{\frac{1}{2}}
$$
Finally, the overall SDF is the sum of the two cases.
$$
SDF(p') = SDF_i(p') + SDF_o(p')
$$
Evaluation of rBezierSketch
Approximability
To demonstrate the approximation ability and the ease of learning of the proposed rBezierSketch, we conduct a fitting experiment that directly optimize for the radial coordinate that best reconstructs a given raster emoji image.
Versatility and error analysis
To show the versatility, we implemented four different kinds of parametric curves, namely polygon, ellipse, Cubic Bezier Sketchs with C1 and C0 continuity. Note that our method is not limited to these curves, and can be easily adapted to new parametric curve types. We also plot the error introduced by apprimation by comparing our results with analytical results.
Edibility of Sketch and Extrude
As rBezier sketch is essentially a cubic rational bezier curve and Extrusion is a typical operation for B-Rep representation, our results are well compatiable to popular CAD software.
Comparison on Geometric Evaluation Results
The following figure shows the qualitative comparison with baselines, We can see our method achieves better geometry approximation with fewer primitives.
Acknowledgement
The work is partially supported by a joint WASP/NTU project (04INS000440C130), Monash FIT Startup Grant, and SenseTime Gift Fund.