POV-Ray : Newsgroups : povray.general : from quad to triangle ...? : Re: from quad to triangle ...? Server Time
3 Aug 2024 02:22:51 EDT (-0400)
  Re: from quad to triangle ...?  
From: andrel
Date: 26 May 2004 07:24:28
Message: <40B47E73.2030007@hotmail.com>
ingo wrote:
> While working on a mesh2 to *obj converter I ran into a problem. It 
> seems that is important to the obj file and applications that use it how 
> a quad is dividen in triangles. Or better, in what order the vertices 
> should be specified, counteclockwise.
> 
> D     C
> ------
> |   /|
> |  / |
> | /  |
> |/   |
> ------
> A     B

In fact it does not matter if the vertices are clockwise or
counterclockwise. You should keep the same order as in the quad.
So either <A,B,C> and <A,C,D> or <A,B,D> and <B,C,D> (or any
rotated form of these).

> It wants <A,B,C>, <D,A,C>. Otherwise the normals get messed up, even if 
> no normals are specified in the obj file. I only have to Poseray to test 
> this and assume it works the right way.
> 
> Is there a consensus on how to specify quads>triangles in the CG world?
> 
> Is there a way to figure out from a list of face_indices and vertices in 
> what way the faces are written?
No, unless you assume that the objects have finite volume and you are
willing to reconstruct the whole object and do some inside/outside
tests. Luckily there is no need to know, just keep the same orientation.

> For POV-Ray it doesn't seem to matter how the faces are arranged, as I 
> noticed when writing the mesh macros. 
It does matter. Normally you do not notice it except if you use
interior_texture. I would not be surprised if there are also problems
if you use interior media in self intersecting objects.
> I there for no specific reason 
> chose for <A,B,D><A,C,D>. This becomes a mess when converting to *obj :(
I assume a typo here, these two triangles do not fill the quad.
> 
> Ingo


Post a reply to this message

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