139
« on: June 25, 2008, 01:35:42 pm »
Attached below are parametric and non-parametric versions of a script that maps copies a "source" mesh to a "target" mesh's points. It is similar in capability to the Mongoose's awesome GrassGen application.
The parametric and command versions of the script are different in the following ways:
1) The command version creates a separate mesh for each copy, while the parametric version is all one shape.
2) The command version has one more parameter because parametric scripts are apparently limited to 10 parameters.
To use, you must have an object that contains a mesh named "source" and another mesh named "target". If you are using the command (non-parametric) version, you must edit the script to adjust the parameters, then Scripts->Run Script File. If you are using the parametric version, just click on the "Mesh Source to Target" icon, then click (or click-drag).
The parameters that can be changed are:
1) The fraction of target mesh points to use: 0 to 1
Anything less than 1 uses a random distribution of points
2) Min and Max Copies per mesh point: 0 to 100
In the parametric version, there is only the max parameter. If max is greater than 1, it will produce a random number from 1 to max for each target mesh point. In the command version, you can set the minimum.
3) Min and Max Scale: 0 to 100.
If the min and max are not equal, it will produce a random distribution of scales between min and max.
4) Fixed rotation x,y,z:
Rotates the copies a fixed amount
5) Variable rotation x,y,z
This will produce a random rotation plus or minus half the amount entered added to the fixed rotation amount in (4).
The lowest y-point on the copy of "source" will correspond to the "target" mesh point.
Open up the scripts in a text editor to see further documentation.
If you are creating many copies, it may appear to be locked up. The Debug Output console shows some stats during execution as well as dots showing progress. You can look here to see if it is locked up or just bogged down with zillions of points and faces.
*** Remember to convert the parametric shape to a mesh before using it in any other objects, in figures, or scenes. It is totally dependent on the original "source" and "target" objects while it remains a parametric shape. As Steve stated: parametric scripts were never intended to work this way. ***
Attached are examples of the script in use.
Please let me know your feedback.