<p>This is how I ended up doing it:</p>
<p>Instead of using vertex colors like most of the solutions I found online, I calculated the angle of each edge, and then used a shader to draw the lines in UV space. This Also gives me control over how thick the lines should be.</p>
<p>In some cases the angle calculated isn't right, but that should be easy to fix.</p>
<p><a href="https://i.sstatic.net/yoqrt.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/yoqrt.png" alt="Curvature map applied to a model" /></a></p>
<p>Here is the project: <a href="https://github.com/Jummit/curvature-baker" rel="nofollow noreferrer">https://github.com/Jummit/curvature-baker</a></p>

CC BY-SA 4.0
2020-12-06T09:50:00.090Z
2020-12-06T09:50:00.090Z
Jummit
<p>I'm looking for a way to generate curvature maps like this:</p>
<p><a href="https://i.sstatic.net/uE97h.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/uE97h.jpg" alt="curvature map" /></a></p>
<p>The map stores the Convexity and Concavity of each pixel as a value from 0 to 1, where .5 is no curvature and 1 and 0 are the extremes.</p>
<p>I searched for how to calculate the curvature of meshes and found these questions on StackExchange:</p>
<p><a href="https://computergraphics.stackexchange.com/questions/1718/what-is-the-simplest-way-to-compute-principal-curvature-for-a-mesh-triangle">What is the simplest way to compute principal curvature for a mesh triangle?</a></p>
<p><a href="https://gamedev.stackexchange.com/questions/92621/cavity-map-generation">https://gamedev.stackexchange.com/questions/92621/cavity-map-generation</a></p>
<p><a href="https://blender.stackexchange.com/questions/146819/is-there-a-way-to-calculate-mean-curvature-of-a-triangular-mesh">https://blender.stackexchange.com/questions/146819/is-there-a-way-to-calculate-mean-curvature-of-a-triangular-mesh</a></p>
<p>But I'm not sure if these are about the method actually used in the example.</p>
<p>What algorithm is used to bake these maps, and where can I find more information about it?</p>

<texture><algorithm><mesh>
What method is used for baking grayscale curvature maps
Jummit
# What method is used for baking grayscale curvature maps

(Asked by: username_0 on 2020-07-21)

I'm looking for a way to generate curvature maps like this:

[![curvature map](https://i.sstatic.net/uE97h.jpg)](https://i.sstatic.net/uE97h.jpg)

The map stores the Convexity and Concavity of each pixel as a value from 0 to 1, where .5 is no curvature and 1 and 0 are the extremes.

I searched for how to calculate the curvature of meshes and found these questions on StackExchange:

[What is the simplest way to compute principal curvature for a mesh triangle?](https://computergraphics.stackexchange.com/questions/1718/what-is-the-simplest-way-to-compute-principal-curvature-for-a-mesh-triangle)

<https://gamedev.stackexchange.com/questions/92621/cavity-map-generation>

<https://blender.stackexchange.com/questions/146819/is-there-a-way-to-calculate-mean-curvature-of-a-triangular-mesh>

But I'm not sure if these are about the method actually used in the example.

What algorithm is used to bake these maps, and where can I find more information about it?

**Tags:** texture, algorithm, mesh


---

## 1 answers

### Answer by username_0 on 2020-12-06. Score: 0 | Accepted answer

This is how I ended up doing it:

Instead of using vertex colors like most of the solutions I found online, I calculated the angle of each edge, and then used a shader to draw the lines in UV space. This Also gives me control over how thick the lines should be.

In some cases the angle calculated isn't right, but that should be easy to fix.

[![Curvature map applied to a model](https://i.sstatic.net/yoqrt.png)](https://i.sstatic.net/yoqrt.png)

Here is the project: <https://github.com/username_0/curvature-baker>


---

