PxParticlesComplex
- Last UpdatedDec 16, 2023
- 8 minute read
The PxParticlesComplex node derives from PxParticles and inherits all its parameters.
A complex particle system is a particle system made up of 1-n emitters. The particles of a complex particle system can interact with the physical scene but do not interact with each other.
Platform support
This node is supported on XR-Windows platform only.
|
XR-WIN |
XR-P-WIN |
XR-P-IOS |
XR-P-AND |
XR-P-WASM |
|---|---|---|---|---|
|
Full support |
No support |
No support |
No support |
No support |
|
|
|
|
|
|
shaderType
The PxParticleComplex node supports both prebuilt shaders and generated shaders.
-
AlphaBlend: The colors of the textures associated to the particles are blended according to their alpha.
-
AlphaAdd: The colors of the textures associated to the particles are added.
-
ShaderGen: Based on a selection of shadergen shaders and a blend mode.
Note: ShaderGen shaders are the only shaders supported by ClipPlanes, so they should be the preferred choice.

Soft blending
Soft blending reduces or eliminates hard edges that appear when texture particles intersect other solid meshes.
This setting blends the texture of the solid mesh with the mesh of the texture according to the softScale parameter.
The contribute to the color from the particle texture decreases linearly based on the distance among the pixels of the mesh texture and the one of the particle texture. When the distance is greater than or equal to softscale value, the contribute is null.

