POV-Ray : Newsgroups : povray.general : Reading mesh2 data from file : Re: Reading mesh2 data from file Server Time
26 Apr 2024 12:37:20 EDT (-0400)
  Re: Reading mesh2 data from file  
From: Kima
Date: 3 Jul 2021 16:10:00
Message: <web.60e0c335c54a2bf0e75ac487d427f3e5@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> 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.)

#include "vertices.inc" trick works like a charm. So silly of me that forgot
#include can do the job. I agree we should minimise any unnecessary process, but
I think reading two files (perhaps three, adding normals) is not a significant
overhead.


Post a reply to this message

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