Skip to content

Fix mushroom cloud being clipped by simulation grid - #2

Open
FraGGerSheep wants to merge 2 commits into
masterfrom
claude/loving-goodall-4cfa1c
Open

Fix mushroom cloud being clipped by simulation grid#2
FraGGerSheep wants to merge 2 commits into
masterfrom
claude/loving-goodall-4cfa1c

Conversation

@FraGGerSheep

Copy link
Copy Markdown
Owner

Summary

The mushroom cloud was being cut off at the top because the MarchingCubes grid was a 12×12×12 cube centered at Y=0, so the simulation only ran from world Y=-6 to Y=+6. The explosion injection at N*0.12 mapped to world Y≈-4.5 (underground!), and as the cloud rose it hit the ceiling at Y=+6 where _setBoundary zeroed its density — literally clipping the cap.

This PR retunes the simulation volume and the cloud dynamics so the full mushroom shape — narrow stem, wide cap, headroom above — actually fits and reads as an atomic mushroom.

What changed

  • Tall non-square grid: mc.scale.set(8, 20, 8) + position.set(0, 20, 0) → world Y now spans 0→40 with the grid bottom at ground level.
  • Open top boundary in FluidSolver.step(): density and temp at j=N-1 copy from j=N-2 (with mild attenuation) instead of being zeroed, so gas flows out rather than getting killed at the ceiling.
  • Entrainment force in _addForces: low-altitude gas gets pulled toward the central axis, producing a narrow rising stem.
  • Vortex ring retuned to form higher (52→74% of grid height) and wider, so the toroidal roll creates a recognizable mushroom cap above the stem.
  • Calmer rise: lower buoyancyAlpha (max 5 instead of 10) and lower initial vy (2.0 instead of 3.0) so gas no longer rockets straight into the boundary.
  • Camera reframe: starts at (22, 10, 32) and tracks the cap up to world Y≈28; FOV 48°; fog thinned from 0.005 → 0.003 so the cap doesn't fade out.
  • Shader height ramp updated to the new world-Y range.

Test plan

  • npm run dev and watch a full detonation cycle — cap should clearly form above a visible stem and not visibly clip against the top of the simulation
  • Restart button still works
  • FPS is comparable to before (entrainment adds one extra branch per cell; should be negligible)

🤖 Generated with Claude Code

FraGGerSheep and others added 2 commits April 27, 2026 19:06
The MarchingCubes grid was a 12×12×12 cube centered at Y=0, so the
simulation space ran from Y=-6 to Y=+6. The explosion injection at
N*0.12 mapped to world Y≈-4.5 (underground), and the rising cloud
hit the ceiling at Y=+6 where _setBoundary zeroed its density,
literally clipping the mushroom cap.

- Switch MC to a tall non-square box (16 wide × 40 high), shifted up
  so the grid bottom sits at ground level and the cap has headroom.
- Open top boundary on density/temp so gas flows out instead of
  being killed at the ceiling.
- Add entrainment force that pulls low-altitude gas toward the
  central axis, forming a narrow rising stem.
- Tune vortex ring to form higher (52-74% of grid height) and wider
  for a recognizable mushroom cap.
- Lower buoyancy and initial velocity so gas rises steadily rather
  than rocketing into the boundary.
- Reframe the camera and tracking target to follow the cap up to
  world Y≈28, and thin the fog so the top stays visible.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant