TAILIEUCHUNG - Character Animation with Direct3D- P20

Character Animation with Direct3D- P20:This book is primarily aimed at teaching indie and hobby game developers how to create character animation with Direct3D. Also, the seasoned professional game developer may find some interesting things in this book. You will need a solid understanding of the C++ programming language as well as general object-oriented programming skills. | 366 Character Animation with Direct3D Get position from the four control hairs floats chi GetHairPos 0 0 1 floats ch2 GetHairPos 1 0 1 floats chS GetHairPos 2 0 1 floats ch4 GetHairPos S 0 1 Blend linearly in 2D floats px1 ch2 ch1 - floats px2 chs ch4 - floats pos px2 px1 - Transform to world coordinates float4 posWorld mul float4 1 matW mul posWorld matVP Copy texture coordinates return OUT Here the exact same operations are done as described earlier in the GetBlended-Point function of the HairPatch class. The blended position of each of the four control hairs is obtained from the ControlHairTable using the GetHairPos helper function. Note that the indices passed to the helper function have been pre-computed and stored in the vertex data. Next the points returned from the control hairs are blended depending on the 2D position of the hair vertex. The resulting point will be in object space so to get it to the correct position on the screen it is multiplied with the world and the view-projection matrix. As said before the beauty of going the long way about this is that you now can update the control hairs on the CPU and the mesh in the hair patch will just follow suit automagically. lease purchase PDF Split-Merge on to remove this watermark. Chapter 15 Hair Animation 367 Creating a Haircut So how would you go about creating these 10 to 20 control hairs needed to create a decent-looking haircut for a character Well the most obvious way is to enter them manually as was done with the four control hairs in Example . Although it doesn t take many minutes to realize that to model a set of 3D lines with a text editor is probably not the way to .