Constructor
new pxlParticles/HeightMap(room, systemNameopt)
- Description:
Creates an instance of HeightMap.
- Source:
Properties:
Name | Type | Description |
---|---|---|
room |
Object | The room object. |
name |
string | The name of the particle system. |
heightMapPath |
Object | The path to the height map texture. |
spawnMapPath |
Object | The path to the spawn map texture. |
spawnMapMode |
number | The number of channels in the spawn map texture. |
material |
Object | The material for the particle system. |
shaderSettings |
Object | The shader settings for the particle system. |
knownKeys |
Array.<string> | Known keys for shader settings. |
Examples
this.shaderSettings = {
"vertCount" : 1000,
"pScale" : 7,
"pOpacity" : 1.0,
"proxDist" : 200,
"atlasRes" : 4,
"atlasPicks" : [],
"randomAtlas" : false,
"additiveBlend" : false,
"jumpHeightMult" : 0,
"offsetPos" : new Vector3( 0, 0, 0 ),
"windDir" : new Vector3( 0, 0, 0 ),
"size" : new Vector3( 0, 0, 0 ),
"hasLights" : false,
"fadeOutScalar" : 1.59 ,
"wanderInf" : 1.0 ,
"wanderRate" : 1.0 ,
"wanderFrequency" : 2.85
}
// HeightMap particle system
// Generate a system that uses a height map to set the Y position of the particles
// With a spawn map to determine the density of the particles
// Set noise and other settings to alter the particles
import { Object3D } from "three";
import { pxlEffects } from "pxlNav.esm.js";
const HeightMap = pxlEffects.pxlParticles.HeightMap;
// You can put this in yuor `fbxPostLoad()` or `build()` function
fbxPostLoad(){
// Create the HeightMap system
let heightMapSystem = new HeightMap( this, "heightMap" );
// Set the paths for the height map
heightMapSystem.setHeightMapPath( "path/to/heightMap.jpg" );
// Set the paths for the spawn map
heightMapSystem.setSpawnMapPath( "path/to/spawnMap.jpg", 1 ); // 1 for single channel map, 3 for RGB
// Get a copy of the current particle systems settings
// Update the settings as needed
let curShaderSettings = heightMapSystem.getSettings();
curShaderSettings["vertCount"] = 600; // Number of particles
curShaderSettings["pScale"] = 9; // Scale of the particles
curShaderSettings["pOpacity"] = 0.8; // Opacity of the particles
curShaderSettings["proxDist"] = 400; // Proximity distance
curShaderSettings["additiveBlend"] = true; // Additive blending for the particles
// Create a 3D object to use as a reference for the particle system
// The position is used for the system's position
// The scale is used for bounding box size of the system
let objectRef = new Object3D();
objectRef.position.set( 0, 0, 0 );
objectRef.scale.set( 1000, 100, 1000 );
// If you used a 3D object in your FBX file, you can use it to set the size
// The object should have a userData property with `Scripted`{bool}
// To set the bounding box size, set your objects scale
// Or use these user attributes - `SizeX`{num}, `SizeY`{num}, & `SizeZ`{num}
// let objectRef = this.geoList[ "Scripted" ][ "YouObjectName" ];
heightMapSystem.build( curShaderSettings, objectRef );
}
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
room |
Object |
null
|
The room object. |
|
systemName |
string |
<optional> |
'heightMap'
|
The name of the particle system. |
Methods
(static) HeightMap#build(curShaderSettingsopt, objectRefopt) → {Object}
- Description:
Builds the particle system with the given shader settings and object reference.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
curShaderSettings |
Object |
<optional> |
{}
|
The current shader settings. |
objectRef |
Object |
<optional> |
null
|
The reference object for positioning and sizing. |
Returns:
The particle system added to the scene.
- Type
- Object
(static) HeightMap#setHeightMapPath(path)
- Description:
Sets the path for the height map texture.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
path |
string | The path to the height map texture. |
(static) HeightMap#setSpawnMapPath(path, channelsopt)
- Description:
Sets the path for the spawn map texture and its mode.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
path |
string | The path to the spawn map texture. |
||
channels |
number |
<optional> |
1
|
The number of channels in the spawn map texture. |