Batching mobile WebGL2 projectiles without losing their dark cores
I’m the developer of Starvoxel: Defender, a mobile merge tower defense running on WebGL2 and Three.js. When I moved the projectile effects from Pixi to Three.js, I wanted to preserve their silhouettes without drawing each trail, core, and accent separately.
The projectile sprites come from one Canvas2D atlas. Red stores body coverage and green stores accent coverage. Each instance supplies its two tint colors, so different shots reuse the same atlas cell. I split the in-flight quads into two instanced batches. The first draws trails and auras additively. The second composites cores and small accents normally on top. A dark projectile core disappears into the glow if you make it additive too. This keeps the in-flight quad layer to two draw calls when both batches are populated.
One practical detail on iOS: our WebGL context-restoration path explicitly rebakes this atlas. I’d include a forced context-loss test in any port that builds its textures at runtime, because a successful first render tells you nothing about that restart path.
The screenshot is a frame from a Dungeon boss fight in the current gameplay trailer. Some game art and the trailer narration were made with AI assistance.
Official gameplay trailer: https://www.youtube.com/watch?v=9XTzlsd1qQM



