r2 - 31 Oct 2008 - 12:43:02 - MattEstelaYou are here: TWiki >  Maya Web > TWikiAdminGroup > MayaMisc > MayaModelling > MayaOptimisingRenders > MayaPaintFxAndHair

PaintFx

paintFx and particles (falling leaves)

Duncan via highend3d:

You can do pfxToPoly, then select the resulting leaves mesh and use as an emitter. If you want falling leaves you could also do an extract on the leaves mesh to separate into individual leaves, then treat these extracted leaves as rigid bodies, with some wind and gravity.

If desired could also use a brush runtime mel function to create particles at leaf segments.(look for leafDroop.mel in the maya scripts location for an example)

Adding fruit to paintfx trees

Duncan via highend3d:

I usually use the brush's flower component for fruit. This can work well if you are using a mesh style brush:

Make the petal flatness zero and edit the petalWidthScale graph to look like a half circle. (also adjust petal width, stiffness, and length) This can create shapes like oranges etc. You may also need to lower the flower translucence values.

Another option is to set the flower texture to an image of the fruit, complete with alpha, make the petal flatness = 1 and turn on the petal forward twist. This treats each fruit as a billboard element. Only one segment is needed per fruit, which is more efficient than individually modelling the shape.

Paintfx and maya 7

Lots of updates, well worth the upgrade if you use paintfx a lot. Convert paintfx to curves, fast realtime preview in standard viewports, tight integration with the toon system, deformers that let you animate most properties of paintfx strokes via an independant transform, and a few other neat things.

Pressure values not batch rendering correctly

There are some dependancy graph update problems with evaluation on the pressure input array. If you have an expression that uses direct setting of values:

strokeShape1.pressure[0] = $pressure;

Try changing this to setAttr calls instead:

setAttr strokeShape1.pressure[0] $pressure;

-- Duncan Brinsmead - 11 Jun 2004

PaintFx shadow tips

For hair the thin line render method can provide good results in combination with pfx oversample and post filtering. Self shadowing, however, is very important and people are frequently not aware of the setup required for pfx in this regard.

