PovAnim pour Blender 2.28
(et Blender 2.23/2.25/2.26/2.27 voir page des anciennes versions)
Jean-Michel Soler, fevrier/mars/avril 2002 .


Structure des fichiers /1 :Page précedente
Page suivante: Fichier (suite)
Structure des fichiers 2/n
 Objet Povray 3.5 Mesh2 
Objectif
Syntaxe
Textures multiples
Textures UV mappées
Taille des fichiers
Faces adoucies
Mélanges: 
textures et faces adoucies...
Modificateurs : 
inside vector
Goal
Syntaxes
multiples textures
UV mapped textures
Size of the files
Softened Faces
Mixtures: 
textures and softened faces ...
Modifyings : 
inside_vector
Le mesh2 est un objet récent dans la boite à outil de povray. Il n'existe que dans la toute dernière version en date, la 3.5 (mais son utilisation a été banalisée par les versions de Megapov,  fer de lance des nouvelles technologies de Povray)

Objectif:
 Permettre l'utilisation d'un très grand nombre de triangles en se basant sur une définition plus proche de la géométrie des objets produits  par les modeleurs les plus courants qui sont généralement de type "surfacique" ... 

The mesh2 is a recent object among the tool box of povray. It only exist in the very last version, the 3.5 (but its utilization is very commonplace now due to Megapov, the spearhead of the new Povray technologies).


Goal:
Allowing the use of a great number of triangles based on an object definition closer to the geometry as used in most of the modellers and that generally produces objects of the type "surfaced" ...


Sommet/Vertex : exemple
Cotés/Edges Facette/Face : exemple
...alors que povray manipule des objets de manière "volumique".
...when povray uses objects in a "volumic" manner.
mesh2 calculé par povray. mesh2 calculé par povray.
Blender
Povray
A gauche, un mesh réalisé dans Blender. A droite, le même mesh exporté au format mesh2 à l'aide d'un script  python, Povanim, et rendu au travers de povray 3.5
On the left, a mesh realised in Blender. On the right, the same mesh exported in mesh2 format with the help of a python script, named Povanim and rendered through povray 3.5.
Syntaxe: Syntaxes:.
mesh2 {
        // Vecteurs:
        vertex_vectors 
          {
           nombre_de_sommets,
           <sommet1>, <sommet2>, ...
          }
        normal_vectors 
          {
           nombre_de_normales,
           <normale1>, <normale2>, ...
          }
        uv_vectors 
          {
           nombre_de_vecteurs_uv,
           <vect_uv1>, <vect_uv2>, ...
          }
  
        // Listes:   
        texture_list 
          {
           nombre_de_textures,
           texture { Texture1 },
           texture { Texture2 }, ...
          }
  
        // Indices: 
        face_indices 
          {
           nombre_de_faces,
           <sommet_index_a, sommet_index_b, sommet_index_c> [,texture_index [,
                                    texture_index, texture_index]],
           <sommet_index_a, sommet_index_b, _sommet_index_c> [,texture_index [,
                                    texture_index, texture_index]],
           ...
          }
        normal_indices 
          {
           nombre_de_faces,
           <index_a, index_b, index_c>,
           <index_d, index_e, index_f>,
           ...
          }
        uv_indices 
          {
           nombre_de_faces,
           <index_a, index_b, index_c>,
           <index_d, index_e, index_f>,
           ...
          }

  // Modificateurs de Mesh :
        inside_vector <direction>
        (..modificateurs d'objets..)
        (..transformations..)
        }
 La syntaxe peut paraître très compliquée mais la définition minimale d'un mesh2 peut  se limiter à cela:
The syntaxes may appear very complicated but the mesh2 minimum definition can be reduced to this:
mesh2 {
        // Vecteurs:
        vertex_vectors 
          {
           nombre_de_sommets,
           <sommet1>, <sommet2>, ...
          }
        // Indices: 
        face_indices 
          {
           nombre_de_faces,
           <sommet_index_a, sommet_index_b, sommet_index_c> [,texture_index [,
                                    texture_index, texture_index]],
           <sommet_index_a, sommet_index_b, _sommet_index_c> [,texture_index [,
                                    texture_index, texture_index]],
           ...
          }
     }
Voici un exemple très simple de mesh2   (celui qui illustre le haut de cette page):
Here is a very simple example of mesh2  (the one that illustrates the top of this page):
//povray  version 3.5
sky_sphere{
  pigment{   gradient z
   color_map{
   [0.0 color rgb<0.14,0.45,0.47>][0.50 color rgb<0.0,0.64,0.77>]
   [1.0 color rgb<0.14,0.45,0.46>]
   } } scale 2 rotate x*45 }

#declare Material_001_pig=pigment{color rgb <0.0,1.0,0.41> }

#declare Material_001_fsh=finish {
  ambient 0.1  diffuse 0.6  specular 0.325 roughness 0.029 }

