Repository navigation
Particles: particles are on their emitter's visibility layer - #1833
Merged
Merged
Conversation
A camera draws a renderable only if it and every container above it share a layer with the camera's cullMask. Particles stayed on layer 1 whatever their emitter was on, so a camera that drew only the emitter's layer (the way to give an effect a camera of its own) drew the emitter and none of its particles. Particles are now born on their emitter's visibilityLayer, and the emitter fans a change out to the live ones on its next update, as it already does for blendMode. A pooled particle no longer keeps the layer of its last life. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JnzwA2BZwXkRJLpNxCXBNt
5 of 10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A camera draws a renderable only if it and every container above it share a layer with the camera's
cullMask. Particles stayed on layer 1 whatever their emitter was on. So the way to give an effect a camera of its own, putting the emitter on a layer and giving that camera acullMaskof just that layer, drew the emitter and none of its particles. (Leaving an emitter out of a camera already worked, because the container check covers its children.)The fix follows the emitter's existing
blendModepattern:visibilityLayer(inParticle#onResetEvent, so a pooled particle no longer keeps the layer of its last life);update. This costs one number compare per emitter per frame.A getter on
Particlereading the parent's layer would have been simpler, but TypeScript rejects an accessor overridingRenderable's plain property (TS2611).Also:
Fixedentry.ParticleEmitter.visibilityLayer/cullMasksection and a symptom row in the particles skill.Found while building the Starsweep example, whose 3D star-dust background is drawn by a second,
Camera3d, camera on its own layer.Type of change
Checklist
pnpm lintpasses): Biome clean,tscclean, no new ESLint warningspnpm testpasses):camera-cull-maskand everyparticle-*spec pass (207 tests)tests/camera-cull-mask.spec.js; the two behaviour tests fail without the fixpnpm build): left to CIRelated issues
None.
Generated by Claude Code