mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-23 03:32:19 +00:00
feat(vessels): draw vessels as shaded sprites seen from the camera's angle
Vessels on the map were flat, top-down hulls turned along their course, drawn at one size at every range. Each hull shape (the ten vessel kinds, a dredger and a pilot boat) is now rendered in Blender into a view sheet like the aircraft's (public/sprites/vessel-views.webp: 208 views a shape, 7.5 degrees apart from straight above down to the horizon, 4096 x 2496, grey, 2.2 MB), cut at the waterline. On a renderer with `viewSheets` the Vessels layer draws a vessel as the view of its hull from where the eye is, with the flat hull as the fallback while the sheet loads or if it cannot load. A vessel keeps its kind's colour; aids to navigation keep their upright buoy; a renderer without view sheets draws the flat hulls as before. Every AIS ship type code 0-99 maps to a shape in the sheet (`vesselShape`, vesselTypes.js), pinned by a test. Type text such as "Search & Rescue" and "Anti Pollution" is now recognised, which also gives those vessels their right kind colour. Size: a vessel's icon now follows its range from the eye on the same range aircraft icons use (1.5 times its former size up close, its former size at about 1,000 km, a third from 8,000 km out), so it stays under an aircraft's icon at every range, and the vessel set recedes toward the horizon as the aircraft sets do. Tools: the bake script handles both sheets (scripts/bake-view-sheet.py; `npm run build:aircraft-views`, `npm run build:vessel-views`), and refuses a partial bake over a shipped sheet. scripts/qa-view-sheet.mjs writes contact sheets of a bake; scripts/qa-aircraft-views.mjs takes `--layer vessels`. The aircraft sheet is unchanged. Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
1 parent
b4ff9b1e07
commit
01187cbe7a
19 files changed
+1115
-272
No files matched your search
@@ -37,7 +37,8 @@ How the layers use them:
|
||||
model is fetched while a session runs.
|
||||
- The aircraft and helicopter models are also rendered from every side into
|
||||
the aircraft view sheet, the shaded sprites far-away aircraft are drawn
|
||||
with ([`../sprites/`](../sprites/README.md)).
|
||||
with, and one ship model for each vessel hull shape, cut at its waterline,
|
||||
into the vessel view sheet ([`../sprites/`](../sprites/README.md)).
|
||||
|
||||
`src/data/fleetModels.js` reads the set and chooses each vehicle's model;
|
||||
`src/data/fleetModels.test.mjs` checks that every model `types.json` names is
|
||||
|
||||
+80
-45
@@ -1,71 +1,106 @@
|
||||
# Aircraft View Sheet
|
||||
# View Sheets
|
||||
|
||||
`aircraft-views.webp` is the sheet of shaded sprites far-away aircraft are
|
||||
drawn with in Flights, Military Flights and Local ADS-B, on a renderer with the
|
||||
`viewSheets` capability. Each aircraft class is rendered from a sphere of
|
||||
camera angles; the renderer lays a contact flat on the earth along its course
|
||||
and draws the frame nearest to where the eye is, as a card that tilts as the
|
||||
eye moves off its direction until the next frame is the nearer (frames are
|
||||
not blended), so an aircraft seen at an oblique angle looks solid and turns
|
||||
with the camera. `aircraft-views.json` is its manifest.
|
||||
A view sheet is one image of small shaded sprites: each subject rendered from
|
||||
a sphere of camera angles. On a renderer with the `viewSheets` capability a
|
||||
layer lays a contact flat on the earth along its course and the renderer
|
||||
draws the frame nearest to where the eye is, as a card that tilts as the eye
|
||||
moves off its direction until the next frame is the nearer (frames are not
|
||||
blended), so a contact seen at an oblique angle looks solid and turns with
|
||||
the camera.
|
||||
|
||||
- `aircraft-views.webp` holds the far-away aircraft of Flights, Military
|
||||
Flights and Local ADS-B.
|
||||
- `vessel-views.webp` holds the vessels of the vessel layer.
|
||||
|
||||
Each has a manifest beside it (`.json`).
|
||||
|
||||
The sprites are rendered from the project's own procedural fleet models
|
||||
([`../models/fleet/`](../models/README.md)), so, like them, they contain no
|
||||
third-party artwork and are covered by the repository's
|
||||
[MIT license](../../LICENSE).
|
||||
|
||||
| Path | What it holds |
|
||||
|---|---|
|
||||
| `aircraft-views.webp` | 4096 × 3648 px, lossless WebP: 64 px cells, 64 a row, 57 rows. Grey: every pixel's red, green and blue are equal. |
|
||||
| Path | What it holds |
|
||||
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `aircraft-views.webp` | 4096 × 3648 px, lossless WebP: 64 px cells, 64 a row, 57 rows. Grey: every pixel's red, green and blue are equal. |
|
||||
| `aircraft-views.json` | The layout (`cellPx`, `columns`, `rows`, `ringStepDeg`, `rings`, `fill`, `grey`) and each subject's first cell, fleet model and bounding radius in metres. |
|
||||
| `vessel-views.webp` | 4096 × 2496 px, lossless WebP: 64 px cells, 64 a row, 39 rows. Grey. |
|
||||
| `vessel-views.json` | Its manifest, of the same shape. |
|
||||
|
||||
## Layout
|
||||
|
||||
Each subject owns 302 consecutive cells, row-major: subject `i` starts at
|
||||
cell `i × 302`. The subjects, in order, are `airliner`, `widebody`, `quadjet`,
|
||||
`turboprop`, `light`, `glider`, `fastjet`, `bizjet`, `uav`, and `helicopter0`
|
||||
to `helicopter2` (the helicopter's three rotor frames, `src/data/rotorFrames.js`).
|
||||
A sheet holds each subject as a block of consecutive cells, row-major:
|
||||
subject `i` starts at cell `i × frames`. Within a block the frames lie in
|
||||
rings 7.5° apart from straight above (ring 0, one frame) downward. A ring
|
||||
runs from the eye dead ahead of the nose or bow, round the starboard side, to
|
||||
dead astern. The renderer mirrors a starboard frame for an eye on the port
|
||||
side, so the light is symmetric about the subject's centre plane. A frame is
|
||||
an orthographic view centred on the model's origin, its bounding sphere
|
||||
spanning 0.92 of the cell, turned so that straight above the nose points up
|
||||
the image. `src/data/viewSheet.js` holds the layouts (`AIRCRAFT_VIEWS`,
|
||||
`VESSEL_VIEWS`) and the maths that picks a frame;
|
||||
`src/data/viewSheet.test.mjs` checks the manifests, the shipped images and
|
||||
the bake script against them.
|
||||
|
||||
Within a block the frames lie in 17 rings 7.5° apart, from straight above
|
||||
(ring 0, one frame) to 30° below the horizon, of 1, 4, 7, 10, 13, 16, 18, 20,
|
||||
22, 23, 24, 25, 25, 25, 24, 23 and 22 frames. A ring runs from the eye dead
|
||||
ahead of the nose, round the starboard side, to dead astern; the renderer
|
||||
mirrors a starboard frame for an eye on the port side, so the light is
|
||||
symmetric about the aircraft's centre plane. A frame is an orthographic view
|
||||
centred on the model's origin, its bounding sphere spanning 0.92 of the cell,
|
||||
turned so that straight above the nose points up the image.
|
||||
`src/data/viewSheet.js` holds the same layout and the maths that picks a frame
|
||||
(`AIRCRAFT_VIEWS`); `src/data/viewSheet.test.mjs` checks the manifest and the
|
||||
bake script against it.
|
||||
| Sheet | Frames a subject | Rings | Subjects, in order |
|
||||
| -------- | ---------------- | ----------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Aircraft | 302 | 17, to 30° below the horizon: 1, 4, 7, 10, 13, 16, 18, 20, 22, 23, 24, 25, 25, 25, 24, 23, 22 | `airliner`, `widebody`, `quadjet`, `turboprop`, `light`, `glider`, `fastjet`, `bizjet`, `uav`, and `helicopter0` to `helicopter2` (the helicopter's three rotor frames, `src/data/rotorFrames.js`) |
|
||||
| Vessels | 208 | 13, to the horizon (a ship is never seen from below): 1, 4, 7, 10, 13, 16, 18, 20, 22, 23, 24, 25, 25 | `cargo`, `tanker`, `passenger`, `highspeed`, `fishing`, `tug`, `sailing`, `pleasure`, `military`, `other` (the kinds of `vesselKind`, `src/data/vesselTypes.js`), `dredger`, `pilot` |
|
||||
|
||||
The sprites are neutral (white paint, grey shading, dark glass, a dark edge)
|
||||
The sprites are neutral (light paint, grey shading, dark glass, a dark edge)
|
||||
so each layer's tint multiplies them, as it does the flat glyphs. They are
|
||||
exactly grey (`"grey": true`): the renderer keeps the sheet as grey and
|
||||
alpha, reading its red channel, which halves its memory. The bake refuses a
|
||||
frame that is not grey, and so does the step that writes the WebP. The thin
|
||||
glider, UAV, light aircraft and helicopter are thickened a little before
|
||||
their edge so they still read 20 to 30 px wide. Every cell keeps its outer
|
||||
2 px transparent, so the renderer's mipmaps never pull in a neighbour.
|
||||
exactly grey (`"grey": true`): the renderer keeps a sheet as grey and alpha,
|
||||
reading its red channel, which halves its memory. The bake refuses a frame
|
||||
that is not grey, and so does the step that writes the WebP. Every cell keeps
|
||||
its outer 2 px transparent, so the renderer's mipmaps never pull in a
|
||||
neighbour.
|
||||
|
||||
Thin subjects are thickened a little before their edge so they still read
|
||||
20 to 30 px wide: the glider, UAV, light aircraft and helicopter, and every
|
||||
vessel (the container ship, tanker and patrol boat most).
|
||||
|
||||
Vessels differ from aircraft in four ways:
|
||||
|
||||
- **Waterline.** A ship model's origin is its waterline. Each model is cut
|
||||
there before it is rendered, so no hull below the water is drawn, even from
|
||||
the horizon.
|
||||
- **Paint.** The ship models are many colours (hull paint, decks,
|
||||
containers). The vessel paint makes every colour a light grey, black hull
|
||||
paint included, except the windows (a dark colour whose blue stands above
|
||||
its red), which stay dark.
|
||||
- **Beam.** Hulls are long and thin, so most are widened across the beam
|
||||
(1.2 to 1.5 times; the trawler and tug as built). The side view keeps its
|
||||
true height.
|
||||
- **Sailboat.** The sailboat's mast is taller than its hull is long. Above
|
||||
1.2 m it is squashed to 0.4 of its height, so the hull fills its cell from
|
||||
above and the sail still reads from the side.
|
||||
|
||||
## Rebuilding
|
||||
|
||||
```
|
||||
npm run build:aircraft-views # about 7 minutes
|
||||
npm run build:aircraft-views -- --only glider,uav --out /tmp/views
|
||||
npm run build:vessel-views # about 4 minutes
|
||||
npm run build:vessel-views -- --only tug,sailing --out /tmp/views
|
||||
```
|
||||
|
||||
This needs Blender (`$BLENDER`, else `blender` on the `PATH`, else
|
||||
`/Applications/Blender.app`). It runs `scripts/build-aircraft-view-sheet.py`
|
||||
headless, which renders every frame with Cycles and refuses a frame whose
|
||||
pixels reach within 2 px of its cell's edge, then
|
||||
`scripts/build-aircraft-views.mjs` writes the PNG as lossless WebP here with
|
||||
the manifest. With `--only`, the other subjects' cells are left empty, so
|
||||
ship only a full bake.
|
||||
`/Applications/Blender.app`). Each runs `scripts/build-view-sheet.mjs`, which
|
||||
runs `scripts/bake-view-sheet.py --sheet aircraft|vessels` headless (one
|
||||
script, with each sheet's layout, models, paint and adjustments). The bake
|
||||
renders every frame with Cycles and refuses a frame whose pixels reach
|
||||
within 2 px of its cell's edge. `build-view-sheet.mjs` then writes the PNG as
|
||||
lossless WebP here with the manifest. With `--only`, the other subjects'
|
||||
cells are left empty, so ship only a full bake. Cycles is not
|
||||
bit-reproducible, so a rebuild changes the WebP's bytes slightly; rebuild a
|
||||
sheet only to change it.
|
||||
|
||||
To review a bake, write a contact sheet per subject (its rings as rows over a
|
||||
dark sea, pale land and a mid satellite tone, plus a few frames at 40, 30 and
|
||||
20 px in the fleet, tracked and military tints):
|
||||
To review a bake, write a contact sheet per subject: its rings as rows, plus
|
||||
a few frames at 40, 30 and 20 px in each tint the layers draw it with.
|
||||
|
||||
- Aircraft: over a dark sea, pale land and a mid satellite tone, in the
|
||||
fleet, tracked and military tints.
|
||||
- Vessels: over a dark sea, pale shallow water and a satellite ocean tone,
|
||||
in white and the kind's colour.
|
||||
|
||||
```
|
||||
node scripts/qa-aircraft-view-sheet.mjs [--manifest public/sprites/aircraft-views.json] [--out qa-shots/aircraft-views]
|
||||
node scripts/qa-view-sheet.mjs --manifest public/sprites/vessel-views.json [--out qa-shots/vessel-views]
|
||||
```
|
||||
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"image": "vessel-views.webp",
|
||||
"cellPx": 64,
|
||||
"columns": 64,
|
||||
"rows": 39,
|
||||
"ringStepDeg": 7.5,
|
||||
"rings": [
|
||||
1,
|
||||
4,
|
||||
7,
|
||||
10,
|
||||
13,
|
||||
16,
|
||||
18,
|
||||
20,
|
||||
22,
|
||||
23,
|
||||
24,
|
||||
25,
|
||||
25
|
||||
],
|
||||
"fill": 0.92,
|
||||
"grey": true,
|
||||
"subjects": {
|
||||
"cargo": {
|
||||
"first": 0,
|
||||
"model": "ships/container_ship.glb",
|
||||
"radiusM": 160.913
|
||||
},
|
||||
"tanker": {
|
||||
"first": 208,
|
||||
"model": "ships/tanker.glb",
|
||||
"radiusM": 130.314
|
||||
},
|
||||
"passenger": {
|
||||
"first": 416,
|
||||
"model": "ships/cruise_ship.glb",
|
||||
"radiusM": 168.583
|
||||
},
|
||||
"highspeed": {
|
||||
"first": 624,
|
||||
"model": "ships/fast_ferry.glb",
|
||||
"radiusM": 23.032
|
||||
},
|
||||
"fishing": {
|
||||
"first": 832,
|
||||
"model": "ships/trawler.glb",
|
||||
"radiusM": 13.229
|
||||
},
|
||||
"tug": {
|
||||
"first": 1040,
|
||||
"model": "ships/tug.glb",
|
||||
"radiusM": 16.418
|
||||
},
|
||||
"sailing": {
|
||||
"first": 1248,
|
||||
"model": "ships/sailboat.glb",
|
||||
"radiusM": 8.358
|
||||
},
|
||||
"pleasure": {
|
||||
"first": 1456,
|
||||
"model": "ships/motor_yacht.glb",
|
||||
"radiusM": 10.073
|
||||
},
|
||||
"military": {
|
||||
"first": 1664,
|
||||
"model": "ships/patrol.glb",
|
||||
"radiusM": 36.28
|
||||
},
|
||||
"other": {
|
||||
"first": 1872,
|
||||
"model": "ships/generic_vessel.glb",
|
||||
"radiusM": 21.828
|
||||
},
|
||||
"dredger": {
|
||||
"first": 2080,
|
||||
"model": "ships/dredger.glb",
|
||||
"radiusM": 53.542
|
||||
},
|
||||
"pilot": {
|
||||
"first": 2288,
|
||||
"model": "ships/pilot_boat.glb",
|
||||
"radiusM": 10.774
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.2 MiB |
Reference in new issue
Block a user