POV-Ray : Newsgroups : povray.general : mesh in povray3.1/3.5 Server Time
20 Nov 2024 10:26:05 EST (-0500)
  mesh in povray3.1/3.5 (Message 1 to 7 of 7)  
From: Ursula
Subject: mesh in povray3.1/3.5
Date: 4 Sep 2001 12:59:07
Message: <3B95089F.C85B19CE@gmx.de>
Hy,
I try 3dwin to convert raw-files to pov-meshes, but I do not understand
the result, but I need to do this because I want to write a programm
that converts special results into pov-files for vizualisation.
What's an "udo" ? Is it necessary in pov3.1/3.5 ?
There seem to be different numbers of vertex-vectors and normal-vectors.
Why this ? What are "normal_indices" and "face-indices" (what's the
number "0" in <0, 1, 2>, _0_ "? How is the format of the "mesh-file" in
3.5 ?
Thanks a lot


Post a reply to this message

From: ingo
Subject: Re: mesh in povray3.1/3.5
Date: 4 Sep 2001 13:14:26
Message: <Xns9112C3B9B606Cseed7@povray.org>
in news:3B95089F.C85B19CE@gmx.de Ursula wrote:

> What's an "udo" ?

A file for use with the Moray modeller.

> Is it necessary in pov3.1/3.5 ?

No.

> There seem to be different numbers of vertex-vectors and
> normal-vectors. Why this ? 

If two or more vertex' have the same normal, the normal is written only 
once

> What are "normal_indices" and
> "face-indices" (what's the number "0" in <0, 1, 2>, _0_ "? 

You can see the combination normal_index + normal as a kind of array, 
the normal index points to the normal that has to be used for a vertex. 
The face_indices point to the three vertex_vectors to be used for a 
triangle.

> How is the format of the "mesh-file" in 3.5 ?

3.5 supports the mesh and mesh2 format (the latter is the format you 
exported to).



Ingo

-- 
Photography: http://members.home.nl/ingoogni/
Pov-Ray    : http://members.home.nl/seed7/


Post a reply to this message

From: Ursula
Subject: Re: mesh in povray3.1/3.5
Date: 4 Sep 2001 17:52:57
Message: <3B954D7E.E42491F3@gmx.de>
>
> > There seem to be different numbers of vertex-vectors and
> > normal-vectors. Why this ?
>
> If two or more vertex' have the same normal, the normal is written only
> once

That means: the normal is calculated for each triangle, then the normals of
all triangles sharing one vertice are averaged (--> normal of vertice),
then all normals are compared and all tsame normals are deleted...right ?


>
> > What are "normal_indices" and
> > "face-indices" (what's the number "0" in <0, 1, 2>, _0_ "?
>
> You can see the combination normal_index + normal as a kind of array,
> the normal index points to the normal that has to be used for a vertex.
> The face_indices point to the three vertex_vectors to be used for a
> triangle.

face-indices: <0, 1, 2>, x,     what does the x(=0) mean ?

face-indice: I do not really understand, what <2, 2, 2> means. Shouldn't be
one value enough (for example "normal vector nr. 4"). What does the vector
(normal vector x, normal vector y, normal vector z ?) mean ?

>
> > How is the format of the "mesh-file" in 3.5 ?
>
> 3.5 supports the mesh and mesh2 format (the latter is the format you
> exported to).
>
> Ingo
>
> --
> Photography: http://members.home.nl/ingoogni/
> Pov-Ray    : http://members.home.nl/seed7/


Post a reply to this message

From: gemelli david
Subject: Re: mesh in povray3.1/3.5
Date: 4 Sep 2001 18:10:02
Message: <3B955132.60203@xlstudio.com>
> 
> That means: the normal is calculated for each triangle, then the normals of
> all triangles sharing one vertice are averaged (--> normal of vertice),
> then all normals are compared and all tsame normals are deleted...right ?

the averaging is not always done...it is named 'smoothing group' in 3DS 
MAX. if your object is not smoothed, the normal of the vertices are the 
same as the face's one.

> face-indices: <0, 1, 2>, x,     what does the x(=0) mean ?
> 
> face-indice: I do not really understand, what <2, 2, 2> means. Shouldn't be
> one value enough (for example "normal vector nr. 4"). What does the vector
> (normal vector x, normal vector y, normal vector z ?) mean ?

0 is : the first vertex of the face is the vertex number 0 in the vertex 
array
1 is: the second vertex of the face is the vertex number 1 in the vertex 
array
....


                 David


Post a reply to this message

From: Ursula
Subject: Re: mesh in povray3.1/3.5
Date: 4 Sep 2001 18:18:21
Message: <3B955372.F8B21CD4@gmx.de>
Thanks
but I had an error in my last posting..

> >
> > face-indice: I do not really understand, what <2, 2, 2> means. Shouldn't be
> > one value enough (for example "normal vector nr. 4"). What does the vector
> > (normal vector x, normal vector y, normal vector z ?) mean ?
>

this should be "normal_indices"...--->

normal-indice: I do not really understand, what <2, 2, 2> means. Shouldn't be
one value enough (for example "normal vector nr. 4"). What does the vector
(normal vector x, normal vector y, normal vector z ?) mean ?

Sorry...


Post a reply to this message

From: gemelli david
Subject: Re: mesh in povray3.1/3.5
Date: 4 Sep 2001 18:22:00
Message: <3B955400.8050307@xlstudio.com>
If I understand well, the answer is:
the same as face-indices !

<2, 3, 4>
the normal of the first vertex of the face is the normal number 2 in the 
normal_vectors array
the normal of the secone vertex of the face is the normal number 3 in 
the normal_vectors array
...

Hopes it's the good answer this time !!

                David


Post a reply to this message

From: ingo
Subject: Re: mesh in povray3.1/3.5
Date: 5 Sep 2001 06:44:26
Message: <Xns9113819AFEC8Cseed7@povray.org>
in news:3B95089F.C85B19CE@gmx.de Ursula wrote:

> I try 3dwin to convert raw-files to pov-meshes, but I do not
> understand the result,

As my answer wasn't clear and there still is need for a piece on mesh2 
for the docs, here is an attempt:

Mesh2

The mesh2 is a representation of a mesh that is much more like the
internal mesh representation than the standard mesh. As a result it
parses faster and it file size is smaller.

<0,0.5,0>___________<1,0.5,0>
       |      /|\   |
       |    /  | \  |
       |  /    |  \ |
       |/      |   \|
       |-------|----|
<0,0,0>   <0.5,0,0>  <1,0,0>
 

We will write the mesh sketched above as a mesh2 object.
The mesh is made of 4 triangles, each with 3 vertices, many of 
these vertices are shared among the triangles. This can be
used to optimise the mesh. First we will do it straight forward.

In mesh2 all the vertices are listed in a list named vertex_vectors{}.
A second list, face_indices{}, tells us how to put together three 
rtices to create one triangle, by pointing to the index number of a 
vertex. All lists in mesh2 are zero based, the number of the first 
vertex is 0. The very first item in a list is the amount of vertices, 
normals or uv_vectors it contains.

Lets go through the mesh above, we do it counter clockwise. The total 
amount of vertices is 12 (4 triangle * 3 vertices)

mesh2 {
   vertex_vectors {
      12,
      ...


Now we can add the coordinates of the vertices of the first triangle:

mesh2 {
   vertex_vectors {
      12, 
      <0,0,0>, <0.5,0,0>, <0.5,0.5,0>
      ..

Next step is to tell the mesh how the triangle should be created:

mesh2 {
   vertex_vectors {
      12, 
      <0,0,0>, <0.5,0,0>, <0.5,0.5,0>
      ...
   }
   face_indices {
      4, 
      <0,1,2> 
      ...

There will be a total of 4 face_indices (4 triangles). The first
point of the first face points to the first vertex_vector (0: <0,0,0>), 
the second to the second (1: <0.5,0,0>), etc...

The complete mesh:

mesh2 {
   vertex_vectors {
      12, 
      <0,0,0>,     <0.5,0,0>, <0.5,0.5,0>
      <0.5,0,0>,   <1,0,0>  , <0.5,0.5,0>
      <1,0,0>,     <1,0.5,0>, <0.5,0.5,0>
      <0.5,0.5,0>, <0,0.5,0>, <0,0,0>
   }
   face_indices {
      4, 
      <0,1,2>
      <3,4,5>
      <6,7,8>
      <9,10,11>
   }
   pigment {rgb 1}
}

As mentioned earlier, many vertices are shared by triangles. We can 
optimise the mesh by removing all duplicate vertices but one. In the 
example this reduces the amount from 12 to 6

mesh2 {
   vertex_vectors {
      6, 
      <0,0,0>,  <0.5,0,0>, <0.5,0.5,0>
      /*as 1*/  <1,0,0>  , /*as 2*/
      /*as 3*/  <1,0.5,0>, /*as 2*/
      /*as 2*/  <0,0.5,0>, /*as 0*/
   }
   ...

Next step is to rebuild the list of face_indices, as they now point 
to indices in the vertex_vector{} list that don't exist anymore.

mesh2 {
   vertex_vectors {
      6, 
      <0,0,0>,  <0.5,0,0>, <0.5,0.5,0>
      /*as 1*/  <1,0,0>  , /*as 2*/
      /*as 3*/  <1,0.5,0>, /*as 2*/
      /*as 2*/  <0,0.5,0>, /*as 0*/
   }
   face_indices {
      4, 
      <0,1,2>
      <1,3,2>
      <3,4,2>
      <2,5,0>
   }
   pigment {rgb 1}
}


In case we want a smooth mesh, the same steps we did also apply to the 
normals in a mesh. For each vertex there is a normal vector listed in 
normal_vectors{}. If the number of normals equals the number of 
vertices then the normal_indices{} list is optional and the indexes 
from the face_indices{} list are used instead.

mesh2 {
   vertex_vectors {
      6, 
      <0,0,0>,  <0.5,0,0>, <0.5,0.5,0>,
       <1,0,0>, <1,0.5,0>, <0,0.5,0>
   }
   normal_vectors {
      6,
      <-1,-1,0>, <0,-1,0>, <0,0,1>
      /*as 1*/   <1,-1,0>, /*as 2*/
      /*as 3*/   <1,1,0>,  /*as 2*/
      /*as 2*/   <-1,1,0>  /*as 0*/
   }
   face_indices {
      4, 
      <0,1,2>
      <1,3,2>
      <3,4,2>
      <2,5,0>
   }
   pigment {rgb 1}
}

When a mesh has a mix of smooth and flat triangles a list of 
normal_indices{} has to be added, where each entry points to what 
vertices a normal should be applied.

mesh2 {
   vertex_vectors {
      6, 
      <0,0,0>,  <0.5,0,0>, <0.5,0.5,0>,
       <1,0,0>, <1,0.5,0>, <0,0.5,0>
   }
   normal_vectors {
      6,
      <-1,-1,0>, <0,-1,0>, <0,0,1>
       <1,-1,0>, <1,1,0>, <-1,1,0> 
   }
   face_indices {
      4, 
      <0,1,2>
      <1,3,2>
      <3,4,2>
      <2,5,0>
   }
   normal_indices {
      2, 
      <1,3,2>
      <3,4,2>
   }
   pigment {rgb 1}
}


Ingo

-- 
Photography: http://members.home.nl/ingoogni/
Pov-Ray    : http://members.home.nl/seed7/


Post a reply to this message

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