<p>You could try the <a href="https://www.semanticscholar.org/paper/FiberMesh%3A-designing-freeform-surfaces-with-3D-Nealen-Igarashi/25b7f1b06e60a39113ebc25049e13b58f84fec1b" rel="nofollow noreferrer">FiberMesh</a> technique. Fibermesh takes 3D input curves and interprets them as the contours of the surface. It then creates a smooth surface by using an optimization technique. <a href="https://www.youtube.com/watch?v=OsOauFjnYSo" rel="nofollow noreferrer">Here</a> you can see a video, which demonstrates the technique. </p>

CC BY-SA 4.0
2019-10-15T12:39:39.810Z
2019-10-15T12:39:39.810Z
Reynolds
<p>One algorithm that's pretty good for this, but very difficult to implement is to find the <a href="https://en.wikipedia.org/wiki/Medial_axis" rel="nofollow noreferrer">Medial Axis</a> of the shape and then have various profiles that are based on the signed distance from the medial axis. You can also use the <a href="https://en.wikipedia.org/wiki/Straight_skeleton" rel="nofollow noreferrer">Straight Skeleton</a> instead of the Medial Axis, but it's also a bit of a pain to calculate.</p>

<p>An easier way that's not quite as accurate, but usually good enough is described here: <a href="https://steamcdn-a.akamaihd.net/apps/valve/2007/SIGGRAPH2007_AlphaTestedMagnification.pdf" rel="nofollow noreferrer">https://steamcdn-a.akamaihd.net/apps/valve/2007/SIGGRAPH2007_AlphaTestedMagnification.pdf</a>. You can take a bitmap of the shape the user drew, shrink it down to some manageable size, calculate the distance of every pixel from the edges of the shape, then scale it to the size you need (and scale the distances accordingly). Once you have signed distances you can use them with the same 3D profiles mentioned above.</p>

<p>For example, the pillow in the video you showed is basically drawn as a square. Your 3D profile would set the front face height to 0 at the squares edges, and increasing up to some maximum as you moved towards the center, peaking after a short distance and holding up to the center. The back face height would be the same but in the opposite direction.</p>

CC BY-SA 4.0
2019-12-04T23:04:55.963Z
The medial axis is easier to calculate then the straight skeleton, the edge cases of the straight skeleton are a nightmare!
Felipe Gutierrez
CC BY-SA 4.0
2019-10-14T02:04:25.693Z
2019-10-14T02:04:25.693Z
user1118321
<p>I am trying to find (or maybe create) an algorithm for creating a smooth, rounded 3D mesh given a 2D outline. I'm trying to recreate a system from a Gamecube game called Amazing Island, and you can see an example of how it works <a href="https://youtu.be/8xI2sZwYg10?t=62" rel="noreferrer">here</a>. A more modern example of what I'm trying to do would be the <a href="https://youtu.be/Zl_Gimw62mM?t=98" rel="noreferrer">Soft Edge 3D Doodle tool in Paint 3D</a>.</p>

<p>Basically, you draw a shape with a freeform pen tool, and the shape is "inflated" into a 3D mesh. The result should have smooth, curved, somewhat organic-looking edges, rather than simply extruding the shape into a prism. Each shape can be assumed to be simply connected (meaning shapes with holes through them are not possible), and it can be assumed that the outline won't self-intersect. It would be nice if I could find a way to have non-simply connected shapes, but it's not necessary, and seems like it would be significantly more complicated.</p>

<p>The closest thing that I've been able to find is how to take an outline and triangulate it to make a flat 2D mesh. I'm pretty lost on how I can take that and turn it into what I want though. I can get a list of points representing the vertices of the outline, which seems like it should be the first step.</p>

<p>I'm implementing this in C#, in Unity, but I'm not necessarily looking for code. A description of an algorithm, or even a good idea for how I could approach the problem, would be great. Thank you for your time.</p>

<3d><algorithm><computational-geometry><mesh><procedural-generation>
Creating a Smooth 3D Mesh from a 2D Outline
hamulstdubbins
# Creating a Smooth 3D Mesh from a 2D Outline

(Asked by: username_0 on 2019-10-11)

I am trying to find (or maybe create) an algorithm for creating a smooth, rounded 3D mesh given a 2D outline. I'm trying to recreate a system from a Gamecube game called Amazing Island, and you can see an example of how it works [here](https://youtu.be/8xI2sZwYg10?t=62). A more modern example of what I'm trying to do would be the [Soft Edge 3D Doodle tool in Paint 3D](https://youtu.be/Zl_Gimw62mM?t=98).

Basically, you draw a shape with a freeform pen tool, and the shape is "inflated" into a 3D mesh. The result should have smooth, curved, somewhat organic-looking edges, rather than simply extruding the shape into a prism. Each shape can be assumed to be simply connected (meaning shapes with holes through them are not possible), and it can be assumed that the outline won't self-intersect. It would be nice if I could find a way to have non-simply connected shapes, but it's not necessary, and seems like it would be significantly more complicated.

The closest thing that I've been able to find is how to take an outline and triangulate it to make a flat 2D mesh. I'm pretty lost on how I can take that and turn it into what I want though. I can get a list of points representing the vertices of the outline, which seems like it should be the first step.

I'm implementing this in C#, in Unity, but I'm not necessarily looking for code. A description of an algorithm, or even a good idea for how I could approach the problem, would be great. Thank you for your time.

**Tags:** 3d, algorithm, computational-geometry, mesh, procedural-generation


---

## 2 answers

### Answer by username_2 on 2019-10-14. Score: 4 | Accepted answer

One algorithm that's pretty good for this, but very difficult to implement is to find the [Medial Axis](https://en.wikipedia.org/wiki/Medial_axis) of the shape and then have various profiles that are based on the signed distance from the medial axis. You can also use the [Straight Skeleton](https://en.wikipedia.org/wiki/Straight_skeleton) instead of the Medial Axis, but it's also a bit of a pain to calculate.

An easier way that's not quite as accurate, but usually good enough is described here: <https://steamcdn-a.akamaihd.net/apps/valve/2007/SIGGRAPH2007_AlphaTestedMagnification.pdf>. You can take a bitmap of the shape the user drew, shrink it down to some manageable size, calculate the distance of every pixel from the edges of the shape, then scale it to the size you need (and scale the distances accordingly). Once you have signed distances you can use them with the same 3D profiles mentioned above.

For example, the pillow in the video you showed is basically drawn as a square. Your 3D profile would set the front face height to 0 at the squares edges, and increasing up to some maximum as you moved towards the center, peaking after a short distance and holding up to the center. The back face height would be the same but in the opposite direction.

> **Comments:**
> **username_3**: The medial axis is easier to calculate then the straight skeleton, the edge cases of the straight skeleton are a nightmare!  

---

### Answer by username_1 on 2019-10-15. Score: 1

You could try the [FiberMesh](https://www.semanticscholar.org/paper/FiberMesh%3A-designing-freeform-surfaces-with-3D-Nealen-Igarashi/25b7f1b06e60a39113ebc25049e13b58f84fec1b) technique. Fibermesh takes 3D input curves and interprets them as the contours of the surface. It then creates a smooth surface by using an optimization technique. [Here](https://www.youtube.com/watch?v=OsOauFjnYSo) you can see a video, which demonstrates the technique.


---