Meshcut and killbox
Meshcut limits the rendering of the particles of a system to a limited area. Meshcut uses a list of cmeshes and, depending on the meshcutInside value, only particles inside the cmeshes are rendered.
Use Meshcut, for example, to avoid a gas being rendered outside a pipe that contains it.
Killbox is another way to define where particles are displayed and where they are not. When killbox is enabled, only those particles that are inside the killbox are rendered. The advantage of killbox is that it does not require geometry creation. The disadvantage is that it is a box oriented with the axes and does not always fit.
You can combine the two mechanisms.
Code example
This is a code example for the PxParticlesComplex node.
<PxParticlesComplex name="MV004_Gas" pxScene="section03PxScene" position="16.49397 3.261862 -317.5836" rotation="0 0 0 1" maxParticles="1500" disableGravity="true" renderPriority="1" softEnabled="true">
PxSParticlesComplex fields
These are the fields for PxParticlesComplex node. Only the node-specific fields are indicated, not fields obtained by inheritance.
Field inheritance: NodeBase > NodeBaseMovable > PxParticles > PxParticlesComplex
|
Fields |
Type |
Use |
Default value |
Description |
|---|---|---|---|---|
|
collisionWithDynamicActors |
sbool |
Optional |
false |
Enables/disables collision of particles with dynamic actors. Setting this flag makes particles collide with, but not influence rigid bodies. Turn off the flag so the SDK can save memory space and execution time. |
|
contactOffset |
sfloat |
Optional |
0.2 |
Defines the distance at which contacts between particles and rigid actors are created. The contacts are internally used to avoid jitter and sticking. It must be larger than restOffset. |
|
damping |
sfloat |
Optional |
0 |
Velocity damping constant, which is globally applied to each particle. It is a force used to reduce the velocity of the particles over time. |
|
disableGravity |
sbool |
Optional |
false |
Particles are not influenced by gravity. |
|
disableWind |
sbool |
Optional |
false |
Particles are not influenced by wind. |
|
durationLoops |
sint |
Optional |
0 |
Number of emission loops. Zero (0) means infinite. |
|
durationTime |
sfloat |
Optional |
10 |
Emission duration for each loop, in seconds. |
|
dynamicFriction |
sfloat |
Optional |
0 |
Dynamic friction used for collision with the shapes of Dynamic Actors. |
|
emittersNum |
sint |
Optional |
1 |
Number of emitters in the particle system. |
|
enabled |
sbool |
Optional |
true |
Block/unblocks particle system calculations. |
|
externalAcceleration |
svec3 |
Optional |
0 0 0 |
Extra acceleration applied to each particle at each time step. |
|
gridSize |
sfloat |
Optional |
5 |
Sets the particle grid size used for internal spatial data structures. Aa hint for the PhysX to choose the particle grouping granularity for proximity tests and parallelization. Small grid size values might result in spatial data structure overflow, since the number of grid cells is limited to about 1000. Large grid size values on the other hand might result in poor performance due to ineffective spatial queries or lack of parallelization opportunities. |
|
influenceDynamicActors |
sbool |
Optional |
false |
Enables/disables particles influence to the rigid bodies simulation. When false, rigid bodies are not influenced by colliding particles. Use particleMass to control the strength of the feedback force on rigid bodies. |
|
maxMotionDistance |
sfloat |
Optional |
0.3 |
The maximum distance a particle can travel during one simulation step. High values may hurt performance, while low values may restrict the particle velocity too much. |
|
maxParticles |
sint |
Optional |
5000 |
The maximum number of particles that can be added to a particle system. It also impacts the memory allocated by the system. |
|
particleMass |
sfloat |
Optional |
0.01 |
Mass used for two way interaction with rigid bodies. |
|
pxScene |
sstring |
Mandatory |
Not set |
Name of the PxScene the particle system belongs to. |
|
rate |
sfloat |
Optional |
200 |
Emission rate, in particles per second. |
|
recycleParticles |
sbool |
Optional |
false |
Sometimes, especially when particles have long life, it may happen the emitter is no longer able to emit new particles due to the fact there are already \\maxParticles emitted particles. Setting the value of this field to true when reached the \\maxParticles value, old particles are killed to let the emitter emit new ones according to the desired rate. |
|
reset |
sevent |
Optional |
Not set |
Kills all the living particles, so resets the system. |
|
restitution |
sfloat |
Optional |
0 |
Restitution used for collision with shapes. |
|
restOffset |
sfloat |
Optional |
0.1 |
Defines the minimum distance between particles and the surface of rigid actors that the collision system maintains. |
|
shaderGen.blendMode |
senum |
Optional |
alphaBlending |
Defines the blend mode to use with the shadergen shader. Values are opaque, additive, alphaAdditive, and alphaBlending. |
|
shaderGen.depthWrite |
sbool |
Optional |
false |
Sets the shader to use depthWrite. Having it disabled avoids issues. |
|
shaderGen.shader |
sstring |
Optional |
CodeLib|Particles|VcTxt |
Specifies the shaderGen shader to use. Even though the selection in XR Studio is restricted to CodeLib|Particles|VcTxt,CodeLib|Particles|VcTxtSoft the field can be patched with any other shader. |
|
shaderType |
senum |
Optional |
AlphaBlend |
Specifies the shader type to use. Values are ShaderGen, AlphaAdd, and AlphaBlend. |
|
skipPassHdrb |
sbool |
Optional |
false |
Should be set to true when using realtime shadows to avoid conflicts among particles and shadows visualization. Verify that the rendering effect of the particle system changes. |
|
staticFriction |
sfloat |
Optional |
0 |
Static friction used for collision with the shapes of Static Actors. |
|
template |
sstring |
Mandatory |
Not set |
Name of the template particle system loaded as parameter starting point. It can be set at runtime too to change the particle system settings. |
|
visible |
sbool |
Optional |
true |
Shows/hides the particle system. |
Emitter attributes
Access the fields of the emitter of a PxParticle with the syntax:
pxparticle.EmitterN\attribute
For example: fuoco.Emitter0\life
MVEC3 fields represents list of parameters with the convention: timekey, minvalue, maxvalue.
|
Attribute |
Type |
Use |
Default value |
Description |
|---|---|---|---|---|
|
aspect |
sfloat |
Optional |
1 |
Particle's aspect ratio (for example 16:9 is 1.78). |
|
blue |
mvec3 |
Optional |
0 10 10 |
Particle's blue color during the particle's life time. |
|
enabled |
sbool |
Optional |
true |
Enables/disables emission of particles. |
|
green |
mvec3 |
Optional |
0 30 30 |
Particle's green color during the particle's life time. |
|
halfEmissionCone |
mvec3 |
Optional |
0 10 10 |
Half of the angle of emission, relative to the untransformed Y axis. |
|
life |
mvec3 |
Optional |
0 0.8 1.2 |
Perturbation of nominal particle duration time. |
|
linkToActorMesh |
sstring |
Optional |
Not set |
Links the emitter to a physx dynamic mesh. |
|
localPos |
svec3 |
Read only |
Internally calculated |
This fields reflects the position of the emitter in World coordinate system. |
|
localRot |
svec4 |
Read only |
Internally calculated |
This fields reflects the Quaternion rotation of the emitter in World coordinate system. |
|
orientation |
svec3 |
Optional |
0 0 0 |
Returns scene emitter orientation. The three elements of the vector are yaw, pitch, and roll. The values are in radians. Please consider that the emitter is a child of the Node transformation, thus the final space transformation is calculated in the following order: Emitter/orientation * Emitter/position * TransformOffset * Transform * matrix * Parent. In cases where no parent is expressed, the World coordinate system is its parent. |
|
position |
svec3 |
Optional |
0 0 0 |
Local emitter position. Please consider that the emitter is a child of the Node transformation, thus the final space transformation is calculated in the following order: Emitter/orientation * Emitter/position * TransformOffset * Transform * matrix * Parent. In cases where no parent is expressed, the World coordinate system is its parent. |
|
rateMultiplier |
mvec3 |
Optional |
0 1 1.2 |
Perturbation of the nominal particles emission rate. |
|
red |
mvec3 |
Optional |
0 200 200 |
Particle's red color during the particle's life time. |
|
rotation |
mvec3 |
Optional |
0 -360 360 |
Particle's 2D rotation (degrees). |
|
shapeHalfX |
sfloat |
Optional |
0 |
Emitter half width. |
|
shapeHalfY |
sfloat |
Optional |
0 |
Emitter half height. |
|
shapeHalfZ |
sfloat |
Optional |
0 |
Emitter half length. |
|
shapeType |
senum |
Optional |
Rectangle |
Shape of the emitter among Point, Rectangle (box) and Cylinder. |
|
size |
mvec3 |
Optional |
0 1 1 |
Size of the rendered particles. |
|
sizeOverLife |
mvec3 |
Optional |
0 30 30,22 60 60,45 70 70, 100 40 40 |
How the size changes during the particle's life time. |
|
spin |
mvec3 |
Optional |
0 -360 360 |
Particle's 2D rotation speed. |
|
spinOverLife |
0 60 70,25 100 100,100 0 10 |
How the spin value changes during the particle's life time. |
||
|
textureAnimFps |
sfloat |
Optional |
0 |
The animation's frames per second. 0 means no animation. |
|
textureAnimFrameWidth |
sint |
Optional |
0 |
Width of the frames inside the texture (used only if textureType is Animated). |
|
textureAnimFrameHeight |
sint |
Optional |
0 |
Height of the frames inside the texture (used only if textureType is Animated). |
|
textureAnimNumFrames |
sint |
Optional |
0 |
Number of frames used in the animation (used only if textureType is Animated). |
|
textureAnimRandomStart |
sint |
Optional |
true |
Will randomize the first frame the Particle will use when spawned. |
|
textureAnimStartFrame |
sint |
Optional |
0 |
Initial animation frame (used only if textureType is Animated). |
|
textureName |
sstring |
Optional |
Fire.png |
Name of the texture file used by the emitter. |
|
textureType |
senum |
Optional |
Animated |
Selects between Simple and Animated textures. |
|
velocity |
mvec3 |
Optional |
0 0.5 1.5 |
Particle velocity on emission. |
|
visibility |
mvec3 |
Optional |
0 1 1 |
Particle's alpha value. |
|
visibilityOverLife |
mvec3 |
Optional |
0 25 30,10 75 80,75 75 80,100 0 15 |
How the alpha value changes during the particle's life time. |