From 24eb3c96b8bce0d52a23e635cef220123cfc74a5 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 5 Dec 2026 22:19:10 +0100 Subject: [PATCH] Cut 10b plume polish: soot/rim separation, uncuffed flow/curl, lazy flow sampling --- client/AtmosphereSystem.cs | 2 +- client/VolumetricEmitterPool.cs | 27 ++++++------ client/volumetric_raymarch.glsl | 75 +++++++++++++++++++------------- client/volumetric_tile_cull.glsl | 2 +- 4 files changed, 60 insertions(+), 46 deletions(-) diff --git a/client/AtmosphereSystem.cs b/client/AtmosphereSystem.cs index e8e7ff6..5c549e0 100644 --- a/client/AtmosphereSystem.cs +++ b/client/AtmosphereSystem.cs @@ -280,7 +280,7 @@ public partial class AtmosphereSystem : Node baked.SunLightEnergy, baked.SunLightColor, ambCol, - extinctionScale: mapKind == ArenaMapKind.Sion ? 0.34f : 0.30f); + extinctionScale: mapKind == ArenaMapKind.Sion ? 0.95f : 0.85f); } } diff --git a/client/VolumetricEmitterPool.cs b/client/VolumetricEmitterPool.cs index d9a57ce..b6d567b 100644 --- a/client/VolumetricEmitterPool.cs +++ b/client/VolumetricEmitterPool.cs @@ -170,7 +170,8 @@ public sealed class VolumetricEmitterPool float rA = MathF.Max(0.25f, Mathf.Lerp(s.RadiusA0, s.RadiusA1, t)); float rB = MathF.Max(0.25f, Mathf.Lerp(s.RadiusB0, s.RadiusB1, t)); - float temp = MathF.Max(0f, Mathf.Lerp(s.Temp0, s.Temp1, t)); + float tempT = MathF.Pow(t, 1.45f); + float temp = MathF.Max(0f, Mathf.Lerp(s.Temp0, s.Temp1, tempT)); Color tint = s.Tint0.Lerp(s.Tint1, t); uint ageByte = (uint)Math.Clamp((int)(t * 255f), 0, 255); @@ -483,10 +484,10 @@ public sealed class VolumetricEmitterPool ? new Color(0.24f, 0.62f, 0.14f) : isThermal ? new Color(0.12f, 0.22f, 0.28f) - : gLin * 0.48f + new Color(0.06f, 0.045f, 0.04f); - Color tint1 = new(0.06f, 0.055f, 0.05f); + : gLin * 0.30f + new Color(0.05f, 0.045f, 0.04f); + Color tint1 = new(0.05f, 0.048f, 0.045f); - float temp0 = (isPlasma || isThermal) ? 1.25f : (isAirburst || isRecoilless || wClass == WeaponVisualClass.RocketSalvo ? 1.65f : 1.15f); + float temp0 = (isPlasma || isThermal) ? 1.65f : (isAirburst || isRecoilless || wClass == WeaponVisualClass.RocketSalvo ? 2.10f : 1.70f); float life = (isRecoilless || wClass == WeaponVisualClass.RocketSalvo) ? 1.55f : (isThermal ? 0.50f : 0.95f); SpawnEmitter( @@ -502,7 +503,7 @@ public sealed class VolumetricEmitterPool density0: 1.85f, density1: 0.26f, temp0: temp0, - temp1: -0.35f, + temp1: 0.0f, tint0: tint0, tint1: tint1, lifetime: life, @@ -597,10 +598,10 @@ public sealed class VolumetricEmitterPool radiusB1: 4.5f * scale, density0: 2.15f, density1: 0.42f, - temp0: 1.65f, - temp1: 0.08f, - tint0: accentCol * 0.45f + new Color(0.14f, 0.11f, 0.09f), - tint1: new Color(0.08f, 0.075f, 0.07f), + temp0: 2.05f, + temp1: 0.10f, + tint0: accentCol * 0.32f + new Color(0.07f, 0.06f, 0.055f), + tint1: new Color(0.055f, 0.05f, 0.048f), lifetime: 2.1f, flowSpeed: 0.8f, softness: 0.40f, @@ -918,8 +919,8 @@ public sealed class VolumetricEmitterPool public void EmitFootstepOrTirePuff(Vector3 pos, Color groundTint, float scale) { - // Strictly gated under 72 active emitters so combat explosions never drop slots and desert stays punchy - if (ActiveEmitterCount >= 72) + // Strictly gated under 48 active emitters so combat explosions never drop slots and desert stays within GPU budget + if (ActiveEmitterCount >= 48) { return; } @@ -934,8 +935,8 @@ public sealed class VolumetricEmitterPool radiusA1: 1.55f * scale, radiusB0: 0.58f * scale, radiusB1: 1.75f * scale, - density0: 0.90f, - density1: 0.10f, + density0: 0.38f, + density1: 0.04f, temp0: 0f, temp1: 0f, tint0: gLin * 1.1f, diff --git a/client/volumetric_raymarch.glsl b/client/volumetric_raymarch.glsl index 4828893..4bfe5ee 100644 --- a/client/volumetric_raymarch.glsl +++ b/client/volumetric_raymarch.glsl @@ -268,7 +268,7 @@ void main() { for (uint k = 0u; k < sTileCount; k++) { VolumetricEmitter em = sEmitters[k]; - float rBound = max(em.posRadius.w, em.params.y) * 1.85; + float rBound = max(em.posRadius.w, em.params.y) * 1.95; float t0, t1; if (intersectCapsule(ro, rd, em.posRadius.xyz, em.endRadiusTemp.xyz, rBound, t0, t1)) { t0 = max(2.0, t0); @@ -313,16 +313,16 @@ void main() { float t = 0.0; int steps = 0; int iter = 0; - const int MaxSteps = 16; - const int MaxIter = 28; + const int MaxSteps = 10; + const int MaxIter = 15; - while ((nextIdx < hitCount || activeMask != 0u) && t < tEndMax && T >= 0.015 && steps < MaxSteps && iter < MaxIter) { + while ((nextIdx < hitCount || activeMask != 0u) && t < tEndMax && T >= 0.03 && steps < MaxSteps && iter < MaxIter) { // Empty-space jump directly to nextIdx's t0 whenever no emitter is currently active if (activeMask == 0u) { float minNext = uintBitsToFloat(hitPack[nextIdx] & 0xFFFFFFE0u); float nextT1 = hitT1[nextIdx]; float chord = max(0.0, nextT1 - minNext); - float dsLeap = max(0.36, 0.26 + 0.011 * minNext); + float dsLeap = max(0.42, 0.32 + 0.014 * minNext); float jitter = ign * min(dsLeap, max(0.05, chord * 0.45)); t = min(max(t, minNext) + jitter, tEndMax - 1e-4); if (t >= tEndMax) { @@ -330,7 +330,7 @@ void main() { } } - float ds = max(0.36, 0.26 + 0.011 * t); + float ds = max(0.42, 0.32 + 0.014 * t); float tLo = t - 0.5 * ds; float tHi = t + 0.5 * ds; @@ -366,11 +366,10 @@ void main() { float emitNearFade = smoothstep(2.5, 8.5, t); if (nearFade > 0.001) { vec3 worldPos = ro + rd * t; - vec3 flowUv = (worldPos - u_frame.flowOriginVoxel.xyz) * u_frame.flowInvExtentDt.xyz; - vec4 flowSample = (all(greaterThanEqual(flowUv, vec3(0.0))) && all(lessThanEqual(flowUv, vec3(1.0)))) - ? textureLod(u_flowField, flowUv, 0.0) - : vec4(0.0); - float shock = clamp(flowSample.a, 0.0, 1.5); + bool hasFlow = false; + vec4 flowSample = vec4(0.0); + float shock = 0.0; + vec3 stepCurl = vec3(0.0); float rhoSum = 0.0; vec3 albedoSum = vec3(0.0); @@ -378,7 +377,6 @@ void main() { float tempSum = 0.0; float noiseSum = 0.0; float plasmaSum = 0.0; - vec3 stepCurl = aetheriaFlow(worldPos - flowSample.rgb * 0.20, 11.0, 0.68, elapsed); uint am = activeMask; while (am != 0u) { @@ -401,23 +399,36 @@ void main() { vec3 ab = B - A; float ab2 = dot(ab, ab); - // Conservative un-displaced distance guard before running triNoise3d + // Conservative squared-distance guard BEFORE sampling 3D flow texture or Tri3D curl (matches 1.95 * rad rBound) float preSegT = ab2 > 1e-5 ? clamp(dot(worldPos - A, ab) / ab2, 0.0, 1.0) : 0.0; float preRad = mix(rA, rB, preSegT); - if (length(worldPos - (A + ab * preSegT)) > 1.05 * preRad + 0.80 * radAvg) { + vec3 preDelta = worldPos - (A + ab * preSegT); + float rGuard = 1.15 * preRad + 0.80 * radAvg; + if (dot(preDelta, preDelta) > rGuard * rGuard) { continue; } - // Bound flow + curl displacement strictly inside rBound (1.85 * rad) so zero spherical/tile clipping occurs - vec3 flowOffset = flowSample.rgb * (0.16 + 0.12 * ageNorm); + if (!hasFlow) { + vec3 flowUv = (worldPos - u_frame.flowOriginVoxel.xyz) * u_frame.flowInvExtentDt.xyz; + flowSample = (all(greaterThanEqual(flowUv, vec3(0.0))) && all(lessThanEqual(flowUv, vec3(1.0)))) + ? textureLod(u_flowField, flowUv, 0.0) + : vec4(0.0); + shock = clamp(flowSample.a, 0.0, 1.5); + stepCurl = aetheriaFlow(worldPos - flowSample.rgb * 0.20, 11.0, 0.68, elapsed); + hasFlow = true; + } + + // Uncuffed 3D flow advection + wind/buoyancy shear + age-grown Tri3D curl bounded inside rBound (1.95 * rad) + vec3 flowOffset = flowSample.rgb * (0.28 + 0.45 * ageNorm); + float advSegT = ab2 > 1e-5 ? clamp(dot((worldPos - flowOffset) - A, ab) / ab2, 0.0, 1.0) : 0.0; + flowOffset += vec3(flowSample.r, 0.0, flowSample.b) * (0.32 * advSegT * (0.35 + ageNorm)); float fOffLen = length(flowOffset); - if (fOffLen > 0.30 * radAvg) { - flowOffset *= (0.30 * radAvg) / fOffLen; + if (fOffLen > 0.62 * radAvg) { + flowOffset *= (0.62 * radAvg) / fOffLen; } vec3 advectedPos = worldPos - flowOffset; - // Gentle Tri3D flow warp (<= 0.24 * radAvg) so flow warps the plume organically without tearing it in half - float curlScale = 0.22 * radAvg * clamp(0.65 + 0.45 * abs(em.params.z), 0.55, 1.10); + float curlScale = mix(0.24, 0.46, clamp(ageNorm * 1.1 + advSegT * 0.45, 0.0, 1.0)) * radAvg; vec3 evalPos = advectedPos + stepCurl * curlScale; float segT = ab2 > 1e-5 ? clamp(dot(evalPos - A, ab) / ab2, 0.0, 1.0) : 0.0; @@ -427,7 +438,7 @@ void main() { vec3 radialVec = evalPos - closest; float distNorm = length(radialVec) / max(0.15, rad); - if (distNorm < 1.24) { + if (distNorm < 1.16) { // True Aetheria gradient-offset pattern (Volumetric.cginc:210-215): // triNoise3d ONLY offsets the smooth radial SDF gradient by a small centered displacement << 1.0 vec3 nCoord = (evalPos / max(1.4, rad * 0.95)) * 0.32 + vec3(seed); @@ -452,7 +463,7 @@ void main() { radialSum += safeNorm(radialVec + vec3(0.0, 0.28 * rad, 0.0)) * rho_k; // Tight radial temperature falloff: outer shell cools to un-emissive rolling soot - float coreRadial = pow(clamp(1.0 - warpedDist, 0.0, 1.0), 1.85); + float coreRadial = pow(clamp(1.0 - warpedDist, 0.0, 1.0), 2.35); float localTemp = max(em.endRadiusTemp.w * coreRadial, shock * 0.22); tempSum += localTemp * rho_k; noiseSum += clamp((n1 - 0.45 * n2) * 2.5 + 0.25, 0.0, 1.0) * rho_k; @@ -472,25 +483,27 @@ void main() { vec3 localUpOrRadial = safeNorm(radialSum); // Layer 1 & 2: Aetheria inverse-density charcoal soot contour (CloudShader.shader:96-97 / Volumetric.cginc:234) - // Thin wispy outer rims stay bright sunlit vapor; dense interior billows plunge into velvety charcoal soot - float sootContour = 1.0 / (1.0 + 4.4 * rawDens); - float rimBias = 0.65 + 0.45 * clamp(dot(localUpOrRadial, sunDir), -1.0, 1.0); - vec3 vaporAlbedo = mix(albedo, max(albedo, vec3(0.24, 0.23, 0.22)), 0.35 * sootContour); + // Dense interiors stay deep velvety charcoal soot; rimBoost (1.65) applies strictly to thin outer sunlit vapor edges + float sootContour = 1.0 / (1.0 + 4.6 * rawDens); + float sunAlignment = clamp(dot(localUpOrRadial, sunDir), -1.0, 1.0); + float rimBias = 0.36 + 0.64 * max(0.0, sunAlignment) + 0.14 * (0.5 + 0.5 * sunAlignment); + float rimFactor = 1.0 + 0.65 * smoothstep(0.25, 0.72, sootContour); + vec3 sunlitEdgeTint = mix(albedo, albedo * 1.35 + vec3(0.045, 0.040, 0.036), sootContour * smoothstep(0.10, 0.78, max(0.0, sunAlignment) + phase)); float vaporEdgeFade = smoothstep(0.0, 0.08, rawDens); - vec3 scatterLum = vaporAlbedo * (sootContour * vaporEdgeFade * 1.65) * (sunRad * (rimBias + phase * 2.4) + ambRad * 0.48); + vec3 scatterLum = sunlitEdgeTint * (sootContour * vaporEdgeFade * rimFactor) * (sunRad * (rimBias + phase * 2.6) + ambRad * 0.25); // Layer 3: Sharp turbulent core-only combustion peeking through dark soot crevices vec3 plasmaEmit = vec3(0.0); float coreSignal = coreTemp * (0.85 + 0.30 * stepNoise); - float coreGate = smoothstep(0.60, 0.92, coreSignal); + float coreGate = smoothstep(0.72, 1.05, coreSignal); if (coreGate > 0.001) { - float coreGlow = pow(clamp(rawDens, 0.0, 1.5), 2.1) * coreGate; + float coreGlow = pow(clamp(rawDens, 0.0, 1.4), 2.15) * coreGate; vec3 bb = blackbodyRamp(coreTemp); float plasmaMix = plasmaSum / rhoSum; if (plasmaMix > 0.01) { bb = mix(bb, albedo * (1.55 + 2.05 * coreTemp), 0.75 * plasmaMix); } - plasmaEmit = bb * (coreGlow * 6.4) * emitNearFade; + plasmaEmit = bb * (coreGlow * 5.0) * emitNearFade; } float sigmaT = rawDens * extScale; @@ -501,7 +514,7 @@ void main() { L += T * stepLight; T *= stepTrans; steps++; - if (T < 0.015) { + if (T < 0.03) { T = 0.0; break; } diff --git a/client/volumetric_tile_cull.glsl b/client/volumetric_tile_cull.glsl index 8b0bf07..baf22a8 100644 --- a/client/volumetric_tile_cull.glsl +++ b/client/volumetric_tile_cull.glsl @@ -128,7 +128,7 @@ void main() { VolumetricEmitter em = u_emitters.emitters[tid]; float rA = em.posRadius.w; float rB = em.params.y; - float rBound = max(rA, rB) * 1.85; + float rBound = max(rA, rB) * 1.95; vec3 wA = em.posRadius.xyz - u_frame.camPosTime.xyz; vec3 wB = em.endRadiusTemp.xyz - u_frame.camPosTime.xyz;