POV-Ray : Newsgroups : povray.general : Reading mesh2 data from file : Re: Reading mesh2 data from file Server Time
25 Apr 2024 17:41:13 EDT (-0400)
  Re: Reading mesh2 data from file  
From: clipka
Date: 3 Jul 2021 02:57:09
Message: <60e00a45$1@news.povray.org>
Am 03.07.2021 um 07:57 schrieb Kima:
> Since a mesh is made of thousands or millions of triangles, it is tidy to keep
> the data in separate files and include them in the .pov file whenever necessary.

If you really want to keep the vertices in a different file than the 
faces, what you could do is use:

     mesh2 {
       vertex_vectors {
         #include "vertices.inc"
       }
       face_indices {
         #include "faces.inc"
       }
     }

making sure to store the vertices and faces, respectively, in the format 
expected by POV-Ray, and putting the number of entries at the top of 
each file.

Meshes tend to take a long time to parse, simply due to the sheer number 
of data points, and every overhead you add to the parsing of that data - 
every single processing step - will only make matters worse. Far, far worse.


That said, I would argue however that it is neater to have all the data 
for one mesh in one file. It is customary to put the entire `mesh2` into 
a single include file, preceded by a `#declare`, like so:

     #declare MyThingumajig = mesh2 {
       ...
     }

In your main scene file, you then use:

     #include "my_thingumajig.inc"
     object { MyThingumajig }


(As an exception, if you are rendering an animation of a mesh that 
changes shape, it might make sense to place vertex and normal vectors in 
one file and the face indices and uv vectors in another, to avoid 
duplicating data, as typically you'll want different vertex and normal 
vectors for each frame but the same face indices and uv vectors for all 
frames.)


Post a reply to this message

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