ABSTRACT

Even though the normal vector is computed during the simulation, it is used only for rendering purposes and does not affect the simulation dynamics. Here, the normal vector of a particle is defined to be the average of the normal vectors of the triangulated faces to which the particle belongs. A different array is created for storing the current positions, previous positions, and normal vectors. As explained in later sections of this chapter, for the GPU implementation, these attributes are loaded as textures or buffers into video memory. Each array stores the attributes for all the particles. The size of each array is equal to the size of an attribute (four floating-point values) multiplied by the number of particles. For example, the position of the i-th particle ip is stored in the positions array and accessed as follows:

The cloth is built as a grid of n n particles, where n is the number of particles composing one side of the grid. Regardless of the value of n, the horizontal and the vertical spatial dimensions of the grid are always normalized to the range

 0,1 . A particle is identified by its array index i, which is related to the row and the column in the grid as follows:

row i n col i n

  .