Search code examples
3dpolygonmeshcurvesmoothing

What is the best type of curve to approximate a smoothed polygonal mesh


I have a 3D mesh made of vertices and triangles. I know the position and smoothed normal of the vertices, and the flat normals of the triangles. I would like to calculate the curve segment passing through 2 given vertices, using only their positions and normals.

Right now, I'm using a Catmull Rom spline, but it needs 4 points to draw 1 curve segment, as shown in this picture of a sliced view of a simple mesh :

enter image description here

To draw the yellow curved segment between B and C, corresponding to the estimated curvature of the red edge, I have to use the positions of vertices A,B,C and D The other cyan segments are drawn using the same method.

  1. I would like to compute each curved segment only using the data in the segment's vertices. Here it would be only using the positions and normals of B and C as input data to compute the yellow curved segment... And still keep an homogeneous overall shape when computing the curves of all segments

  2. I'm not sure this curve is the right one to represent the simulated curvature shown by the smoothed normals of the mesh while rendering it with a simple 3D diffuse shading, therefore I would like to know which other type of curve could be a better match in this precise case. And maybe one more adapted to the constrain of using as input only the positions and normals of the two points.

Thanks ! :)


EDIT : The result using a Hermite spline as suggested by Fang : enter image description here This is perfect for me. Thanks again :)


Solution

  • If you simply want to interpolate between two end points and two end normal vectors, you can use cubic Hermite curve. Cubic Hermite curve is defined by two end points and two end first derivatives. Since you don't have first derivatives at the vertices, you can infer them from the vertex normal

    Given vertex B and C and vertex normal Nb and Nc,

    1. construct first derivative at vertex B by projecting vector S = 1/3* (C - B) onto the plane defined by vertex B and its vertex normal Nb.
    2. construct first derivative at vertex C by projecting same vector S onto the plane defined by vertex C and its vertex normal Nc.
    3. The cubic Hermite curve is now fully defined as we have two end points (vertex B and C) and two end first derivatives. It will interpolate vertex B and C and its tangent at B and C will be perpendicular to the normal.

    If vector(BC) is already perpendicular to normal Nb and Nc, the cubic Hermite curve will become a straight line.

    The cubic Hermite curve constructed in this way only utilizes the data within segment between vertex B and C. Therefore, it is likely that it will not be joined smoothly to its adjacent curve segments. If you would like to avoid this issue, then you will have to utilize data from adjacent segments. Instead of projecting vector S = 1/3*(C-B), project vectors Sb and Sc onto planes at vertex B and C respectively where

       Sb = m*(A + C - 2*B)/2,
       Sc = m*(B + D - 2*C)/2.
    

    and m is a constant (typically < 1.0) to adjust for the first derivative's magnitude.

    This way, the first derivative will be the same at vertex B for segment BC and for segment AB, which will ensure that the curve segment BC and curve segment AB will be joined smoothly.