|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
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?
For POV-Ray it doesn't seem to matter how the faces are arranged, as I
noticed when writing the mesh macros. I there for no specific reason
chose for <A,B,D><A,C,D>. This becomes a mess when converting to *obj :(
Ingo
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 25 May 2004 19:18:57 -0400, ingo <ing### [at] tagpovrayorg> wrote:
> Is there a consensus on how to specify quads>triangles in the CG world?
Usually, triangles/quads are specified with their vertices in
counter-clockwise order.
> Is there a way to figure out from a list of face_indices and vertices in
> what way the faces are written?
In general, no.
If it's a closed mesh, I suppose you could examine one of the faces to see
which order makes the normal point outward. You could do the same for an
open mesh if you know which way at least one of the normals is supposed to
point.
> For POV-Ray it doesn't seem to matter how the faces are arranged, as I
> noticed when writing the mesh macros.
It matters if you specify an interior texture.
--
FE
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Note that converting a quad into two triangles may be the most efficient
way if the amount of triangles is concerned, but it's not the best way
if you are texturing the polygon with uv-mapping.
This image explains why:
http://www.cs.tut.fi/~warp/images/uvproblem.gif
(And no, that image has no perspective. I bet all my money someone would
comment something about perspective correction (which has nothing to do
with this since there's no perspective projection anywhere).)
I don't know if there exists any solution to this problem.
--
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
>
> 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?
My New Surface Subdivision Suite contains code that does this. It was
posted to p.b.scene-files a few days ago.
Basically you look at each edge, and see the way the vertices of that edge
are specified in the faces bordering on that edge. If they are named in
opposite order, you're cool.
So if one triangle has the vertices A, B, and C, then the other triangle can
have vertices B,A,D, D,B,A, or A,D,B (assuming that A and B are the shared
vertices).
Regards,
John
Regards,
John
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <40B### [at] hotmailcom>,
andrel <a_l### [at] hotmailcom> wrote:
> I would not be surprised if there are also problems
> if you use interior media in self intersecting objects.
There are no problems with this. Since media uses intersections to
decide which volume a ray is in, the only requirement is a "well
behaved" object with no holes or stray internal surfaces.
--
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Christopher James Huff wrote:
> In article <40B### [at] hotmailcom>,
> andrel <a_l### [at] hotmailcom> wrote:
>
>
>>I would not be surprised if there are also problems
>>if you use interior media in self intersecting objects.
>
>
> There are no problems with this. Since media uses intersections to
> decide which volume a ray is in, the only requirement is a "well
> behaved" object with no holes or stray internal surfaces.
>
Am I correct that the 3D equivalent of the even/odd rule is used.
If I have a self intersecting object and I enter the object
again somewhere on the inside, I am supposed to be outside
again? Can I also create hollow objects by simply adding two
meshes? No need to invert the orientation of the inner surface?
That would be much faster then using differences, I guess.
I know I can simply try this myself, only with meshes you always
have a lot of boundary cases with rays exactly hitting a vertex
or a face 'horizontally', and in this case you could hit
two vertices and/or faces at the same time. So I guess asking
you is a more authoritative answer then any testing I can do myself.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|