Generate Guide Data Modifier 

Generate guide data modifier is a procedural way of creating per-guide values based on some criteria. These per-guide values can then be used to control parameters and groups inside Ornatrix.

 

Generating hair LOD using Generate Guide Data Modifier 

In this quick tutorial we will go over the Generate Guide Data Modifier in Ornatrix 3dsmax and use it to add and remove hairs based on how far the object is from the camera. This technique can be useful for setting up characters which are in the background while saving memory and speeding up the renders. General Generate Guide Data overview will also help you use this powerful modifier for generating other procedural information which can be used down the hair pipeline.

 

Hair LOD with changing strand thickness 

Building on the previous hair LOD tutorial where we decreased hair count when camera moves away from hair we now improve the effect by increasing the strand thickness. This allows for a smoother distance level of detail transition and reduces any potential popping.

 

Parameters 

 

Data Generation Settings 

 

Strand Group 

Allows you to select a Strand Group created in Edit Guides modifier which contains the guides from where you want the data to be generated by this node.

 

Random Seed 

Very straight forward: Use this parameter to randomize the way the data is generated.

 

Target Channel 

Similar to Strand Groups, this allows you specify a channel to isolate the area you want the strand data to be generated from.

 

Target Data 

Specifies which part of hair this operator will modify. Aside from creating and changing strand channel data Generate Strand Data operator can also modify other aspects of hair like its width, strand groups, texture coordinates, and more. The available options are:

  • Existing Strand Data Channel
    Strand channel set in Target Channel option will be modified. If this value is set to None then a new channel will be created, this is behavior as designed for backward compatibility.
  • New Strand Data Channel
    This option will create a new channel for the Generate Strand Data node using the name provided in New Channel Name instead of using the default name.
  • Strand Groups
    Strand groups will be modified. It is important to make sure that the target value range is sufficiently high to set groups to an integer value. For example, the default target range of [0,1] will set all groups to 0. However, changing it to [0,100] will set groups to a range between 0 and 100. Values are per-strand.
  • Strand Ids
    Unique per-strand ids will be modified. This is typically not needed but could be useful in some exotic scenarios. Values are per-strand.
  • Widths
    The thickness of individual strands will be modified. Values can be per-strand or per-vertex.
  • Texture Coordinates
    Currently not supported
  • Strand Rotations
    The twist rotations of strands around their stem will be modified. Values are per-strand.
 

New Channel Name 

A blank field to provide a name to the generated channel. If a channel with specified name already exists a number will be appended at the end to make the name unique, for example MyChannel can become MyChannel1. If you are exporting more than one sample per channel then channel for each new sample will have an integer value appended to it. For example, MyColor becomes MyColor1, MyColor2, and MyColor3.

 

New Channel Type 

Here you can choose if the new channel will be generated Per-Strands or Per-Vertex.

 

Sample Value Count 

You can generate or alter more than one consecutive data channel. For example, you may want to generate 3 channels to define an RGB color set or an XYZ object position. Or you may want to generate 2 channels to define a UV set. This parameters specifies how many channels will be generated or altered by this operator. There is no limit, you can go beyond 3 channels if needed.

If you're generating new channels then each new channel will be given a new name with a number suffix. If you're altering existing channels then the channel specified will be the first one to be altered and subsequent channels after it will be altered as well, up to the same value count.

This option is only applicable if target data is either an existing or new data channel, or texture coordinates.

 

Generation Method 

In the drop down list select the type of data to be generated. The following are the options:
  • Constant
    Minimum target value will be assigned to all resulting strands or vertices.
  • Random
    A random value within the minimum and maximum target range will be assigned to each strand or vertex. Each target sample will have a different random value.
  • Index
    Index of the current strand will be assigned to each strand or vertex.
  • Strand Length
    The length of the current strand will be assigned to each strand or vertex.
  • Strand Curviness
    A value between target minimum and maximum range will be set based on how straight or curvy the strand is. The more kinks and turns the strand has the bigger the value will be.
  • Distance To Object
    For each strand or vertex distance to selected scene shape will be calculated and assigned. If a target range is provided the distance will be scaled based on the farthest strand or vertex. See below how to properly use this option.
  • Is Inside Object
    A value of 0 or 1 will be assigned based on whether the strand's root or vertex is inside specified scene shape.
  • World Space Position
    Generates a set of three channels, each containing X, Y, and Z components of world space positions for the strands or vertices.
  • Object Space Position
    Generates a set of three channels, each containing X, Y, and Z components of object space positions for the strands or vertices.
  • Expression
    A custom user expression will be used to assign values to strands or vertices
  • Texture Map
    A source texture map provided through the Texture Map parameter will be used to get the greyscale or RGB values
 

Store Values 

When this option is on the current data output is remembered and always used. Use this to freeze the output of this operator. It will also be saved with the scene. To clear the values simply uncheck this option.

 

Use Source Value Range 

When on, used strand values will be clamped with minimum and maximum values

 

Minimum Source Value 

Any strand values less than this will be clamped to the minimum target value

 

Maximum Source Value 

Any strand values larger than this will be clamped to the maximum target value

 

Use Target Value Range 

When on, the generated values will be rescaled to be in this range, instead of being between 0 and 1

 

Minimum Target Value 

Smallest generated output value

 

Maximum Target Value 

Largest generated output value

 

Texture Map 

When generation method is set to Texture Map or Expression this provides the texture to use for getting source greyscale or RGB values. With expressions texture( u, v, index ) function can be used to get the texture map. Default index is 0.

 

Expressions 

One of the ways to generate data is by using SeExpr expressions. Ornatrix provides per-strand or per-vertex contextual expressions which can incorporate other channel data, parameters, texture maps, and other information to produce the target values.

 

Setting Expressions 

To set the expression to use for generating data click on the Edit Expression button inside the Modifier Panel. The expression dialog will open where you can type in the expressions, preview them, get auto-complete functionality, and use widgets.

NOTE: Expression editor dialog is only available in 3dsmax 2017 and newer. In older versions of 3dsmax a simple textbox for editing expressions is displayed in the Modifier Panel instead.

 

Variables 

The following variables can be used as part of your expressions:
  • $index
    Index of the current strand or vertex. Ranges from 0 to number of strands or vertices.
  • $strandId
    Unique id of the current strand. This value can be an arbitrary unbounded integer.
  • $strandIndex
    Index of the current strand. Unlike index parameter this parameter will always return strand index, even when generating vertex data. Ranges from 0 to number of strands.
  • $point
    Index of current vertex on the strand. For strand data will always be 0. For vertex data will be the point index ranging from 0 to number of points on current strand.
  • $P
    Position of current point in object space. For strand data will be the position of strand's root.
  • $u
    U texture coordinate of the strand or vertex
  • $v
    V texture coordinate of the strand or vertex
  • sc_XXX
    Value present for current strand in per-strand channel named XXX. For example, if you have a per-strand channel named MyChannel you would use sc_MyChannel to get its value
  • vc_XXX
    Value present for current vertex in per-vertex channel named XXX. For example, if you have a per-vertex channel named MyChannel you would use vc_MyChannel to get its value
To get a list of all available variables, including the full list of available per-vertex and per-strand data channel variables:
  • Press the Open Editor button in Attribute Editor to open the SeExpr editor.
  • Press List button to open the dialog containing all variables

 

Functions 

The following functions can be used as part of your expressions:
  • texture( u, v, index )
    Samples a value from provided texture map map at specified UV coordinates. index parameter needs to be 0.
Missing Something? Let us know if this page needs more information about the topic.