#declare Plane2 = mesh2 {
vertex_vectors{ 
                             4,
                              <3.8,16.9,0.45>,<4.07,4.4,-2.23>,
                              <-8.7,1.48,-1.49>,<-7.3,15.55,-4.02>
                       }
face_indices{ 
                              2, 
                              <0,2,1>,<0,3,2>
                      }
                  }

object{ Plane2 
   scale<1.27,1.27,1.27>  rotate<65.85,20.24,-2.42> translate<4.16,-1.77,-12.80> 
   pigment{Material_001_pig}    finish{Material_001_fsh} 
}

camera {
    location <0, 0, 0> look_at <0, 0, 1>
    right <-1.33333333333, 0, 0>
    up    <0, 1, 0> angle 27.912
    rotate <0, 180, 0> scale <1.0, 1.0, 1.0>
    rotate <90, 0.0, 0.0> translate <5.42, -50.4, -2.2>
}

#declare Lamp_001 = light_source{
   0*x  color rgb<1.0, 1.0, 1.0>
   spotlight point_at <0,0,-1>  radius  12.95 tightness  0.42
   falloff  22.5
   area_light<8, 0, 0> <0, 0, 8> 4, 4
   adaptive 0  jitter  circular orient
   fade_distance 110.0   fade_power 1
  }

object{ Lamp_001
   rotate <59, -25.68, -35.81>   translate <-17.02, -15.51, 14.34>
  }

Textures multiples et texture_list :
Certains logiciels de 3D,  offrent la possibilité de "peindre" les couleurs sur chaque sommet d'un triangle. La définition d'une texture_list permet de reproduire cet effet en offrant la possibilité d'associer une texture différente à chaque sommet d'une face .
Multiples textures and texture_list :
Some 3D software offers the ability to paint colours on each vertex of a triangle. The definition of a texture_list allows reproducing this effect offering the ability to join a texture to each vertex of a face. 
mesh2 calculé par povray. mesh2 calculé par povray.
Blender
Povray
Le mesh de gauche est modelé et colorié dans Blender. Dans ce cas particulier, la lumière a été augmentée pour  faire ressortir les couleurs.  Celui de droite est rendu dans povray. Un tel objet devrait être déclaré  de la manière suivante:
The mesh on the left is modelled and painted in Blender. In this particular case, the light has been increased to improve the visibility of the colours. The one on the right is rendered in povray. Such an object should be declared the following manner:
#declare Plane2 = mesh2 {
                      vertex_vectors{4, <3.8058,16.9311,0.4496>,
                                        <4.0735,4.3990,-2.2274>,
                                        <-8.6940,1.4797,-1.4879>,
                                        <-7.2997,15.5429,-4.0221>
                                      }
                      texture_list{ 4, 
                                       texture{pigment{rgb<0.0,0.44,0.66>}finish{Material_001_fsh}}
                                       texture{pigment{rgb<0.87,0.19,0.0>*1.0}finish{Material_001_fsh}}
                                       texture{pigment{rgb<0.01,0.39,0.16>*1.0}finish{Material_001_fsh}}
                                       texture{pigment{rgb<0.0,0.13,0.054>*1.0}finish{Material_001_fsh}}
                                   }
                      face_indices{2, <0,2,1>,0,1,2,
                                      <0,3,2>,0,3,1 }
                       }
