MaxwellGrass

Description

This extension allows to generate grass on the top of meshes. It works as a object modifier plugin. Internally it creates blades and converts them to different grass primitives depending on the user parameters.

Example of how to create a MaxwellGrass object:

// If we don't need to call functions such as CgeometryModifierExtension::getProxyDisplayPoints() 
// (i.e for display purposes) 
// then it is possible to define procedural geometries or object modifiers 
// without loading extension dynamic libraries (.mxx files) 
// but a MXparamList object can be created and filled with the desired parameters.

Cmaxwell::Cobject mesh = pMaxwell->createMesh( ... );

// ...fill mesh parameters
MXparamList* grassParams = new MXparamList( "MaxwellGrass" );


float bladesDensity = 500.0; 
grassParams->createUInt( "Density", 2000, 1, 1000000000 );
grassParams->setUint( "Density", bladesDensity ); 

float length = 0.25; 
grassParams->createFloat( "Length", 10.0f, 0.f, 100000.f ); 
grassParams->setFloat( "Lenght ", length ); 

grassParams->createString( "Material", "" );
grassParams->setString( "Material", materialName );

//...etc..


object.applyGeometryModifierExtension( grassParams );


 

 

Parameters

 

NameTypeMinMaxDefaultDescription
Materialchar*------Material name
Points per Bladeunsigned int2204Number of control points per blade
Primitive Typeunsigned int020Grass type (0: Smooth; 1: Flat; 2: Cylinder (hair)
Seedunsigned int0163830Initial seed for blades generation (useful when there are two grass modifiers in the same mesh)
Densityunsigned int11e82000Blades density (blades/m2)
Density MapCmap------Blades density texture map
Lengthfloat0.01e510.0Blade length in centimeters
Length MapCmap------Blade length map
Length Variationfloat0.0100.020.0Length random variation (%)
Root Width
float0.11e55.0Root width in milimeters
Tip Widthfloat0.11e51.0Tip width in milimeters
Initial Anglefloat0.090.080.0Initial blade-ground angle in degrees (º)
Initial Angle MapCmap------Initial angle texture map
Initial Angle Variationfloat0.0100.025.0Initial angle variation (%)
Start Bendfloat0.0100.040.0Start bend point (in % of blade length)
Start Bend MapCmap------Start bend texture map
Start Bend Variationfloat0.0100.025.0Start bend variation (%)
Bend Radiusfloat0.0011e510.0Bend radius in centimeters
Bend Radius MapCmap------Bend radius texture map
Bend Radius Variationfloat0.0100.025.0Bend radius variation (%)
Bend Anglefloat0.0360.080.0Bend angle in degrees (º)
Bend Angle MapCmap------Bend angle texture map
Bend Angle Variationfloat0.0100.025.0Bend angle variation (%)
Cut Offfloat100.00.0100.0Cut off point (in %)
Cut Off MapCmap------Cut off texture map
Cut Off Variationfloat0.0100.00.0Cut off variation (%)
Enable LODbyte010Enable density level of detail
LOD Min Distancefloat0.01e510.0Level of detail starting distance (in meters)
LOD Max Distancefloat0.01e550.0Level of detail end distance (in meters)
LOD Max Distance Density
float0.0100.010.0Percent (%) of initial density at Max. distance
Display Percentunsigned int0.0100.010.0Percent (%) of blades displayed for preview purposes
Display Max. Bladesunsigned int0.01e51000.0Maximum amount of blades displayed for preview purposes
"TRIANGLES_WITH_BLADES"byte array------

Optional array to define which triangles of the modified mesh will have blades.

The size of this array should be the same than the triangle count, each element of the array corresponds to a triangle index

  • 0: skip this triangle
  • 1:generate grass in this triangle