vertex normal

本文介绍了几种基本的矢量运算方法,包括向量叉乘和点乘,并详细阐述了如何通过这些运算来计算面法线和顶点法线,提供了两种不同的顶点法线计算算法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Basis:
    Cross Product
        Define two input vectors, Vector1 (x1, y1, z1) and Vector2 (x2, y2, z2), and one output vector, OutVect(ox, oy, oz). The components of OutVect are calculated as follows:
        ox = (y1 * z2) - (y2 * z1)
        oy = (z1 * x2) - (z2 * x1)
        oz = (x1 * y2) - (x2 * y1)

    Dot Product
        Define two vectors. Vector1 (x1, y1, z1) and Vector2 (x2, y2, z2).
        DotProduct = (x1*x2 + y1*y2 + z1*z2)

surface normal:
    three vertices V1, V2 and V3, ordered in counterclockwise order, obtain the direction of the normal by computing
    (V2 - V1) x (V3 - V1), where x is the cross product of the two vectors

    U = (V2 - V1)
    V = (V3 - V1)
    surfaceNormal.x = U.y * V.z - U.z * V.y
    surfaceNormal.y = U.z * V.x - U.x * V.z
    surfaceNormal.z = U.x * V.y - U.y * V.x

vertex normal:
    Algorithm1:
    Use cross-products to calculate the face normals for the triangles surrounding a given vertex, add them together, and normalize.
        1. Read the faces in your model file
        2. Calculate the face normal
        3. Add it to the normal of each vertex making up that face
        4. After that's done, normalize all the vertex normals

    Algorithm2:
        Sum the face normals (component wise) for avery triangle containing the vertex
        Devide the summed normal (component wise) by the number of triangles containing the vertex to get the normal for the vertex
        Normalize all the vertex normals


reference:
    google "Face and Vertex Normal Vectors mdsn"
    https://msdn.microsoft.com/en-us/library/windows/desktop/bb324491%28v=vs.85%29.aspx

    google "vertex normal wiki"
    https://en.wikipedia.org/wiki/Vertex_normal

    google "A Comparison of Algorithms for Vertex Normal Computation"
    A Comparison of Algorithms for Vertex Normal Computation.pdf

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值