First off all lights should have

  1. depthmap shadows ON
  2. mid dist maps OFF (if ON then pfx won't self shadow)

Turning off mid dist maps requires careful setting of the dmap bias. The dmap bias combined with large filter values can provide a natural looking translucent shadow volume. This is critical for providing shape to the hair, especially for blond hair.

It is also a good idea to set the depth map autofocus manually. One other pitfall is that you need at least one shadow casting bit of non-pfx geometry(could be a tiny trangle) within the field of the shadowmap or the shadow map will not generate.

Note that many paint effects presets have high translucence, such as leaves and grass. If these are not properly self shadowed they tend to look very glowy and cartoonish.
-- Duncan Brinsmead, 27 April 2004

Draw order

If some strokes need to sit in front of others, use the strokeshape draw depth property. Higher numbers render in front of others. If using this however, make sure the 'affect depth' option is off, as it overrides draw order.

Freeze textures on animated strokes

Run the handy command
freezeBrushTexture
Note that if you have brush sharing, it won't work properly, as it creates an expression linking curve flow speed to texture offset. If you have shared brushes, and the brushes are flowing at different speeds, it'll only look right for the first stroke.

Reversing a strokes pressure values

Little theory, then the full thing, I'll convert it to a self contained procedure soon.

size of array (or any value for that matter)

size($myPressure);

get pressure values from stroke

float $myPressure[] = `getAttr baseBark.pressure`;

a little procedure to flip, or reverse an array (some keywords here: flipArray, reverseArray)

proc float[] reverseFloatArray(float $a[]) { 
   int $asize = `size($a)`;
   float $tempArray[];
   for($i = 0; $i < $asize; $i++) { 
      $tempArray[$i] = $a[$asize-$i-1]; 
   }
   return $tempArray; 
} 

Now we can flip the temp array, and apply it to the paintFx stroke. MEL won't let you assign one array to another directly, so we need to iterate through them with a for loop.

$myPressure = `reverseFloatArray($myPressure)`;
for($i = 0; $i < `size($myPressure)`; $i++) {
   setAttr baseBark.pressure[$i] $myPressure[$i];
} 

so the full proc would look like

float $myPressure[] = `getAttr baseBark.pressure`;

proc float[] reverseFloatArray(float $a[]) { 
   int $asize = `size($a)`;
   float $tempArray[];
   for($i = 0; $i < $asize; $i++) { 
      $tempArray[$i] = $a[$asize-$i-1]; 
   }
   return $tempArray; 
} 

$myPressure = `reverseFloatArray($myPressure)`;

for($i = 0; $i < `size($myPressure)`; $i++) {
   setAttr baseBark.pressure[$i] $myPressure[$i];
}
TODO: wrap all that up in a global proc, like reversePressure() so it can be called from a shelf button or similar.

max clip and min clip leave little dots when animated

  • If you animate max clip from 0 to 1 over time, it'll have a little tail at the start, ditto if you then animate min clip from 0 to 1 afterwards. To get rid of it, make the values of max/min go beyond, making the total pfx length negative, in a sense.

Ie, if maxclip is at 1, and you want to animate it growing off, animate minclip from 0 to 1.1, rather than 1. Converseley, if a line has to shrink down to nothing at its start point, animate max clip from 1 to -0.1, rather than 0.

Hair

Hair for antenna/dynamic curves

Select the curve, make dynamic, the hairsystem node determines if the curve is anchored at both ends (the default), at the base, the tip, or none. For antenna you probably want the tip, then start messing with the dynamic properties. You can then either extrude the curve, or use it to drive spline-ik, a wire deformer, whatever.

Setting an initial style using curves

Daniel Jay via highend3d:

I don't actually start out with regular NURBS curves, but I use the hair system curves to do the trick. For some reason that I don't really understand, the hair system curves need to be degree one for simulation. What I've been doing is to convert them to degree three while I'm shaping them and then convert them back to degree one when it comes time to simulate. Seems to work okay.

The main concept is that passive follicles without start curves will follow active follicles with start curves. So, first, use the paint hair too to create a new hair system. Click on your object and create one (yes, just ONE) active follicle. Now, switch the paint hair tool to create passive follicles, and paint a bunch around that one. Now, if you display start position, you'll see that you have one active follicle with a start curve surrounded by a bunch of passive follicles without start curves. So, if you bend and shape that one start curve, all the other hairs will follow. Once you get it to where you like it, select all the follicles and click set start to current. Now, all they have start curves so they're fixed. Make them all passive.

Next, go back to the paint hair tool and repeat the process. Create one more active follicle in another spot. Then, paint a bunch of passive follicles around it. Bend and shape that one active one until you get it where you like it. Set start to current. Keep repeating the process all around the head until you shape out the entire hair. At any point, if you want to modify existing hairs, just go to the start position, select a bunch of passive follicles and delete their start curves. Then make a few follicles around that bunch active. Shape those start curves and they'll influence the passive ones from which you just deleted the start curves. Keep in mind that if you have any other active follicles in some other part of the system they will also influence the passive ones without start curves. So, the whole technique works by having only a few select active follicles in the whole system at a time. When you're all done, you can make them all active.

One draw back is that the Paint Hair tool doesn't paint follicles randomly so you may have to move them manually. Another thing you could do is to create a hair system the normal way and just make all the passive follicles with start curves really short to begin with so they're easy to distinguish from the ones without start curves.

Reducing flex in hair

Increase hairSystem -> iterations.

This is one aspect of the hairSystem UI that is not as intuitive as I would have liked. It is important to understand the relationship between stiffness, lengthflex, iterations and the number of segments on a hair.

Like most dynamic solvers the hair solver iterations towards a solution. To make hair 100% stiff or non-stretchy requires an infinite amount of iterations. The stiffness and flex is relative to each segment or joint in the hair, so having more segments will require higher stiffness and lower length flex values. If lengthFlex of zero or stiffness of one is insufficient then one needs to either increase the iterations, or lower the number of segments on the simulating hairs( the latter being more efficient when possible ). There are a couple of ways one can lower the number of segments of an existing hair system. Either resample the start position curves of the hair with fewer cvs, or decrease the sample density attribute on the follicle.
-- Duncan Brinsmead - 7 June 2004

-- MattEstela? - 31 May 2003

Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r2 < r1 | More topic actions
Main.MayaPaintFxAndHair moved from Main.MayaPaintFx on 11 Aug 2004 - 18:09 by MattEstela
 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback