|
 |
"ingo" <nomail@nomail> wrote:
> 1. First calculate the face normal, either by cross product of three edges or
> Newell's method
>
> Newell:
> for i in 0..<vertices.len:
> let curr = vertices[i]
> let next = vertices[(i + 1) mod vertices.len]
> normal.x += (curr.y - next.y) * (curr.z + next.z)
> normal.y += (curr.z - next.z) * (curr.x + next.x)
> normal.z += (curr.x - next.x) * (curr.y + next.y)
> return normalize(normal)
>
> 2. Now calulate the vertex normals, there several weighting types can be used,
> based on properties of the adjacent polygons.
> Weighted by area, weighted by angle or just average the face normals as they
> are.
You're making me want to revisit one of my other small projects:
https://news.povray.org/web.655dee4084c692a31f9dae3025979125%40news.povray.org
Too much to do, too little time.
- BW
Post a reply to this message
|
 |