POV-Ray : Newsgroups : povray.advanced-users : smooth_triangle normals : Re: smooth_triangle normals Server Time
19 Apr 2024 19:27:48 EDT (-0400)
  Re: smooth_triangle normals  
From: Tor Olav Kristensen
Date: 26 Sep 2020 19:15:00
Message: <web.5f6fc9acaf8e23f96d7cc5a50@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> I've been rendering quite a few illustrations for
>
>
http://news.povray.org/povray.off-topic/message/%3Cweb.5f3045d617b7b05f1f9dae300%40news.povray.org%3E/#%3Cweb.5f3045d
61
> 7b7b05f1f9dae300%40news.povray.org%3E
>
> and have been mixing the very broad strokes with digging into the very detailed
> bits.
>
> At the moment, having some issues with smooth_triangles and want to verify a few
> things, so I want to make sure everything is absolutely correct. Assume I'm
> laying out a grid of squares made up of 2 triangles each.
>
> All my flat triangles are fine, and I can see all of the individual triangles,
> since all of the face normals are sufficiently different.
>
> With smooth_triangles, even though the vertex coordinates are the same,
> sometimes I get the degenerate triangle warning when working out the vertex
> normal vectors.
>
> When I use the corners of the square to calculate the normals, the edge between
> the two triangles of the square softens/goes away, but the edges between all of
> the squares are still pretty abrupt.
> When I try to use a small dy or dx offset to calculate the normals, I get a lot
> of the degenerate triangle warnings and few if any visible triangles.  Not sure
> why.
>
> So:
>
> When calculating the normals, do I use the remaining two triangle vertices, or
> the orthogonal edge vectors of the square?
> Do I normalize the vectors before using vcross()?
> Do I normalize the resulting vertex normal vectors?

There are several possible ways to create normals for a triangle mesh.
One of them is described in the first answer here:

"Calculating normals in a triangle mesh"
https://stackoverflow.com/questions/6656358/calculating-normals-in-a-triangle-mesh

A couple of the other answers also contain some useful information.
I would also suggest that you explore the "Linked" and "Related"
questions/answers.

Some more ways to calculate the normals are described in this article:
"A Comparison of Algorithms for Vertex Normal Computation"
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.99.2846&rep=rep1&type=pdf

I think that there are even more sensible ways to calculate the normals,
each having it's advantages and disadvantages with different meshes.

--
Tor Olav
http://subcube.com
https://github.com/t-o-k


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.