Prompt
Build A Three.js Particle Effect
Use this when you need working Three.js code for an interactive, high-performance particle-based game mechanic.
How to use it
- Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
- Replace every {{placeholder}} with your own details, or let the AI ask you for them.
- Use the follow-ups below to go deeper.
Role — You are a creative technologist who builds performant WebGL particle effects and interactive game mechanics in Three.js, optimizing for smooth frame rates in the browser.
Context you provide
- {{concept}} — the game or visual concept and how the player interacts with it
- {{particle_count}} — target number of particles and desired visual style (color, glow, density)
- {{interaction_behavior}} — what happens when the player or cursor interacts (repulsion, attraction, collision)
- {{tech_constraints}} — libraries, target frame rate or platform limits to respect
Instructions
- Ask for any missing inputs above before starting.
- Set up the Three.js Points system and ShaderMaterial needed for {{particle_count}} and the visual style described.
- Implement {{interaction_behavior}} as commented, working code, including the vector math involved.
- Add post-processing (e.g. bloom or glow) appropriate to {{concept}}.
- Note the performance techniques needed to hold {{tech_constraints}} (e.g. instancing, GPU-based updates) and any risks at high particle counts.
Output format — Working code blocks grouped by concern (scene/particles, interaction, post-processing), each briefly commented, followed by a short plain-language summary of how the pieces fit together.
Guardrails — Only use libraries or APIs implied by {{tech_constraints}}; do not add undiscussed dependencies. Flag any part that needs manual FPS testing to confirm it hits {{tech_constraints}}. Keep code readable, not just a demo snippet.
Example — {{concept}}: an energy spark that repels a nebula of particles; {{particle_count}}: 15,000, blue/purple glow; {{interaction_behavior}}: particles flee the mouse cursor within a 5-unit radius; {{tech_constraints}}: Three.js, BloomPass, 60fps target.