POV-Ray : Newsgroups : povray.general : mesh2 syntax clarification : mesh2 syntax clarification Server Time
18 Apr 2024 19:41:33 EDT (-0400)
  mesh2 syntax clarification  
From: Chris R
Date: 7 Dec 2022 16:05:00
Message: <web.6390fed831a063799a2b94cc5cc1b6e@news.povray.org>
Doing some more work on tools for creating mesh2 objects, and I want to be sure
I am understanding the syntax of the mesh2 object correctly.

First, the ordering of the triangles in face_indices is irrelevant, correct?
Are there any optimizations in placing adjacent triangles near to each other in
the declaration?

Second, if using uv_indices then it must contain the same number of entries as
face_indices, and each uv_indices entry references the same triangle as the
corresponding face_indices entry, correct?

Third, if using normal_indices it does not have to contain the same number or
fewer entries than face_indices, and the entries that are present in
normal_indices reference the same triangle as the corresponding face_indices
entry, correct?

Fourth, if uv_vectors is specified and has the same number of entries as
vertex_vectors, (and you have not bizarrely decided to list the uv_vectors in a
different order than the vertex_vectors), then there is no need to specify
uv_indices, as POVRay will simply use the same entry numbers for uv_vectors as
it does for vertex_vectors from the face_indices.  If you do specify uv_vectors,
then it must contain the same number of entries, in the same order as
face_indices.  Correct?

Fifth, if normal_vectors is specified and has the same number of entries as
vertex_vectors, (and same caveat about ordering the normals), and you want all
triangles to be smooth, then there is no need to specify normal_indices, as
POVRay will simply use the same entry numbers for normal_vectors as it does for
vertex_vectors from the face_indices.  If normal_vectors has fewer entries than
vertex_vectors, or you wish to specify that some triangles are not smooth, then
you must declare normal_indices.  The entries in normal_indices must be in the
same order as the triangles in face_indices.

I am writing code that will take a collection of Faces (triangles), create the
set of unique vertex points to optimize the declaration of vertex_vectors, and
then determine whether it is cheaper to declare uv_vectors and normal_vectors to
match vertex_vectors and thus reuse the face_indices for all three, (as long as
everything is either smooth or not-smooth), or to make the uv_vectors and
normal_vectors only contain unique values and pay the cost of declaring
uv_indices and normal_indices.


-- Chris R.


Post a reply to this message

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