MAXScript Extensions > MAXScript Extensions for Hair & Fur >

# HairMod : Modifier

The HairMod modifier available since 3ds Max 8 is a world-space modifier controlling the hair generation parameters.

Properties:

### Selection Rollout

    .byVertex (By_Vertex) : boolean

Get/set the state of the "By Vertex" checkbox.

    .ignoreBackfacing (Ignore_Backfacing) : boolean

Get/set the state of the "Ignore Backfacing" checkbox.

### General Parameters Rollout

    .HairCount (Count) : integer

Get/set the hair count. This is not the absolute number of hairs to be generated, as the final number of hairs is affected by other factors like density maps and cut maps.

    .HairSegments (Segments) : integer

Get/set the segments along the length of each hair.

    .HairPasses (Passes) : integer

Get/set the hair passes. Higher numbers increase the rendering time linearly and reduce the transparency of each pass.

    .HairDensity (Density) : float

Get/set theHairDensity. Default is 100 percent.If a Density Map is assigned, the Hair Density value is used to scale the influence of the Density Map.

    .HairScale (Scale) : float

Get/set theHairScale. Default is 100 percent.If a Scale Map is assigned, the Hair Scale value is used to scale the influence of the Scale Map.

    .HairCutLength (Cut_Length) : float

Get/set the Cut Length. Default is 100 percent. If a Cut Map is assigned, the Hair Cut Length value is used to scale the influence of the Cut Map.

    .HairRandScale (Random_Scale) : float

Get/set the Hair Random Scale value which controls the randomness of the hair scale. When this value is 0, all hairs are scaled according to the HairScale and Scale Map values. When set to 100, each hair can be scaled down between 0 and 100%. Default is 40 percent. If a Random Scale Map is assigned, the Hair Random Scale value is used to scale the influence of the Random Scale Map.

    .HairRootThickness (Root_Thickness) : float

Get/set the Hair Root Thickness value which controls the thickness of the hair at the base. Default is 12. If a Root Thickness Map is assigned, the Hair Root Thickness value is used to scale the influence of the Root Thickness Map.

    .HairTipThickness (Tip_Thickness) : float

Get/set the Hair Tip Thickness value which controls the thickness of the hair at the tip. Default is 0. If a Tip Thickness Map is assigned, the Hair Tip Thickness value is used to scale the influence of the Tip Thickness Map.

    .HairDisplacement (Displacement) : float

Get/set the Hair Displacement value which controls the offset of the hair's root from the source surface. Default is 0. If a Displacement Map is assigned, the Hair Displacement value is used to scale the influence of the Displacement Map.

    .HairInterpolateGuides (Hair_Interpolate_Guides) : boolean

Toggle the Guides Interpolation on and off. When turned on (default), the hair guides will be interpolated across the surface. When turned off, maximum one guide will be drawn from the center of each triangle face. In both cases, the Density value / map will be taken into account.

### Material Parameters Rollout

    .MaterialOccludedAmb (Ambient_Diffuse) : float

Get/set the Occluded Amb value. Default is 40.

    .MaterialTipColor (Tip_Color) : RGB color

Get/set the Tip color. If a Tip Color Map is assigned, the Tip color will be multiplied by the Map color value to determine the final color.

    .MaterialRootColor (Root_Color) : RGB color

Get/set the Root color. If a Root Color Map is assigned, the Root color will be multiplied by the Map color value to determine the final color.

    .MaterialHueVariation (Hue_Variation) : float

Get/set the Hue Variation value.This parameter specifies the range within which the Hue value of the haircolor should be varied.Higher values result in hair strands with different colors.

    .MaterialValueVariation (Value_Variation) : float

Get/set the Value Variation value.This parameter specifies the range within which theValueof the haircolor should be varied.Higher values result in brighter/darker strands.

    .MaterialMutantHairColor (Mutant_Color) : RGB color

