Repository navigation
feat(wasm): run a fire in the browser on real terrain - #211
Merged
Merged
Conversation
Contributor
|
@HugoFara would be cool to deploy in pages indeed ! so cool, as demo, the thing is to get consistent tiled data, but cool. With a static page action ? or just deploy from a branch.. a github action might be more configurable with WASM build. |
A static page over the WebAssembly module (forefireAPI#171). landscape.mjs builds the fuel and elevation layers from satellite and Terrarium tiles for any square of ground, worker.mjs runs the whole simulation off the main thread and reports why it ended, and terrain3d.mjs draws the result on a raw WebGL heightfield that tilts up from the 2D map, with click-to-ignite by ray cast.
Collaborator
Author
|
I find GitHub Action more convenient. Keeping a separate branch leads to code drift and more time in maintenance... I am updating this PR, following the merge of #210 |
HugoFara
force-pushed
the
feat/wasm-demo
branch
from
October 23, 2026 15:14
2a49877 to
25ad0be
Compare
…sing layer addLayer returned void, so JavaScript saw undefined and the demo's worker treated the propagation layer as unregistered: every run failed with "a layer failed to register". The engine side was fixed in forefireAPI#209; this is the binding half, which forefireAPI#210 shipped without. The smoke test printed each layer's result without checking it, which is how this got through CI. It now exits non-zero if any layer is missing.
Explore is the default: click the map to light a fire, set the wind on a dial or from a scenario, and watch it play back over a full-height map. Research adds the propagation model, the two tuning factors, the numerics, fuel moisture and bed depths, and the fuel class cut-offs, each labelled with the ForeFire name it sets. Each run now gets its own worker. The engine's state is process-wide (forefireAPI#175), so a reused module kept the first run's propagation model and a model switch did nothing.
The tile mosaic was drawn at fractional pixel offsets, so every tile edge was antialiased: a dark seam in the imagery, and in the terrain tiles half-blended pixels that decode to spikes hundreds of metres high. The offsets are now rounded to whole pixels. The wheel in 3D only moved the camera over the ground already loaded. It now zooms the ground as in 2D, and the rebuilt mesh keeps the orbit pose. setView dropped tilt.value, so the second terrain rebuild passed undefined as the camera blend and drew nothing until the view was toggled.
Any pan or zoom cleared the run, because the fronts were drawn in the current view's metres and would have landed on the wrong ground. Each run now remembers the square it was computed on, its fronts are drawn wherever that square sits in the view, and the ignition is measured against that square rather than a view still waiting on its tiles.
…f the terrain Each front was filled on its own, so the inner front ForeFire keeps round ground the fire has encircled was filled orange like the burn around it. The fronts are now one shape filled even-odd, which leaves that ground clear. The wind arrow was painted on the 2D canvas, which is also the texture of the 3D mesh, so it was draped over the terrain. It is now an overlay on the map, hidden in 3D where map north turns with the camera.
Collaborator
Author
HugoFara
marked this pull request as ready for review
October 23, 2026 15:45
Collaborator
Author
|
One thing I did not do: should we add flames height? We have it with Balbi2020. Plume would be useful be needs Meso-NH. |
filippi
approved these changes
Oct 23, 2026
filippi
left a comment
Contributor
There was a problem hiding this comment.
I leave this one, cool.
There is the ability to load standard fuel tables procompiled as a parameter too i think. But that is great
filippi
approved these changes
Oct 23, 2026
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.





A browser demo of the WASM build from #210. Explore mode: click the map to light a fire, set the wind, and watch it spread in 2D or on 3D terrain. Research mode adds the model,
propagationSpeedAdjustmentFactor,windReductionFactor, the numerics, and fuel moisture and classes.wasm-pages.ymlpublishes it on every push todev, as discussed in #212. Thegithub-pagesenvironment needsdevadded as an allowed branch (Settings → Environments → github-pages).Also fixes a bug from #210: the WASM
addLayerreturned nothing, so the demo failed to register its layers. The smoke test now fails when a layer is missing.Tested in Chrome against
dev. Each run uses a fresh worker, because the engine's state is process-wide (#175).Drafted with Claude Opus 5.5.