**3D Texture Coordinates on Polygon Mesh Sequences**

*Cecilienstraße 15, D-66111 Saarbrücken, Germany*

Abstract
*Abstract*— A method for creating 3D texture coordinates for a sequence of polygon meshes with changing topology and vertex motion vectors.

*Keywords*— texture, coordinate, uv, uvw, sequence, polygon, mesh, motion, marching, cube, changing, topology, empolygonizer, emtopolizer

The use of polygon mesh sequences as a final form for animated implicit surfaces presents the challenge of generating meaningful and temporally coherent texture coordinates.

An easily implemented method for creating 3D texture coordinates is proposed and presented as a technique relevant for meshing algorithms as for example the widely used marching cubes ^{[1]}. In general these sequences have changing topology: the amount of points (vertices) and polygons varies between each element of the sequence.

The texture coordinates are generated after the mesh and it is therefore irrelevant with what method the meshes are created.

The proposed method has been implemented with success in the two commercial plugins *emPolygonizer* and *emTopolizer*.

In the following *3D texture coordinates* will be referred to as UVWs and a *sequence of polygon meshes* will be referred to as M, the amount of elements (polygon meshes) in M as |M| and its elements as M_{i} with 1 ≤ i ≤ |M|.

Each element M_{i} in M is described by a *set of vertices* V_{Mi} and a *polygonal description* P_{Mi} that contains the triangles as triplets of vertex indices. |V_{Mi}| is the amount of vertices in V_{Mi} and V_{Mi,j} the j-th vertex with 1 ≤ j ≤ |V_{Mi}|. |P_{Mi}| is the amount of polygons (triangles) in P_{Mi} and P_{Mi,j} the j-th triangle with 1 ≤ j ≤ |P_{Mi}|. The vertex indices of the j-th triangle are P_{Mi,j,1}, P_{Mi,j,2} and P_{Mi,j,3}.

Each vertex V_{Mi,j} has a *position* V^{Pos}_{Mi,j}, a *motion vector* V^{Vel}_{Mi,j} and a *texture coordinate* V^{Tex}_{Mi,j}, all of which are in 3D space.

A *location* L on M_{i} is defined as the barycentric coordinates of a triangle in P_{Mi}.

For a given sequence M, initialize the texture coordinates of M_{1}, then, for each M_{i} in M, backtrace the vertex positions V^{Pos}_{Mi} using the motion vectors V^{Vel}_{Mi} and transfer the texture coordinates of the closest locations on M_{i-1} on to M_{i}, with i ≥ 2.

Pseudo code:

`Initialize V ^{Tex}_{M1}`

For i = 2 to |M|

For j = 1 to |V_{Mi}|

p = V^{Pos}_{Mi,j} - V^{Vel}_{Mi,j}

L = Closest Location on M_{i-1} to p

V^{Tex}_{Mi,j} = Texture Coordinate of L

Next j

Next i

The two commercial plugins *emPolygonizer* and *emTopolizer* have both been using the presented method since end of 2012 to create UVWs on mesh sequences, simulated as well as cached.

The algorithm presented can be implemented either in existing code or in a node based 3D application such as Softimage's ICE or Houdini, both of which provide the necessary functionality to find the closest location on a polygon mesh.

As with most simulations the initial state (i.e. the initial UVWs) is crucial and will determine the main look of the result.

The method can be used on existing, i.e. cached, mesh sequences or directly during mesh generation by keeping a polygon mesh M_{n} in memory and then using it for the creation of the texture coordinates of the next mesh M_{n+1}.

The UVWs should have at least 32 bit precision (float) in order to produce acceptable results over time. Tests with 16 bit half float UVWs resulted in too many rounding errors that got worse the longer the sequence was, each error being passed on to the next mesh in the sequence.

Polygon meshes tend to have slightly jittering UVWs with this method, especially on coarse meshes. On high resolution meshes the jittering is hardly noticeable and can furthermore be reduced by applying a Laplacian Smooth to the UVW values.

Some tests revealed a minor tendency of the UVWs to drag behind (or hurry ahead). One reason for that behavior are little imprecisions in the calculations of the backward advection. Another reason is the nature of the motion vectors itself: they can either represent the *current motion* (i.e. the motion that defines the vertex position for the next frame) or the *previous motion* (i.e. the motion that was used in the previous frame to get to the current vertex position), depending on how the algorithm that creates the mesh was implemented by the programmer. The drag/hurry effect can be reduced by using a sort of backward-forward advection together with an error compensation, similar to the BFECC method ^{[2] [3]} used in grid based fluid solvers ^{[4]}.

The present method produces quite satisfactory results and is easy to implement, especially when using a preexisting library or software for the gathering of the closest locations.

The method has been implemented in commercial plugins such as *emPolygonizer* (version 4.0 and above) and *emTopolizer* (version 1.0 and above) and used in various commercial productions.

Thanks to Andy Moorer, Shannon Moon, Dr. Anne S. Dederichs and Sandra E. Wildt for their time and advice.

[1] William E. Lorensen and Harvey E. Cline, *Marching Cubes: a high resolution 3D surface construction algorithm*, Computer Graphics, Volume 21, Number 4, July 1987.

[2] R. MacCormack. *The effect of viscosity in hypervelocity impact cratering*. In AIAA Hypervelocity Impact Conference, 1969. AIAA paper 69-354.

[3] Selle, A., Fedkiw, R., Kim, B., Liu, Y., and RossignacC, J. 2008. *An unconditionally stable MacCormack method*. J. Sci. Comp. 35, 350–371.

[4] Stam, J. 1999. *Stable fluids*. In Proceedings of ACM SIGGRAPH, 121–128.

Fig. 1 Texture coordinates generated while meshing a point cloud with the plugin emPolygonizer4 for Softimage and Maya. The renderings show the final meshes with a procedural 3D checkerboard. |
Fig. 2 UVWs generated for a sequence of geometry cache files using the UVW Engineer of the plugin emTopolizer for Softimage's ICE. The renderings show the final meshes with a 2D image texture. |

Fig. 3 Left: the particles of a simple SPH liquid simulation. Middle: the meshed particles using marching cubes and some post smoothing and quadrangulation. The UVWs are generated directly afterwards using the method of this paper. Right: the rendered mesh with a texture using the generated UVWs. |