11/28/2013

Creating Waves Using Input Curves

Josh Clos has written a nice tutorial on creating waves in 3ds max using the ideas used in Imageworks' animated movie Surf's UP (http://www.joshclos.com/2013/09/28/3ds-max-tutorial-rigging-waves/
).

I tried to duplicate these ideas to be able to implement in Maya and possibly extend it a little further.

(For this tutorial i used a convexity map creating plug-in called r7_vertCurvature. You can get it here:http://www.trisoup.net/shtuff/scripts/r7_vertCurvature.zip )



The first thing to do is to create the image plane texture to create the input curves. For this i've downloaded the surf's up pdf (as explained by josh clos) and extracted the curves reference.



I textured a free image plane and built bezier curves using this reference



Then i duplicated the bottom one to be the master curve and added a blend shape deformer to this curve


Then i added other curves using Edit Deformers > Blendshape and adding them as inbetweens. i have increased the key weight as i go along from top curve to the bottom one.


I have created a custom curve circle and placed it along curve somewhere. I've animated the circle in z translation and rotation in x. You can see these steps also in josh clos' tutorial.

Then i added a set driven key to drive the blendshape's weight attribute to animate the wave




I then added a locator to the circle's pivot and used a point constraint (keep offset) to the locator. To be able to drive the wave motion forward with circle i created a cluster deformer (Animate > Create Deformers > Cluster) selecting the bezier points and anchor points (be sure to select everything) that are in the middle. I used the point constraint again to parent the locator to the cluster.




Now that the curve has wave motion, i crated multiple curves using duplicate special to import input nodes. and i repeated the driven keys. I also offset the keys on circles to give the wave a realistic motion.





I selected all the wave curves and used a loft to create the surface. I also added a smooth modifier. You can see the loft settings below.




Extending the possibilities

     As i was reading the pdf i realized that many of the particle systems Imageworks has used can be driven by textures and maps. To be able to emit particles from the lip (The highest part of the wave) there should be a way to assign a map to this area. First i thought it would be done by testing the vertex speed but i realized that this part was the most convex area of all mesh. So i decided to use the plug-in called r7-vertCurvature to find convexity at this part. The figure below shows that this area is indeed the most convex. 




Now, to be able to emit particles i needed an image sequence to texture the surface. To export the vertex color information to a texture map i've written a procedural MEL script that calculates the convexity at that frame and writes out a texture map.


PaintVertexColorTool; int $endFrame = `getAttr "defaultRenderGlobals.endFrame"`; string $path = "G:/temp/curvatureMap_"; currentTime ( 1 ); for( $i=1; $i<=$endFrame; ++$i ) { $path = "G:/temp/curvatureMap_"; // calculate the convexity r7_vertCurvature -outputMode 0 -normalizeValues 0 -normalizeToAvg 0 -useAlgo 0 -useAllChannels 0 -useDifference 0 -convexChannel 1 -concaveChannel 0 -scaleValues 1.000000; // write out the image file $path += $i+".jpeg"; artExportAttrMapCB artAttrPaintVertexCtx $path "map"; //increment one frame currentTime ( `currentTime -q` + 1 ); }

Be sure to replace the "G:/temp/curvatureMap" destination with yours, and to be sure this code takes the render frame settings to take the last frame.


I then used nuke to edit the image for particle emmision and used the enable texture rate option at emmitter settings to emit from white areas.




That's it. There are much to be applied but this is the final step i came. To be able to emit water splash particles an ambient occlusion shader can be used to define the areas that are contact (that wave craches on water surface), and it must be pretty straightforward to setup a foam system out of this.


I hope you enjoyed the tutorial. Please comment if there is anything missing.



No comments:

Post a Comment