Get/set the Mutant Hair Color.Mutant Hairs are randomly selected and receive this color.Mutant hairs can be used to mix in hairs with a different (for example grey or white) color.

    .MaterialPercentMutantHair (Mutant_Percent) : float

Get/set theMutantPercentage value.This parameter controls the percentage of hairs to receive the Mutant Hair Color.

    .MaterialSpecular (Specular) : float

Get/set the Specular value.

    .MaterialGlossness (Gloss) : float

Get/set the Glossiness value.

    .MaterialSelfShadow (Self_Shadow) : float

Get/set the SelfShadowvalue. This parameter controls the magnitude of the self shadowing. A value of 0.0 defeats self shadowing, while a value of 100.0 results in maximum self shadowing.Default is 100.0

    .MaterialGeomShadow (Geom_Shadow) : float

Get/set the Geom. Shadowvalue. Default is 100.0

    .MaterialGeomMtlID (Geom_Mtl_ID) : integer

Get/set the Geom. Mat. IDvalue. Default is 1

### FrizzParameters Rollout

The Frizz effect calculates twoPerlinnoise fieldsand displaces the root and the tip of the hair. Both noise fields share the same frequency settings, and the same tip/root amplitudes. One of the noise fields is static relative to the hair.The second field can beanimatedthrough the hair over time to achieve effects like grassy fields in the wind with small computational overhead compared to real dynamics.

    .FrizzRoot (Frizz_Root) : float

Get/set the Frizz Root value. Default is 15.5. This parameter controls the displacement of the hair at its root relatively to the surface normal. When Frizz Root is set to 0, the root of the hair is parallel to the surface normal.

    .FrizzTip (Frizz_Tip) : float

Get/set the Frizz Tip value. Default is 130.0. This parameter controls the displacement of the hair's tip.

    .FrizzFreqX (Frizz_Freq_X) : float .FrizzFreqY (Frizz_Freq_Y) : float .FrizzFreqZ (Frizz_Freq_Z) : float

Get/set the Frizz Frequency values in all 3 axes. These parameters control the frequency of the Frizz displacement noise fields.

    .FrizzAnim (Frizz_Anim) : float

Get/set theFrizz Animvalue whichadjusts the bias between the contributions of the static and animated noise fields. When set to 0, only the static field affects the hair. When set to 1, only the animated field affects the hair. If Anim Speed is set to 0, then a value of 1 will produce an identical result to a setting of 0 (if Anim Speed is set to 0, both noise fields will be coincident).

    .FrizzAnimSpeed (Frizz_Anim_Speed) : float

Get/set theAnim Speed value. Itis a multiplier controlling the speed at which the second (animated) noise field moves through space. When set to 0,there will be noeffect when increasing the Frizz Anim parameter. This value is multiplied by the X, Y, and Z components of the Frizz Anim Dir to determine the per frame offset of the animatednoise field.

    .FrizzAnimDir (Frizz_Anim_Dir) : point3

Get/set theFrizz Anim Dirvector whichcontrols the direction of the frizz animation. This vector is not normalized before use. This means that you can apply little tweaks to the values to achieve fine control over the speed of the animation on a given axes.

### Kink Parameters Rollout

The kink displacement works similar to Frizz, but it evaluates noise lookups along the whole length of the guide.

    .KinkRoot (Kink_Root) : float

Get/set the Kink Root value.

    .KinkTip (Kink_Tip) : float

Get/set the Kink Tip value.

    .KinkFreqX (Kink_Freq_X) : float .KinkFreqY (Kink_Freq_Y) : float .KinkFreqZ (Kink_Freq_Z) : float

Get/set the Kink Frequency values in all 3 axes.

### Multi Strand Parameters Rollout

Multi Strand generates clumps of hair by scattering multiple hair strands per each hair strand that would normally be rendered.

    .MultiStrandCount (Multi_Strand_Count) : integer

Get/set the Count value.This parameter controls how many hairs will be generated per clump.

    .MultiStrandRootSplay (Root_Splay) : float

