POV-Ray : Newsgroups : povray.general : back side and interior texture : Re: back side and interior texture Server Time
3 Aug 2024 18:21:20 EDT (-0400)
  Re: back side and interior texture  
From: Thorsten Froehlich
Date: 26 Feb 2004 05:18:16
Message: <403dc7e8$1@news.povray.org>
In article <403### [at] univ-savoiefr> , Christophe Raffalli 
<raf### [at] univ-savoiefr>  wrote:

> I understand better the problem: my mesh2 is not closed and it seems
> that the algorithm used to define the front and back side is the same
> than the algorithm to test if a point is inside the mesh: fire a ray in
> one direction and if the  number of intersection is odd you are inside
> (this is what the doc says).

This has absolutely nothing to do with determining the backface.  It is
relevant to CSG.  The backface of a triangle has nothing to do with the
inside of an object.

> But when the mesh in open, this fails. Clearly, for open mesh inside is
> not meaningfull. But back and front sides are. So this algorithm is a
> wrong choice and one should use the normals or the order of vertices to
> distinguish the back and front side (moreover it will be faster).

POV-Ray does use the normals to determine what is to be considered the
backface and frontface.  You should not jump to conclusions about something
you don't understand what it is used for.  You simply looked at the
completely wrong spot in the documentation where the documentation explains
something completely different and unrelated.  As said above, the section
you are referring to explains how meshes inside and outside are determined
for use in CSG.  This has absolutely nothing to do with what you are trying
to do.

The only way to define the bachface and frontface of a triangle is to use
the surface normal.  To assume anything else is actually a bit insulting to
the intelligence of whoever implemented the mesh object.  Do you really
think they do not know how to determine the backface and frontface of a
triangle using a surface normal?

Your mistake is really simple, and as simple to fix:

If you do not provide a surface normal, POV-Ray has to compute one for you.
If both sides of the triangle mesh are to be lit and textured equally, the
direction of the surface normal does not matter. However, if you want
POV-Ray to apply different texturing or lighting to the backface and
frontface, it needs more information such that all normals point in the same
direction.

In order to let POV-Ray do this, you have to provide all triangle vertices
in the same order.  Either clockwise or counterclockwise, it does not matter
which order, just that they all have the same order.

This is the *only* way POV-Ray can compute a surface normal that always
points in the same direction.  Once all your triangle vertices are specified
in the same order, the surface normal will be well-defined and POV-Ray can
correctly apply the backface and frontface texture.

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

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