Description
This extension enables maxwell to render particles as spheres. These particles can be stored in a .bin or .pxy file, typically saved from realflow, or passed as internal data which is stored in the .mxs file.Besides generating its own geometry, this extension can generate also its own UV coordinates. This is done using one or more of the 39 custom UV generators available. Each particle is assigned a pair of UV coordinates whose value depends on the generator used and the mapped magnitude. To use one of the generators, create a UV channel and assign it the desired custom type, and don't forget to enable loading the appropriate data arrayis a geometry modifier. It loads a particle file, or reads particles stored internally and creates instances of the selected geometry at the particles positions.
Example of how to create a MaxwellParticles object, add a uv channel, set its custom type to "Density" and enable loading the particle densities arrayMaxwellCloner modifier, and apply it to an already existing object in the scene.
Code Block | ||||
---|---|---|---|---|
| ||||
CextensionManager* extensionManager = CextensionManager::instance(); CgeometryProceduralExtensionCgeometryModifierExtension* geomProcExtensiongeomModifExtension = extensionManager->createGeometryProceduralExtension>createGeometryModifierExtension( "MaxwellParticlesMaxwellCloner" ); //Get the extension container. When using this method of getting the container, //nearly all parameters have default values, and there is no need to explicitly set them. MXparamList* particlesParamsclonerParams = geomProcExtensiongeomModifExtension->getExtensionData(); //Fill the required data char* filename = "/home/rocco/Emitter01_00023.bin"; particlesParamsclonerParams->setString( "FileName", filename ); //Enable loading particle densities data byte load = 1; particlesParams->setByte( "Load particle Density", load ); //These two numbers can be obtained parsing the particles file //They're needed to map the values of densities from 0.0 to 1.0 to access the texture. float minD = 0.19; float maxD = 1.67; particlesParams->setFloat( "Min Density", minD ); particlesParams->setFloat( "Max Density", maxD ); //Get the number of custom generators available byte numCustomUVGenerators = geomProcPlugin->getNumberOfUVGenerators(); Get the object we want to clone Cmaxwell::Cobject objmxObject = scene->createGeometryProceduralObject>getObject( "My Particles", particlesParams ); dword uvIndex;//returned uv channel index. Use this index in the texture map properties to access its uv's byte MyGeometry" ); isOk = objmxObject.addChannelUVWapplyGeometryModifierExtension( uvIndexclonerParams ); obj.generateCustomUVW( uvIndex, 34 );//34 is the type of the custom uv generator. //Now assign a material and set the first BSDF reflectance0º color a texture driven by uv channel 'uvIndex' |
...
Parameters
Name | Type | Description |
---|---|---|
char* | Particles filenameCopy of MaxwellParticles | |
float | Particle radius multiplierCopy of MaxwellParticles | |
float | Motion blur multiplierCopy of MaxwellParticles | |
float | Camera shutterspeed | |
Copy of MaxwellParticles"Load particles %" | float | Percentage of particles to loadCopy of MaxwellParticles |
" Start offset" | unsigned int | Skip some particles before loading |
"Create N particles per particle" | unsigned int | Enables Multipoint feature if N > 0 |
Copy of MaxwellParticles"Extra particles dispersion" | float | Dispersion of the extra particles cloudCopy of MaxwellParticles |
"Extra particles deformation" | float | Deformation of the extra particles cloud |
Copy of MaxwellParticles | byte | Load or not array of Force vectors |
"Min Force" | float | Minimum force modulus value |
"Max Force" | float | Maximum force modulus value |
"Load particle Vorticity"Use velocity" | byte | Load or not array of Vorticity vectors |
"Min Vorticity" | float | Minimum vorticity modulus value |
Copy of MaxwellParticles | float | Maximum vorticity modulus value |
"Load particle Normal" | byte | Load or not array of Normal vectors |
"Load particle neighbors no." | byte | Load or not array of particle neighbors# |
"Min Nneighbors" | unsigned int | Minimum number of neighbors value |
"Max Nneighbors" | unsigned int | Maximum number of neighbors valueCopy of MaxwellParticles |
"Load particle UV" | byte | Load or not array of particle UV |
"Load particle Age" | byte | Load or not array of particle Age |
"Min Age" | float | Minimum age value |
"Max Age" | float | Maximum age value |
"Load particle Isolation Time" | byte | Load or not array of particle isolation time |
"Min Isolation Time" | float | Minimum isolation time value |
"Max Isolation Time" | float | Maximum isolation time value |
"Load particle Viscosity" | byte | Load or not array of particle viscosity |
"Min Viscosity" | float | Minimum viscosity value |
"Max Viscosity" | float | Maximum viscosity value |
"Load particle Density" | byte | Load or not array of particle density |
"Min Density" | float | Minimum density value |
Copy of MaxwellParticles | float | Maximum density value |
"Load particle Pressure" | byte | Load or not array of particle pressure |
"Min Pressure" | float | Minimum pressure value |
"Max Pressure" | float | Maximum pressure value |
"Load particle Mass" | byte | Load or not array of particle mass |
"Min Mass" | float | Minimum mass value |
"Max Mass" | float | Maximum mass value |
"Load particle Temperature" | byte | Load or not array of particle temperature |
"Min Temperature" | float | Minimum temperature value |
"Max Temperature" | float | Maximum temperature value |
"Load particle ID" | byte | Load or not array of particle ID |
"Use the velocity vector to as Y axis of the instance | ||
"Scale with particle radius" | byte | Scale instances with particle radius |
"PARTICLE_POSITIONS" | float* | Array of particle positions |
"PARTICLE_SPEEDS" | float* | Array of particle speeds |
"PARTICLE_RADII" | float* | Array of particle radii |
"PARTICLE_IDS" | int* | Array of particleID's |
...
UV Generators
...
"
...
...
FileName"
Name of the file that contains particles data. It is a NULL terminated string.
...
Code Block | ||
---|---|---|
| ||
char* file = "/home/paco/Emitter01_00049.bin"; extParam->setString( "FileName", file ); |
"Radius Factor"
Multiplier for the particle radius that is read from the file. Can go from 0.00001 to 1000000 and the default value is 1.
...
Code Block | ||
---|---|---|
| ||
float rFactor = 0.3f; extParam->setFloat( "Radius Factor", rFactor ); |
"MB Factor"
Multiplier to increase or decrease the amount of motion blur of the particles. Can go from 0.0 to 1000000.0. Default is 1.0.
...
Code Block | ||
---|---|---|
| ||
float factor = 0.3f; extParam->setFloat( "MB Factor", factor ); |
"Shutter 1/"
Shutterspeed of the active camera. Affects the amount of motion of the particles. It is the inverse of the time the shutter is open.
...
Code Block | ||
---|---|---|
| ||
float shutter = 125.f; extParam->setFloat( "Shutter 1/", shutter ); |
"Load particles %"
Percentage of particles to load. Can go from 0.0 to 100.0, default value is 100.
...
Code Block | ||
---|---|---|
| ||
float percent = 75.f;
extParam->setFloat( "Load particles %", percent ); |
"Start offset"
Skip N particles when loading.
Example:
Code Block | ||
---|---|---|
| ||
unsigned int nOff = 10; extParam->setUInt( "Start offset", nOff ); |
"Create N particles per particle"
This parameter, if set greater than zero, activates the Multipoint feature, creating N more particles around each particle. So, if you have 100 particles and set this parameter to 4, it will create 400 more particles, and the final count will be 500.
...
Code Block | ||
---|---|---|
| ||
unsigned int nParts = 10; extParam->setUInt( "Create N particles per particle", nParts ); |
"Extra particles dispersion"
This parameter sets the size of the cloud of extra particles around each original particle. Can go from 0 to 100000. Default is 0.
...
Code Block | ||
---|---|---|
| ||
float dispersion = 2.f; extParam->setFloat( "Extra particles dispersion", dispersion ); |
"Extra particles deformation"
Sets the amount of deformation of the new particles cloud along the speed vector of the original particle. Can go from 0 to 100000. Default is 0.
...
Code Block | ||
---|---|---|
| ||
float deformation = 1.1f; extParam->setFloat( "Extra particles deformation", deformation ); |
"
...
Use velocity"
Use the particle velocity vector as the Y (up) axis of the instanced geometry.
Example:
Code Block | ||
---|---|---|
| ||
byte useVel = 1;
extParam->setByte( "Use velocity", useVel ); |
"Scale with particle radius"
Scale the instanced geometry with the particle radius.
Example:
Code Block | ||
---|---|---|
| ||
byte loadArrayuseRad = 1; extParam->setByte( "LoadScale with particle Viscosityradius", loadArrayuseRad ); |
"Min Force" "Max Force" "Min Vorticity" "Max Vorticity" "Min Nneighbors" "Max Nneighbors" "Min Age" "Max Age" "Min Isolation Time" "Max Isolation Time" "Min Viscosity" "Max Viscosity" "Min Density" "Max Density" "Min Pressure" "Max Pressure" "Min Mass" "Max Mass" "Min Temperature" "Max Temperature"
...
"PARTICLE_POSITIONS"
Particle data can come whether in a file or internally stored in the .mxs file. If a filename is not supplied, the extension checks for internal data, and if successful, loads it. This parameter is a linear array of floats x0 y0 z0 x1 y1 z1 x2 y2 z2 x3 y3 z3 x4 y4 z4 ...., its length is 3*numberOfParticles.
...
Code Block | ||
---|---|---|
| ||
int numParticles = 4; float points[ 3*4 ]; for( int idx = 0; idx < numParticles; idx++ ) { points[ 3*idx + 0 ] = (float)idx; points[ 3*idx + 1 ] = (float)idx; points[ 3*idx + 2 ] = (float)idx; } extParam->setFloatArray( "PARTICLE_POSITIONS", points, 3*numParticles ); |
"PARTICLE_SPEEDS"
Linear array of particle speeds, floating point numbers, needed to enable calculation of motion blur: Vx0 Vy0 Vz0 Vx1 Vy1 Vz1 Vx2 Vy2 Vz2...., its length is 3*numberOfParticles.
...
Code Block | ||
---|---|---|
| ||
int numParticles = 4; float speeds[ 3*4 ]; for( int idx = 0; idx < numParticles; idx++ ) { speeds[ 3*idx + 0 ] = (float)idx; speeds[ 3*idx + 1 ] = (float)idx; speeds[ 3*idx + 2 ] = (float)idx; } extParam->setFloatArray( "PARTICLE_SPEEDS", speeds, 3*numParticles ); |
"PARTICLE_RADII"
Linear array of particle radii, floating point numbers: r0 r1 r2 r3 r4 r5 r6 .... The length of this array can be either 1 or numParticles. If only one radius is given , it is applied to all the particles, otherwise each particle gets its own radius.
...
Code Block | ||
---|---|---|
| ||
//Each particle its own radius int numParticles = 4; float radius[ 4 ]; for( int idx = 0; idx < numParticles; idx++ ) { radius[ idx ] = (float)idx + 0.01f; } extParam->setFloatArray( "PARTICLE_RADII", radius, numParticles ); //One radius for all particles float r = 0.4f; setFloatArray( "PARTICLE_RADII", &r, 1 ); |
"PARTICLE_IDS"
Linear array of particle IDs, id0 id1 id2 id3 id4 id5.......needed to enable coherent calculation of multipoint. It is an integer array.
...