<p>I've been playing around with an idea, but I'm struggling with some of the math involved.</p>
<p>Now, each face of a mesh has a normal vector, and that the normal map fragment shader modifies that face normal, based on the RBG pixel of the normal map. This, in turn modifies the brightness of a rendered mesh, giving the impression of height and depth. Correct me if I'm mistaken, of course.</p>
<p>So, based on this, if you managed to split up a mesh, to add extra edges that correspond to individual pixel boundaries - with each boundary containing portions of one or more of the original faces, you could then apply the normal modification of the corresponding normal map's pixel, as rotation.</p>
<p>Then, it would simply be a matter of reconnecting the vertices, to make the mesh cohesive again</p>
<p>While I can find plenty of sources on how normal maps affect the normal vectors of a mesh, I'm a bit lost on how to take that effect, and apply it to physically rotating the face, so the original normal vector matches its modified vector.</p>

CC BY-SA 4.0
2021-02-04T01:08:01.250Z
Some food for thought: Would you expect the tessellated mesh to be free of "cracks"? If not would you add triangles to fill those cracks? Otherwise the new mesh effectively becomes a heightfield which limits how far individual triangles can be "rotated". The points in a triangle all lie in a common plane, a plane is defined by a normal and a distance from the origin. The new normal is the normal of the plane, pick a point in the triangle to compute the distance and adjust the triangle corners along the normal direction to lie in the plane.(not a solution just a thought)
pmw1234
CC BY-SA 4.0
2021-02-04T12:50:31.620Z
Well, lets consider a mormal map that consists of a large dome, and its applied to a mesh that's a flat plane. If this split and rotate method was done to the plane, the result should be a collection of quasi fragments all rotated appropriately, yet still sitting on the same z axis (z-up) as the original plane. The result should be the same as if you took a physical dome mesh, broke all its vertices, and moved each face down.
Digital_Utopia
CC BY-SA 4.0
2021-02-04T13:00:03.263Z
So, in both cases, the dome should be able to be assembled from the outside in, by moving each "fragment" up the z-axis, until its verts match up with its neighbors. The same basic technique should hold true for more complex meshes/normal maps
Digital_Utopia
CC BY-SA 4.0
2021-02-04T14:37:36.280Z
I suggest looking up "tessellation shading" on a search engine. That should point you at mountains of info for what you are describing.
pmw1234
<mathematics><vectors>
How do I figure rotation from the difference between two vectors?
Digital_Utopia
# How do I figure rotation from the difference between two vectors?

(Asked by: username_0 on 2021-02-04)

I've been playing around with an idea, but I'm struggling with some of the math involved.

Now, each face of a mesh has a normal vector, and that the normal map fragment shader modifies that face normal, based on the RBG pixel of the normal map. This, in turn modifies the brightness of a rendered mesh, giving the impression of height and depth. Correct me if I'm mistaken, of course.

So, based on this, if you managed to split up a mesh, to add extra edges that correspond to individual pixel boundaries - with each boundary containing portions of one or more of the original faces, you could then apply the normal modification of the corresponding normal map's pixel, as rotation.

Then, it would simply be a matter of reconnecting the vertices, to make the mesh cohesive again

While I can find plenty of sources on how normal maps affect the normal vectors of a mesh, I'm a bit lost on how to take that effect, and apply it to physically rotating the face, so the original normal vector matches its modified vector.

**Tags:** mathematics, vectors

> **Comments:**
> **username_1**: Some food for thought: Would you expect the tessellated mesh to be free of "cracks"? If not would you add triangles to fill those cracks? Otherwise the new mesh effectively becomes a heightfield which limits how far individual triangles can be "rotated". The points in a triangle all lie in a common plane, a plane is defined by a normal and a distance from the origin. The new normal is the normal of the plane, pick a point in the triangle to compute the distance and adjust the triangle corners along the normal direction to lie in the plane.(not a solution just a thought)  
> **username_0**: Well, lets consider a mormal map that consists of a large dome, and its applied to a mesh that's a flat plane. If this split and rotate method was done to the plane, the result should be a collection of quasi fragments all rotated appropriately, yet still sitting on the same z axis (z-up) as the original plane. The result should be the same as if you took a physical dome mesh, broke all its vertices, and moved each face down.  
> **username_0**: So, in both cases, the dome should be able to be assembled from the outside in, by moving each "fragment" up the z-axis, until its verts match up with its neighbors. The same basic technique should hold true for more complex meshes/normal maps  
> **username_1**: I suggest looking up "tessellation shading" on a search engine. That should point you at mountains of info for what you are describing.  

---

## 0 answers