Textures UV mappées :
La grande force des logiciels surfaciques est la possibilité d'ajouter des images repérées par des coordonnées uv . Ces informations sont gérées par un tableau de vecteurs nommé uv_vectors. Chacun de ces vecteurs est associé à un sommet de face.  Noter bien qu'un sommet  de la liste vertex_vectors peut être utilisé par un nombre indéterminé de faces et que chaque face uvmappée aura automatiquement trois uv_vectors associés. 
UV mapped textures:
The great strength of surfaced software is the ability to add pictures located with uv coordinates. These information are handled through a vectors table named uv_vectors. Each of the vectors is linked to a face's vertex. Take notice of that, the vertex of the list vertex_vectors can be used by a undetermined number of faces and that each uvmapped face will have automatically three uv_vectors associated. 
mesh2 calculé par povray. mesh2 calculé par povray.
Blender
Povray
L'exemple ci-dessus sera déclaré de la manière suivante:
The example here above will be declared the following way :
#declare Plane2 = mesh2 {
      vertex_vectors{ 4,
                        <3.8058,16.9311,0.4496>,<4.07356,4.3990,-2.2274>,
                        <-8.694,1.4797,-1.4879>,<-7.2997,15.5429,-4.0221>
                }
      uv_vectors{ 6, 
                        <0.98907,0.98907>,<0.00546,0.00546>,<1.0,0.01093>,
                        <0.98907,0.98907>,<0.00546,1.0>,<0.00546,0.00546>
                 }
      texture_list{ 4, 
                       texture{pigment{average 
                         pigment_map{ 
                             [1.0 color rgb<0.0,0.44,0.66>][1.0 img0]}}
                             finish{Material_001_fsh}}
                       texture{pigment{average 
                         pigment_map{ 
                             [1.0 color rgb<0.875,0.19,0.0>][1.0img0]}}
                             finish{Material_001_fsh}}
                       texture{pigment{average 
                         pigment_map{ 
                             [1.0 color rgb<0.011,0.39,0.16>][1.0 img0]}}
                             finish{Material_001_fsh}}
                       texture{pigment{average 
                         pigment_map{ [1.0 color rgb<0.0,0.13,0.054>][1.0 img0]}}
                         finish{Material_001_fsh}}
                  }
      face_indices{ 2, 
                   <0,2,1>,0,1,2, <0,3,2>,0,3,1
      }
      uv_indices{ 2, 
                  <0,1,2>,<0,1,2>+3
      }
      uv_mapping
}
Taille des fichiers :
Une simple sphère peut comporter 42  sommets et 80 faces.
Size of the files :
A simple sphere can contain 42 vertices and 80 faces.
.
Sommet/Vertex
Cotés/Edges Facette/Face
mesh2 calculé par povray. mesh2 calculé par povray.
Blender
Povray
Le modèle qui est présenté ci-dessus (à gauche le mesh Blender, à droite le mesh2 rendu par povray) devient un texte particulièrement indigeste comme on peut le voir dans les lignes qui suivent.
The model shown here above (on the left the Blender mesh, on the right the mesh2 rendered by povray) becomes a particularly indigestible text as you can see by reading the following lines..
#declare Sphereexport2 = mesh2 {
 vertex_vectors{ 42,
                <6e-008,0.0,-3.979780674>,
                <2.879769325,-2.092250109,-1.779817104>, <-1.099951625,-3.385360479,-1.779817104>,
                <-3.559614897,0.0,-1.779817581>,<-1.099951625,3.385360718,-1.779817581>,
                <2.879769325,2.092250347,-1.779817581>,<1.099951744,-3.385360479,1.779817581>,
                <-2.879769325,-2.092250109,1.779817581>,<-2.879769325,2.092250347,1.779817343>,
                <1.099951744,3.385360718,1.779817343>,<3.559614897,0.0,1.779817581>,
                <6e-008,0.0,3.979780436>,<1.692691207,-1.22979784,-3.385416508>,
                <-0.646537423,-1.98987174,-3.385417461>,<1.04616034,-3.219688654,-2.092320442>,
                <1.692691207,1.229797363,-3.385416508>,<3.385391712,0.0,-2.09231329>,
                <-2.092288971,0.0,-3.385406971>,<-2.738842487,-1.989877939,-2.09231472>,
                <-0.646537423,1.989871502,-3.385417461>,<-2.738842487,1.989877701,-2.09231472>,
                <1.04616034,3.219688416,-2.092320442>,<3.785001755,1.229802608,0.0>,
               <3.785001755,-1.229802608,0.0>,<2.339257956,-3.21970892,0.0>,
                <6e-008,-3.979780674,0.0>,<-2.339257717,-3.21970892,0.0>,
                <-3.785001755,-1.229802608,0.0>,<-3.785001755,1.229802608,0.0>,
                <-2.339257717,3.219708443,0.0>,<6e-008,3.979780197,0.0>,
                <2.339257956,3.219708443,0.0>,<2.738842726,-1.989877701,2.092314959>,
                <-1.046160221,-3.219688654,2.092320681>,<-3.385391712,0.0,2.09231329>,
                <-1.046160221,3.219688416,2.092320204>,<2.738842726,1.989878178,2.092314482>,
                <2.092288971,0.0,3.385406733>,<0.646537542,-1.989871264,3.385417461>,
                <-1.692691088,-1.229797363,3.385416985>,<-1.692691088,1.22979784,3.385416985>,
                <0.646537542,1.989871502,3.385417461>
                    }
