Particle systems in Phenomenon are created by adding instances to the renderer. Each instance represents a collection of particles that share the same geometry, shaders, and attributes.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/vaneenige/phenomenon/llms.txt
Use this file to discover all available pages before exploring further.
Basic particle system
Create the renderer
Initialize Phenomenon with your desired settings. The renderer manages all particle instances and handles the render loop.
The
position property controls the camera position. Higher z values move the camera further away from the scene.Define your attributes
Attributes are data passed to each particle. Every attribute needs a name (used in shaders), size (number of values), and a data function that returns values for each particle.
Set up uniforms
Uniforms are values that remain constant across all particles during a single render, but can be updated between frames.
Supported uniform types:
float, vec2, vec3, vec4, mat2, mat3, mat4Write your shaders
The vertex shader positions particles in 3D space, while the fragment shader determines their color.
Animating particles
Use theonRender hook to update uniforms and animate your particles on every frame.
Understanding the multiplier
The multiplier creates duplicate copies of your geometry with different attribute values. This is far more efficient than creating separate instances.Less instances with higher multipliers will always perform better than more instances with lower multipliers. See the performance guide for details.
Using geometry
By default, particles are rendered as points (mode 0). You can also render custom geometry by providing vertices.Common pitfalls
Particles not visible
Particles not visible
Check these common issues:
- Verify the camera position (z value) is appropriate for your scene
- Ensure
gl_PointSizeis set to a visible value (at least 1.0) - Confirm particle positions are within the clip range (default: 0.001 to 100)
- Check that your fragment shader sets
gl_FragColor
Poor performance
Poor performance
- Reduce the multiplier value
- Set
devicePixelRatioto 1 instead ofwindow.devicePixelRatio - Disable antialiasing in context settings
- Use fewer or simpler attributes
- See the performance guide for optimization strategies
Attributes not updating
Attributes not updating
Attributes are set once during initialization. To update them, you need to use
prepareAttribute() or prepareBuffer(). See the dynamic attributes guide.