POV-Ray : Newsgroups : povray.binaries.scene-files : Wrong normal direction on triangle{ }s : Re: Wrong normal direction on triangle{ }s Server Time
25 Apr 2024 15:59:38 EDT (-0400)
  Re: Wrong normal direction on triangle{ }s  
From: clipka
Date: 18 Aug 2016 00:22:26
Message: <57b53802@news.povray.org>
Am 17.08.2016 um 21:11 schrieb Bald Eagle:

> I just got done working out some code to generate spheres from traingles and
> smooth_triangles, but when I texture the sphere with both a texture (red) and an
> interior_texture (green), it appears to me that some of the surface normals are
> the opposite of what they should be.  I tried playing around with the order of
> the vertices, but that didn't seem to accomplish much.

- Can you be more specific what playing around with the order of the
vertices /did/ accomplish, and what it /didn't/?

- The interior/exterior texture issues seen with the /flat/ triangles
version are most certainly due to inconsistent ordering of the vertices.

- The interior/exterior texture issues seen with the /smooth/ triangles
version in the image posted on povray.binaries.images are known
artifacts of smooth triangles.

What happens is this:

- To determine whether we see the inside or outside of an object,
POV-Ray tests whether the surface normal computed at a given point is
oriented somewhat towards us (in which case POV-Ray concludes that we
see the outside) or somewhat away from us (in which case POV-Ray
concludes that we see the inside).

- With flat triangles, the surface normal is computed as the cross
product of the vectors P2->P1 and P2->P3, respectively. As a result, the
direction of the surface normal is determined by the ordering of the
vertices, and if you get the ordering wrong on a triangle you will see
the inside texture where you expect the outside texture and vice versa.
To fix this, you have to re-order the vertices.

- With smooth triangles, the surface normal is instead interpolated from
the normal vectors given for the vertices. If we see the triangle almost
edge-on, it may happen that the normal vectors of one or more vertices
point away from us even though we see what would normally be considered
the front side of the triangle. In such a case, parts of the smooth
triangle will show the exterior texture while others will show the
interior texture, and unfortunately there is nothing you can do to fix this.


Post a reply to this message

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