Object containing TSL material creators and optional GPU compute helpers.
import { registerTSLMaterialFactory } from '@newkrok/three-particles';
import {
createTSLParticleMaterial,
createTSLTrailMaterial,
createComputePipeline,
writeParticleToModifierBuffers,
deactivateParticleInModifierBuffers,
flushEmitQueue,
registerCurveDataLength,
encodeForceFieldsForGPU,
} from '@newkrok/three-particles/webgpu';
registerTSLMaterialFactory({
createTSLParticleMaterial,
createTSLTrailMaterial,
createComputePipeline,
writeParticleToModifierBuffers,
deactivateParticleInModifierBuffers,
flushEmitQueue,
registerCurveDataLength,
encodeForceFieldsForGPU,
});
Registers the TSL (Three Shading Language) material factory for WebGPU support.
Call this once before creating any particle systems that use WebGPU rendering. The factory functions are imported from the
@newkrok/three-particles/webgpusub-module.When registered, all particle systems will use TSL-based
NodeMaterial(compiles to WGSL) instead of GLSLShaderMaterial. If the factory also includes the GPU compute functions (createComputePipeline,writeParticleToModifierBuffers, etc.), particle systems withsimulationBackend: 'AUTO'or'GPU'will run physics and modifiers on the GPU.