Spaces:
Running
Running
Upload index.html with huggingface_hub
Browse files3883 unmodified lines388438853886388738883889666 unmodified lines4556455745584559456045614562165 unmodified lines472847294730473147324733473466 unmodified lines480148024803480448054806480748084809481076 unmodified lines48874888488948904891489248934894489548962429 unmodified lines73267327732873297330733173327333144 unmodified lines74787479748074817482748374843883 unmodified linesconst float AW_SK_LOBE_TAU = 0.60; // how hard a lobe bends the shading columnconst float AW_SK_LID = 90000.0; // metres at which a deck's distance saturatesconst float AW_SK_TAU_CUM = 5.5; // optical depth of a fully opaque cumulusconst vec3 AW_SK_MS_TINT = vec3(0.70, 0.80, 0.95);// Rayleigh is pulled up as the aerosol is pulled back: the two together set the// sky's luminance, and only their ratio sets its colour. At 0.55 with the flat666 unmodified lines// two parallaxes and stops looking like one sheet of wallpaper. Same// interpolation as the cumulus, with a lower ceiling of its own.float awSkyCoverage2(vec2 q) {float base = 0.085 + 0.62 * awFbm2(q * 0.30 - 41.3, 3, 2.11, 0.5);return clamp(mix(base, 0.52 + 0.34 * base, awSkyWindCover()), 0.04, 0.88);}165 unmodified lines// cirrus is a minority sky: it is the thin high layer you see *through* the// gaps, not the thing the sky is made of, and at 0.52 it stopped reading as// a high deck at all and became the weather.float d2 = awSkyCloudDensity(q2, 0.30 + 0.16 * wind, uQuality < 1.5 ? 3 : 4, 0.0,AW_SK_CIRRUS_SOFT * (0.78 + 0.22 * wedge), det2);if (d2 > 0.004) {float slant = 1.0 / max(uSunDir.y, 0.14);66 unmodified linesfloat dist1 = min((AW_SK_DECK_H - uCamPos.y) / max(dir.y, 0.03), 90000.0);float cover = awSkyCoverage(q1);float det1 = awSkyCloudDetailLod(q1, 61.3, dist1, AW_SK_CELL);float d1 = awSkyCloudDensity(q1, cover, uQuality < 1.5 ? 4 : 5,lod == 0 ? 0.9 : 0.0,AW_SK_CUM_SOFT * mix(1.55, 0.85, cover)* (0.78 + 0.22 * wedge), det1);d1 = mix(d1, mix(d1, cover, 0.65), deckAA);if (d1 > 0.004) {// Transmittance of the sun to this point, read a good fraction of a cell76 unmodified lines// between the base and the sky. This is the gradient the deck was missing// between the rim and the body, and it is why the base read as the same// value as the top.vec3 c1 = sunE * (0.28 * lit) * towers+ amb * (0.17 + 0.28 * shade) * (1.0 - 0.20 * thick)+ sunE * (0.030 * shade)+ uSunColor * (0.28 * flank * lit) * (1.0 - 0.75 * wind)+ msSheet;// A gale desaturates the deck: a storm sky is a grey sheet, not a summer2429 unmodified lines* the backs of the swell β satisfying the one thing the gradient-keyed version* got right β without handing it the placement, which stays with the chop.* ---------------------------------------------------------------------- */#define AW_FOAM_BREAK_LO 0.22#define AW_FOAM_BREAK_HI 0.38#define AW_FOAM_BREAK_WID 0.22float awWaveBreakFrom(float B, float lean, float h, float S) {144 unmodified linesfloat fray = awFbm2(vec2(along, across) * 3.10 + vec2(uTime * 0.08, 0.0), 2, 2.4, 0.5);edge = mix(0.38, edge, lodEdge);fray = mix(0.50, fray, lodFray);float mask = clamp((edge * 0.80 + 0.20) * (0.30 + 1.20 * cover) + 0.35 * fray * cover,0.0, 1.5);// Spindrift. Above about 15 m/s the wind no longer just leaves foam behind,3883 unmodified lines3884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914666 unmodified lines45814582458345844585458645874588458945904591459245934594165 unmodified lines476047614762476347644765476666 unmodified lines483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490576 unmodified lines49824983498449854986498749884989499049914992499349944995499649972429 unmodified lines74277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449144 unmodified lines7594759575967597759875997600760176027603760476057606760776083883 unmodified linesconst float AW_SK_LOBE_TAU = 0.60; // how hard a lobe bends the shading columnconst float AW_SK_LID = 90000.0; // metres at which a deck's distance saturatesconst float AW_SK_TAU_CUM = 5.5; // optical depth of a fully opaque cumulus// How deep the cumulus deck is, and how its mass narrows as it rises. These// three are the difference between a cloud and a cutout, and they exist because// the deck used to be read at one height only.//// A fair-weather cumulus is about a kilometre of vertical development standing// on a condensation level, and its defining shape is that it is WIDE AT THE// BASE AND NARROW AT THE TOP: the base is the flat plane where the rising air// first reaches saturation, and above it only the strongest columns keep going.// A body that holds its width all the way up is a cylinder, and a cylinder seen// from below is a disc, which is exactly what a single-height sample produces.//// So the deck gets a top, the ray is walked between the two, and the coverage// is tightened with height by AW_SK_CUM_TAPER. The taper is what carves the// dome: it removes the weak columns first, so the summit that survives is the// core of the cloud rather than its outline, and a sightline that clears that// summit is genuinely clear sky rather than a faded edge.const float AW_SK_CUM_TOP = 2250.0; // metres, top of the cumulus deckconst int AW_SK_CUM_STEPS = 4; // samples between base and topconst float AW_SK_CUM_TAPER = 0.55; // coverage lost at the very top// Extinction of one step of unit density, along the SUN's slant. It sets how// deep a cloud has to be before its own mass starts shading its base: at 0.85 a// full-density column leaves about a third of its light reaching the bottom,// and a tenth-density wisp keeps nearly all of it.const float AW_SK_CUM_EXT = 0.85;const vec3 AW_SK_MS_TINT = vec3(0.70, 0.80, 0.95);// Rayleigh is pulled up as the aerosol is pulled back: the two together set the// sky's luminance, and only their ratio sets its colour. At 0.55 with the flat666 unmodified lines// two parallaxes and stops looking like one sheet of wallpaper. Same// interpolation as the cumulus, with a lower ceiling of its own.float awSkyCoverage2(vec2 q) {// Thinned, and the reason is composition rather than weather. All three decks// used to run at comparable coverage β cirrus 0.30, this one 0.40, cumulus// 0.49 β and three unrelated sheets layered at half cover is not a sky any// real hour produces. It is a stack of veils, and what the eye reads in it is// whichever sheet happens to be nearest: horizontal smear. Keeping the upper// decks as the minority they are in a fair-weather sky is what lets the// cumulus below read as the cloud the sky is made of.float base = 0.045 + 0.38 * awFbm2(q * 0.30 - 41.3, 3, 2.11, 0.5);return clamp(mix(base, 0.52 + 0.34 * base, awSkyWindCover()), 0.04, 0.88);}165 unmodified lines// cirrus is a minority sky: it is the thin high layer you see *through* the// gaps, not the thing the sky is made of, and at 0.52 it stopped reading as// a high deck at all and became the weather.float d2 = awSkyCloudDensity(q2, 0.13 + 0.13 * wind, uQuality < 1.5 ? 3 : 4, 0.0,AW_SK_CIRRUS_SOFT * (0.78 + 0.22 * wedge), det2);if (d2 > 0.004) {float slant = 1.0 / max(uSunDir.y, 0.14);66 unmodified linesfloat dist1 = min((AW_SK_DECK_H - uCamPos.y) / max(dir.y, 0.03), 90000.0);float cover = awSkyCoverage(q1);float det1 = awSkyCloudDetailLod(q1, 61.3, dist1, AW_SK_CELL);float soft1 = AW_SK_CUM_SOFT * mix(1.55, 0.85, cover) * (0.78 + 0.22 * wedge);// The walk up through the deck. Each step reads the SAME field on a higher// plane, so what a sightline meets at the base and what it meets at the top// are two different places in the noise and the body is sheared rather than// extruded. The steps are cheap on purpose β fewer octaves, no edge detail β// because the fine field's entire job is the boundary, and the boundary is// the base sample, which keeps every octave it had.float colD = 0.0;float litFrac = 1.0;{float tBase = (AW_SK_DECK_H - uCamPos.y) / max(dir.y, 1e-3);float tTop = (AW_SK_CUM_TOP - uCamPos.y) / max(dir.y, 1e-3);float cumThick = max(AW_SK_CUM_TOP - AW_SK_DECK_H, 1.0);int steps = uQuality < 1.5 ? 3 : AW_SK_CUM_STEPS;float dt = (tTop - tBase) / float(steps);// Light does not enter a cloud from the side, it enters from the TOP, and// whatever the summit takes the base does not get. So the walk is run// downward and carries the optical depth of everything already crossed,// which is the one number that separates a brilliant cauliflower crown from// the flat grey underside beneath it. Read bottom-up instead and that shadow// has nowhere to come from: every level would be lit as though nothing stood// over it, which is precisely how a body of cloud ends up uniformly white// and flat however well its silhouette is shaped.float sunSlant = 1.0 / max(uSunDir.y, 0.18);float above = 0.0;float litSum = 0.0;for (int i = 0; i < steps; i++) {float h = uCamPos.y + dir.y * (tTop - (float(i) + 0.5) * dt);float f = clamp((h - AW_SK_DECK_H) / cumThick, 0.0, 1.0);float covH = cover * (1.0 - AW_SK_CUM_TAPER * f * f);float d = awSkyCloudDensity(awSkyDeckUV(dir, h, AW_SK_CELL), covH,uQuality < 1.5 ? 3 : 4, 0.0, soft1, 0.0);colD += d;litSum += exp(-above) * d;above += d * sunSlant * AW_SK_CUM_EXT;}colD /= float(steps);// As a FRACTION of the column's own mass, not as a raw sum. A wisp has to// read as fully lit β sunlight crosses it and comes out the other side β and// only a body deep enough to shade itself should lose anything. A raw sum// would dim the thin clouds in proportion to how little of them there is,// which is backwards.litFrac = litSum / max(colD * float(steps), 1e-4);}// Mean density along the column, not the density of one point. A sightline// that grazes the flank of a cloud low down and is clear above it now// measures thin, and one that passes through a core measures solid β which is// the whole of what a silhouette is.float d1 = awSkyCloudDensity(q1, cover, uQuality < 1.5 ? 4 : 5,lod == 0 ? 0.9 : 0.0, soft1, det1);// The base sample supplies the edge β it is the only one carrying the fine// field β and the column supplies the mass.//// How much of each is a function of how steeply the ray is climbing, and that// is not a taste: the four steps of the walk are separated horizontally by// dir.xz * dt, which at a degree above the horizon is kilometres. What the// column measures down there is therefore the MEAN OF THE WHOLE DECK rather// than a path through one cloud, and a mean has no structure in it β measured// on the first build of this, it flattened the entire grazing band into the// grey smear the deck was before. It is true in the limit and useless at four// samples. So the column takes over as the ray steepens, where its samples// are genuinely stacked in one cloud, and hands back to the base sample where// they are not.float columnW = 0.70 * smoothstep(0.05, 0.22, dir.y);d1 = mix(d1, colD, columnW);d1 = mix(d1, mix(d1, cover, 0.65), deckAA);if (d1 > 0.004) {// Transmittance of the sun to this point, read a good fraction of a cell76 unmodified lines// between the base and the sky. This is the gradient the deck was missing// between the rim and the body, and it is why the base read as the same// value as the top.// The direct term carries the column's own light budget. A wisp lets the// sun straight through and returns it, so it is bright for its mass; a body// deep enough to shade its own base returns less of what falls on it and// reads heavier. That difference is a property of the cloud, not a grade,// and it is the reason a sky of one coverage does not come out as one// value.vec3 c1 = sunE * (0.28 * lit) * towers * (0.72 + 0.62 * litFrac)+ amb * (0.17 + 0.28 * shade) * (1.0 - 0.20 * thick)+ sunE * (0.030 * shade)+ uSunColor * (0.46 * flank * exp(-dSun * 0.90)) * (1.0 - 0.75 * wind)+ msSheet;// A gale desaturates the deck: a storm sky is a grey sheet, not a summer2429 unmodified lines* the backs of the swell β satisfying the one thing the gradient-keyed version* got right β without handing it the placement, which stays with the chop.* ---------------------------------------------------------------------- */// The threshold is set from the MEASURED tail of B, not from the textbook 0.5,// and this is the second time it has had to be moved.//// The spectrum is deliberately slope-capped at about 0.28 (see the limiter in// rebuild), so B never reaches the Longuet-Higgins criterion at all: measured// over a dense grid at 11 m/s and amplitude 1 it runs p90 0.233, p98 0.374,// p99 0.405, and tops out at 0.523. A threshold of 0.30 with a 0.22-wide step// therefore puts brk at 0.26 at the ninety-eighth percentile -- the water the// model says is breaking hardest is more than three quarters clear on screen.// That is why the sea had no whitecaps to find: not the mask, not the mixing,// but a threshold sitting past the end of the distribution it is thresholding.//// These put the shoulder where the tail actually is, so the top couple of// percent of the sea -- which is Monahan's whitecap fraction at this wind --// comes out as foam rather than as a rounding error.#define AW_FOAM_BREAK_LO 0.17#define AW_FOAM_BREAK_HI 0.32#define AW_FOAM_BREAK_WID 0.22float awWaveBreakFrom(float B, float lean, float h, float S) {144 unmodified linesfloat fray = awFbm2(vec2(along, across) * 3.10 + vec2(uTime * 0.08, 0.0), 2, 2.4, 0.5);edge = mix(0.38, edge, lodEdge);fray = mix(0.50, fray, lodFray);// The worley field is the patch's TEAR LINE, so it thins the rim and leaves// the body alone. It used to do the exact opposite -- border 0.99 against an// interior of 0.27 -- and that is the whole reason a sea with foam in it// showed none. edge is ONE at the cell border, so multiplying the field by it// drew every whitecap as its own outline: a thin ring of white with dark// water in the middle, which is the one shape foam never has. A crest that// breaks is solid where it is breaking and torn where it stops, so the border// takes the loss and the interior keeps everything.float mask = clamp((1.0 - 0.55 * edge) * (0.30 + 1.20 * cover) + 0.35 * fray * cover,0.0, 1.5);// Spindrift. Above about 15 m/s the wind no longer just leaves foam behind,
index.html+134-10