Saturday, July 28, 2012

create a thatched roof for a beach hut with Maya Hair


“How can I create a thatched roof for a beach hut with Maya Hair?”
Eric Keller answers this tropical Maya question, as posed by Simon Smyth
Get the support files for this Q&A here.
Eric Keller replies: Painting strokes on a surface is a laborious, time-consuming job, and the result can be difficult to adjust. Thankfully, Maya Hair offers a great alternative for tasks such as creating a thatched roof, and the same techniques can easily be applied to medieval cottages or similar structures.
First, you need to create UV texture coordinates. The surface you use for your roof can be any shape you like, but it should have non-overlapping UVs to support the hair. Create UVs using Planar projection along the Y axis (from the top view). Ensure that no UVs are overlapping, and select the edges along the bottom of the polygon roof. Spend a few minutes inspecting and cleaning up the UVs in the UV Texture Editor. Switch to the Dynamics menu and choose Hair > Create Hair > Options. Set Output to NURBS Curves; U Count to 24; V Count to 24; Randomization to 0.5; Points Per Hair to 10; Length to 2.5; and ensure that Grid and Dynamic are checked.
Next you need to create a collision surface. To make the hairs lie on the roof geometry, select HairSystem1 in the Outliner, hold down [Shift] and select the roof geometry. Choose Hair > Make Collide. Rewind and play the scene. The hairs will slowly fall and lie on top of the roof geometry.
Once the hairs have settled, select the hairSystem1OutputCurves group in the Outliner and duplicate it ([Ctrl]+[D]). Name the group roof_curves. Select the hairSystem1 nodes and place them in another group named hairSystem. Press [Ctrl]+[H] to hide this group. By duplicating the curves and hiding the group you can always go back and tweak the simulation if you want to make changes later.
Now you can apply Paint Effects strokes to the duplicated curves. Choose Window > General Editors > Visor to open the visor. Under the Paint Effects tab select Grasses and click the Straw preset so that it turns yellow. This copies the settings into memory.
Before applying the hay stroke to all of the curves, you want to test it on a single curve. This makes designing the roof thatching a bit easier and faster. Select one of the curves, switch to the Rendering menu set and choose Paint Effects > Curve Utilities > Attach Brush To Curves.
In the Perspective view, zoom in on the stroke, open the Attribute Editor and switch to the Straw tab. Tweak the stroke settings to get it to look more like roof thatching. The settings I used in the render above are Global Scale: 10; Tubes Per Step: 2; Segments: 14; Length Min: 0.2; Length Max: 0.3; Tube Width 1: 0.032; Tube Width 2: 0.012; Elevation Min: 0.271; Elevation Max: 0.519; Azimuth Min: -0.115; Azimuth Max: 0.188; under Forces, Path Follow: 0.456 and Path Attract: 0.225; and Random: 0.146. If you use this technique in your own scene the settings may vary depending on the scale of the roof. You’ll probably want to experiment with the parameters until you get the look you want.
Now you can apply the strokes to the other curves. Select stroke 1 in the Outliner and choose Paint Effects > Get Settings From Selected Stroke. Expand the roof_curves group in the Outliner, hold down [Shift] and select all the curves. Choose Paint Effects > Curve Utilities > Attach Brush To Curves. After a few moments the strokes will appear on the curves.
If you’re rendering with mental ray you’ll need to convert the strokes to Polygons. Hold down [Shift] and select all the strokes in the Outliner. Choose Modify > Convert > Strokes To Polygons. After a few minutes the strokes will be converted. Now you can apply a shader to the strokes and render.
Finally, tidy up the scene. Create a group for the strokes and a group for the polygons created by the strokes so that you can easily hide them when working on other aspects of the scene.

Create a thatched roof in Maya

Add hair to the roof geometry
Create a polygon surface for the roof, and make sure it has non-overlapping UVs. Apply hair to the surface using the Grid option.

Run the simulation
Select the hair system and the roof geometry and choose Hair > Make Collide. Run the simulation, then duplicate the output curves.

Apply strokes to the curves
Select the curves and attach the Paint Effects Straw preset to the curves. Edit the strokes and convert them to polygons for rendering.

No comments:

Post a Comment