@johnmorrisdotca/wakusei-planets 0.66.0 → 0.68.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -1
- package/NOTICE.md +11 -0
- package/README.md +3 -3
- package/dist/body-physics.d.ts +114 -0
- package/dist/body-physics.js +162 -0
- package/dist/data/moon-catalogue.d.ts +1 -1
- package/dist/data/moon-catalogue.js +1 -1
- package/dist/data/places-added.d.ts +2 -0
- package/dist/data/places-added.js +2 -0
- package/dist/data/places-aliases.d.ts +1 -0
- package/dist/data/places-aliases.js +14 -0
- package/dist/data/places-planned.js +1 -1
- package/dist/data/places-search-67p.d.ts +1 -0
- package/dist/data/places-search-67p.js +3 -0
- package/dist/data/places-search-amalthea.d.ts +1 -0
- package/dist/data/places-search-amalthea.js +3 -0
- package/dist/data/places-search-ariel.d.ts +1 -0
- package/dist/data/places-search-ariel.js +3 -0
- package/dist/data/places-search-bennu.d.ts +1 -0
- package/dist/data/places-search-bennu.js +3 -0
- package/dist/data/places-search-bodies.d.ts +25 -0
- package/dist/data/places-search-bodies.js +125 -0
- package/dist/data/places-search-callisto.d.ts +1 -0
- package/dist/data/places-search-callisto.js +3 -0
- package/dist/data/places-search-ceres.d.ts +1 -0
- package/dist/data/places-search-ceres.js +3 -0
- package/dist/data/places-search-charon.d.ts +1 -0
- package/dist/data/places-search-charon.js +3 -0
- package/dist/data/places-search-dactyl.d.ts +1 -0
- package/dist/data/places-search-dactyl.js +3 -0
- package/dist/data/places-search-deimos.d.ts +1 -0
- package/dist/data/places-search-deimos.js +3 -0
- package/dist/data/places-search-didymos.d.ts +1 -0
- package/dist/data/places-search-didymos.js +3 -0
- package/dist/data/places-search-dimorphos.d.ts +1 -0
- package/dist/data/places-search-dimorphos.js +3 -0
- package/dist/data/places-search-dinkinesh.d.ts +1 -0
- package/dist/data/places-search-dinkinesh.js +3 -0
- package/dist/data/places-search-dione.d.ts +1 -0
- package/dist/data/places-search-dione.js +3 -0
- package/dist/data/places-search-donaldjohanson.d.ts +1 -0
- package/dist/data/places-search-donaldjohanson.js +3 -0
- package/dist/data/places-search-enceladus.d.ts +1 -0
- package/dist/data/places-search-enceladus.js +3 -0
- package/dist/data/places-search-epimetheus.d.ts +1 -0
- package/dist/data/places-search-epimetheus.js +3 -0
- package/dist/data/places-search-eros.d.ts +1 -0
- package/dist/data/places-search-eros.js +3 -0
- package/dist/data/places-search-europa.d.ts +1 -0
- package/dist/data/places-search-europa.js +3 -0
- package/dist/data/places-search-ganymede.d.ts +1 -0
- package/dist/data/places-search-ganymede.js +3 -0
- package/dist/data/places-search-gaspra.d.ts +1 -0
- package/dist/data/places-search-gaspra.js +3 -0
- package/dist/data/places-search-hyperion.d.ts +1 -0
- package/dist/data/places-search-hyperion.js +3 -0
- package/dist/data/places-search-iapetus.d.ts +1 -0
- package/dist/data/places-search-iapetus.js +3 -0
- package/dist/data/places-search-ida.d.ts +1 -0
- package/dist/data/places-search-ida.js +3 -0
- package/dist/data/places-search-io.d.ts +1 -0
- package/dist/data/places-search-io.js +3 -0
- package/dist/data/places-search-itokawa.d.ts +1 -0
- package/dist/data/places-search-itokawa.js +3 -0
- package/dist/data/places-search-janus.d.ts +1 -0
- package/dist/data/places-search-janus.js +3 -0
- package/dist/data/places-search-jupiter.d.ts +1 -0
- package/dist/data/places-search-jupiter.js +3 -0
- package/dist/data/places-search-lutetia.d.ts +1 -0
- package/dist/data/places-search-lutetia.js +3 -0
- package/dist/data/places-search-mars.d.ts +1 -0
- package/dist/data/places-search-mars.js +3 -0
- package/dist/data/places-search-mathilde.d.ts +1 -0
- package/dist/data/places-search-mathilde.js +3 -0
- package/dist/data/places-search-mercury.d.ts +1 -0
- package/dist/data/places-search-mercury.js +3 -0
- package/dist/data/places-search-mimas.d.ts +1 -0
- package/dist/data/places-search-mimas.js +3 -0
- package/dist/data/places-search-miranda.d.ts +1 -0
- package/dist/data/places-search-miranda.js +3 -0
- package/dist/data/places-search-moon-satellites.d.ts +1 -0
- package/dist/data/places-search-moon-satellites.js +3 -0
- package/dist/data/places-search-moon.d.ts +1 -0
- package/dist/data/places-search-moon.js +3 -0
- package/dist/data/places-search-oberon.d.ts +1 -0
- package/dist/data/places-search-oberon.js +3 -0
- package/dist/data/places-search-phobos.d.ts +1 -0
- package/dist/data/places-search-phobos.js +3 -0
- package/dist/data/places-search-phoebe.d.ts +1 -0
- package/dist/data/places-search-phoebe.js +3 -0
- package/dist/data/places-search-pluto.d.ts +1 -0
- package/dist/data/places-search-pluto.js +3 -0
- package/dist/data/places-search-proteus.d.ts +1 -0
- package/dist/data/places-search-proteus.js +3 -0
- package/dist/data/places-search-rhea.d.ts +1 -0
- package/dist/data/places-search-rhea.js +3 -0
- package/dist/data/places-search-ryugu.d.ts +1 -0
- package/dist/data/places-search-ryugu.js +3 -0
- package/dist/data/places-search-saturn.d.ts +1 -0
- package/dist/data/places-search-saturn.js +3 -0
- package/dist/data/places-search-steins.d.ts +1 -0
- package/dist/data/places-search-steins.js +3 -0
- package/dist/data/places-search-tempel-1.d.ts +1 -0
- package/dist/data/places-search-tempel-1.js +3 -0
- package/dist/data/places-search-tethys.d.ts +1 -0
- package/dist/data/places-search-tethys.js +3 -0
- package/dist/data/places-search-thebe.d.ts +1 -0
- package/dist/data/places-search-thebe.js +3 -0
- package/dist/data/places-search-titan.d.ts +1 -0
- package/dist/data/places-search-titan.js +3 -0
- package/dist/data/places-search-titania.d.ts +1 -0
- package/dist/data/places-search-titania.js +3 -0
- package/dist/data/places-search-triton.d.ts +1 -0
- package/dist/data/places-search-triton.js +3 -0
- package/dist/data/places-search-types.d.ts +1 -0
- package/dist/data/places-search-types.js +59 -0
- package/dist/data/places-search-umbriel.d.ts +1 -0
- package/dist/data/places-search-umbriel.js +3 -0
- package/dist/data/places-search-venus.d.ts +1 -0
- package/dist/data/places-search-venus.js +3 -0
- package/dist/data/places-search-vesta.d.ts +1 -0
- package/dist/data/places-search-vesta.js +3 -0
- package/dist/fact-sheets.d.ts +1 -1
- package/dist/fact-sheets.js +1 -1
- package/dist/flat/words.js +2 -0
- package/dist/moon-catalogue.d.ts +190 -0
- package/dist/moon-catalogue.js +189 -3
- package/dist/place-marks.js +1 -1
- package/dist/place-search.d.ts +157 -0
- package/dist/place-search.js +198 -0
- package/dist/places/moon.js +4 -1
- package/dist/places/search/67p.d.ts +12 -0
- package/dist/places/search/67p.js +14 -0
- package/dist/places/search/amalthea.d.ts +12 -0
- package/dist/places/search/amalthea.js +14 -0
- package/dist/places/search/ariel.d.ts +12 -0
- package/dist/places/search/ariel.js +14 -0
- package/dist/places/search/bennu.d.ts +12 -0
- package/dist/places/search/bennu.js +14 -0
- package/dist/places/search/callisto.d.ts +12 -0
- package/dist/places/search/callisto.js +14 -0
- package/dist/places/search/ceres.d.ts +12 -0
- package/dist/places/search/ceres.js +14 -0
- package/dist/places/search/charon.d.ts +12 -0
- package/dist/places/search/charon.js +14 -0
- package/dist/places/search/dactyl.d.ts +12 -0
- package/dist/places/search/dactyl.js +14 -0
- package/dist/places/search/deimos.d.ts +12 -0
- package/dist/places/search/deimos.js +14 -0
- package/dist/places/search/didymos.d.ts +12 -0
- package/dist/places/search/didymos.js +14 -0
- package/dist/places/search/dimorphos.d.ts +12 -0
- package/dist/places/search/dimorphos.js +14 -0
- package/dist/places/search/dinkinesh.d.ts +12 -0
- package/dist/places/search/dinkinesh.js +14 -0
- package/dist/places/search/dione.d.ts +12 -0
- package/dist/places/search/dione.js +14 -0
- package/dist/places/search/donaldjohanson.d.ts +12 -0
- package/dist/places/search/donaldjohanson.js +14 -0
- package/dist/places/search/enceladus.d.ts +12 -0
- package/dist/places/search/enceladus.js +14 -0
- package/dist/places/search/epimetheus.d.ts +12 -0
- package/dist/places/search/epimetheus.js +14 -0
- package/dist/places/search/eros.d.ts +12 -0
- package/dist/places/search/eros.js +14 -0
- package/dist/places/search/europa.d.ts +12 -0
- package/dist/places/search/europa.js +14 -0
- package/dist/places/search/ganymede.d.ts +12 -0
- package/dist/places/search/ganymede.js +14 -0
- package/dist/places/search/gaspra.d.ts +12 -0
- package/dist/places/search/gaspra.js +14 -0
- package/dist/places/search/hyperion.d.ts +12 -0
- package/dist/places/search/hyperion.js +14 -0
- package/dist/places/search/iapetus.d.ts +12 -0
- package/dist/places/search/iapetus.js +14 -0
- package/dist/places/search/ida.d.ts +12 -0
- package/dist/places/search/ida.js +14 -0
- package/dist/places/search/io.d.ts +12 -0
- package/dist/places/search/io.js +14 -0
- package/dist/places/search/itokawa.d.ts +12 -0
- package/dist/places/search/itokawa.js +14 -0
- package/dist/places/search/janus.d.ts +12 -0
- package/dist/places/search/janus.js +14 -0
- package/dist/places/search/jupiter.d.ts +12 -0
- package/dist/places/search/jupiter.js +14 -0
- package/dist/places/search/lutetia.d.ts +12 -0
- package/dist/places/search/lutetia.js +14 -0
- package/dist/places/search/mars.d.ts +12 -0
- package/dist/places/search/mars.js +14 -0
- package/dist/places/search/mathilde.d.ts +12 -0
- package/dist/places/search/mathilde.js +14 -0
- package/dist/places/search/mercury.d.ts +12 -0
- package/dist/places/search/mercury.js +14 -0
- package/dist/places/search/mimas.d.ts +12 -0
- package/dist/places/search/mimas.js +14 -0
- package/dist/places/search/miranda.d.ts +12 -0
- package/dist/places/search/miranda.js +14 -0
- package/dist/places/search/moon-satellites.d.ts +12 -0
- package/dist/places/search/moon-satellites.js +14 -0
- package/dist/places/search/moon.d.ts +12 -0
- package/dist/places/search/moon.js +14 -0
- package/dist/places/search/oberon.d.ts +12 -0
- package/dist/places/search/oberon.js +14 -0
- package/dist/places/search/phobos.d.ts +12 -0
- package/dist/places/search/phobos.js +14 -0
- package/dist/places/search/phoebe.d.ts +12 -0
- package/dist/places/search/phoebe.js +14 -0
- package/dist/places/search/pluto.d.ts +12 -0
- package/dist/places/search/pluto.js +14 -0
- package/dist/places/search/proteus.d.ts +12 -0
- package/dist/places/search/proteus.js +14 -0
- package/dist/places/search/rhea.d.ts +12 -0
- package/dist/places/search/rhea.js +14 -0
- package/dist/places/search/ryugu.d.ts +12 -0
- package/dist/places/search/ryugu.js +14 -0
- package/dist/places/search/saturn.d.ts +12 -0
- package/dist/places/search/saturn.js +14 -0
- package/dist/places/search/steins.d.ts +12 -0
- package/dist/places/search/steins.js +14 -0
- package/dist/places/search/tempel-1.d.ts +12 -0
- package/dist/places/search/tempel-1.js +14 -0
- package/dist/places/search/tethys.d.ts +12 -0
- package/dist/places/search/tethys.js +14 -0
- package/dist/places/search/thebe.d.ts +12 -0
- package/dist/places/search/thebe.js +14 -0
- package/dist/places/search/titan.d.ts +12 -0
- package/dist/places/search/titan.js +14 -0
- package/dist/places/search/titania.d.ts +12 -0
- package/dist/places/search/titania.js +14 -0
- package/dist/places/search/triton.d.ts +12 -0
- package/dist/places/search/triton.js +14 -0
- package/dist/places/search/umbriel.d.ts +12 -0
- package/dist/places/search/umbriel.js +14 -0
- package/dist/places/search/venus.d.ts +12 -0
- package/dist/places/search/venus.js +14 -0
- package/dist/places/search/vesta.d.ts +12 -0
- package/dist/places/search/vesta.js +14 -0
- package/dist/places/search.d.ts +25 -0
- package/dist/places/search.js +28 -0
- package/dist/places.d.ts +4 -3
- package/dist/scene/place-layer.js +1 -0
- package/dist/space/all-moons.d.ts +81 -10
- package/dist/space/all-moons.js +132 -27
- package/dist/space/element.d.ts +31 -5
- package/dist/space/element.js +122 -23
- package/dist/space/moon-settings.d.ts +25 -0
- package/dist/space/moon-settings.js +43 -0
- package/dist/space/orbit-rules.d.ts +25 -0
- package/dist/space/orbit-rules.js +36 -0
- package/dist/space/scene.d.ts +9 -3
- package/dist/space/scene.js +27 -17
- package/dist/surface/element.d.ts +8 -0
- package/dist/surface/element.js +70 -15
- package/dist/surface/glide.d.ts +27 -0
- package/dist/surface/glide.js +43 -0
- package/dist/surface/glsl.d.ts +3 -3
- package/dist/surface/glsl.js +2 -1
- package/dist/surface/landing.d.ts +33 -0
- package/dist/surface/landing.js +26 -0
- package/package.json +276 -1
package/dist/surface/glsl.d.ts
CHANGED
|
@@ -5,12 +5,12 @@ export declare const DETAIL = "\nuniform float uPixel; // the angle one pixel ta
|
|
|
5
5
|
/** The ground's vertices: a ring index and an angle across the view, laid out as the viewer's own polar grid, then raised to the measured heights. */
|
|
6
6
|
export declare const GROUND_VERTEX = "\nprecision highp float;\nprecision highp sampler2D;\n// position (declared by three.js) holds x: 0 to 1 out along the rays (ring spacing grows with the distance), y: -1 to 1 across the view\nuniform mat4 uVP;\nuniform vec2 uEyeEN; // the eyes' place in the site's plane: east, north\nuniform float uYaw; // radians, clockwise from north\nuniform float uSpan; // half the angle drawn across the view, radians\nuniform float uRMin;\nuniform float uRMax;\n\nuniform sampler2D uH0;\nuniform sampler2D uH1;\nuniform sampler2D uH2;\nuniform sampler2D uH3;\nuniform sampler2D uA0; // the ground picture on the first three levels, 0 to 1 with the middle at 0.5\nuniform sampler2D uA1;\nuniform sampler2D uA2;\nuniform float uPicture; // 1 where the picture is there\nuniform vec4 uL0; // half width, metres a sample, samples across, the distance out to which this level is used\nuniform vec4 uL1;\nuniform vec4 uL2;\nuniform vec4 uL3;\nuniform float uHmin;\nuniform float uHrange;\nuniform float uGround;\nuniform float uRadius;\n\nuniform vec2 uFarHeight; // the range the coarse level is encoded over: its minimum and its span\nfloat dec(vec4 t, vec2 hr) { return hr.x + (t.r * 255.0 * 256.0 + t.g * 255.0) / 65535.0 * hr.y; }\n\nfloat lin(sampler2D s, vec2 p, vec4 l, vec2 hr) {\n vec2 f = vec2((p.x + l.x) / l.y - 0.5, (l.x - p.y) / l.y - 0.5);\n vec2 i = floor(f);\n vec2 t = f - i;\n float st = 1.0 / l.z;\n vec2 uv = (i + 0.5) * st;\n float a = dec(texture2D(s, uv), hr);\n float b = dec(texture2D(s, uv + vec2(st, 0.0)), hr);\n float c = dec(texture2D(s, uv + vec2(0.0, st)), hr);\n float d = dec(texture2D(s, uv + vec2(st, st)), hr);\n return mix(mix(a, b, t.x), mix(c, d, t.x), t.y);\n}\n\nfloat nearest(sampler2D s, vec2 p, vec4 l, vec2 hr) {\n vec2 uv = vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z));\n return dec(texture2D(s, uv), hr);\n}\n\nbool holds(vec2 p, vec4 l, float dist) { return dist < l.w && abs(p.x) < l.x - 2.0 * l.y && abs(p.y) < l.x - 2.0 * l.y; }\n\n// the ground's height over the site's, the sphere's fall taken off; `fine` reads four samples, otherwise one\nfloat terrainY(vec2 p, float dist, bool fine) {\n float h;\n if (holds(p, uL0, dist)) h = fine ? lin(uH0, p, uL0, vec2(uHmin, uHrange)) : nearest(uH0, p, uL0, vec2(uHmin, uHrange));\n else if (holds(p, uL1, dist)) h = fine ? lin(uH1, p, uL1, vec2(uHmin, uHrange)) : nearest(uH1, p, uL1, vec2(uHmin, uHrange));\n else if (holds(p, uL2, dist)) h = fine ? lin(uH2, p, uL2, vec2(uHmin, uHrange)) : nearest(uH2, p, uL2, vec2(uHmin, uHrange));\n else h = fine ? lin(uH3, p, uL3, uFarHeight) : nearest(uH3, p, uL3, uFarHeight);\n return h - uGround - dot(p, p) / (2.0 * uRadius);\n}\n\n// the ground's own brightness at a point, from the picture of the level that serves it, 1 where it is the middle\nfloat albedoAt(vec2 p, float dist) {\n if (uPicture < 0.5) return 1.0;\n vec4 l;\n if (holds(p, uL0, dist)) { l = uL0; return 2.0 * texture2D(uA0, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n if (holds(p, uL1, dist)) { l = uL1; return 2.0 * texture2D(uA1, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n if (holds(p, uL2, dist)) { l = uL2; return 2.0 * texture2D(uA2, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n return 1.0;\n}\n\n// the measured ground's shadows, baked (scripts/make-moon-terrain.py): for a point, the elevation angle in degrees of the horizon toward the Sun, read from the finest of the three horizon maps that holds the point\nuniform sampler2D uZ0;\nuniform sampler2D uZ1;\nuniform sampler2D uZ2;\nuniform float uHzOn; // 1 where the maps are there\nuniform vec3 uHzSun; // the two directions (of 18) the Sun's azimuth lies between, and the share of the second\nuniform vec2 uHzRange; // the degrees the codes 0 and 255 stand for\n\nfloat hzSector(sampler2D s, vec2 cell, float k) {\n float slab = floor(k / 3.0);\n float ch = k - slab * 3.0;\n vec3 v = texture2D(s, vec2((cell.x + slab) / 6.0, cell.y)).rgb;\n return ch < 0.5 ? v.r : (ch < 1.5 ? v.g : v.b);\n}\n\nfloat hzFrom(sampler2D s, vec2 p, float reach) {\n vec2 cell = clamp(vec2((p.x + reach) / (2.0 * reach), (reach - p.y) / (2.0 * reach)), vec2(0.5 / 512.0), vec2(1.0 - 0.5 / 512.0));\n float code = mix(hzSector(s, cell, uHzSun.x), hzSector(s, cell, uHzSun.y), uHzSun.z);\n return uHzRange.x + code * (uHzRange.y - uHzRange.x);\n}\n\nfloat horizonAt(vec2 p) {\n if (abs(p.x) < uL0.x && abs(p.y) < uL0.x) return hzFrom(uZ0, p, uL0.x);\n if (abs(p.x) < uL1.x && abs(p.y) < uL1.x) return hzFrom(uZ1, p, uL1.x);\n if (abs(p.x) < uL2.x && abs(p.y) < uL2.x) return hzFrom(uZ2, p, uL2.x);\n return -90.0;\n}\n\n// the spacing of the level that serves a point, for the step of a slope\nfloat spacing(vec2 p, float dist) {\n if (holds(p, uL0, dist)) return uL0.y;\n if (holds(p, uL1, dist)) return uL1.y;\n if (holds(p, uL2, dist)) return uL2.y;\n return uL3.y;\n}\n\n\nuniform float uPixel; // the angle one pixel takes, radians\nuniform float uDetail; // 1 for the made detail, 0 for none\n\nuvec2 pcg2d(uvec2 v) {\n v = v * 1664525u + 1013904223u;\n v.x += v.y * 1664525u;\n v.y += v.x * 1664525u;\n v = v ^ (v >> 16u);\n v.x += v.y * 1664525u;\n v.y += v.x * 1664525u;\n v = v ^ (v >> 16u);\n return v;\n}\nfloat u24(uint h) { return float(h >> 8u) * (1.0 / 16777216.0); }\n\nuniform vec4 uKeep[6]; // the objects the made ground keeps away from: east, north, the distance inside which nothing is made, the distance outside which it all is\nuniform float uKeepCount;\nfloat keepMask(vec2 p) {\n float keep = 1.0;\n for (int i = 0; i < 6; i += 1) {\n if (float(i) >= uKeepCount) break;\n vec4 k = uKeep[i];\n float t = clamp((distance(p, k.xy) - k.z) / (k.w - k.z), 0.0, 1.0);\n keep = min(keep, t * t * (3.0 - 2.0 * t));\n }\n return keep;\n}\n\n// the made ground at a point: x the height in metres, yz the slope east and north, from every crater of every octave whose nominal diameter is over `fromD`\nvec3 madeGround(vec2 p, float fromD) {\n vec3 sum = vec3(0.0);\n for (int octave = 5; octave >= 0; octave -= 1) {\n float nominal = 0.5 * exp2(float(octave));\n float fade = clamp(nominal / fromD - 1.0, 0.0, 1.0);\n if (fade <= 0.0) break;\n float cell = 3.0 * nominal;\n ivec2 base = ivec2(floor(p / cell));\n vec2 fr = p / cell - vec2(base);\n float occ = (octave >= 3 ? 0.5 : 1.0) * 0.36 * exp2(-0.5 * float(octave));\n for (int j = -1; j <= 1; j += 1) {\n for (int i = -1; i <= 1; i += 1) {\n // a crater is kept to the middle of its cell, so a neighbour's reaches this cell only within a fifth of the edge\n if ((i == -1 && fr.x > 0.2) || (i == 1 && fr.x < 0.8) || (j == -1 && fr.y > 0.2) || (j == 1 && fr.y < 0.8)) continue;\n ivec2 c = base + ivec2(i, j);\n uvec2 ab = pcg2d(uvec2(uint(c.x), uint(c.y + octave * 7919)));\n if (u24(ab.x) >= occ) continue;\n uvec2 cd = pcg2d(uvec2(uint(c.x + 104729), uint(c.y + octave * 7919 + 15485863)));\n float diameter = nominal * (1.0 + (octave == 5 ? 0.25 : 1.0) * u24(cd.y));\n float r4 = float(ab.x & 255u) / 255.0;\n float age = 1.0 - r4 * r4 * r4 * r4;\n float radius = 0.5 * diameter;\n float vary = 0.6 + 0.4 * (float(cd.x & 255u) / 255.0);\n float depth = diameter * (0.2 - 0.17 * age) * vary;\n float rim = 0.045 * diameter * pow(1.0 - age, 1.5);\n float rimWidth = 0.22 + 0.5 * age;\n vec2 centre = vec2(float(c.x) + 0.25 + 0.5 * u24(ab.y), float(c.y) + 0.25 + 0.5 * u24(cd.x)) * cell;\n vec2 d = p - centre;\n float r = length(d);\n float x = r / radius;\n float h = 0.0;\n float dh = 0.0;\n if (x < 1.0) { float bowl = 1.0 - x * x; float pw = 1.0 + age; h = -depth * pow(bowl, pw); dh = 2.0 * depth * pw * x * pow(bowl, age); }\n float e = (x - 1.0) / rimWidth;\n float ex = exp(-e * e);\n h += rim * ex;\n dh += -2.0 * rim * e * ex / rimWidth;\n if (x > 1.0) { float t = 1.0 / x; h += 0.25 * rim * t * t * t; dh += -0.75 * rim * t * t * t * t; }\n float k = r > 1e-6 ? dh / (radius * r) : 0.0;\n sum += fade * vec3(h, k * d.x, k * d.y);\n }\n }\n }\n return sum * keepMask(p);\n}\n\nfloat vnoise(vec2 p) {\n vec2 i = floor(p);\n vec2 f = p - i;\n vec2 w = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);\n uvec2 c = uvec2(ivec2(i));\n float a = u24(pcg2d(c).x);\n float b = u24(pcg2d(c + uvec2(1u, 0u)).x);\n float cc = u24(pcg2d(c + uvec2(0u, 1u)).x);\n float d = u24(pcg2d(c + uvec2(1u, 1u)).x);\n return mix(mix(a, b, w.x), mix(cc, d, w.x), w.y);\n}\n\n// a fine roughness of the dust: two scales, as a slope (east, north), faded out where a pixel covers more than a few of its grains\nvec2 roughness(vec2 p, float footprint) {\n vec2 g = vec2(0.0);\n for (int k = 0; k < 2; k += 1) {\n float s = k == 0 ? 0.07 : 0.3;\n float amp = k == 0 ? 0.3 : 0.28;\n float fade = smoothstep(footprint * 2.0, footprint * 7.0, s);\n if (fade <= 0.0) continue;\n float d = s * 0.25;\n vec2 q = (k == 0 ? vec2(p.x * 0.629 + p.y * 0.777, p.y * 0.629 - p.x * 0.777) : vec2(p.x * 0.857 - p.y * 0.515, p.x * 0.515 + p.y * 0.857)) / s;\n float dx = vnoise(q + vec2(0.25, 0.0)) - vnoise(q - vec2(0.25, 0.0));\n float dy = vnoise(q + vec2(0.0, 0.25)) - vnoise(q - vec2(0.0, 0.25));\n g += fade * amp * vec2(dx, dy) / (0.5 * s) * 0.012;\n }\n return g;\n}\n\nvarying vec3 vP;\nvoid main() {\n float r = uRMin * pow(uRMax / uRMin, position.x);\n float a = uYaw + position.y * uSpan;\n vec2 p = uEyeEN + r * vec2(sin(a), cos(a));\n float y = terrainY(p, r, true);\n // the made craters, those the mesh can hold here: bigger than a few of its steps\n if (uDetail > 0.5 && r < 3000.0) y += madeGround(p, max(2.5 * r * uPixel, 0.06 * r)).x;\n vP = vec3(p.x, y, p.y);\n gl_Position = uVP * vec4(p.x, y, -p.y, 1.0);\n}\n";
|
|
7
7
|
/** What the ground, the rocks and their shadows all need to be lit: the Sun, the eyes, the heights and the made detail, the ground's height with the craters on it, and a point's light (a hard shadow by a march toward the Sun). */
|
|
8
|
-
export declare const LIGHT = "\nuniform vec3 uSun;\nuniform vec3 uEye;\nuniform vec2 uEyeEN;\nuniform float uExposure;\nuniform float uAlbedo;\nuniform float uMaxY; // the highest ground over the site's, for the end of a shadow's march\nuniform float uEarthshine; // the light of the sunlit ground round the shade, a small share of a lit slope's (on Mars the sky's light, a good deal more)\nuniform vec3 uTint; // the ground's colour over its grey: white on the Moon\nuniform float uShadows; // 1 for the ground to shadow itself (the default), 0 for none (a try-out)\nuniform float uSunDegrees; // the Sun's elevation in degrees\nuniform vec3 uNear; // the near march: steps, the distance it reaches in metres, the distance out to which the made craters are in it (the quality of the draw)\n\nuniform sampler2D uH0;\nuniform sampler2D uH1;\nuniform sampler2D uH2;\nuniform sampler2D uH3;\nuniform sampler2D uA0; // the ground picture on the first three levels, 0 to 1 with the middle at 0.5\nuniform sampler2D uA1;\nuniform sampler2D uA2;\nuniform float uPicture; // 1 where the picture is there\nuniform vec4 uL0; // half width, metres a sample, samples across, the distance out to which this level is used\nuniform vec4 uL1;\nuniform vec4 uL2;\nuniform vec4 uL3;\nuniform float uHmin;\nuniform float uHrange;\nuniform float uGround;\nuniform float uRadius;\n\nuniform vec2 uFarHeight; // the range the coarse level is encoded over: its minimum and its span\nfloat dec(vec4 t, vec2 hr) { return hr.x + (t.r * 255.0 * 256.0 + t.g * 255.0) / 65535.0 * hr.y; }\n\nfloat lin(sampler2D s, vec2 p, vec4 l, vec2 hr) {\n vec2 f = vec2((p.x + l.x) / l.y - 0.5, (l.x - p.y) / l.y - 0.5);\n vec2 i = floor(f);\n vec2 t = f - i;\n float st = 1.0 / l.z;\n vec2 uv = (i + 0.5) * st;\n float a = dec(texture2D(s, uv), hr);\n float b = dec(texture2D(s, uv + vec2(st, 0.0)), hr);\n float c = dec(texture2D(s, uv + vec2(0.0, st)), hr);\n float d = dec(texture2D(s, uv + vec2(st, st)), hr);\n return mix(mix(a, b, t.x), mix(c, d, t.x), t.y);\n}\n\nfloat nearest(sampler2D s, vec2 p, vec4 l, vec2 hr) {\n vec2 uv = vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z));\n return dec(texture2D(s, uv), hr);\n}\n\nbool holds(vec2 p, vec4 l, float dist) { return dist < l.w && abs(p.x) < l.x - 2.0 * l.y && abs(p.y) < l.x - 2.0 * l.y; }\n\n// the ground's height over the site's, the sphere's fall taken off; `fine` reads four samples, otherwise one\nfloat terrainY(vec2 p, float dist, bool fine) {\n float h;\n if (holds(p, uL0, dist)) h = fine ? lin(uH0, p, uL0, vec2(uHmin, uHrange)) : nearest(uH0, p, uL0, vec2(uHmin, uHrange));\n else if (holds(p, uL1, dist)) h = fine ? lin(uH1, p, uL1, vec2(uHmin, uHrange)) : nearest(uH1, p, uL1, vec2(uHmin, uHrange));\n else if (holds(p, uL2, dist)) h = fine ? lin(uH2, p, uL2, vec2(uHmin, uHrange)) : nearest(uH2, p, uL2, vec2(uHmin, uHrange));\n else h = fine ? lin(uH3, p, uL3, uFarHeight) : nearest(uH3, p, uL3, uFarHeight);\n return h - uGround - dot(p, p) / (2.0 * uRadius);\n}\n\n// the ground's own brightness at a point, from the picture of the level that serves it, 1 where it is the middle\nfloat albedoAt(vec2 p, float dist) {\n if (uPicture < 0.5) return 1.0;\n vec4 l;\n if (holds(p, uL0, dist)) { l = uL0; return 2.0 * texture2D(uA0, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n if (holds(p, uL1, dist)) { l = uL1; return 2.0 * texture2D(uA1, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n if (holds(p, uL2, dist)) { l = uL2; return 2.0 * texture2D(uA2, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n return 1.0;\n}\n\n// the measured ground's shadows, baked (scripts/make-moon-terrain.py): for a point, the elevation angle in degrees of the horizon toward the Sun, read from the finest of the three horizon maps that holds the point\nuniform sampler2D uZ0;\nuniform sampler2D uZ1;\nuniform sampler2D uZ2;\nuniform float uHzOn; // 1 where the maps are there\nuniform vec3 uHzSun; // the two directions (of 18) the Sun's azimuth lies between, and the share of the second\nuniform vec2 uHzRange; // the degrees the codes 0 and 255 stand for\n\nfloat hzSector(sampler2D s, vec2 cell, float k) {\n float slab = floor(k / 3.0);\n float ch = k - slab * 3.0;\n vec3 v = texture2D(s, vec2((cell.x + slab) / 6.0, cell.y)).rgb;\n return ch < 0.5 ? v.r : (ch < 1.5 ? v.g : v.b);\n}\n\nfloat hzFrom(sampler2D s, vec2 p, float reach) {\n vec2 cell = clamp(vec2((p.x + reach) / (2.0 * reach), (reach - p.y) / (2.0 * reach)), vec2(0.5 / 512.0), vec2(1.0 - 0.5 / 512.0));\n float code = mix(hzSector(s, cell, uHzSun.x), hzSector(s, cell, uHzSun.y), uHzSun.z);\n return uHzRange.x + code * (uHzRange.y - uHzRange.x);\n}\n\nfloat horizonAt(vec2 p) {\n if (abs(p.x) < uL0.x && abs(p.y) < uL0.x) return hzFrom(uZ0, p, uL0.x);\n if (abs(p.x) < uL1.x && abs(p.y) < uL1.x) return hzFrom(uZ1, p, uL1.x);\n if (abs(p.x) < uL2.x && abs(p.y) < uL2.x) return hzFrom(uZ2, p, uL2.x);\n return -90.0;\n}\n\n// the spacing of the level that serves a point, for the step of a slope\nfloat spacing(vec2 p, float dist) {\n if (holds(p, uL0, dist)) return uL0.y;\n if (holds(p, uL1, dist)) return uL1.y;\n if (holds(p, uL2, dist)) return uL2.y;\n return uL3.y;\n}\n\n\nuniform float uPixel; // the angle one pixel takes, radians\nuniform float uDetail; // 1 for the made detail, 0 for none\n\nuvec2 pcg2d(uvec2 v) {\n v = v * 1664525u + 1013904223u;\n v.x += v.y * 1664525u;\n v.y += v.x * 1664525u;\n v = v ^ (v >> 16u);\n v.x += v.y * 1664525u;\n v.y += v.x * 1664525u;\n v = v ^ (v >> 16u);\n return v;\n}\nfloat u24(uint h) { return float(h >> 8u) * (1.0 / 16777216.0); }\n\nuniform vec4 uKeep[6]; // the objects the made ground keeps away from: east, north, the distance inside which nothing is made, the distance outside which it all is\nuniform float uKeepCount;\nfloat keepMask(vec2 p) {\n float keep = 1.0;\n for (int i = 0; i < 6; i += 1) {\n if (float(i) >= uKeepCount) break;\n vec4 k = uKeep[i];\n float t = clamp((distance(p, k.xy) - k.z) / (k.w - k.z), 0.0, 1.0);\n keep = min(keep, t * t * (3.0 - 2.0 * t));\n }\n return keep;\n}\n\n// the made ground at a point: x the height in metres, yz the slope east and north, from every crater of every octave whose nominal diameter is over `fromD`\nvec3 madeGround(vec2 p, float fromD) {\n vec3 sum = vec3(0.0);\n for (int octave = 5; octave >= 0; octave -= 1) {\n float nominal = 0.5 * exp2(float(octave));\n float fade = clamp(nominal / fromD - 1.0, 0.0, 1.0);\n if (fade <= 0.0) break;\n float cell = 3.0 * nominal;\n ivec2 base = ivec2(floor(p / cell));\n vec2 fr = p / cell - vec2(base);\n float occ = (octave >= 3 ? 0.5 : 1.0) * 0.36 * exp2(-0.5 * float(octave));\n for (int j = -1; j <= 1; j += 1) {\n for (int i = -1; i <= 1; i += 1) {\n // a crater is kept to the middle of its cell, so a neighbour's reaches this cell only within a fifth of the edge\n if ((i == -1 && fr.x > 0.2) || (i == 1 && fr.x < 0.8) || (j == -1 && fr.y > 0.2) || (j == 1 && fr.y < 0.8)) continue;\n ivec2 c = base + ivec2(i, j);\n uvec2 ab = pcg2d(uvec2(uint(c.x), uint(c.y + octave * 7919)));\n if (u24(ab.x) >= occ) continue;\n uvec2 cd = pcg2d(uvec2(uint(c.x + 104729), uint(c.y + octave * 7919 + 15485863)));\n float diameter = nominal * (1.0 + (octave == 5 ? 0.25 : 1.0) * u24(cd.y));\n float r4 = float(ab.x & 255u) / 255.0;\n float age = 1.0 - r4 * r4 * r4 * r4;\n float radius = 0.5 * diameter;\n float vary = 0.6 + 0.4 * (float(cd.x & 255u) / 255.0);\n float depth = diameter * (0.2 - 0.17 * age) * vary;\n float rim = 0.045 * diameter * pow(1.0 - age, 1.5);\n float rimWidth = 0.22 + 0.5 * age;\n vec2 centre = vec2(float(c.x) + 0.25 + 0.5 * u24(ab.y), float(c.y) + 0.25 + 0.5 * u24(cd.x)) * cell;\n vec2 d = p - centre;\n float r = length(d);\n float x = r / radius;\n float h = 0.0;\n float dh = 0.0;\n if (x < 1.0) { float bowl = 1.0 - x * x; float pw = 1.0 + age; h = -depth * pow(bowl, pw); dh = 2.0 * depth * pw * x * pow(bowl, age); }\n float e = (x - 1.0) / rimWidth;\n float ex = exp(-e * e);\n h += rim * ex;\n dh += -2.0 * rim * e * ex / rimWidth;\n if (x > 1.0) { float t = 1.0 / x; h += 0.25 * rim * t * t * t; dh += -0.75 * rim * t * t * t * t; }\n float k = r > 1e-6 ? dh / (radius * r) : 0.0;\n sum += fade * vec3(h, k * d.x, k * d.y);\n }\n }\n }\n return sum * keepMask(p);\n}\n\nfloat vnoise(vec2 p) {\n vec2 i = floor(p);\n vec2 f = p - i;\n vec2 w = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);\n uvec2 c = uvec2(ivec2(i));\n float a = u24(pcg2d(c).x);\n float b = u24(pcg2d(c + uvec2(1u, 0u)).x);\n float cc = u24(pcg2d(c + uvec2(0u, 1u)).x);\n float d = u24(pcg2d(c + uvec2(1u, 1u)).x);\n return mix(mix(a, b, w.x), mix(cc, d, w.x), w.y);\n}\n\n// a fine roughness of the dust: two scales, as a slope (east, north), faded out where a pixel covers more than a few of its grains\nvec2 roughness(vec2 p, float footprint) {\n vec2 g = vec2(0.0);\n for (int k = 0; k < 2; k += 1) {\n float s = k == 0 ? 0.07 : 0.3;\n float amp = k == 0 ? 0.3 : 0.28;\n float fade = smoothstep(footprint * 2.0, footprint * 7.0, s);\n if (fade <= 0.0) continue;\n float d = s * 0.25;\n vec2 q = (k == 0 ? vec2(p.x * 0.629 + p.y * 0.777, p.y * 0.629 - p.x * 0.777) : vec2(p.x * 0.857 - p.y * 0.515, p.x * 0.515 + p.y * 0.857)) / s;\n float dx = vnoise(q + vec2(0.25, 0.0)) - vnoise(q - vec2(0.25, 0.0));\n float dy = vnoise(q + vec2(0.0, 0.25)) - vnoise(q - vec2(0.0, 0.25));\n g += fade * amp * vec2(dx, dy) / (0.5 * s) * 0.012;\n }\n return g;\n}\n\n\n// the ground's height at a point: the measured heights and, near the eyes, the made craters (kept to the ones a pixel here can show)\nfloat groundY(vec2 p, float dist, bool fine, float fromD) {\n float y = terrainY(p, dist, fine);\n if (uDetail > 0.5 && fromD < 24.0) y += madeGround(p, fromD).x;\n return y;\n}\n\n// 1 where the Sun reaches a point, 0 where the ground is in its way. The measured ground's shadow is read from the baked horizon; the march toward the Sun over the heights (and the made craters) is the near\n// field's only, a few tens of metres with a fixed number of steps, as sharp as the Sun's edge. Where there is no baked horizon the march goes all the way, as it did before the maps.\nfloat lit(vec3 P, float dist0) {\n vec2 dir = normalize(uSun.xz);\n float slope = uSun.y / max(length(uSun.xz), 1e-4);\n if (uHzOn > 0.5 && horizonAt(P.xz) - 0.3 > uSunDegrees) return 0.0;\n // the ground at the point from the heights themselves, not the mesh's slope between its corners, which can be a long way off on a far mountain\n P.y = groundY(P.xz, dist0, true, 2.5 * dist0 * uPixel);\n float t = 0.5 * spacing(P.xz, dist0) + 0.25;\n if (uDetail > 0.5) t = min(t, 0.2 + 0.02 * dist0);\n // a pixel's own start along the ray: the edge of a rim's shadow is a line of steps, and a line of steps is jagged; with a start of its own each pixel it becomes a fine grain instead\n float jitter = fract(sin(dot(P.xz, vec2(12.9898, 78.233))) * 43758.5453);\n float range = uHzOn > 0.5 ? uNear.y : 80000.0;\n for (int i = 0; i < 260; i += 1) {\n if (float(i) >= uNear.x) break;\n vec2 q = P.xz + dir * t;\n float y = P.y + slope * t;\n float dist = max(t, distance(q, uEyeEN));\n float res = spacing(q, dist);\n float h = groundY(q, dist, t < 600.0, t < uNear.z ? max(0.2 * t, 2.5 * dist * uPixel) : 99.0);\n float bias = (t < 40.0 ? 0.01 : 0.3 * res) + 0.002 * t;\n if (h > y + bias) return 0.0;\n if (y > uMaxY || t > range) break;\n float step = t < 30.0 ? t * 0.045 + 0.04 : t * 0.06 + 0.5;\n t += step * (0.65 + 0.7 * jitter);\n }\n return 1.0;\n}\n";
|
|
8
|
+
export declare const LIGHT = "\nuniform vec3 uSun;\nuniform vec3 uEye;\nuniform vec2 uEyeEN;\nuniform float uExposure;\nuniform float uAlbedo;\nuniform float uMaxY; // the highest ground over the site's, for the end of a shadow's march\nuniform float uEarthshine; // the light of the sunlit ground round the shade, a small share of a lit slope's (on Mars the sky's light, a good deal more)\nuniform vec3 uTint; // the ground's colour over its grey: white on the Moon\nuniform float uShadows; // 1 for the ground to shadow itself (the default), 0 for none (a try-out)\nuniform float uSunDegrees; // the Sun's elevation in degrees\nuniform vec3 uNear; // the near march: steps, the distance it reaches in metres, the distance out to which the made craters are in it (the quality of the draw)\n\nuniform sampler2D uH0;\nuniform sampler2D uH1;\nuniform sampler2D uH2;\nuniform sampler2D uH3;\nuniform sampler2D uA0; // the ground picture on the first three levels, 0 to 1 with the middle at 0.5\nuniform sampler2D uA1;\nuniform sampler2D uA2;\nuniform float uPicture; // 1 where the picture is there\nuniform vec4 uL0; // half width, metres a sample, samples across, the distance out to which this level is used\nuniform vec4 uL1;\nuniform vec4 uL2;\nuniform vec4 uL3;\nuniform float uHmin;\nuniform float uHrange;\nuniform float uGround;\nuniform float uRadius;\n\nuniform vec2 uFarHeight; // the range the coarse level is encoded over: its minimum and its span\nfloat dec(vec4 t, vec2 hr) { return hr.x + (t.r * 255.0 * 256.0 + t.g * 255.0) / 65535.0 * hr.y; }\n\nfloat lin(sampler2D s, vec2 p, vec4 l, vec2 hr) {\n vec2 f = vec2((p.x + l.x) / l.y - 0.5, (l.x - p.y) / l.y - 0.5);\n vec2 i = floor(f);\n vec2 t = f - i;\n float st = 1.0 / l.z;\n vec2 uv = (i + 0.5) * st;\n float a = dec(texture2D(s, uv), hr);\n float b = dec(texture2D(s, uv + vec2(st, 0.0)), hr);\n float c = dec(texture2D(s, uv + vec2(0.0, st)), hr);\n float d = dec(texture2D(s, uv + vec2(st, st)), hr);\n return mix(mix(a, b, t.x), mix(c, d, t.x), t.y);\n}\n\nfloat nearest(sampler2D s, vec2 p, vec4 l, vec2 hr) {\n vec2 uv = vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z));\n return dec(texture2D(s, uv), hr);\n}\n\nbool holds(vec2 p, vec4 l, float dist) { return dist < l.w && abs(p.x) < l.x - 2.0 * l.y && abs(p.y) < l.x - 2.0 * l.y; }\n\n// the ground's height over the site's, the sphere's fall taken off; `fine` reads four samples, otherwise one\nfloat terrainY(vec2 p, float dist, bool fine) {\n float h;\n if (holds(p, uL0, dist)) h = fine ? lin(uH0, p, uL0, vec2(uHmin, uHrange)) : nearest(uH0, p, uL0, vec2(uHmin, uHrange));\n else if (holds(p, uL1, dist)) h = fine ? lin(uH1, p, uL1, vec2(uHmin, uHrange)) : nearest(uH1, p, uL1, vec2(uHmin, uHrange));\n else if (holds(p, uL2, dist)) h = fine ? lin(uH2, p, uL2, vec2(uHmin, uHrange)) : nearest(uH2, p, uL2, vec2(uHmin, uHrange));\n else h = fine ? lin(uH3, p, uL3, uFarHeight) : nearest(uH3, p, uL3, uFarHeight);\n return h - uGround - dot(p, p) / (2.0 * uRadius);\n}\n\n// the ground's own brightness at a point, from the picture of the level that serves it, 1 where it is the middle\nfloat albedoAt(vec2 p, float dist) {\n if (uPicture < 0.5) return 1.0;\n vec4 l;\n if (holds(p, uL0, dist)) { l = uL0; return 2.0 * texture2D(uA0, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n if (holds(p, uL1, dist)) { l = uL1; return 2.0 * texture2D(uA1, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n if (holds(p, uL2, dist)) { l = uL2; return 2.0 * texture2D(uA2, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n return 1.0;\n}\n\n// the measured ground's shadows, baked (scripts/make-moon-terrain.py): for a point, the elevation angle in degrees of the horizon toward the Sun, read from the finest of the three horizon maps that holds the point\nuniform sampler2D uZ0;\nuniform sampler2D uZ1;\nuniform sampler2D uZ2;\nuniform float uHzOn; // 1 where the maps are there\nuniform vec3 uHzSun; // the two directions (of 18) the Sun's azimuth lies between, and the share of the second\nuniform vec2 uHzRange; // the degrees the codes 0 and 255 stand for\n\nfloat hzSector(sampler2D s, vec2 cell, float k) {\n float slab = floor(k / 3.0);\n float ch = k - slab * 3.0;\n vec3 v = texture2D(s, vec2((cell.x + slab) / 6.0, cell.y)).rgb;\n return ch < 0.5 ? v.r : (ch < 1.5 ? v.g : v.b);\n}\n\nfloat hzFrom(sampler2D s, vec2 p, float reach) {\n vec2 cell = clamp(vec2((p.x + reach) / (2.0 * reach), (reach - p.y) / (2.0 * reach)), vec2(0.5 / 512.0), vec2(1.0 - 0.5 / 512.0));\n float code = mix(hzSector(s, cell, uHzSun.x), hzSector(s, cell, uHzSun.y), uHzSun.z);\n return uHzRange.x + code * (uHzRange.y - uHzRange.x);\n}\n\nfloat horizonAt(vec2 p) {\n if (abs(p.x) < uL0.x && abs(p.y) < uL0.x) return hzFrom(uZ0, p, uL0.x);\n if (abs(p.x) < uL1.x && abs(p.y) < uL1.x) return hzFrom(uZ1, p, uL1.x);\n if (abs(p.x) < uL2.x && abs(p.y) < uL2.x) return hzFrom(uZ2, p, uL2.x);\n return -90.0;\n}\n\n// the spacing of the level that serves a point, for the step of a slope\nfloat spacing(vec2 p, float dist) {\n if (holds(p, uL0, dist)) return uL0.y;\n if (holds(p, uL1, dist)) return uL1.y;\n if (holds(p, uL2, dist)) return uL2.y;\n return uL3.y;\n}\n\n\nuniform float uPixel; // the angle one pixel takes, radians\nuniform float uDetail; // 1 for the made detail, 0 for none\n\nuvec2 pcg2d(uvec2 v) {\n v = v * 1664525u + 1013904223u;\n v.x += v.y * 1664525u;\n v.y += v.x * 1664525u;\n v = v ^ (v >> 16u);\n v.x += v.y * 1664525u;\n v.y += v.x * 1664525u;\n v = v ^ (v >> 16u);\n return v;\n}\nfloat u24(uint h) { return float(h >> 8u) * (1.0 / 16777216.0); }\n\nuniform vec4 uKeep[6]; // the objects the made ground keeps away from: east, north, the distance inside which nothing is made, the distance outside which it all is\nuniform float uKeepCount;\nfloat keepMask(vec2 p) {\n float keep = 1.0;\n for (int i = 0; i < 6; i += 1) {\n if (float(i) >= uKeepCount) break;\n vec4 k = uKeep[i];\n float t = clamp((distance(p, k.xy) - k.z) / (k.w - k.z), 0.0, 1.0);\n keep = min(keep, t * t * (3.0 - 2.0 * t));\n }\n return keep;\n}\n\n// the made ground at a point: x the height in metres, yz the slope east and north, from every crater of every octave whose nominal diameter is over `fromD`\nvec3 madeGround(vec2 p, float fromD) {\n vec3 sum = vec3(0.0);\n for (int octave = 5; octave >= 0; octave -= 1) {\n float nominal = 0.5 * exp2(float(octave));\n float fade = clamp(nominal / fromD - 1.0, 0.0, 1.0);\n if (fade <= 0.0) break;\n float cell = 3.0 * nominal;\n ivec2 base = ivec2(floor(p / cell));\n vec2 fr = p / cell - vec2(base);\n float occ = (octave >= 3 ? 0.5 : 1.0) * 0.36 * exp2(-0.5 * float(octave));\n for (int j = -1; j <= 1; j += 1) {\n for (int i = -1; i <= 1; i += 1) {\n // a crater is kept to the middle of its cell, so a neighbour's reaches this cell only within a fifth of the edge\n if ((i == -1 && fr.x > 0.2) || (i == 1 && fr.x < 0.8) || (j == -1 && fr.y > 0.2) || (j == 1 && fr.y < 0.8)) continue;\n ivec2 c = base + ivec2(i, j);\n uvec2 ab = pcg2d(uvec2(uint(c.x), uint(c.y + octave * 7919)));\n if (u24(ab.x) >= occ) continue;\n uvec2 cd = pcg2d(uvec2(uint(c.x + 104729), uint(c.y + octave * 7919 + 15485863)));\n float diameter = nominal * (1.0 + (octave == 5 ? 0.25 : 1.0) * u24(cd.y));\n float r4 = float(ab.x & 255u) / 255.0;\n float age = 1.0 - r4 * r4 * r4 * r4;\n float radius = 0.5 * diameter;\n float vary = 0.6 + 0.4 * (float(cd.x & 255u) / 255.0);\n float depth = diameter * (0.2 - 0.17 * age) * vary;\n float rim = 0.045 * diameter * pow(1.0 - age, 1.5);\n float rimWidth = 0.22 + 0.5 * age;\n vec2 centre = vec2(float(c.x) + 0.25 + 0.5 * u24(ab.y), float(c.y) + 0.25 + 0.5 * u24(cd.x)) * cell;\n vec2 d = p - centre;\n float r = length(d);\n float x = r / radius;\n float h = 0.0;\n float dh = 0.0;\n if (x < 1.0) { float bowl = 1.0 - x * x; float pw = 1.0 + age; h = -depth * pow(bowl, pw); dh = 2.0 * depth * pw * x * pow(bowl, age); }\n float e = (x - 1.0) / rimWidth;\n float ex = exp(-e * e);\n h += rim * ex;\n dh += -2.0 * rim * e * ex / rimWidth;\n if (x > 1.0) { float t = 1.0 / x; h += 0.25 * rim * t * t * t; dh += -0.75 * rim * t * t * t * t; }\n float k = r > 1e-6 ? dh / (radius * r) : 0.0;\n sum += fade * vec3(h, k * d.x, k * d.y);\n }\n }\n }\n return sum * keepMask(p);\n}\n\nfloat vnoise(vec2 p) {\n vec2 i = floor(p);\n vec2 f = p - i;\n vec2 w = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);\n uvec2 c = uvec2(ivec2(i));\n float a = u24(pcg2d(c).x);\n float b = u24(pcg2d(c + uvec2(1u, 0u)).x);\n float cc = u24(pcg2d(c + uvec2(0u, 1u)).x);\n float d = u24(pcg2d(c + uvec2(1u, 1u)).x);\n return mix(mix(a, b, w.x), mix(cc, d, w.x), w.y);\n}\n\n// a fine roughness of the dust: two scales, as a slope (east, north), faded out where a pixel covers more than a few of its grains\nvec2 roughness(vec2 p, float footprint) {\n vec2 g = vec2(0.0);\n for (int k = 0; k < 2; k += 1) {\n float s = k == 0 ? 0.07 : 0.3;\n float amp = k == 0 ? 0.3 : 0.28;\n float fade = smoothstep(footprint * 2.0, footprint * 7.0, s);\n if (fade <= 0.0) continue;\n float d = s * 0.25;\n vec2 q = (k == 0 ? vec2(p.x * 0.629 + p.y * 0.777, p.y * 0.629 - p.x * 0.777) : vec2(p.x * 0.857 - p.y * 0.515, p.x * 0.515 + p.y * 0.857)) / s;\n float dx = vnoise(q + vec2(0.25, 0.0)) - vnoise(q - vec2(0.25, 0.0));\n float dy = vnoise(q + vec2(0.0, 0.25)) - vnoise(q - vec2(0.0, 0.25));\n g += fade * amp * vec2(dx, dy) / (0.5 * s) * 0.012;\n }\n return g;\n}\n\n\n// the ground's height at a point: the measured heights and, near the eyes, the made craters (kept to the ones a pixel here can show)\nfloat groundY(vec2 p, float dist, bool fine, float fromD) {\n float y = terrainY(p, dist, fine);\n if (uDetail > 0.5 && fromD < 24.0) y += madeGround(p, fromD).x;\n return y;\n}\n\n// 1 where the Sun reaches a point, 0 where the ground is in its way. The measured ground's shadow is read from the baked horizon; the march toward the Sun over the heights (and the made craters) is the near\n// field's only, a few tens of metres with a fixed number of steps, as sharp as the Sun's edge. Where there is no baked horizon the march goes all the way, as it did before the maps.\nfloat lit(vec3 P, float dist0) {\n vec2 dir = normalize(uSun.xz);\n float slope = uSun.y / max(length(uSun.xz), 1e-4);\n if (uHzOn > 0.5 && horizonAt(P.xz) - 0.3 > uSunDegrees) return 0.0;\n // the ground at the point from the heights themselves, not the mesh's slope between its corners, which can be a long way off on a far mountain\n // the made craters are in the ground at the point only where they are in the march too (uNear.z is 0 in the quality of motion, which leaves them out of the march): a point set down in a made crater's floor and a ray over the ground without the crater put the whole floor under the ground's height, black\n P.y = groundY(P.xz, dist0, true, uNear.z > 0.0 ? 2.5 * dist0 * uPixel : 99.0);\n float t = 0.5 * spacing(P.xz, dist0) + 0.25;\n if (uDetail > 0.5) t = min(t, 0.2 + 0.02 * dist0);\n // a pixel's own start along the ray: the edge of a rim's shadow is a line of steps, and a line of steps is jagged; with a start of its own each pixel it becomes a fine grain instead\n float jitter = fract(sin(dot(P.xz, vec2(12.9898, 78.233))) * 43758.5453);\n float range = uHzOn > 0.5 ? uNear.y : 80000.0;\n for (int i = 0; i < 260; i += 1) {\n if (float(i) >= uNear.x) break;\n vec2 q = P.xz + dir * t;\n float y = P.y + slope * t;\n float dist = max(t, distance(q, uEyeEN));\n float res = spacing(q, dist);\n float h = groundY(q, dist, t < 600.0, t < uNear.z ? max(0.2 * t, 2.5 * dist * uPixel) : 99.0);\n float bias = (t < 40.0 ? 0.01 : 0.3 * res) + 0.002 * t;\n if (h > y + bias) return 0.0;\n if (y > uMaxY || t > range) break;\n float step = t < 30.0 ? t * 0.045 + 0.04 : t * 0.06 + 0.5;\n t += step * (0.65 + 0.7 * jitter);\n }\n return 1.0;\n}\n";
|
|
9
9
|
/** The ground's light. */
|
|
10
|
-
export declare const GROUND_FRAGMENT = "\nprecision highp float;\nprecision highp sampler2D;\n\nuniform vec3 uSun;\nuniform vec3 uEye;\nuniform vec2 uEyeEN;\nuniform float uExposure;\nuniform float uAlbedo;\nuniform float uMaxY; // the highest ground over the site's, for the end of a shadow's march\nuniform float uEarthshine; // the light of the sunlit ground round the shade, a small share of a lit slope's (on Mars the sky's light, a good deal more)\nuniform vec3 uTint; // the ground's colour over its grey: white on the Moon\nuniform float uShadows; // 1 for the ground to shadow itself (the default), 0 for none (a try-out)\nuniform float uSunDegrees; // the Sun's elevation in degrees\nuniform vec3 uNear; // the near march: steps, the distance it reaches in metres, the distance out to which the made craters are in it (the quality of the draw)\n\nuniform sampler2D uH0;\nuniform sampler2D uH1;\nuniform sampler2D uH2;\nuniform sampler2D uH3;\nuniform sampler2D uA0; // the ground picture on the first three levels, 0 to 1 with the middle at 0.5\nuniform sampler2D uA1;\nuniform sampler2D uA2;\nuniform float uPicture; // 1 where the picture is there\nuniform vec4 uL0; // half width, metres a sample, samples across, the distance out to which this level is used\nuniform vec4 uL1;\nuniform vec4 uL2;\nuniform vec4 uL3;\nuniform float uHmin;\nuniform float uHrange;\nuniform float uGround;\nuniform float uRadius;\n\nuniform vec2 uFarHeight; // the range the coarse level is encoded over: its minimum and its span\nfloat dec(vec4 t, vec2 hr) { return hr.x + (t.r * 255.0 * 256.0 + t.g * 255.0) / 65535.0 * hr.y; }\n\nfloat lin(sampler2D s, vec2 p, vec4 l, vec2 hr) {\n vec2 f = vec2((p.x + l.x) / l.y - 0.5, (l.x - p.y) / l.y - 0.5);\n vec2 i = floor(f);\n vec2 t = f - i;\n float st = 1.0 / l.z;\n vec2 uv = (i + 0.5) * st;\n float a = dec(texture2D(s, uv), hr);\n float b = dec(texture2D(s, uv + vec2(st, 0.0)), hr);\n float c = dec(texture2D(s, uv + vec2(0.0, st)), hr);\n float d = dec(texture2D(s, uv + vec2(st, st)), hr);\n return mix(mix(a, b, t.x), mix(c, d, t.x), t.y);\n}\n\nfloat nearest(sampler2D s, vec2 p, vec4 l, vec2 hr) {\n vec2 uv = vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z));\n return dec(texture2D(s, uv), hr);\n}\n\nbool holds(vec2 p, vec4 l, float dist) { return dist < l.w && abs(p.x) < l.x - 2.0 * l.y && abs(p.y) < l.x - 2.0 * l.y; }\n\n// the ground's height over the site's, the sphere's fall taken off; `fine` reads four samples, otherwise one\nfloat terrainY(vec2 p, float dist, bool fine) {\n float h;\n if (holds(p, uL0, dist)) h = fine ? lin(uH0, p, uL0, vec2(uHmin, uHrange)) : nearest(uH0, p, uL0, vec2(uHmin, uHrange));\n else if (holds(p, uL1, dist)) h = fine ? lin(uH1, p, uL1, vec2(uHmin, uHrange)) : nearest(uH1, p, uL1, vec2(uHmin, uHrange));\n else if (holds(p, uL2, dist)) h = fine ? lin(uH2, p, uL2, vec2(uHmin, uHrange)) : nearest(uH2, p, uL2, vec2(uHmin, uHrange));\n else h = fine ? lin(uH3, p, uL3, uFarHeight) : nearest(uH3, p, uL3, uFarHeight);\n return h - uGround - dot(p, p) / (2.0 * uRadius);\n}\n\n// the ground's own brightness at a point, from the picture of the level that serves it, 1 where it is the middle\nfloat albedoAt(vec2 p, float dist) {\n if (uPicture < 0.5) return 1.0;\n vec4 l;\n if (holds(p, uL0, dist)) { l = uL0; return 2.0 * texture2D(uA0, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n if (holds(p, uL1, dist)) { l = uL1; return 2.0 * texture2D(uA1, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n if (holds(p, uL2, dist)) { l = uL2; return 2.0 * texture2D(uA2, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n return 1.0;\n}\n\n// the measured ground's shadows, baked (scripts/make-moon-terrain.py): for a point, the elevation angle in degrees of the horizon toward the Sun, read from the finest of the three horizon maps that holds the point\nuniform sampler2D uZ0;\nuniform sampler2D uZ1;\nuniform sampler2D uZ2;\nuniform float uHzOn; // 1 where the maps are there\nuniform vec3 uHzSun; // the two directions (of 18) the Sun's azimuth lies between, and the share of the second\nuniform vec2 uHzRange; // the degrees the codes 0 and 255 stand for\n\nfloat hzSector(sampler2D s, vec2 cell, float k) {\n float slab = floor(k / 3.0);\n float ch = k - slab * 3.0;\n vec3 v = texture2D(s, vec2((cell.x + slab) / 6.0, cell.y)).rgb;\n return ch < 0.5 ? v.r : (ch < 1.5 ? v.g : v.b);\n}\n\nfloat hzFrom(sampler2D s, vec2 p, float reach) {\n vec2 cell = clamp(vec2((p.x + reach) / (2.0 * reach), (reach - p.y) / (2.0 * reach)), vec2(0.5 / 512.0), vec2(1.0 - 0.5 / 512.0));\n float code = mix(hzSector(s, cell, uHzSun.x), hzSector(s, cell, uHzSun.y), uHzSun.z);\n return uHzRange.x + code * (uHzRange.y - uHzRange.x);\n}\n\nfloat horizonAt(vec2 p) {\n if (abs(p.x) < uL0.x && abs(p.y) < uL0.x) return hzFrom(uZ0, p, uL0.x);\n if (abs(p.x) < uL1.x && abs(p.y) < uL1.x) return hzFrom(uZ1, p, uL1.x);\n if (abs(p.x) < uL2.x && abs(p.y) < uL2.x) return hzFrom(uZ2, p, uL2.x);\n return -90.0;\n}\n\n// the spacing of the level that serves a point, for the step of a slope\nfloat spacing(vec2 p, float dist) {\n if (holds(p, uL0, dist)) return uL0.y;\n if (holds(p, uL1, dist)) return uL1.y;\n if (holds(p, uL2, dist)) return uL2.y;\n return uL3.y;\n}\n\n\nuniform float uPixel; // the angle one pixel takes, radians\nuniform float uDetail; // 1 for the made detail, 0 for none\n\nuvec2 pcg2d(uvec2 v) {\n v = v * 1664525u + 1013904223u;\n v.x += v.y * 1664525u;\n v.y += v.x * 1664525u;\n v = v ^ (v >> 16u);\n v.x += v.y * 1664525u;\n v.y += v.x * 1664525u;\n v = v ^ (v >> 16u);\n return v;\n}\nfloat u24(uint h) { return float(h >> 8u) * (1.0 / 16777216.0); }\n\nuniform vec4 uKeep[6]; // the objects the made ground keeps away from: east, north, the distance inside which nothing is made, the distance outside which it all is\nuniform float uKeepCount;\nfloat keepMask(vec2 p) {\n float keep = 1.0;\n for (int i = 0; i < 6; i += 1) {\n if (float(i) >= uKeepCount) break;\n vec4 k = uKeep[i];\n float t = clamp((distance(p, k.xy) - k.z) / (k.w - k.z), 0.0, 1.0);\n keep = min(keep, t * t * (3.0 - 2.0 * t));\n }\n return keep;\n}\n\n// the made ground at a point: x the height in metres, yz the slope east and north, from every crater of every octave whose nominal diameter is over `fromD`\nvec3 madeGround(vec2 p, float fromD) {\n vec3 sum = vec3(0.0);\n for (int octave = 5; octave >= 0; octave -= 1) {\n float nominal = 0.5 * exp2(float(octave));\n float fade = clamp(nominal / fromD - 1.0, 0.0, 1.0);\n if (fade <= 0.0) break;\n float cell = 3.0 * nominal;\n ivec2 base = ivec2(floor(p / cell));\n vec2 fr = p / cell - vec2(base);\n float occ = (octave >= 3 ? 0.5 : 1.0) * 0.36 * exp2(-0.5 * float(octave));\n for (int j = -1; j <= 1; j += 1) {\n for (int i = -1; i <= 1; i += 1) {\n // a crater is kept to the middle of its cell, so a neighbour's reaches this cell only within a fifth of the edge\n if ((i == -1 && fr.x > 0.2) || (i == 1 && fr.x < 0.8) || (j == -1 && fr.y > 0.2) || (j == 1 && fr.y < 0.8)) continue;\n ivec2 c = base + ivec2(i, j);\n uvec2 ab = pcg2d(uvec2(uint(c.x), uint(c.y + octave * 7919)));\n if (u24(ab.x) >= occ) continue;\n uvec2 cd = pcg2d(uvec2(uint(c.x + 104729), uint(c.y + octave * 7919 + 15485863)));\n float diameter = nominal * (1.0 + (octave == 5 ? 0.25 : 1.0) * u24(cd.y));\n float r4 = float(ab.x & 255u) / 255.0;\n float age = 1.0 - r4 * r4 * r4 * r4;\n float radius = 0.5 * diameter;\n float vary = 0.6 + 0.4 * (float(cd.x & 255u) / 255.0);\n float depth = diameter * (0.2 - 0.17 * age) * vary;\n float rim = 0.045 * diameter * pow(1.0 - age, 1.5);\n float rimWidth = 0.22 + 0.5 * age;\n vec2 centre = vec2(float(c.x) + 0.25 + 0.5 * u24(ab.y), float(c.y) + 0.25 + 0.5 * u24(cd.x)) * cell;\n vec2 d = p - centre;\n float r = length(d);\n float x = r / radius;\n float h = 0.0;\n float dh = 0.0;\n if (x < 1.0) { float bowl = 1.0 - x * x; float pw = 1.0 + age; h = -depth * pow(bowl, pw); dh = 2.0 * depth * pw * x * pow(bowl, age); }\n float e = (x - 1.0) / rimWidth;\n float ex = exp(-e * e);\n h += rim * ex;\n dh += -2.0 * rim * e * ex / rimWidth;\n if (x > 1.0) { float t = 1.0 / x; h += 0.25 * rim * t * t * t; dh += -0.75 * rim * t * t * t * t; }\n float k = r > 1e-6 ? dh / (radius * r) : 0.0;\n sum += fade * vec3(h, k * d.x, k * d.y);\n }\n }\n }\n return sum * keepMask(p);\n}\n\nfloat vnoise(vec2 p) {\n vec2 i = floor(p);\n vec2 f = p - i;\n vec2 w = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);\n uvec2 c = uvec2(ivec2(i));\n float a = u24(pcg2d(c).x);\n float b = u24(pcg2d(c + uvec2(1u, 0u)).x);\n float cc = u24(pcg2d(c + uvec2(0u, 1u)).x);\n float d = u24(pcg2d(c + uvec2(1u, 1u)).x);\n return mix(mix(a, b, w.x), mix(cc, d, w.x), w.y);\n}\n\n// a fine roughness of the dust: two scales, as a slope (east, north), faded out where a pixel covers more than a few of its grains\nvec2 roughness(vec2 p, float footprint) {\n vec2 g = vec2(0.0);\n for (int k = 0; k < 2; k += 1) {\n float s = k == 0 ? 0.07 : 0.3;\n float amp = k == 0 ? 0.3 : 0.28;\n float fade = smoothstep(footprint * 2.0, footprint * 7.0, s);\n if (fade <= 0.0) continue;\n float d = s * 0.25;\n vec2 q = (k == 0 ? vec2(p.x * 0.629 + p.y * 0.777, p.y * 0.629 - p.x * 0.777) : vec2(p.x * 0.857 - p.y * 0.515, p.x * 0.515 + p.y * 0.857)) / s;\n float dx = vnoise(q + vec2(0.25, 0.0)) - vnoise(q - vec2(0.25, 0.0));\n float dy = vnoise(q + vec2(0.0, 0.25)) - vnoise(q - vec2(0.0, 0.25));\n g += fade * amp * vec2(dx, dy) / (0.5 * s) * 0.012;\n }\n return g;\n}\n\n\n// the ground's height at a point: the measured heights and, near the eyes, the made craters (kept to the ones a pixel here can show)\nfloat groundY(vec2 p, float dist, bool fine, float fromD) {\n float y = terrainY(p, dist, fine);\n if (uDetail > 0.5 && fromD < 24.0) y += madeGround(p, fromD).x;\n return y;\n}\n\n// 1 where the Sun reaches a point, 0 where the ground is in its way. The measured ground's shadow is read from the baked horizon; the march toward the Sun over the heights (and the made craters) is the near\n// field's only, a few tens of metres with a fixed number of steps, as sharp as the Sun's edge. Where there is no baked horizon the march goes all the way, as it did before the maps.\nfloat lit(vec3 P, float dist0) {\n vec2 dir = normalize(uSun.xz);\n float slope = uSun.y / max(length(uSun.xz), 1e-4);\n if (uHzOn > 0.5 && horizonAt(P.xz) - 0.3 > uSunDegrees) return 0.0;\n // the ground at the point from the heights themselves, not the mesh's slope between its corners, which can be a long way off on a far mountain\n P.y = groundY(P.xz, dist0, true, 2.5 * dist0 * uPixel);\n float t = 0.5 * spacing(P.xz, dist0) + 0.25;\n if (uDetail > 0.5) t = min(t, 0.2 + 0.02 * dist0);\n // a pixel's own start along the ray: the edge of a rim's shadow is a line of steps, and a line of steps is jagged; with a start of its own each pixel it becomes a fine grain instead\n float jitter = fract(sin(dot(P.xz, vec2(12.9898, 78.233))) * 43758.5453);\n float range = uHzOn > 0.5 ? uNear.y : 80000.0;\n for (int i = 0; i < 260; i += 1) {\n if (float(i) >= uNear.x) break;\n vec2 q = P.xz + dir * t;\n float y = P.y + slope * t;\n float dist = max(t, distance(q, uEyeEN));\n float res = spacing(q, dist);\n float h = groundY(q, dist, t < 600.0, t < uNear.z ? max(0.2 * t, 2.5 * dist * uPixel) : 99.0);\n float bias = (t < 40.0 ? 0.01 : 0.3 * res) + 0.002 * t;\n if (h > y + bias) return 0.0;\n if (y > uMaxY || t > range) break;\n float step = t < 30.0 ? t * 0.045 + 0.04 : t * 0.06 + 0.5;\n t += step * (0.65 + 0.7 * jitter);\n }\n return 1.0;\n}\n\nvarying vec3 vP;\n\nvoid main() {\n float dist = distance(vP.xz, uEyeEN);\n float fromD = 2.5 * dist * uPixel;\n float e = max(spacing(vP.xz, dist), dist * 0.001);\n float hE = terrainY(vP.xz + vec2(e, 0.0), dist, true);\n float hW = terrainY(vP.xz - vec2(e, 0.0), dist, true);\n float hN = terrainY(vP.xz + vec2(0.0, e), dist, true);\n float hS = terrainY(vP.xz - vec2(0.0, e), dist, true);\n vec2 slope = vec2((hE - hW) / (2.0 * e), (hN - hS) / (2.0 * e));\n if (uDetail > 0.5) {\n if (fromD < 24.0) slope += madeGround(vP.xz, fromD).yz;\n slope += roughness(vP.xz, dist * uPixel);\n }\n vec3 n = normalize(vec3(-slope.x, 1.0, -slope.y));\n float mu0 = dot(n, uSun);\n float mu = max(dot(n, normalize(uEye - vP)), 0.03);\n float shine = 0.0;\n if (mu0 > 0.0 && uSun.y > -0.01) shine = (uShadows > 0.5 ? lit(vP, dist) : 1.0) * 2.0 * mu0 / (mu0 + mu);\n float light = uAlbedo * albedoAt(vP.xz, dist) * (shine + uEarthshine * max(n.y, 0.0)) * uExposure;\n gl_FragColor = vec4(pow(clamp(vec3(light) * uTint, 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);\n}\n";
|
|
10
|
+
export declare const GROUND_FRAGMENT = "\nprecision highp float;\nprecision highp sampler2D;\n\nuniform vec3 uSun;\nuniform vec3 uEye;\nuniform vec2 uEyeEN;\nuniform float uExposure;\nuniform float uAlbedo;\nuniform float uMaxY; // the highest ground over the site's, for the end of a shadow's march\nuniform float uEarthshine; // the light of the sunlit ground round the shade, a small share of a lit slope's (on Mars the sky's light, a good deal more)\nuniform vec3 uTint; // the ground's colour over its grey: white on the Moon\nuniform float uShadows; // 1 for the ground to shadow itself (the default), 0 for none (a try-out)\nuniform float uSunDegrees; // the Sun's elevation in degrees\nuniform vec3 uNear; // the near march: steps, the distance it reaches in metres, the distance out to which the made craters are in it (the quality of the draw)\n\nuniform sampler2D uH0;\nuniform sampler2D uH1;\nuniform sampler2D uH2;\nuniform sampler2D uH3;\nuniform sampler2D uA0; // the ground picture on the first three levels, 0 to 1 with the middle at 0.5\nuniform sampler2D uA1;\nuniform sampler2D uA2;\nuniform float uPicture; // 1 where the picture is there\nuniform vec4 uL0; // half width, metres a sample, samples across, the distance out to which this level is used\nuniform vec4 uL1;\nuniform vec4 uL2;\nuniform vec4 uL3;\nuniform float uHmin;\nuniform float uHrange;\nuniform float uGround;\nuniform float uRadius;\n\nuniform vec2 uFarHeight; // the range the coarse level is encoded over: its minimum and its span\nfloat dec(vec4 t, vec2 hr) { return hr.x + (t.r * 255.0 * 256.0 + t.g * 255.0) / 65535.0 * hr.y; }\n\nfloat lin(sampler2D s, vec2 p, vec4 l, vec2 hr) {\n vec2 f = vec2((p.x + l.x) / l.y - 0.5, (l.x - p.y) / l.y - 0.5);\n vec2 i = floor(f);\n vec2 t = f - i;\n float st = 1.0 / l.z;\n vec2 uv = (i + 0.5) * st;\n float a = dec(texture2D(s, uv), hr);\n float b = dec(texture2D(s, uv + vec2(st, 0.0)), hr);\n float c = dec(texture2D(s, uv + vec2(0.0, st)), hr);\n float d = dec(texture2D(s, uv + vec2(st, st)), hr);\n return mix(mix(a, b, t.x), mix(c, d, t.x), t.y);\n}\n\nfloat nearest(sampler2D s, vec2 p, vec4 l, vec2 hr) {\n vec2 uv = vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z));\n return dec(texture2D(s, uv), hr);\n}\n\nbool holds(vec2 p, vec4 l, float dist) { return dist < l.w && abs(p.x) < l.x - 2.0 * l.y && abs(p.y) < l.x - 2.0 * l.y; }\n\n// the ground's height over the site's, the sphere's fall taken off; `fine` reads four samples, otherwise one\nfloat terrainY(vec2 p, float dist, bool fine) {\n float h;\n if (holds(p, uL0, dist)) h = fine ? lin(uH0, p, uL0, vec2(uHmin, uHrange)) : nearest(uH0, p, uL0, vec2(uHmin, uHrange));\n else if (holds(p, uL1, dist)) h = fine ? lin(uH1, p, uL1, vec2(uHmin, uHrange)) : nearest(uH1, p, uL1, vec2(uHmin, uHrange));\n else if (holds(p, uL2, dist)) h = fine ? lin(uH2, p, uL2, vec2(uHmin, uHrange)) : nearest(uH2, p, uL2, vec2(uHmin, uHrange));\n else h = fine ? lin(uH3, p, uL3, uFarHeight) : nearest(uH3, p, uL3, uFarHeight);\n return h - uGround - dot(p, p) / (2.0 * uRadius);\n}\n\n// the ground's own brightness at a point, from the picture of the level that serves it, 1 where it is the middle\nfloat albedoAt(vec2 p, float dist) {\n if (uPicture < 0.5) return 1.0;\n vec4 l;\n if (holds(p, uL0, dist)) { l = uL0; return 2.0 * texture2D(uA0, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n if (holds(p, uL1, dist)) { l = uL1; return 2.0 * texture2D(uA1, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n if (holds(p, uL2, dist)) { l = uL2; return 2.0 * texture2D(uA2, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n return 1.0;\n}\n\n// the measured ground's shadows, baked (scripts/make-moon-terrain.py): for a point, the elevation angle in degrees of the horizon toward the Sun, read from the finest of the three horizon maps that holds the point\nuniform sampler2D uZ0;\nuniform sampler2D uZ1;\nuniform sampler2D uZ2;\nuniform float uHzOn; // 1 where the maps are there\nuniform vec3 uHzSun; // the two directions (of 18) the Sun's azimuth lies between, and the share of the second\nuniform vec2 uHzRange; // the degrees the codes 0 and 255 stand for\n\nfloat hzSector(sampler2D s, vec2 cell, float k) {\n float slab = floor(k / 3.0);\n float ch = k - slab * 3.0;\n vec3 v = texture2D(s, vec2((cell.x + slab) / 6.0, cell.y)).rgb;\n return ch < 0.5 ? v.r : (ch < 1.5 ? v.g : v.b);\n}\n\nfloat hzFrom(sampler2D s, vec2 p, float reach) {\n vec2 cell = clamp(vec2((p.x + reach) / (2.0 * reach), (reach - p.y) / (2.0 * reach)), vec2(0.5 / 512.0), vec2(1.0 - 0.5 / 512.0));\n float code = mix(hzSector(s, cell, uHzSun.x), hzSector(s, cell, uHzSun.y), uHzSun.z);\n return uHzRange.x + code * (uHzRange.y - uHzRange.x);\n}\n\nfloat horizonAt(vec2 p) {\n if (abs(p.x) < uL0.x && abs(p.y) < uL0.x) return hzFrom(uZ0, p, uL0.x);\n if (abs(p.x) < uL1.x && abs(p.y) < uL1.x) return hzFrom(uZ1, p, uL1.x);\n if (abs(p.x) < uL2.x && abs(p.y) < uL2.x) return hzFrom(uZ2, p, uL2.x);\n return -90.0;\n}\n\n// the spacing of the level that serves a point, for the step of a slope\nfloat spacing(vec2 p, float dist) {\n if (holds(p, uL0, dist)) return uL0.y;\n if (holds(p, uL1, dist)) return uL1.y;\n if (holds(p, uL2, dist)) return uL2.y;\n return uL3.y;\n}\n\n\nuniform float uPixel; // the angle one pixel takes, radians\nuniform float uDetail; // 1 for the made detail, 0 for none\n\nuvec2 pcg2d(uvec2 v) {\n v = v * 1664525u + 1013904223u;\n v.x += v.y * 1664525u;\n v.y += v.x * 1664525u;\n v = v ^ (v >> 16u);\n v.x += v.y * 1664525u;\n v.y += v.x * 1664525u;\n v = v ^ (v >> 16u);\n return v;\n}\nfloat u24(uint h) { return float(h >> 8u) * (1.0 / 16777216.0); }\n\nuniform vec4 uKeep[6]; // the objects the made ground keeps away from: east, north, the distance inside which nothing is made, the distance outside which it all is\nuniform float uKeepCount;\nfloat keepMask(vec2 p) {\n float keep = 1.0;\n for (int i = 0; i < 6; i += 1) {\n if (float(i) >= uKeepCount) break;\n vec4 k = uKeep[i];\n float t = clamp((distance(p, k.xy) - k.z) / (k.w - k.z), 0.0, 1.0);\n keep = min(keep, t * t * (3.0 - 2.0 * t));\n }\n return keep;\n}\n\n// the made ground at a point: x the height in metres, yz the slope east and north, from every crater of every octave whose nominal diameter is over `fromD`\nvec3 madeGround(vec2 p, float fromD) {\n vec3 sum = vec3(0.0);\n for (int octave = 5; octave >= 0; octave -= 1) {\n float nominal = 0.5 * exp2(float(octave));\n float fade = clamp(nominal / fromD - 1.0, 0.0, 1.0);\n if (fade <= 0.0) break;\n float cell = 3.0 * nominal;\n ivec2 base = ivec2(floor(p / cell));\n vec2 fr = p / cell - vec2(base);\n float occ = (octave >= 3 ? 0.5 : 1.0) * 0.36 * exp2(-0.5 * float(octave));\n for (int j = -1; j <= 1; j += 1) {\n for (int i = -1; i <= 1; i += 1) {\n // a crater is kept to the middle of its cell, so a neighbour's reaches this cell only within a fifth of the edge\n if ((i == -1 && fr.x > 0.2) || (i == 1 && fr.x < 0.8) || (j == -1 && fr.y > 0.2) || (j == 1 && fr.y < 0.8)) continue;\n ivec2 c = base + ivec2(i, j);\n uvec2 ab = pcg2d(uvec2(uint(c.x), uint(c.y + octave * 7919)));\n if (u24(ab.x) >= occ) continue;\n uvec2 cd = pcg2d(uvec2(uint(c.x + 104729), uint(c.y + octave * 7919 + 15485863)));\n float diameter = nominal * (1.0 + (octave == 5 ? 0.25 : 1.0) * u24(cd.y));\n float r4 = float(ab.x & 255u) / 255.0;\n float age = 1.0 - r4 * r4 * r4 * r4;\n float radius = 0.5 * diameter;\n float vary = 0.6 + 0.4 * (float(cd.x & 255u) / 255.0);\n float depth = diameter * (0.2 - 0.17 * age) * vary;\n float rim = 0.045 * diameter * pow(1.0 - age, 1.5);\n float rimWidth = 0.22 + 0.5 * age;\n vec2 centre = vec2(float(c.x) + 0.25 + 0.5 * u24(ab.y), float(c.y) + 0.25 + 0.5 * u24(cd.x)) * cell;\n vec2 d = p - centre;\n float r = length(d);\n float x = r / radius;\n float h = 0.0;\n float dh = 0.0;\n if (x < 1.0) { float bowl = 1.0 - x * x; float pw = 1.0 + age; h = -depth * pow(bowl, pw); dh = 2.0 * depth * pw * x * pow(bowl, age); }\n float e = (x - 1.0) / rimWidth;\n float ex = exp(-e * e);\n h += rim * ex;\n dh += -2.0 * rim * e * ex / rimWidth;\n if (x > 1.0) { float t = 1.0 / x; h += 0.25 * rim * t * t * t; dh += -0.75 * rim * t * t * t * t; }\n float k = r > 1e-6 ? dh / (radius * r) : 0.0;\n sum += fade * vec3(h, k * d.x, k * d.y);\n }\n }\n }\n return sum * keepMask(p);\n}\n\nfloat vnoise(vec2 p) {\n vec2 i = floor(p);\n vec2 f = p - i;\n vec2 w = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);\n uvec2 c = uvec2(ivec2(i));\n float a = u24(pcg2d(c).x);\n float b = u24(pcg2d(c + uvec2(1u, 0u)).x);\n float cc = u24(pcg2d(c + uvec2(0u, 1u)).x);\n float d = u24(pcg2d(c + uvec2(1u, 1u)).x);\n return mix(mix(a, b, w.x), mix(cc, d, w.x), w.y);\n}\n\n// a fine roughness of the dust: two scales, as a slope (east, north), faded out where a pixel covers more than a few of its grains\nvec2 roughness(vec2 p, float footprint) {\n vec2 g = vec2(0.0);\n for (int k = 0; k < 2; k += 1) {\n float s = k == 0 ? 0.07 : 0.3;\n float amp = k == 0 ? 0.3 : 0.28;\n float fade = smoothstep(footprint * 2.0, footprint * 7.0, s);\n if (fade <= 0.0) continue;\n float d = s * 0.25;\n vec2 q = (k == 0 ? vec2(p.x * 0.629 + p.y * 0.777, p.y * 0.629 - p.x * 0.777) : vec2(p.x * 0.857 - p.y * 0.515, p.x * 0.515 + p.y * 0.857)) / s;\n float dx = vnoise(q + vec2(0.25, 0.0)) - vnoise(q - vec2(0.25, 0.0));\n float dy = vnoise(q + vec2(0.0, 0.25)) - vnoise(q - vec2(0.0, 0.25));\n g += fade * amp * vec2(dx, dy) / (0.5 * s) * 0.012;\n }\n return g;\n}\n\n\n// the ground's height at a point: the measured heights and, near the eyes, the made craters (kept to the ones a pixel here can show)\nfloat groundY(vec2 p, float dist, bool fine, float fromD) {\n float y = terrainY(p, dist, fine);\n if (uDetail > 0.5 && fromD < 24.0) y += madeGround(p, fromD).x;\n return y;\n}\n\n// 1 where the Sun reaches a point, 0 where the ground is in its way. The measured ground's shadow is read from the baked horizon; the march toward the Sun over the heights (and the made craters) is the near\n// field's only, a few tens of metres with a fixed number of steps, as sharp as the Sun's edge. Where there is no baked horizon the march goes all the way, as it did before the maps.\nfloat lit(vec3 P, float dist0) {\n vec2 dir = normalize(uSun.xz);\n float slope = uSun.y / max(length(uSun.xz), 1e-4);\n if (uHzOn > 0.5 && horizonAt(P.xz) - 0.3 > uSunDegrees) return 0.0;\n // the ground at the point from the heights themselves, not the mesh's slope between its corners, which can be a long way off on a far mountain\n // the made craters are in the ground at the point only where they are in the march too (uNear.z is 0 in the quality of motion, which leaves them out of the march): a point set down in a made crater's floor and a ray over the ground without the crater put the whole floor under the ground's height, black\n P.y = groundY(P.xz, dist0, true, uNear.z > 0.0 ? 2.5 * dist0 * uPixel : 99.0);\n float t = 0.5 * spacing(P.xz, dist0) + 0.25;\n if (uDetail > 0.5) t = min(t, 0.2 + 0.02 * dist0);\n // a pixel's own start along the ray: the edge of a rim's shadow is a line of steps, and a line of steps is jagged; with a start of its own each pixel it becomes a fine grain instead\n float jitter = fract(sin(dot(P.xz, vec2(12.9898, 78.233))) * 43758.5453);\n float range = uHzOn > 0.5 ? uNear.y : 80000.0;\n for (int i = 0; i < 260; i += 1) {\n if (float(i) >= uNear.x) break;\n vec2 q = P.xz + dir * t;\n float y = P.y + slope * t;\n float dist = max(t, distance(q, uEyeEN));\n float res = spacing(q, dist);\n float h = groundY(q, dist, t < 600.0, t < uNear.z ? max(0.2 * t, 2.5 * dist * uPixel) : 99.0);\n float bias = (t < 40.0 ? 0.01 : 0.3 * res) + 0.002 * t;\n if (h > y + bias) return 0.0;\n if (y > uMaxY || t > range) break;\n float step = t < 30.0 ? t * 0.045 + 0.04 : t * 0.06 + 0.5;\n t += step * (0.65 + 0.7 * jitter);\n }\n return 1.0;\n}\n\nvarying vec3 vP;\n\nvoid main() {\n float dist = distance(vP.xz, uEyeEN);\n float fromD = 2.5 * dist * uPixel;\n float e = max(spacing(vP.xz, dist), dist * 0.001);\n float hE = terrainY(vP.xz + vec2(e, 0.0), dist, true);\n float hW = terrainY(vP.xz - vec2(e, 0.0), dist, true);\n float hN = terrainY(vP.xz + vec2(0.0, e), dist, true);\n float hS = terrainY(vP.xz - vec2(0.0, e), dist, true);\n vec2 slope = vec2((hE - hW) / (2.0 * e), (hN - hS) / (2.0 * e));\n if (uDetail > 0.5) {\n if (fromD < 24.0) slope += madeGround(vP.xz, fromD).yz;\n slope += roughness(vP.xz, dist * uPixel);\n }\n vec3 n = normalize(vec3(-slope.x, 1.0, -slope.y));\n float mu0 = dot(n, uSun);\n float mu = max(dot(n, normalize(uEye - vP)), 0.03);\n float shine = 0.0;\n if (mu0 > 0.0 && uSun.y > -0.01) shine = (uShadows > 0.5 ? lit(vP, dist) : 1.0) * 2.0 * mu0 / (mu0 + mu);\n float light = uAlbedo * albedoAt(vP.xz, dist) * (shine + uEarthshine * max(n.y, 0.0)) * uExposure;\n gl_FragColor = vec4(pow(clamp(vec3(light) * uTint, 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);\n}\n";
|
|
11
11
|
/** The rocks: pieces of ground standing on it. Their corners come from the page already in the site's plane (east, up, north). */
|
|
12
12
|
export declare const ROCK_VERTEX = "\nprecision highp float;\n// position, normal and uv are declared by three.js\nattribute float tone;\nuniform mat4 uVP;\nvarying vec3 vP;\nvarying vec3 vN;\nvarying float vTone;\nvoid main() {\n vP = position;\n vN = normal;\n vTone = tone;\n gl_Position = uVP * vec4(position.x, position.y, -position.z, 1.0);\n}\n";
|
|
13
|
-
export declare const ROCK_FRAGMENT = "\nprecision highp float;\nprecision highp sampler2D;\n\nuniform vec3 uSun;\nuniform vec3 uEye;\nuniform vec2 uEyeEN;\nuniform float uExposure;\nuniform float uAlbedo;\nuniform float uMaxY; // the highest ground over the site's, for the end of a shadow's march\nuniform float uEarthshine; // the light of the sunlit ground round the shade, a small share of a lit slope's (on Mars the sky's light, a good deal more)\nuniform vec3 uTint; // the ground's colour over its grey: white on the Moon\nuniform float uShadows; // 1 for the ground to shadow itself (the default), 0 for none (a try-out)\nuniform float uSunDegrees; // the Sun's elevation in degrees\nuniform vec3 uNear; // the near march: steps, the distance it reaches in metres, the distance out to which the made craters are in it (the quality of the draw)\n\nuniform sampler2D uH0;\nuniform sampler2D uH1;\nuniform sampler2D uH2;\nuniform sampler2D uH3;\nuniform sampler2D uA0; // the ground picture on the first three levels, 0 to 1 with the middle at 0.5\nuniform sampler2D uA1;\nuniform sampler2D uA2;\nuniform float uPicture; // 1 where the picture is there\nuniform vec4 uL0; // half width, metres a sample, samples across, the distance out to which this level is used\nuniform vec4 uL1;\nuniform vec4 uL2;\nuniform vec4 uL3;\nuniform float uHmin;\nuniform float uHrange;\nuniform float uGround;\nuniform float uRadius;\n\nuniform vec2 uFarHeight; // the range the coarse level is encoded over: its minimum and its span\nfloat dec(vec4 t, vec2 hr) { return hr.x + (t.r * 255.0 * 256.0 + t.g * 255.0) / 65535.0 * hr.y; }\n\nfloat lin(sampler2D s, vec2 p, vec4 l, vec2 hr) {\n vec2 f = vec2((p.x + l.x) / l.y - 0.5, (l.x - p.y) / l.y - 0.5);\n vec2 i = floor(f);\n vec2 t = f - i;\n float st = 1.0 / l.z;\n vec2 uv = (i + 0.5) * st;\n float a = dec(texture2D(s, uv), hr);\n float b = dec(texture2D(s, uv + vec2(st, 0.0)), hr);\n float c = dec(texture2D(s, uv + vec2(0.0, st)), hr);\n float d = dec(texture2D(s, uv + vec2(st, st)), hr);\n return mix(mix(a, b, t.x), mix(c, d, t.x), t.y);\n}\n\nfloat nearest(sampler2D s, vec2 p, vec4 l, vec2 hr) {\n vec2 uv = vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z));\n return dec(texture2D(s, uv), hr);\n}\n\nbool holds(vec2 p, vec4 l, float dist) { return dist < l.w && abs(p.x) < l.x - 2.0 * l.y && abs(p.y) < l.x - 2.0 * l.y; }\n\n// the ground's height over the site's, the sphere's fall taken off; `fine` reads four samples, otherwise one\nfloat terrainY(vec2 p, float dist, bool fine) {\n float h;\n if (holds(p, uL0, dist)) h = fine ? lin(uH0, p, uL0, vec2(uHmin, uHrange)) : nearest(uH0, p, uL0, vec2(uHmin, uHrange));\n else if (holds(p, uL1, dist)) h = fine ? lin(uH1, p, uL1, vec2(uHmin, uHrange)) : nearest(uH1, p, uL1, vec2(uHmin, uHrange));\n else if (holds(p, uL2, dist)) h = fine ? lin(uH2, p, uL2, vec2(uHmin, uHrange)) : nearest(uH2, p, uL2, vec2(uHmin, uHrange));\n else h = fine ? lin(uH3, p, uL3, uFarHeight) : nearest(uH3, p, uL3, uFarHeight);\n return h - uGround - dot(p, p) / (2.0 * uRadius);\n}\n\n// the ground's own brightness at a point, from the picture of the level that serves it, 1 where it is the middle\nfloat albedoAt(vec2 p, float dist) {\n if (uPicture < 0.5) return 1.0;\n vec4 l;\n if (holds(p, uL0, dist)) { l = uL0; return 2.0 * texture2D(uA0, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n if (holds(p, uL1, dist)) { l = uL1; return 2.0 * texture2D(uA1, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n if (holds(p, uL2, dist)) { l = uL2; return 2.0 * texture2D(uA2, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n return 1.0;\n}\n\n// the measured ground's shadows, baked (scripts/make-moon-terrain.py): for a point, the elevation angle in degrees of the horizon toward the Sun, read from the finest of the three horizon maps that holds the point\nuniform sampler2D uZ0;\nuniform sampler2D uZ1;\nuniform sampler2D uZ2;\nuniform float uHzOn; // 1 where the maps are there\nuniform vec3 uHzSun; // the two directions (of 18) the Sun's azimuth lies between, and the share of the second\nuniform vec2 uHzRange; // the degrees the codes 0 and 255 stand for\n\nfloat hzSector(sampler2D s, vec2 cell, float k) {\n float slab = floor(k / 3.0);\n float ch = k - slab * 3.0;\n vec3 v = texture2D(s, vec2((cell.x + slab) / 6.0, cell.y)).rgb;\n return ch < 0.5 ? v.r : (ch < 1.5 ? v.g : v.b);\n}\n\nfloat hzFrom(sampler2D s, vec2 p, float reach) {\n vec2 cell = clamp(vec2((p.x + reach) / (2.0 * reach), (reach - p.y) / (2.0 * reach)), vec2(0.5 / 512.0), vec2(1.0 - 0.5 / 512.0));\n float code = mix(hzSector(s, cell, uHzSun.x), hzSector(s, cell, uHzSun.y), uHzSun.z);\n return uHzRange.x + code * (uHzRange.y - uHzRange.x);\n}\n\nfloat horizonAt(vec2 p) {\n if (abs(p.x) < uL0.x && abs(p.y) < uL0.x) return hzFrom(uZ0, p, uL0.x);\n if (abs(p.x) < uL1.x && abs(p.y) < uL1.x) return hzFrom(uZ1, p, uL1.x);\n if (abs(p.x) < uL2.x && abs(p.y) < uL2.x) return hzFrom(uZ2, p, uL2.x);\n return -90.0;\n}\n\n// the spacing of the level that serves a point, for the step of a slope\nfloat spacing(vec2 p, float dist) {\n if (holds(p, uL0, dist)) return uL0.y;\n if (holds(p, uL1, dist)) return uL1.y;\n if (holds(p, uL2, dist)) return uL2.y;\n return uL3.y;\n}\n\n\nuniform float uPixel; // the angle one pixel takes, radians\nuniform float uDetail; // 1 for the made detail, 0 for none\n\nuvec2 pcg2d(uvec2 v) {\n v = v * 1664525u + 1013904223u;\n v.x += v.y * 1664525u;\n v.y += v.x * 1664525u;\n v = v ^ (v >> 16u);\n v.x += v.y * 1664525u;\n v.y += v.x * 1664525u;\n v = v ^ (v >> 16u);\n return v;\n}\nfloat u24(uint h) { return float(h >> 8u) * (1.0 / 16777216.0); }\n\nuniform vec4 uKeep[6]; // the objects the made ground keeps away from: east, north, the distance inside which nothing is made, the distance outside which it all is\nuniform float uKeepCount;\nfloat keepMask(vec2 p) {\n float keep = 1.0;\n for (int i = 0; i < 6; i += 1) {\n if (float(i) >= uKeepCount) break;\n vec4 k = uKeep[i];\n float t = clamp((distance(p, k.xy) - k.z) / (k.w - k.z), 0.0, 1.0);\n keep = min(keep, t * t * (3.0 - 2.0 * t));\n }\n return keep;\n}\n\n// the made ground at a point: x the height in metres, yz the slope east and north, from every crater of every octave whose nominal diameter is over `fromD`\nvec3 madeGround(vec2 p, float fromD) {\n vec3 sum = vec3(0.0);\n for (int octave = 5; octave >= 0; octave -= 1) {\n float nominal = 0.5 * exp2(float(octave));\n float fade = clamp(nominal / fromD - 1.0, 0.0, 1.0);\n if (fade <= 0.0) break;\n float cell = 3.0 * nominal;\n ivec2 base = ivec2(floor(p / cell));\n vec2 fr = p / cell - vec2(base);\n float occ = (octave >= 3 ? 0.5 : 1.0) * 0.36 * exp2(-0.5 * float(octave));\n for (int j = -1; j <= 1; j += 1) {\n for (int i = -1; i <= 1; i += 1) {\n // a crater is kept to the middle of its cell, so a neighbour's reaches this cell only within a fifth of the edge\n if ((i == -1 && fr.x > 0.2) || (i == 1 && fr.x < 0.8) || (j == -1 && fr.y > 0.2) || (j == 1 && fr.y < 0.8)) continue;\n ivec2 c = base + ivec2(i, j);\n uvec2 ab = pcg2d(uvec2(uint(c.x), uint(c.y + octave * 7919)));\n if (u24(ab.x) >= occ) continue;\n uvec2 cd = pcg2d(uvec2(uint(c.x + 104729), uint(c.y + octave * 7919 + 15485863)));\n float diameter = nominal * (1.0 + (octave == 5 ? 0.25 : 1.0) * u24(cd.y));\n float r4 = float(ab.x & 255u) / 255.0;\n float age = 1.0 - r4 * r4 * r4 * r4;\n float radius = 0.5 * diameter;\n float vary = 0.6 + 0.4 * (float(cd.x & 255u) / 255.0);\n float depth = diameter * (0.2 - 0.17 * age) * vary;\n float rim = 0.045 * diameter * pow(1.0 - age, 1.5);\n float rimWidth = 0.22 + 0.5 * age;\n vec2 centre = vec2(float(c.x) + 0.25 + 0.5 * u24(ab.y), float(c.y) + 0.25 + 0.5 * u24(cd.x)) * cell;\n vec2 d = p - centre;\n float r = length(d);\n float x = r / radius;\n float h = 0.0;\n float dh = 0.0;\n if (x < 1.0) { float bowl = 1.0 - x * x; float pw = 1.0 + age; h = -depth * pow(bowl, pw); dh = 2.0 * depth * pw * x * pow(bowl, age); }\n float e = (x - 1.0) / rimWidth;\n float ex = exp(-e * e);\n h += rim * ex;\n dh += -2.0 * rim * e * ex / rimWidth;\n if (x > 1.0) { float t = 1.0 / x; h += 0.25 * rim * t * t * t; dh += -0.75 * rim * t * t * t * t; }\n float k = r > 1e-6 ? dh / (radius * r) : 0.0;\n sum += fade * vec3(h, k * d.x, k * d.y);\n }\n }\n }\n return sum * keepMask(p);\n}\n\nfloat vnoise(vec2 p) {\n vec2 i = floor(p);\n vec2 f = p - i;\n vec2 w = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);\n uvec2 c = uvec2(ivec2(i));\n float a = u24(pcg2d(c).x);\n float b = u24(pcg2d(c + uvec2(1u, 0u)).x);\n float cc = u24(pcg2d(c + uvec2(0u, 1u)).x);\n float d = u24(pcg2d(c + uvec2(1u, 1u)).x);\n return mix(mix(a, b, w.x), mix(cc, d, w.x), w.y);\n}\n\n// a fine roughness of the dust: two scales, as a slope (east, north), faded out where a pixel covers more than a few of its grains\nvec2 roughness(vec2 p, float footprint) {\n vec2 g = vec2(0.0);\n for (int k = 0; k < 2; k += 1) {\n float s = k == 0 ? 0.07 : 0.3;\n float amp = k == 0 ? 0.3 : 0.28;\n float fade = smoothstep(footprint * 2.0, footprint * 7.0, s);\n if (fade <= 0.0) continue;\n float d = s * 0.25;\n vec2 q = (k == 0 ? vec2(p.x * 0.629 + p.y * 0.777, p.y * 0.629 - p.x * 0.777) : vec2(p.x * 0.857 - p.y * 0.515, p.x * 0.515 + p.y * 0.857)) / s;\n float dx = vnoise(q + vec2(0.25, 0.0)) - vnoise(q - vec2(0.25, 0.0));\n float dy = vnoise(q + vec2(0.0, 0.25)) - vnoise(q - vec2(0.0, 0.25));\n g += fade * amp * vec2(dx, dy) / (0.5 * s) * 0.012;\n }\n return g;\n}\n\n\n// the ground's height at a point: the measured heights and, near the eyes, the made craters (kept to the ones a pixel here can show)\nfloat groundY(vec2 p, float dist, bool fine, float fromD) {\n float y = terrainY(p, dist, fine);\n if (uDetail > 0.5 && fromD < 24.0) y += madeGround(p, fromD).x;\n return y;\n}\n\n// 1 where the Sun reaches a point, 0 where the ground is in its way. The measured ground's shadow is read from the baked horizon; the march toward the Sun over the heights (and the made craters) is the near\n// field's only, a few tens of metres with a fixed number of steps, as sharp as the Sun's edge. Where there is no baked horizon the march goes all the way, as it did before the maps.\nfloat lit(vec3 P, float dist0) {\n vec2 dir = normalize(uSun.xz);\n float slope = uSun.y / max(length(uSun.xz), 1e-4);\n if (uHzOn > 0.5 && horizonAt(P.xz) - 0.3 > uSunDegrees) return 0.0;\n // the ground at the point from the heights themselves, not the mesh's slope between its corners, which can be a long way off on a far mountain\n P.y = groundY(P.xz, dist0, true, 2.5 * dist0 * uPixel);\n float t = 0.5 * spacing(P.xz, dist0) + 0.25;\n if (uDetail > 0.5) t = min(t, 0.2 + 0.02 * dist0);\n // a pixel's own start along the ray: the edge of a rim's shadow is a line of steps, and a line of steps is jagged; with a start of its own each pixel it becomes a fine grain instead\n float jitter = fract(sin(dot(P.xz, vec2(12.9898, 78.233))) * 43758.5453);\n float range = uHzOn > 0.5 ? uNear.y : 80000.0;\n for (int i = 0; i < 260; i += 1) {\n if (float(i) >= uNear.x) break;\n vec2 q = P.xz + dir * t;\n float y = P.y + slope * t;\n float dist = max(t, distance(q, uEyeEN));\n float res = spacing(q, dist);\n float h = groundY(q, dist, t < 600.0, t < uNear.z ? max(0.2 * t, 2.5 * dist * uPixel) : 99.0);\n float bias = (t < 40.0 ? 0.01 : 0.3 * res) + 0.002 * t;\n if (h > y + bias) return 0.0;\n if (y > uMaxY || t > range) break;\n float step = t < 30.0 ? t * 0.045 + 0.04 : t * 0.06 + 0.5;\n t += step * (0.65 + 0.7 * jitter);\n }\n return 1.0;\n}\n\nvarying vec3 vP;\nvarying vec3 vN;\nvarying float vTone;\nvoid main() {\n vec3 n = normalize(vN);\n float mu0 = dot(n, uSun);\n float mu = max(dot(n, normalize(uEye - vP)), 0.03);\n float dist = distance(vP.xz, uEyeEN);\n float shine = 0.0;\n if (mu0 > 0.0 && uSun.y > -0.01) shine = (uShadows > 0.5 ? lit(vP + n * 0.02, dist) : 1.0) * 2.0 * mu0 / (mu0 + mu);\n float light = uAlbedo * 1.1 * vTone * (shine + 0.12 * (n.y * 0.5 + 0.5)) * uExposure; // the shade of a stone is lit by the ground round it\n gl_FragColor = vec4(vec3(pow(clamp(light, 0.0, 1.0), 1.0 / 2.2)), 1.0);\n}\n";
|
|
13
|
+
export declare const ROCK_FRAGMENT = "\nprecision highp float;\nprecision highp sampler2D;\n\nuniform vec3 uSun;\nuniform vec3 uEye;\nuniform vec2 uEyeEN;\nuniform float uExposure;\nuniform float uAlbedo;\nuniform float uMaxY; // the highest ground over the site's, for the end of a shadow's march\nuniform float uEarthshine; // the light of the sunlit ground round the shade, a small share of a lit slope's (on Mars the sky's light, a good deal more)\nuniform vec3 uTint; // the ground's colour over its grey: white on the Moon\nuniform float uShadows; // 1 for the ground to shadow itself (the default), 0 for none (a try-out)\nuniform float uSunDegrees; // the Sun's elevation in degrees\nuniform vec3 uNear; // the near march: steps, the distance it reaches in metres, the distance out to which the made craters are in it (the quality of the draw)\n\nuniform sampler2D uH0;\nuniform sampler2D uH1;\nuniform sampler2D uH2;\nuniform sampler2D uH3;\nuniform sampler2D uA0; // the ground picture on the first three levels, 0 to 1 with the middle at 0.5\nuniform sampler2D uA1;\nuniform sampler2D uA2;\nuniform float uPicture; // 1 where the picture is there\nuniform vec4 uL0; // half width, metres a sample, samples across, the distance out to which this level is used\nuniform vec4 uL1;\nuniform vec4 uL2;\nuniform vec4 uL3;\nuniform float uHmin;\nuniform float uHrange;\nuniform float uGround;\nuniform float uRadius;\n\nuniform vec2 uFarHeight; // the range the coarse level is encoded over: its minimum and its span\nfloat dec(vec4 t, vec2 hr) { return hr.x + (t.r * 255.0 * 256.0 + t.g * 255.0) / 65535.0 * hr.y; }\n\nfloat lin(sampler2D s, vec2 p, vec4 l, vec2 hr) {\n vec2 f = vec2((p.x + l.x) / l.y - 0.5, (l.x - p.y) / l.y - 0.5);\n vec2 i = floor(f);\n vec2 t = f - i;\n float st = 1.0 / l.z;\n vec2 uv = (i + 0.5) * st;\n float a = dec(texture2D(s, uv), hr);\n float b = dec(texture2D(s, uv + vec2(st, 0.0)), hr);\n float c = dec(texture2D(s, uv + vec2(0.0, st)), hr);\n float d = dec(texture2D(s, uv + vec2(st, st)), hr);\n return mix(mix(a, b, t.x), mix(c, d, t.x), t.y);\n}\n\nfloat nearest(sampler2D s, vec2 p, vec4 l, vec2 hr) {\n vec2 uv = vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z));\n return dec(texture2D(s, uv), hr);\n}\n\nbool holds(vec2 p, vec4 l, float dist) { return dist < l.w && abs(p.x) < l.x - 2.0 * l.y && abs(p.y) < l.x - 2.0 * l.y; }\n\n// the ground's height over the site's, the sphere's fall taken off; `fine` reads four samples, otherwise one\nfloat terrainY(vec2 p, float dist, bool fine) {\n float h;\n if (holds(p, uL0, dist)) h = fine ? lin(uH0, p, uL0, vec2(uHmin, uHrange)) : nearest(uH0, p, uL0, vec2(uHmin, uHrange));\n else if (holds(p, uL1, dist)) h = fine ? lin(uH1, p, uL1, vec2(uHmin, uHrange)) : nearest(uH1, p, uL1, vec2(uHmin, uHrange));\n else if (holds(p, uL2, dist)) h = fine ? lin(uH2, p, uL2, vec2(uHmin, uHrange)) : nearest(uH2, p, uL2, vec2(uHmin, uHrange));\n else h = fine ? lin(uH3, p, uL3, uFarHeight) : nearest(uH3, p, uL3, uFarHeight);\n return h - uGround - dot(p, p) / (2.0 * uRadius);\n}\n\n// the ground's own brightness at a point, from the picture of the level that serves it, 1 where it is the middle\nfloat albedoAt(vec2 p, float dist) {\n if (uPicture < 0.5) return 1.0;\n vec4 l;\n if (holds(p, uL0, dist)) { l = uL0; return 2.0 * texture2D(uA0, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n if (holds(p, uL1, dist)) { l = uL1; return 2.0 * texture2D(uA1, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n if (holds(p, uL2, dist)) { l = uL2; return 2.0 * texture2D(uA2, vec2((p.x + l.x) / (l.y * l.z), (l.x - p.y) / (l.y * l.z))).r; }\n return 1.0;\n}\n\n// the measured ground's shadows, baked (scripts/make-moon-terrain.py): for a point, the elevation angle in degrees of the horizon toward the Sun, read from the finest of the three horizon maps that holds the point\nuniform sampler2D uZ0;\nuniform sampler2D uZ1;\nuniform sampler2D uZ2;\nuniform float uHzOn; // 1 where the maps are there\nuniform vec3 uHzSun; // the two directions (of 18) the Sun's azimuth lies between, and the share of the second\nuniform vec2 uHzRange; // the degrees the codes 0 and 255 stand for\n\nfloat hzSector(sampler2D s, vec2 cell, float k) {\n float slab = floor(k / 3.0);\n float ch = k - slab * 3.0;\n vec3 v = texture2D(s, vec2((cell.x + slab) / 6.0, cell.y)).rgb;\n return ch < 0.5 ? v.r : (ch < 1.5 ? v.g : v.b);\n}\n\nfloat hzFrom(sampler2D s, vec2 p, float reach) {\n vec2 cell = clamp(vec2((p.x + reach) / (2.0 * reach), (reach - p.y) / (2.0 * reach)), vec2(0.5 / 512.0), vec2(1.0 - 0.5 / 512.0));\n float code = mix(hzSector(s, cell, uHzSun.x), hzSector(s, cell, uHzSun.y), uHzSun.z);\n return uHzRange.x + code * (uHzRange.y - uHzRange.x);\n}\n\nfloat horizonAt(vec2 p) {\n if (abs(p.x) < uL0.x && abs(p.y) < uL0.x) return hzFrom(uZ0, p, uL0.x);\n if (abs(p.x) < uL1.x && abs(p.y) < uL1.x) return hzFrom(uZ1, p, uL1.x);\n if (abs(p.x) < uL2.x && abs(p.y) < uL2.x) return hzFrom(uZ2, p, uL2.x);\n return -90.0;\n}\n\n// the spacing of the level that serves a point, for the step of a slope\nfloat spacing(vec2 p, float dist) {\n if (holds(p, uL0, dist)) return uL0.y;\n if (holds(p, uL1, dist)) return uL1.y;\n if (holds(p, uL2, dist)) return uL2.y;\n return uL3.y;\n}\n\n\nuniform float uPixel; // the angle one pixel takes, radians\nuniform float uDetail; // 1 for the made detail, 0 for none\n\nuvec2 pcg2d(uvec2 v) {\n v = v * 1664525u + 1013904223u;\n v.x += v.y * 1664525u;\n v.y += v.x * 1664525u;\n v = v ^ (v >> 16u);\n v.x += v.y * 1664525u;\n v.y += v.x * 1664525u;\n v = v ^ (v >> 16u);\n return v;\n}\nfloat u24(uint h) { return float(h >> 8u) * (1.0 / 16777216.0); }\n\nuniform vec4 uKeep[6]; // the objects the made ground keeps away from: east, north, the distance inside which nothing is made, the distance outside which it all is\nuniform float uKeepCount;\nfloat keepMask(vec2 p) {\n float keep = 1.0;\n for (int i = 0; i < 6; i += 1) {\n if (float(i) >= uKeepCount) break;\n vec4 k = uKeep[i];\n float t = clamp((distance(p, k.xy) - k.z) / (k.w - k.z), 0.0, 1.0);\n keep = min(keep, t * t * (3.0 - 2.0 * t));\n }\n return keep;\n}\n\n// the made ground at a point: x the height in metres, yz the slope east and north, from every crater of every octave whose nominal diameter is over `fromD`\nvec3 madeGround(vec2 p, float fromD) {\n vec3 sum = vec3(0.0);\n for (int octave = 5; octave >= 0; octave -= 1) {\n float nominal = 0.5 * exp2(float(octave));\n float fade = clamp(nominal / fromD - 1.0, 0.0, 1.0);\n if (fade <= 0.0) break;\n float cell = 3.0 * nominal;\n ivec2 base = ivec2(floor(p / cell));\n vec2 fr = p / cell - vec2(base);\n float occ = (octave >= 3 ? 0.5 : 1.0) * 0.36 * exp2(-0.5 * float(octave));\n for (int j = -1; j <= 1; j += 1) {\n for (int i = -1; i <= 1; i += 1) {\n // a crater is kept to the middle of its cell, so a neighbour's reaches this cell only within a fifth of the edge\n if ((i == -1 && fr.x > 0.2) || (i == 1 && fr.x < 0.8) || (j == -1 && fr.y > 0.2) || (j == 1 && fr.y < 0.8)) continue;\n ivec2 c = base + ivec2(i, j);\n uvec2 ab = pcg2d(uvec2(uint(c.x), uint(c.y + octave * 7919)));\n if (u24(ab.x) >= occ) continue;\n uvec2 cd = pcg2d(uvec2(uint(c.x + 104729), uint(c.y + octave * 7919 + 15485863)));\n float diameter = nominal * (1.0 + (octave == 5 ? 0.25 : 1.0) * u24(cd.y));\n float r4 = float(ab.x & 255u) / 255.0;\n float age = 1.0 - r4 * r4 * r4 * r4;\n float radius = 0.5 * diameter;\n float vary = 0.6 + 0.4 * (float(cd.x & 255u) / 255.0);\n float depth = diameter * (0.2 - 0.17 * age) * vary;\n float rim = 0.045 * diameter * pow(1.0 - age, 1.5);\n float rimWidth = 0.22 + 0.5 * age;\n vec2 centre = vec2(float(c.x) + 0.25 + 0.5 * u24(ab.y), float(c.y) + 0.25 + 0.5 * u24(cd.x)) * cell;\n vec2 d = p - centre;\n float r = length(d);\n float x = r / radius;\n float h = 0.0;\n float dh = 0.0;\n if (x < 1.0) { float bowl = 1.0 - x * x; float pw = 1.0 + age; h = -depth * pow(bowl, pw); dh = 2.0 * depth * pw * x * pow(bowl, age); }\n float e = (x - 1.0) / rimWidth;\n float ex = exp(-e * e);\n h += rim * ex;\n dh += -2.0 * rim * e * ex / rimWidth;\n if (x > 1.0) { float t = 1.0 / x; h += 0.25 * rim * t * t * t; dh += -0.75 * rim * t * t * t * t; }\n float k = r > 1e-6 ? dh / (radius * r) : 0.0;\n sum += fade * vec3(h, k * d.x, k * d.y);\n }\n }\n }\n return sum * keepMask(p);\n}\n\nfloat vnoise(vec2 p) {\n vec2 i = floor(p);\n vec2 f = p - i;\n vec2 w = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);\n uvec2 c = uvec2(ivec2(i));\n float a = u24(pcg2d(c).x);\n float b = u24(pcg2d(c + uvec2(1u, 0u)).x);\n float cc = u24(pcg2d(c + uvec2(0u, 1u)).x);\n float d = u24(pcg2d(c + uvec2(1u, 1u)).x);\n return mix(mix(a, b, w.x), mix(cc, d, w.x), w.y);\n}\n\n// a fine roughness of the dust: two scales, as a slope (east, north), faded out where a pixel covers more than a few of its grains\nvec2 roughness(vec2 p, float footprint) {\n vec2 g = vec2(0.0);\n for (int k = 0; k < 2; k += 1) {\n float s = k == 0 ? 0.07 : 0.3;\n float amp = k == 0 ? 0.3 : 0.28;\n float fade = smoothstep(footprint * 2.0, footprint * 7.0, s);\n if (fade <= 0.0) continue;\n float d = s * 0.25;\n vec2 q = (k == 0 ? vec2(p.x * 0.629 + p.y * 0.777, p.y * 0.629 - p.x * 0.777) : vec2(p.x * 0.857 - p.y * 0.515, p.x * 0.515 + p.y * 0.857)) / s;\n float dx = vnoise(q + vec2(0.25, 0.0)) - vnoise(q - vec2(0.25, 0.0));\n float dy = vnoise(q + vec2(0.0, 0.25)) - vnoise(q - vec2(0.0, 0.25));\n g += fade * amp * vec2(dx, dy) / (0.5 * s) * 0.012;\n }\n return g;\n}\n\n\n// the ground's height at a point: the measured heights and, near the eyes, the made craters (kept to the ones a pixel here can show)\nfloat groundY(vec2 p, float dist, bool fine, float fromD) {\n float y = terrainY(p, dist, fine);\n if (uDetail > 0.5 && fromD < 24.0) y += madeGround(p, fromD).x;\n return y;\n}\n\n// 1 where the Sun reaches a point, 0 where the ground is in its way. The measured ground's shadow is read from the baked horizon; the march toward the Sun over the heights (and the made craters) is the near\n// field's only, a few tens of metres with a fixed number of steps, as sharp as the Sun's edge. Where there is no baked horizon the march goes all the way, as it did before the maps.\nfloat lit(vec3 P, float dist0) {\n vec2 dir = normalize(uSun.xz);\n float slope = uSun.y / max(length(uSun.xz), 1e-4);\n if (uHzOn > 0.5 && horizonAt(P.xz) - 0.3 > uSunDegrees) return 0.0;\n // the ground at the point from the heights themselves, not the mesh's slope between its corners, which can be a long way off on a far mountain\n // the made craters are in the ground at the point only where they are in the march too (uNear.z is 0 in the quality of motion, which leaves them out of the march): a point set down in a made crater's floor and a ray over the ground without the crater put the whole floor under the ground's height, black\n P.y = groundY(P.xz, dist0, true, uNear.z > 0.0 ? 2.5 * dist0 * uPixel : 99.0);\n float t = 0.5 * spacing(P.xz, dist0) + 0.25;\n if (uDetail > 0.5) t = min(t, 0.2 + 0.02 * dist0);\n // a pixel's own start along the ray: the edge of a rim's shadow is a line of steps, and a line of steps is jagged; with a start of its own each pixel it becomes a fine grain instead\n float jitter = fract(sin(dot(P.xz, vec2(12.9898, 78.233))) * 43758.5453);\n float range = uHzOn > 0.5 ? uNear.y : 80000.0;\n for (int i = 0; i < 260; i += 1) {\n if (float(i) >= uNear.x) break;\n vec2 q = P.xz + dir * t;\n float y = P.y + slope * t;\n float dist = max(t, distance(q, uEyeEN));\n float res = spacing(q, dist);\n float h = groundY(q, dist, t < 600.0, t < uNear.z ? max(0.2 * t, 2.5 * dist * uPixel) : 99.0);\n float bias = (t < 40.0 ? 0.01 : 0.3 * res) + 0.002 * t;\n if (h > y + bias) return 0.0;\n if (y > uMaxY || t > range) break;\n float step = t < 30.0 ? t * 0.045 + 0.04 : t * 0.06 + 0.5;\n t += step * (0.65 + 0.7 * jitter);\n }\n return 1.0;\n}\n\nvarying vec3 vP;\nvarying vec3 vN;\nvarying float vTone;\nvoid main() {\n vec3 n = normalize(vN);\n float mu0 = dot(n, uSun);\n float mu = max(dot(n, normalize(uEye - vP)), 0.03);\n float dist = distance(vP.xz, uEyeEN);\n float shine = 0.0;\n if (mu0 > 0.0 && uSun.y > -0.01) shine = (uShadows > 0.5 ? lit(vP + n * 0.02, dist) : 1.0) * 2.0 * mu0 / (mu0 + mu);\n float light = uAlbedo * 1.1 * vTone * (shine + 0.12 * (n.y * 0.5 + 0.5)) * uExposure; // the shade of a stone is lit by the ground round it\n gl_FragColor = vec4(vec3(pow(clamp(light, 0.0, 1.0), 1.0 / 2.2)), 1.0);\n}\n";
|
|
14
14
|
/** A rock's shadow on the ground: a quad laid along the way the Sun's light goes, a soft dark shape, drawn over the ground. */
|
|
15
15
|
export declare const SHADOW_VERTEX = "\nprecision highp float;\nuniform mat4 uVP;\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = uVP * vec4(position.x, position.y, -position.z, 1.0);\n}\n";
|
|
16
16
|
export declare const SHADOW_FRAGMENT = "\nprecision highp float;\nvarying vec2 vUv;\nvoid main() {\n float u = vUv.x;\n float across = smoothstep(1.0, 0.5, abs(vUv.y));\n float along = smoothstep(0.0, 0.06, u) * (1.0 - smoothstep(0.78, 1.0, u));\n float a = across * along * 0.85;\n if (a < 0.01) discard;\n gl_FragColor = vec4(0.0, 0.0, 0.0, a);\n}\n";
|
package/dist/surface/glsl.js
CHANGED
|
@@ -262,7 +262,8 @@ float lit(vec3 P, float dist0) {
|
|
|
262
262
|
float slope = uSun.y / max(length(uSun.xz), 1e-4);
|
|
263
263
|
if (uHzOn > 0.5 && horizonAt(P.xz) - 0.3 > uSunDegrees) return 0.0;
|
|
264
264
|
// the ground at the point from the heights themselves, not the mesh's slope between its corners, which can be a long way off on a far mountain
|
|
265
|
-
|
|
265
|
+
// the made craters are in the ground at the point only where they are in the march too (uNear.z is 0 in the quality of motion, which leaves them out of the march): a point set down in a made crater's floor and a ray over the ground without the crater put the whole floor under the ground's height, black
|
|
266
|
+
P.y = groundY(P.xz, dist0, true, uNear.z > 0.0 ? 2.5 * dist0 * uPixel : 99.0);
|
|
266
267
|
float t = 0.5 * spacing(P.xz, dist0) + 0.25;
|
|
267
268
|
if (uDetail > 0.5) t = min(t, 0.2 + 0.02 * dist0);
|
|
268
269
|
// a pixel's own start along the ray: the edge of a rim's shadow is a line of steps, and a line of steps is jagged; with a start of its own each pixel it becomes a fine grain instead
|
|
@@ -132,3 +132,36 @@ export declare function clockText(t: number): {
|
|
|
132
132
|
t: string;
|
|
133
133
|
get: string;
|
|
134
134
|
};
|
|
135
|
+
/** How far a drag has turned the watched view from where its camera points by itself, in degrees. */
|
|
136
|
+
export interface WatchTurn {
|
|
137
|
+
azimuth: number;
|
|
138
|
+
pitch: number;
|
|
139
|
+
}
|
|
140
|
+
/** The most a drag may tip the watched view up or down from where its camera points by itself, in degrees (the rover's view has the same limit). */
|
|
141
|
+
export declare const WATCH_PITCH_LIMIT = 60;
|
|
142
|
+
/**
|
|
143
|
+
* A drag turns the watched view (MODULES-1546): the camera follows the descent and points itself at each frame, so a drag cannot set where the view looks (the next frame would put it back); it adds to a turn kept
|
|
144
|
+
* beside it, which every frame adds to where the camera points by itself. Dragging right turns the view right, and dragging down tips it up, as in the standing view.
|
|
145
|
+
*
|
|
146
|
+
* @param turn - The turn so far.
|
|
147
|
+
* @param dx - How far the pointer moved across, in pixels, to the right positive.
|
|
148
|
+
* @param dy - How far it moved down, in pixels, down positive.
|
|
149
|
+
* @param degreesPerPixel - How many degrees a pixel of the drag turns the view (the field of view over the view's height).
|
|
150
|
+
* @returns The turn after the drag, the pitch kept within `WATCH_PITCH_LIMIT`.
|
|
151
|
+
*/
|
|
152
|
+
export declare function turnedBy(turn: WatchTurn, dx: number, dy: number, degreesPerPixel: number): WatchTurn;
|
|
153
|
+
/**
|
|
154
|
+
* Where the watched view looks at a frame: where its camera points by itself (towards the descending stage from the ground, along the lunar module's heading and pitch from its window) turned by what the viewer has dragged.
|
|
155
|
+
* Pure, and the same at every frame for the same turn, so the turn survives the frames that follow it.
|
|
156
|
+
*
|
|
157
|
+
* @param camera - Where the camera points by itself: azimuth clockwise from north and pitch up from the horizon, in degrees.
|
|
158
|
+
* @param turn - The viewer's turn.
|
|
159
|
+
* @returns The azimuth from 0 up to 360 and the pitch, before the view's own limits.
|
|
160
|
+
*/
|
|
161
|
+
export declare function watchedLook(camera: {
|
|
162
|
+
azimuth: number;
|
|
163
|
+
pitch: number;
|
|
164
|
+
}, turn: WatchTurn): {
|
|
165
|
+
azimuth: number;
|
|
166
|
+
pitch: number;
|
|
167
|
+
};
|
package/dist/surface/landing.js
CHANGED
|
@@ -235,3 +235,29 @@ export function clockText(t) {
|
|
|
235
235
|
const g = 110 * 3600 + 9 * 60 + 53 + s;
|
|
236
236
|
return { t: `T+${two(s / 60)}:${two(s % 60)}`, get: `${Math.floor(g / 3600)}:${two((g % 3600) / 60)}:${two(g % 60)}` };
|
|
237
237
|
}
|
|
238
|
+
/** The most a drag may tip the watched view up or down from where its camera points by itself, in degrees (the rover's view has the same limit). */
|
|
239
|
+
export const WATCH_PITCH_LIMIT = 60;
|
|
240
|
+
/**
|
|
241
|
+
* A drag turns the watched view (MODULES-1546): the camera follows the descent and points itself at each frame, so a drag cannot set where the view looks (the next frame would put it back); it adds to a turn kept
|
|
242
|
+
* beside it, which every frame adds to where the camera points by itself. Dragging right turns the view right, and dragging down tips it up, as in the standing view.
|
|
243
|
+
*
|
|
244
|
+
* @param turn - The turn so far.
|
|
245
|
+
* @param dx - How far the pointer moved across, in pixels, to the right positive.
|
|
246
|
+
* @param dy - How far it moved down, in pixels, down positive.
|
|
247
|
+
* @param degreesPerPixel - How many degrees a pixel of the drag turns the view (the field of view over the view's height).
|
|
248
|
+
* @returns The turn after the drag, the pitch kept within `WATCH_PITCH_LIMIT`.
|
|
249
|
+
*/
|
|
250
|
+
export function turnedBy(turn, dx, dy, degreesPerPixel) {
|
|
251
|
+
return { azimuth: turn.azimuth - dx * degreesPerPixel, pitch: Math.max(-WATCH_PITCH_LIMIT, Math.min(WATCH_PITCH_LIMIT, turn.pitch + dy * degreesPerPixel)) };
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Where the watched view looks at a frame: where its camera points by itself (towards the descending stage from the ground, along the lunar module's heading and pitch from its window) turned by what the viewer has dragged.
|
|
255
|
+
* Pure, and the same at every frame for the same turn, so the turn survives the frames that follow it.
|
|
256
|
+
*
|
|
257
|
+
* @param camera - Where the camera points by itself: azimuth clockwise from north and pitch up from the horizon, in degrees.
|
|
258
|
+
* @param turn - The viewer's turn.
|
|
259
|
+
* @returns The azimuth from 0 up to 360 and the pitch, before the view's own limits.
|
|
260
|
+
*/
|
|
261
|
+
export function watchedLook(camera, turn) {
|
|
262
|
+
return { azimuth: (((camera.azimuth + turn.azimuth) % 360) + 360) % 360, pitch: camera.pitch + turn.pitch };
|
|
263
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@johnmorrisdotca/wakusei-planets",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.68.0",
|
|
4
4
|
"description": "Wakusei Planets 惑星 — The Sun, planets and moons for the web: each as a clean line drawing, a shaded realistic drawing or a painted surface map, with real sizes, axial tilt and rotation as data, and positions of the moons for any date and time. SVG for the lines, three.js (optional) for the rest.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"planets",
|
|
@@ -241,6 +241,11 @@
|
|
|
241
241
|
"import": "./dist/fact-sheets.js",
|
|
242
242
|
"default": "./dist/fact-sheets.js"
|
|
243
243
|
},
|
|
244
|
+
"./body-physics": {
|
|
245
|
+
"types": "./dist/body-physics.d.ts",
|
|
246
|
+
"import": "./dist/body-physics.js",
|
|
247
|
+
"default": "./dist/body-physics.js"
|
|
248
|
+
},
|
|
244
249
|
"./discovery": {
|
|
245
250
|
"types": "./dist/discovery.d.ts",
|
|
246
251
|
"import": "./dist/discovery.js",
|
|
@@ -431,6 +436,276 @@
|
|
|
431
436
|
"import": "./dist/places/saturn.js",
|
|
432
437
|
"default": "./dist/places/saturn.js"
|
|
433
438
|
},
|
|
439
|
+
"./places/search": {
|
|
440
|
+
"types": "./dist/places/search.d.ts",
|
|
441
|
+
"import": "./dist/places/search.js",
|
|
442
|
+
"default": "./dist/places/search.js"
|
|
443
|
+
},
|
|
444
|
+
"./places/search/moon": {
|
|
445
|
+
"types": "./dist/places/search/moon.d.ts",
|
|
446
|
+
"import": "./dist/places/search/moon.js",
|
|
447
|
+
"default": "./dist/places/search/moon.js"
|
|
448
|
+
},
|
|
449
|
+
"./places/search/mars": {
|
|
450
|
+
"types": "./dist/places/search/mars.d.ts",
|
|
451
|
+
"import": "./dist/places/search/mars.js",
|
|
452
|
+
"default": "./dist/places/search/mars.js"
|
|
453
|
+
},
|
|
454
|
+
"./places/search/mercury": {
|
|
455
|
+
"types": "./dist/places/search/mercury.d.ts",
|
|
456
|
+
"import": "./dist/places/search/mercury.js",
|
|
457
|
+
"default": "./dist/places/search/mercury.js"
|
|
458
|
+
},
|
|
459
|
+
"./places/search/venus": {
|
|
460
|
+
"types": "./dist/places/search/venus.d.ts",
|
|
461
|
+
"import": "./dist/places/search/venus.js",
|
|
462
|
+
"default": "./dist/places/search/venus.js"
|
|
463
|
+
},
|
|
464
|
+
"./places/search/io": {
|
|
465
|
+
"types": "./dist/places/search/io.d.ts",
|
|
466
|
+
"import": "./dist/places/search/io.js",
|
|
467
|
+
"default": "./dist/places/search/io.js"
|
|
468
|
+
},
|
|
469
|
+
"./places/search/europa": {
|
|
470
|
+
"types": "./dist/places/search/europa.d.ts",
|
|
471
|
+
"import": "./dist/places/search/europa.js",
|
|
472
|
+
"default": "./dist/places/search/europa.js"
|
|
473
|
+
},
|
|
474
|
+
"./places/search/ganymede": {
|
|
475
|
+
"types": "./dist/places/search/ganymede.d.ts",
|
|
476
|
+
"import": "./dist/places/search/ganymede.js",
|
|
477
|
+
"default": "./dist/places/search/ganymede.js"
|
|
478
|
+
},
|
|
479
|
+
"./places/search/callisto": {
|
|
480
|
+
"types": "./dist/places/search/callisto.d.ts",
|
|
481
|
+
"import": "./dist/places/search/callisto.js",
|
|
482
|
+
"default": "./dist/places/search/callisto.js"
|
|
483
|
+
},
|
|
484
|
+
"./places/search/titan": {
|
|
485
|
+
"types": "./dist/places/search/titan.d.ts",
|
|
486
|
+
"import": "./dist/places/search/titan.js",
|
|
487
|
+
"default": "./dist/places/search/titan.js"
|
|
488
|
+
},
|
|
489
|
+
"./places/search/enceladus": {
|
|
490
|
+
"types": "./dist/places/search/enceladus.d.ts",
|
|
491
|
+
"import": "./dist/places/search/enceladus.js",
|
|
492
|
+
"default": "./dist/places/search/enceladus.js"
|
|
493
|
+
},
|
|
494
|
+
"./places/search/mimas": {
|
|
495
|
+
"types": "./dist/places/search/mimas.d.ts",
|
|
496
|
+
"import": "./dist/places/search/mimas.js",
|
|
497
|
+
"default": "./dist/places/search/mimas.js"
|
|
498
|
+
},
|
|
499
|
+
"./places/search/tethys": {
|
|
500
|
+
"types": "./dist/places/search/tethys.d.ts",
|
|
501
|
+
"import": "./dist/places/search/tethys.js",
|
|
502
|
+
"default": "./dist/places/search/tethys.js"
|
|
503
|
+
},
|
|
504
|
+
"./places/search/dione": {
|
|
505
|
+
"types": "./dist/places/search/dione.d.ts",
|
|
506
|
+
"import": "./dist/places/search/dione.js",
|
|
507
|
+
"default": "./dist/places/search/dione.js"
|
|
508
|
+
},
|
|
509
|
+
"./places/search/rhea": {
|
|
510
|
+
"types": "./dist/places/search/rhea.d.ts",
|
|
511
|
+
"import": "./dist/places/search/rhea.js",
|
|
512
|
+
"default": "./dist/places/search/rhea.js"
|
|
513
|
+
},
|
|
514
|
+
"./places/search/iapetus": {
|
|
515
|
+
"types": "./dist/places/search/iapetus.d.ts",
|
|
516
|
+
"import": "./dist/places/search/iapetus.js",
|
|
517
|
+
"default": "./dist/places/search/iapetus.js"
|
|
518
|
+
},
|
|
519
|
+
"./places/search/miranda": {
|
|
520
|
+
"types": "./dist/places/search/miranda.d.ts",
|
|
521
|
+
"import": "./dist/places/search/miranda.js",
|
|
522
|
+
"default": "./dist/places/search/miranda.js"
|
|
523
|
+
},
|
|
524
|
+
"./places/search/ariel": {
|
|
525
|
+
"types": "./dist/places/search/ariel.d.ts",
|
|
526
|
+
"import": "./dist/places/search/ariel.js",
|
|
527
|
+
"default": "./dist/places/search/ariel.js"
|
|
528
|
+
},
|
|
529
|
+
"./places/search/umbriel": {
|
|
530
|
+
"types": "./dist/places/search/umbriel.d.ts",
|
|
531
|
+
"import": "./dist/places/search/umbriel.js",
|
|
532
|
+
"default": "./dist/places/search/umbriel.js"
|
|
533
|
+
},
|
|
534
|
+
"./places/search/titania": {
|
|
535
|
+
"types": "./dist/places/search/titania.d.ts",
|
|
536
|
+
"import": "./dist/places/search/titania.js",
|
|
537
|
+
"default": "./dist/places/search/titania.js"
|
|
538
|
+
},
|
|
539
|
+
"./places/search/oberon": {
|
|
540
|
+
"types": "./dist/places/search/oberon.d.ts",
|
|
541
|
+
"import": "./dist/places/search/oberon.js",
|
|
542
|
+
"default": "./dist/places/search/oberon.js"
|
|
543
|
+
},
|
|
544
|
+
"./places/search/triton": {
|
|
545
|
+
"types": "./dist/places/search/triton.d.ts",
|
|
546
|
+
"import": "./dist/places/search/triton.js",
|
|
547
|
+
"default": "./dist/places/search/triton.js"
|
|
548
|
+
},
|
|
549
|
+
"./places/search/pluto": {
|
|
550
|
+
"types": "./dist/places/search/pluto.d.ts",
|
|
551
|
+
"import": "./dist/places/search/pluto.js",
|
|
552
|
+
"default": "./dist/places/search/pluto.js"
|
|
553
|
+
},
|
|
554
|
+
"./places/search/charon": {
|
|
555
|
+
"types": "./dist/places/search/charon.d.ts",
|
|
556
|
+
"import": "./dist/places/search/charon.js",
|
|
557
|
+
"default": "./dist/places/search/charon.js"
|
|
558
|
+
},
|
|
559
|
+
"./places/search/ceres": {
|
|
560
|
+
"types": "./dist/places/search/ceres.d.ts",
|
|
561
|
+
"import": "./dist/places/search/ceres.js",
|
|
562
|
+
"default": "./dist/places/search/ceres.js"
|
|
563
|
+
},
|
|
564
|
+
"./places/search/vesta": {
|
|
565
|
+
"types": "./dist/places/search/vesta.d.ts",
|
|
566
|
+
"import": "./dist/places/search/vesta.js",
|
|
567
|
+
"default": "./dist/places/search/vesta.js"
|
|
568
|
+
},
|
|
569
|
+
"./places/search/eros": {
|
|
570
|
+
"types": "./dist/places/search/eros.d.ts",
|
|
571
|
+
"import": "./dist/places/search/eros.js",
|
|
572
|
+
"default": "./dist/places/search/eros.js"
|
|
573
|
+
},
|
|
574
|
+
"./places/search/ryugu": {
|
|
575
|
+
"types": "./dist/places/search/ryugu.d.ts",
|
|
576
|
+
"import": "./dist/places/search/ryugu.js",
|
|
577
|
+
"default": "./dist/places/search/ryugu.js"
|
|
578
|
+
},
|
|
579
|
+
"./places/search/bennu": {
|
|
580
|
+
"types": "./dist/places/search/bennu.d.ts",
|
|
581
|
+
"import": "./dist/places/search/bennu.js",
|
|
582
|
+
"default": "./dist/places/search/bennu.js"
|
|
583
|
+
},
|
|
584
|
+
"./places/search/dimorphos": {
|
|
585
|
+
"types": "./dist/places/search/dimorphos.d.ts",
|
|
586
|
+
"import": "./dist/places/search/dimorphos.js",
|
|
587
|
+
"default": "./dist/places/search/dimorphos.js"
|
|
588
|
+
},
|
|
589
|
+
"./places/search/tempel-1": {
|
|
590
|
+
"types": "./dist/places/search/tempel-1.d.ts",
|
|
591
|
+
"import": "./dist/places/search/tempel-1.js",
|
|
592
|
+
"default": "./dist/places/search/tempel-1.js"
|
|
593
|
+
},
|
|
594
|
+
"./places/search/67p": {
|
|
595
|
+
"types": "./dist/places/search/67p.d.ts",
|
|
596
|
+
"import": "./dist/places/search/67p.js",
|
|
597
|
+
"default": "./dist/places/search/67p.js"
|
|
598
|
+
},
|
|
599
|
+
"./places/search/jupiter": {
|
|
600
|
+
"types": "./dist/places/search/jupiter.d.ts",
|
|
601
|
+
"import": "./dist/places/search/jupiter.js",
|
|
602
|
+
"default": "./dist/places/search/jupiter.js"
|
|
603
|
+
},
|
|
604
|
+
"./places/search/saturn": {
|
|
605
|
+
"types": "./dist/places/search/saturn.d.ts",
|
|
606
|
+
"import": "./dist/places/search/saturn.js",
|
|
607
|
+
"default": "./dist/places/search/saturn.js"
|
|
608
|
+
},
|
|
609
|
+
"./places/search/amalthea": {
|
|
610
|
+
"types": "./dist/places/search/amalthea.d.ts",
|
|
611
|
+
"import": "./dist/places/search/amalthea.js",
|
|
612
|
+
"default": "./dist/places/search/amalthea.js"
|
|
613
|
+
},
|
|
614
|
+
"./places/search/dactyl": {
|
|
615
|
+
"types": "./dist/places/search/dactyl.d.ts",
|
|
616
|
+
"import": "./dist/places/search/dactyl.js",
|
|
617
|
+
"default": "./dist/places/search/dactyl.js"
|
|
618
|
+
},
|
|
619
|
+
"./places/search/deimos": {
|
|
620
|
+
"types": "./dist/places/search/deimos.d.ts",
|
|
621
|
+
"import": "./dist/places/search/deimos.js",
|
|
622
|
+
"default": "./dist/places/search/deimos.js"
|
|
623
|
+
},
|
|
624
|
+
"./places/search/didymos": {
|
|
625
|
+
"types": "./dist/places/search/didymos.d.ts",
|
|
626
|
+
"import": "./dist/places/search/didymos.js",
|
|
627
|
+
"default": "./dist/places/search/didymos.js"
|
|
628
|
+
},
|
|
629
|
+
"./places/search/dinkinesh": {
|
|
630
|
+
"types": "./dist/places/search/dinkinesh.d.ts",
|
|
631
|
+
"import": "./dist/places/search/dinkinesh.js",
|
|
632
|
+
"default": "./dist/places/search/dinkinesh.js"
|
|
633
|
+
},
|
|
634
|
+
"./places/search/donaldjohanson": {
|
|
635
|
+
"types": "./dist/places/search/donaldjohanson.d.ts",
|
|
636
|
+
"import": "./dist/places/search/donaldjohanson.js",
|
|
637
|
+
"default": "./dist/places/search/donaldjohanson.js"
|
|
638
|
+
},
|
|
639
|
+
"./places/search/epimetheus": {
|
|
640
|
+
"types": "./dist/places/search/epimetheus.d.ts",
|
|
641
|
+
"import": "./dist/places/search/epimetheus.js",
|
|
642
|
+
"default": "./dist/places/search/epimetheus.js"
|
|
643
|
+
},
|
|
644
|
+
"./places/search/gaspra": {
|
|
645
|
+
"types": "./dist/places/search/gaspra.d.ts",
|
|
646
|
+
"import": "./dist/places/search/gaspra.js",
|
|
647
|
+
"default": "./dist/places/search/gaspra.js"
|
|
648
|
+
},
|
|
649
|
+
"./places/search/hyperion": {
|
|
650
|
+
"types": "./dist/places/search/hyperion.d.ts",
|
|
651
|
+
"import": "./dist/places/search/hyperion.js",
|
|
652
|
+
"default": "./dist/places/search/hyperion.js"
|
|
653
|
+
},
|
|
654
|
+
"./places/search/ida": {
|
|
655
|
+
"types": "./dist/places/search/ida.d.ts",
|
|
656
|
+
"import": "./dist/places/search/ida.js",
|
|
657
|
+
"default": "./dist/places/search/ida.js"
|
|
658
|
+
},
|
|
659
|
+
"./places/search/itokawa": {
|
|
660
|
+
"types": "./dist/places/search/itokawa.d.ts",
|
|
661
|
+
"import": "./dist/places/search/itokawa.js",
|
|
662
|
+
"default": "./dist/places/search/itokawa.js"
|
|
663
|
+
},
|
|
664
|
+
"./places/search/janus": {
|
|
665
|
+
"types": "./dist/places/search/janus.d.ts",
|
|
666
|
+
"import": "./dist/places/search/janus.js",
|
|
667
|
+
"default": "./dist/places/search/janus.js"
|
|
668
|
+
},
|
|
669
|
+
"./places/search/lutetia": {
|
|
670
|
+
"types": "./dist/places/search/lutetia.d.ts",
|
|
671
|
+
"import": "./dist/places/search/lutetia.js",
|
|
672
|
+
"default": "./dist/places/search/lutetia.js"
|
|
673
|
+
},
|
|
674
|
+
"./places/search/mathilde": {
|
|
675
|
+
"types": "./dist/places/search/mathilde.d.ts",
|
|
676
|
+
"import": "./dist/places/search/mathilde.js",
|
|
677
|
+
"default": "./dist/places/search/mathilde.js"
|
|
678
|
+
},
|
|
679
|
+
"./places/search/phobos": {
|
|
680
|
+
"types": "./dist/places/search/phobos.d.ts",
|
|
681
|
+
"import": "./dist/places/search/phobos.js",
|
|
682
|
+
"default": "./dist/places/search/phobos.js"
|
|
683
|
+
},
|
|
684
|
+
"./places/search/phoebe": {
|
|
685
|
+
"types": "./dist/places/search/phoebe.d.ts",
|
|
686
|
+
"import": "./dist/places/search/phoebe.js",
|
|
687
|
+
"default": "./dist/places/search/phoebe.js"
|
|
688
|
+
},
|
|
689
|
+
"./places/search/proteus": {
|
|
690
|
+
"types": "./dist/places/search/proteus.d.ts",
|
|
691
|
+
"import": "./dist/places/search/proteus.js",
|
|
692
|
+
"default": "./dist/places/search/proteus.js"
|
|
693
|
+
},
|
|
694
|
+
"./places/search/steins": {
|
|
695
|
+
"types": "./dist/places/search/steins.d.ts",
|
|
696
|
+
"import": "./dist/places/search/steins.js",
|
|
697
|
+
"default": "./dist/places/search/steins.js"
|
|
698
|
+
},
|
|
699
|
+
"./places/search/thebe": {
|
|
700
|
+
"types": "./dist/places/search/thebe.d.ts",
|
|
701
|
+
"import": "./dist/places/search/thebe.js",
|
|
702
|
+
"default": "./dist/places/search/thebe.js"
|
|
703
|
+
},
|
|
704
|
+
"./places/search/moon-satellites": {
|
|
705
|
+
"types": "./dist/places/search/moon-satellites.d.ts",
|
|
706
|
+
"import": "./dist/places/search/moon-satellites.js",
|
|
707
|
+
"default": "./dist/places/search/moon-satellites.js"
|
|
708
|
+
},
|
|
434
709
|
"./orbiters": {
|
|
435
710
|
"types": "./dist/orbiters.d.ts",
|
|
436
711
|
"import": "./dist/orbiters.js",
|