Meshes
Home Up UV Mapping Patterns Meshes Radiosity Photons Misc. Changes Media

 

Solid triangle meshes

Triangle mesh objects (mesh and mesh2) can now be used in CSG objects such as difference and intersect, because they do have a defined 'inside.'  This will only work for well-behaved meshes, which are completely closed volumes.  If meshes have any holes in them, this might work, but the results are not guaranteed.

To determine if a point is inside a triangle mesh, POV-Ray shoots a ray from the point in some arbitrary direction (the default is <1,0,0>).  If this vector intersects an odd number of triangles, the point is inside the mesh.  If it intersects an even number of triangles, the point is outside of the mesh.  You can specify the direction of this vector.  For example, to use +z as the direction, you would add the following line to the triangle mesh description (following all other mesh data, but before the object modifiers).

  inside_test_vector z

This change does not have any effect on unions of triangles... these will still be always hollow.

New Mesh Syntax

The new mesh syntax is designed for use in conversion from other file formats. This format was developed by myself and Thomas Baier.

mesh2
{
  vertex_vectors
  {
    number_of_vertices,
    <vertex1>, <vertex2>, ...
  }
  normal_vectors
  {
    number_of_normals,
    <normal1>, <normal2>, ...
  }
  uv_vectors
  {
    number_of_uv_vectors,
    <uv_vect1>, <uv_vect2>, ...
  }
  texture_list
  {
    number_of_textures,
    texture { Texture1 },
    texture { Texture2 }, ...
  }
  face_indices
  {
    number_of_faces,
    <index_a, index_b, index_c>, [texture_index],
    <index_d, index_e, index_f>, [texture_index],
    ...
  }
  normal_indices
  {
    number_of_faces,
    <index_a, index_b, index_c>,
    <index_d, index_e, index_f>,
    ...
  }
  uv_indices
  {
    number_of_faces,
    <index_a, index_b, index_c>,
    <index_d, index_e, index_f>,
    ...
  }

  [object modifiers]
}              

The normal_vectors, uv_vectors, and texture_list sections are optional. If the number of normals equals the number of vertices than the normal_indices section is optional and the indexes from the face_indices section are used instead. Likewise for the uv_indices section.

The indexes are ZERO-BASED!

This page was last updated July 10, 1999.

If you have any comments, please email me. My email address is Nathan at Kopp dot Com.