Get/set the Root Splay value.This parameter varies the offset from the center of the clump at the root.

    .MultiStrandTipSplay (Multi_Strand_Tip_Splay) : float

Get/set the Root Splay value.This parameter varies the offset from the center of the clump at the tip.

    .MultiRandomize (Multi_Strand_Random) : float

Get/set the Randomize value.This parameter varies the scale of each hair in the clump.

### Dynamics Parameters Rollout

    .dynamicsMode (Dynamics_Mode) : integer

Get/set the Dynamics Mode.

Possible values are:

0 - None

1 - Live

2 - Precomputed

    .simulationStart (Simulation_Start) : integer

Get/set the Simulation Start value.

    .simulationEnd (Simulation_End) : integer

Get/set the Simulation End value.

    .DynamicsGravity (Gravity) : float

Get/set the Gravity value.

    .DynamicsStiffness (Stiffness) : float

Get/set the Stiffness value.

    .DynamicsRootHold (Root_Hold) : float

Get/set the Root Hold value.

    .DynamicsDampen (Dampen) : float

Get/set the Dampen value.

    .collisionMethod (Collision_Method) : integer

Get/set the Collision method.

Possible values are:

0 - None

1 - Sphere

2 - Polygon

    .autoCollision: boolean

Toggle the "Use Growth Object" option on and off.Default is off.

    .collisionNodes (Collision_Nodes) : node array

Get/set the list of collision nodes.

    .forceFields (Force_Fields) : node array

Get/set the list of External Forces.

### Display Parameters Rollout

    .displayShowGuides (Display_Show_Guides) : boolean

Toggle the "Display Guides" option on and off. Default is off.

    .DisplayGuideColor (Guide_Color) : RGB color

Get/set the Guide Color value.

    .displayShowHairs (Display_Show_Hairs) : boolean

Toggle the "Display Hairs" option on and off. Default is on.

    .DisplayHairColor (Hair_Color) : RGB color

Get/set the Hair Guide Color value.

    .DisplayHairPercent (Hair_Percentage) : float

Get/set the Display Percentage value.This parameter controls the percentage of hairs to be displayed in the viewports.

    .DisplayMaxHairs (Max_Display_Hairs) : integer

Get/set the Max. Hairs value.This parameter controls the absolute maximum number of hairs to be displayed in the viewports.

    .displayHairAsGeometry (Display_Hairs_As_Geometry) : boolean

Toggle the "As Geometry" option on and off. Default is off. When set to true, the hair strands will be displayed as geometry. When set to false, the hairs will be displayed as lines.

### Map Controls

    .maps: texturemap array

Get/set the texture maps assigned to the hair controls.

Possible indices into the texture map array are:

1 - Density Map

2 - Cut Map

3 - Scale Map

4 - Rand. Scale Map

5 - Root Thickness Map

6 - Tip Thickness Map

7 - Self Shadow Map

8 - Geom.Shadow Map

9 - Specular Map

10 - Glossiness Map

11 - Occluded Amb. Map

12 - Tip Color Map

13 - Hue Variation Map

14 - Value Variation Map

15 - Root Color Map

16- Mutant Color Map

17- Mutant Percentage Map

18 - Frizz Root Map

19 - Frizz Tip Map

20 - Frizz X Frequency Map

21 - Frizz Y Frequency Map

22 - Frizz Z Frequency Map

23 - Frizz Anim Map

24 - Anim Speed Map

25 - Kink Root Map

26 - Kink Tip Map

27 - Kink X Frequency Map

28 - Kink Y Frequency Map

29 - Kink Z Frequency Map

30 - Multi Strand Count Map

31 - Multi Strand Root Splay Map

32 - Multi Strand Tip Splay Map

33 - Multi Strand Randomize Map

34 - Dynamic Stiffness Map

35 - Dynamic Root Hold Map

36 - Dynamic Dampen Map

37 - Displacement Map

    .mapEnables (Maps_Enable) : boolean array

