Parameters

In addition to variables declared directly in the expression and Forest Packs built- in attributes, you can also create Parameters. These allow the user to control effects by editing values directly in the Effects rollout without needing to open the Effects Editor or understand the expression. Parameters are created using the Parameters Tab found on the left side of the effects editor.



There are 5 types available which you create by clicking on the corresponding button:

 Numeric Parameters. Adds a numeric spinner to the effects rollout. Number format can be set to real, integer, percentage (real), or scene units (real).

 Object Parameters. Adds an object picker to the effects rollout and allows you to access the selected object's position vector.

 Controller Parameters. Allow you to access the output from any controller in 3ds Max, picked from the effects rollout.

 Texture Parameters. Allow you to use the RGB values from a map, picked from the effects rollout.

 Curve Parameters. Allow you to use a curve to control values. The curve can be edited from the effects rollout.


Each parameter must be assigned a unique name which is used in the expression to call the parameter's value, the following restrictions apply:

  • Cannot be the same as an existing attribute, function, variable or parameter.
  • Must only consist of alpha-numeric symbols and underscores (_).
  • Cannot start with a number.
  • Cannot contain spaces.
  • Parameters are local to the Forest Object, this means you can use the same name in different objects without problems.

The procedures show below explain how to create and edit the five different parameter types.

Procedures

To create a Numeric Parameter

  1. In the Effects rollout, click to open the Effects Editor.
  2. Select the Parameters tab in the Command List.
  3. Click to add a new Numeric Parameter.
  4. In the Name box, assign the Parameter a unique variable name. This will be shown in the Effects rollout and is used in the expression to refer to the value it contains.
  5. Use the Type dropdown to set the type of number from Integer, Real,  Percentage (real) and Scene Units (real).
  6. Set a Default Value, this is the value that will be used when the effect is first loaded and applied, before the user has made any edits.
  7. If necessary active Limits and enter a Minimum and Maximum value to constrain the parameter to within a range.
  8. Optionally enter a Description explaining the parameter. This message will display when a user clicks the button in the effects rollout.

To edit a Numeric Parameter

  1. Open the Effects rollout.
  2. Select a Parameter from the list
  3. Enter a new value.
  4. To see a description of the parameter, click .
  5. To deactivate an effect in the viewports, click the Apply only at rendertime checkbox. This can improve interactivity for complex effects.

To create an Object Parameter

  1. In the Effects rollout, click to open the Effects Editor.
  2. Select the Parameters tab in the Command List.
  3. Click  to add a new Object Parameter.
  4. In the Name box, assign the Parameter a unique variable name. This will be shown in the Effects rollout and is used in the expression to refer to the value it contains.
  5. Optionally enter a Description explaining the parameter. This message will display when a user clicks the button in the effects rollout.

To assigning an Object Parameter

  1. Open the Effects rollout.
  2. Select an Object Parameter from the list
  3. Click on
  4. Pick an object from the scene. 
  5. To remove the object from the Parameter, click

To creating a Controller Parameter

  1. In the Effects rollout, click to open the Effects Editor.
  2. Select the Parameters tab in the Command List.
  3. Click  to add a new Controller Parameter.
  4. In the Name box, assign the Parameter a unique variable name. This will be shown in the Effects rollout and is used in the expression to refer to the value it contains.
  5. Use the Type dropdown to set the type of number from Integer, Real,  or Vector. Only tracks of the same type will be pickable from the Effects rollout.
  6. Optionally enter a Description explaining the parameter. This message will display when a user clicks the button in the effects rollout.

To assign a Controller parameter

  1. Open the Effects rollout.
  2. Select a Controller parameter from the list
  3. Click on 
  4. The Track View Pick dialogue will open showing the scenes objects and their controllers. Controllers that are compatible with the parameter's type are selectable, incompatible tracks are greyed out.
  5. Select a compatible controller and click OK.

To create a Texture Parameter

  1. In the Effects rollout, click  to open the Effects Editor.
  2. Select the Parameters tab in the Command List.
  3. Click  to add a new Texture Parameter.
  4. In the Name box, assign the Parameter a unique variable name. This will be shown in the Effects rollout and is used in the expression to refer to the value it contains.
  5. Optionally enter a Description explaining the parameter. This message will display when a user clicks the  button in the effects rollout.

To assigning a Texture Parameter

  1. Open the Effectsrollout and go to the Parameters list
  2. Pick the Texture parameter
  3. Click on the TexMap picker and select a texture, or drag a texture from the material editor to this slot. 
  4. Use the Clear button to remove the existing Texture map. 
  5. In the Effect you can use the following format to access the texture information:

    evaluateTexture([parameter name], [UVW Coordinate]);

    E.G.
    vector tintColor = evaluateTexture(DisplacementMap,fpItem.distUVW);

To create a Curve Parameter

  1. In the Effects rollout, click  to open the Effects Editor.
  2. Select the Parameters tab in the Command List.
  3. Click  to add a new Curve Parameter.
  4. In the Name box, assign the Parameter a unique variable name. This will be shown in the Effects rollout and is used in the expression to refer to the value it contains.
  5. Optionally enter a Description explaining the parameter. This message will display when a user clicks the  button in the effects rollout.

To edit a Curve Parameter

  1. Open the Effects rollout and go to the Parameters list
  2. Pick the Curve parameter
  3. Click on Edit Curve to open the curve editor
  4. Forest Pack uses Max's default curve editor.



    Use: 
    a - to move points
    b - to scale points
    c - to add points
    d - to delete points
    e - to reset curves
    f - right click to change the curve type (choices include corner, bezier-smooth, and bezier-corner).
  5. In the Effect you can use the following format to access the curve's output:

    evaluateCurve([Curve name], [X Position]);

    E.G.
    fpItem.position.x = evaluateCurve(X_position,timePosition);

To delete a parameter

  1. In the Effects rollout, click to open the Effects Editor.
  2. Select the Parameters tab in the Command List.
  3. Select the parameter you wish to delete from the list.
  4. Click

To use a Parameter's value in an expression

  1. Type the name of the parameter, case is ignored.
  2. For vectors, append .x, .y, and .z to access the 3 components.