contrails: distance-scaled ribbon width (sub-pixel fix), brighter head, far longer visible range
This commit is contained in:
1 parent
4ecef21729
commit
1879a6912a
1 file changed
+11
-9
Vendored
+11
-9
@@ -2892,13 +2892,13 @@ var CT_FRAG_SRC = [
|
|||||||
'float dens = 0.62 + 0.38 * sin(along) * sin(along * 2.7 + 1.3);',
|
'float dens = 0.62 + 0.38 * sin(along) * sin(along * 2.7 + 1.3);',
|
||||||
'if (dens < 0.0) dens = 0.0;',
|
'if (dens < 0.0) dens = 0.0;',
|
||||||
// eroded, uneven edges: the stripe narrows and widens along u
|
// eroded, uneven edges: the stripe narrows and widens along u
|
||||||
'float wob = 0.45 + 0.55 * (0.5 + 0.5 * sin(along * 3.1 + 7.0));',
|
'float wob = 0.55 + 0.45 * (0.5 + 0.5 * sin(along * 3.1 + 7.0));',
|
||||||
'float side = abs(vV);',
|
'float side = abs(vV);',
|
||||||
'float edge = 1.0 - smoothstep(wob * 0.30, wob, side);',
|
'float edge = 1.0 - smoothstep(wob * 0.22, wob, side);',
|
||||||
// older tail also thins out across its width
|
// older tail also thins out across its width
|
||||||
'edge *= 0.35 + 0.65 * pow(vU, 0.6);',
|
'edge *= 0.45 + 0.55 * pow(vU, 0.6);',
|
||||||
'if (edge <= 0.0) discard;',
|
'if (edge <= 0.0) discard;',
|
||||||
'float a = vS * pow(vU, 1.25) * 0.95 * dens * edge;',
|
'float a = vS * pow(vU, 1.15) * 1.15 * dens * edge;',
|
||||||
'if (a <= 0.004) discard;',
|
'if (a <= 0.004) discard;',
|
||||||
'gl_FragColor = vec4(0.95, 0.96, 1.0, a);',
|
'gl_FragColor = vec4(0.95, 0.96, 1.0, a);',
|
||||||
'}'
|
'}'
|
||||||
@@ -3774,11 +3774,13 @@ window.clouds3dRender = function(target) {
|
|||||||
fltLegAt(stc.leg, stc.s - tl * 0.5, _cs);
|
fltLegAt(stc.leg, stc.s - tl * 0.5, _cs);
|
||||||
var cdx = _cs.x - camX, cdy = stc.y - camY, cdz = _cs.z - camZ;
|
var cdx = _cs.x - camX, cdy = stc.y - camY, cdz = _cs.z - camZ;
|
||||||
var distc = Math.sqrt(cdx * cdx + cdy * cdy + cdz * cdz);
|
var distc = Math.sqrt(cdx * cdx + cdy * cdy + cdz * cdz);
|
||||||
// gentle distance thinning only - trails should stay
|
// gentle distance thinning only
|
||||||
// readable across the whole visible sky
|
var dfc = 1 - (distc - 16) / 10;
|
||||||
var dfc = 1 - (distc - 12) / 12;
|
|
||||||
if (dfc > 1) dfc = 1; else if (dfc <= 0.02) continue;
|
if (dfc > 1) dfc = 1; else if (dfc <= 0.02) continue;
|
||||||
var strg = gt * dayf * dfc * 0.9;
|
var strg = gt * dayf * dfc;
|
||||||
|
// widen with distance: a fixed 310 m ribbon is sub-pixel at
|
||||||
|
// 150 km and blends away; grow it to hold ~2-4 screen px
|
||||||
|
var hw = CT_HALF_W + distc * 0.0025;
|
||||||
var ph = fltData[cj].phase;
|
var ph = fltData[cj].phase;
|
||||||
var hy = stc.y;
|
var hy = stc.y;
|
||||||
var prev = null, cur = _sk0;
|
var prev = null, cur = _sk0;
|
||||||
@@ -3787,7 +3789,7 @@ window.clouds3dRender = function(target) {
|
|||||||
if (dd < 0) dd = 0;
|
if (dd < 0) dd = 0;
|
||||||
fltLegAt(stc.leg, dd, _cs);
|
fltLegAt(stc.leg, dd, _cs);
|
||||||
cur.x = _cs.x; cur.z = _cs.z;
|
cur.x = _cs.x; cur.z = _cs.z;
|
||||||
cur.px = _cs.tz * CT_HALF_W; cur.pz = -_cs.tx * CT_HALF_W;
|
cur.px = _cs.tz * hw; cur.pz = -_cs.tx * hw;
|
||||||
cur.u = sk / CT_SEG;
|
cur.u = sk / CT_SEG;
|
||||||
if (prev) {
|
if (prev) {
|
||||||
_ctVert(prev.x + prev.px, hy, prev.z + prev.pz, prev.u, 1, strg, ph);
|
_ctVert(prev.x + prev.px, hy, prev.z + prev.pz, prev.u, 1, strg, ph);
|
||||||
|
|||||||
Reference in new issue
Block a user