Get/set the elements of the array controlling whether to use the respective texture maps listed above. Setting the i-th element to false disables the texture map temporarily without removing it from the map slot - the capital "M" on the button turns into a lower-case "m". The indices into the array are identical to the ones listed above.

### InstanceNode

    .mergeInstanceMaterial (Merge_Instance_Material) : boolean

Get/set the state of the "Merge Material" checkbox in the "Instance Node" group of controls in the Tools rollout. When set to true, the material assigned to the instance node will be used.

## Hair Interfaces

    Interface:Hair

Methods:

Note

The same modifier can be applied as instance to multiple scene nodes.

Some of the methods below provide an optional instance: keyword parameter. If supplied, only the instance of the modifier applied to the specified node will be affected. If not supplied, all nodes sharing the modifier will be affected.

### Tools Rollout

    <void> LaunchGUIinstance :<node>

instance default value: undefined

Opens the Hair Style editor window. If the optional instance keyword parameter is supplied,only the hair instance applied tothe given node will be loaded in the Style editor.

Corresponds to pressing the "Style Hair..." button in the Tools rollout.

    <void> RecombFromSplines<node>shapeNode instance :<node> instance default value: undefined

Converts the Hair to Mesh. If the optional instance keyword parameter is supplied, the hair from the given node will be converted. Corresponds to pressing the "Hair -> Mesh" button in the Tools rollout.

    <void> ResetRest instance :<node> instance default value: undefined

Resets the Rest. If the optional instance keyword parameter is supplied, the hair from the given node will be reset. Corresponds to pressing the "Reset Rest" button in the Tools rollout.

    <void> RegrowHair instance :<node> instance default value: undefined

Regrows the Hair. If the optional instance keyword parameter is supplied, the hair from the given node will be regrown. Corresponds to pressing the "Regrow Hair" button in the Tools rollout.

### Tools Rollout - Presets

    <void> LoadPreset <filename> presetName

Loads the Preset with the given name. Corresponds to pressing the "Load" button in the "Presets:" group of controls in the Tools rollout.

    <void> SavePreset <filename> presetName

Saves a Preset under the given name. Corresponds to pressing the "Save" button in the "Presets:" group of controls in the Tools rollout.

### Tools Rollout - Hairdo

    <void> CopyHairdo instance:<node>

instance default value: undefined

Copies the Hairdo.If the optional instance keyword parameter is supplied, the hair will be copied from the given node.Corresponds to pressing the "Copy" button in the "Hairdo:" group of controls in the Tools rollout.

    <void> PasteHairdo instance :<node> instance default value: undefined

Pastes the Hairdo.. If the optional instance keyword parameter is supplied, the hair will be pasted onto the given node.Corresponds to pressing the "Copy" button in the "Hairdo:" group of controls in the Tools rollout.

### Tools Rollout - Instance Node

    <boolean> SetInstance <node> instance

Sets the Instance to the given node.

    <void> ClearInstance()

Removes the Instance node.

### Tools Rollout - Convert

    <node> ConvertGuidesToSplines instance :<node> instance default value: undefined

Converts the Guides to Splines. If the optional instance keyword parameter is supplied, the hair from the given node will be converted. Corresponds to pressing the "Guides -> Splines" button in the Tools rollout.

    <node>ConvertHairsToSplines instance:<node> instance default value: undefined

Converts the Hair to Splines. If the optional instance keyword parameter is supplied, the hair from the given node will be converted. Corresponds to pressing the "Hair -> Splines" button in the Tools rollout.

    <node> ConvertToMesh instance :<node>

    instance default value: undefined

Converts the Hair to Mesh. If the optional instance keyword parameter is supplied, the hair from the given node will be converted. Corresponds to pressing the "Hair -> Mesh" button in the Tools rollout.

#### See Also

- MAXScript Extensions for Hair& Fur

- What wasNew in MAXScript in 3ds Max 8