face_indices{80, 
                <12,14,13>,<12,15,16>,<13,18,17>,<17,20,19>,<19,21,15>,
                <16,22,23>,<14,24,25>,<18,26,27>,<20,28,29>,<21,30,31>,
                <23,32,24>,<25,33,26>,<27,34,28>,<29,35,30>,<31,36,22>,
                <32,37,38>,<33,38,39>,<34,39,40>,<35,40,41>,<36,41,37>,
                <9,41,36>,<11,37,41>,<10,36,37>,<8,40,35>,<11,41,40>,
                <9,35,41>,<7,39,34>,<11,40,39>,<8,34,40>,<6,38,33>,
                <11,39,38>,<7,33,39>,<10,37,32>,<11,38,37>,<6,32,38>,
                <5,31,22>,<10,22,36>,<9,36,31>,<4,29,30>,<9,30,35>,
                <8,35,29>,<3,27,28>,<8,28,34>,<7,34,27>,<2,25,26>,
                <7,26,33>,<6,33,25>,<1,23,24>,<6,24,32>,<10,32,23>,
                <4,30,21>,<9,31,30>,<5,21,31>,<3,28,20>,<8,29,28>,
                <4,20,29>,<2,26,18>,<7,27,26>,<3,18,27>,<1,24,14>,
                <6,25,24>,<2,14,25>,<5,22,16>,<10,23,22>,<1,16,23>,
                <0,19,15>,<5,15,21>,<4,21,19>,<0,17,19>,<4,19,20>,
                <3,20,17>,<0,13,17>,<3,17,18>,<2,18,13>,<0,15,12>,
                <5,16,15>,<1,12,16>,<0,12,13>,<2,13,14>,<1,14,12>
}
Si l'on fait appel à des opérations de subdivision pour adoucir la forme, on va multiplier de manière exponentielle les informations rébarbatives. Si l'on prend en considération que des objets de moyenne résolution peuvent atteindre plusieurs dizaines de milliers de faces, la gestion de toutes les informations groupées d'un mesh2 devient proprement impossible dans un traitement de texte classique. Heureusement il est possible de réaliser des #include
If we use dividing operations to soften the shape, we are going to dramatically increase the number of points composing the object and thus, heavy and repugnant information. Even if weonly consider objects of middle resolution, they contain tens of thousand faces. Handling with such an amount of data becomes queeckly impossible in a basic word processor. Luckily we can use #include.
..
mesh2 calculé par povray. mesh2 calculé par povray.
Blender
Povray
Alors que l'objet ci-dessus contient 4 fois plus de faces que le précedent, sa gestion se limite maintenant à deux simples lignes.
However the here above object contains 4 times more faces than the preceding one, you can see that it takes only two lines in the file.
.
#declare Sphereexport2 = mesh2 {
                      vertex_vectors{ #include "Sphereexport2verts.inc"}
                      face_indices{ #include "Sphereexport2faces.inc"}
}
Face adoucies: Softened faces :
mesh2 calculé par povray. mesh2 calculé par povray.
Blender
Povray
Les vecteurs normaux permettent  de donner un aspect plus lissé à la forme de manière plus économique que la subdivision des facette.
The normals vectors allow giving a smother aspect to the shape in a more economic way than the subdivision of the faces.

 
normal_vectors{ }
Si certaines faces restent à l'état brut, il faut ajouter la déclaration:
If certain faces stay at the raw state, you have to add the declaration:

 
normal_indices{}
.
Exemple: Example:
#declare Sphereexport2 = mesh2 {
                      vertex_vectors{ #include "Sphereexport2verts.inc"}
                      normal_vectors{ #include "Sphereexport2norm.inc"}
                      face_indices{ #include "Sphereexport2faces.inc"}
                      normal_indices{ #include "Sphereexport2nindice.inc"}
}
.
Mélanges: listes de textures  et faces adoucies...  Mixtures: textures list and softened faces ... 
mesh2 calculé par povray. mesh2 calculé par povray.
Blender
Povray
Exemple: .
#declare Sphereexport2 = mesh2 {
                      vertex_vectors{ #include "Sphereexport2verts.inc"}
                      normal_vectors{ #include "Sphereexport2norm.inc"}
                      texture_list{ #include "Sphereexport2text_list.inc"}
                      face_indices{ #include "Sphereexport2faces.inc"}
                      normal_indices{ #include "Sphereexport2nindice.inc"}
}
... plus texture uvmappées: ... plus uvmapped textures:
mesh2 calculé par povray. mesh2 calculé par povray.
Blender
Povray
Exemple: Example:.
#declare Sphereexport2 = mesh2 {
                      vertex_vectors{ #include "Sphereexport2verts.inc"}
                      uv_vectors{ #include "Sphereexport2uvco.inc"}
                      normal_vectors{ #include "Sphereexport2norm.inc"}
                      texture_list{ #include "Sphereexport2text_list.inc"}
                      face_indices{ #include "Sphereexport2faces.inc"}
                      normal_indices{ #include "Sphereexport2nindice.inc"}
                      uv_indices{ #include "Sphereexport2uvind.inc"}
                      uv_mapping
}
... Modificateurs : inside_vector: ... Modifying : inside_vector:
mesh2 calculé par povray. mesh2 calculé par povray. mesh2 calculé par povray.
Blender
Povray
CSG, union et difference ou intersection: CSG, union and substraction or intersection:
Exemple: Example:.
. .
Tous les droits réservés pour le logo "povanim", les explications, scripts et images sur ces pages par JM Soler fevrier/juin 2002. 

Pour toutes les questions touchant les éventuels problèmes rencontrés avec cette page contacter l'auteur sur le forum de discussion:
3D.Blender

 Structure des fichiers /1 :Page précedente
Page suivante: Fichier (suite)
Index principal