Cut 10b plume polish: soot/rim separation, uncuffed flow/curl, lazy flow sampling
This commit is contained in:
parent
a6eba2cfa0
commit
24eb3c96b8
4 changed files with 60 additions and 46 deletions
|
|
@ -280,7 +280,7 @@ public partial class AtmosphereSystem : Node
|
||||||
baked.SunLightEnergy,
|
baked.SunLightEnergy,
|
||||||
baked.SunLightColor,
|
baked.SunLightColor,
|
||||||
ambCol,
|
ambCol,
|
||||||
extinctionScale: mapKind == ArenaMapKind.Sion ? 0.34f : 0.30f);
|
extinctionScale: mapKind == ArenaMapKind.Sion ? 0.95f : 0.85f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,8 @@ public sealed class VolumetricEmitterPool
|
||||||
|
|
||||||
float rA = MathF.Max(0.25f, Mathf.Lerp(s.RadiusA0, s.RadiusA1, t));
|
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 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);
|
Color tint = s.Tint0.Lerp(s.Tint1, t);
|
||||||
|
|
||||||
uint ageByte = (uint)Math.Clamp((int)(t * 255f), 0, 255);
|
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)
|
? new Color(0.24f, 0.62f, 0.14f)
|
||||||
: isThermal
|
: isThermal
|
||||||
? new Color(0.12f, 0.22f, 0.28f)
|
? new Color(0.12f, 0.22f, 0.28f)
|
||||||
: gLin * 0.48f + new Color(0.06f, 0.045f, 0.04f);
|
: gLin * 0.30f + new Color(0.05f, 0.045f, 0.04f);
|
||||||
Color tint1 = new(0.06f, 0.055f, 0.05f);
|
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);
|
float life = (isRecoilless || wClass == WeaponVisualClass.RocketSalvo) ? 1.55f : (isThermal ? 0.50f : 0.95f);
|
||||||
|
|
||||||
SpawnEmitter(
|
SpawnEmitter(
|
||||||
|
|
@ -502,7 +503,7 @@ public sealed class VolumetricEmitterPool
|
||||||
density0: 1.85f,
|
density0: 1.85f,
|
||||||
density1: 0.26f,
|
density1: 0.26f,
|
||||||
temp0: temp0,
|
temp0: temp0,
|
||||||
temp1: -0.35f,
|
temp1: 0.0f,
|
||||||
tint0: tint0,
|
tint0: tint0,
|
||||||
tint1: tint1,
|
tint1: tint1,
|
||||||
lifetime: life,
|
lifetime: life,
|
||||||
|
|
@ -597,10 +598,10 @@ public sealed class VolumetricEmitterPool
|
||||||
radiusB1: 4.5f * scale,
|
radiusB1: 4.5f * scale,
|
||||||
density0: 2.15f,
|
density0: 2.15f,
|
||||||
density1: 0.42f,
|
density1: 0.42f,
|
||||||
temp0: 1.65f,
|
temp0: 2.05f,
|
||||||
temp1: 0.08f,
|
temp1: 0.10f,
|
||||||
tint0: accentCol * 0.45f + new Color(0.14f, 0.11f, 0.09f),
|
tint0: accentCol * 0.32f + new Color(0.07f, 0.06f, 0.055f),
|
||||||
tint1: new Color(0.08f, 0.075f, 0.07f),
|
tint1: new Color(0.055f, 0.05f, 0.048f),
|
||||||
lifetime: 2.1f,
|
lifetime: 2.1f,
|
||||||
flowSpeed: 0.8f,
|
flowSpeed: 0.8f,
|
||||||
softness: 0.40f,
|
softness: 0.40f,
|
||||||
|
|
@ -918,8 +919,8 @@ public sealed class VolumetricEmitterPool
|
||||||
|
|
||||||
public void EmitFootstepOrTirePuff(Vector3 pos, Color groundTint, float scale)
|
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
|
// Strictly gated under 48 active emitters so combat explosions never drop slots and desert stays within GPU budget
|
||||||
if (ActiveEmitterCount >= 72)
|
if (ActiveEmitterCount >= 48)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -934,8 +935,8 @@ public sealed class VolumetricEmitterPool
|
||||||
radiusA1: 1.55f * scale,
|
radiusA1: 1.55f * scale,
|
||||||
radiusB0: 0.58f * scale,
|
radiusB0: 0.58f * scale,
|
||||||
radiusB1: 1.75f * scale,
|
radiusB1: 1.75f * scale,
|
||||||
density0: 0.90f,
|
density0: 0.38f,
|
||||||
density1: 0.10f,
|
density1: 0.04f,
|
||||||
temp0: 0f,
|
temp0: 0f,
|
||||||
temp1: 0f,
|
temp1: 0f,
|
||||||
tint0: gLin * 1.1f,
|
tint0: gLin * 1.1f,
|
||||||
|
|
|
||||||
|
|
@ -268,7 +268,7 @@ void main() {
|
||||||
|
|
||||||
for (uint k = 0u; k < sTileCount; k++) {
|
for (uint k = 0u; k < sTileCount; k++) {
|
||||||
VolumetricEmitter em = sEmitters[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;
|
float t0, t1;
|
||||||
if (intersectCapsule(ro, rd, em.posRadius.xyz, em.endRadiusTemp.xyz, rBound, t0, t1)) {
|
if (intersectCapsule(ro, rd, em.posRadius.xyz, em.endRadiusTemp.xyz, rBound, t0, t1)) {
|
||||||
t0 = max(2.0, t0);
|
t0 = max(2.0, t0);
|
||||||
|
|
@ -313,16 +313,16 @@ void main() {
|
||||||
float t = 0.0;
|
float t = 0.0;
|
||||||
int steps = 0;
|
int steps = 0;
|
||||||
int iter = 0;
|
int iter = 0;
|
||||||
const int MaxSteps = 16;
|
const int MaxSteps = 10;
|
||||||
const int MaxIter = 28;
|
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
|
// Empty-space jump directly to nextIdx's t0 whenever no emitter is currently active
|
||||||
if (activeMask == 0u) {
|
if (activeMask == 0u) {
|
||||||
float minNext = uintBitsToFloat(hitPack[nextIdx] & 0xFFFFFFE0u);
|
float minNext = uintBitsToFloat(hitPack[nextIdx] & 0xFFFFFFE0u);
|
||||||
float nextT1 = hitT1[nextIdx];
|
float nextT1 = hitT1[nextIdx];
|
||||||
float chord = max(0.0, nextT1 - minNext);
|
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));
|
float jitter = ign * min(dsLeap, max(0.05, chord * 0.45));
|
||||||
t = min(max(t, minNext) + jitter, tEndMax - 1e-4);
|
t = min(max(t, minNext) + jitter, tEndMax - 1e-4);
|
||||||
if (t >= tEndMax) {
|
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 tLo = t - 0.5 * ds;
|
||||||
float tHi = t + 0.5 * ds;
|
float tHi = t + 0.5 * ds;
|
||||||
|
|
||||||
|
|
@ -366,11 +366,10 @@ void main() {
|
||||||
float emitNearFade = smoothstep(2.5, 8.5, t);
|
float emitNearFade = smoothstep(2.5, 8.5, t);
|
||||||
if (nearFade > 0.001) {
|
if (nearFade > 0.001) {
|
||||||
vec3 worldPos = ro + rd * t;
|
vec3 worldPos = ro + rd * t;
|
||||||
vec3 flowUv = (worldPos - u_frame.flowOriginVoxel.xyz) * u_frame.flowInvExtentDt.xyz;
|
bool hasFlow = false;
|
||||||
vec4 flowSample = (all(greaterThanEqual(flowUv, vec3(0.0))) && all(lessThanEqual(flowUv, vec3(1.0))))
|
vec4 flowSample = vec4(0.0);
|
||||||
? textureLod(u_flowField, flowUv, 0.0)
|
float shock = 0.0;
|
||||||
: vec4(0.0);
|
vec3 stepCurl = vec3(0.0);
|
||||||
float shock = clamp(flowSample.a, 0.0, 1.5);
|
|
||||||
|
|
||||||
float rhoSum = 0.0;
|
float rhoSum = 0.0;
|
||||||
vec3 albedoSum = vec3(0.0);
|
vec3 albedoSum = vec3(0.0);
|
||||||
|
|
@ -378,7 +377,6 @@ void main() {
|
||||||
float tempSum = 0.0;
|
float tempSum = 0.0;
|
||||||
float noiseSum = 0.0;
|
float noiseSum = 0.0;
|
||||||
float plasmaSum = 0.0;
|
float plasmaSum = 0.0;
|
||||||
vec3 stepCurl = aetheriaFlow(worldPos - flowSample.rgb * 0.20, 11.0, 0.68, elapsed);
|
|
||||||
|
|
||||||
uint am = activeMask;
|
uint am = activeMask;
|
||||||
while (am != 0u) {
|
while (am != 0u) {
|
||||||
|
|
@ -401,23 +399,36 @@ void main() {
|
||||||
vec3 ab = B - A;
|
vec3 ab = B - A;
|
||||||
float ab2 = dot(ab, ab);
|
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 preSegT = ab2 > 1e-5 ? clamp(dot(worldPos - A, ab) / ab2, 0.0, 1.0) : 0.0;
|
||||||
float preRad = mix(rA, rB, preSegT);
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bound flow + curl displacement strictly inside rBound (1.85 * rad) so zero spherical/tile clipping occurs
|
if (!hasFlow) {
|
||||||
vec3 flowOffset = flowSample.rgb * (0.16 + 0.12 * ageNorm);
|
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);
|
float fOffLen = length(flowOffset);
|
||||||
if (fOffLen > 0.30 * radAvg) {
|
if (fOffLen > 0.62 * radAvg) {
|
||||||
flowOffset *= (0.30 * radAvg) / fOffLen;
|
flowOffset *= (0.62 * radAvg) / fOffLen;
|
||||||
}
|
}
|
||||||
vec3 advectedPos = worldPos - flowOffset;
|
vec3 advectedPos = worldPos - flowOffset;
|
||||||
|
|
||||||
// Gentle Tri3D flow warp (<= 0.24 * radAvg) so flow warps the plume organically without tearing it in half
|
float curlScale = mix(0.24, 0.46, clamp(ageNorm * 1.1 + advSegT * 0.45, 0.0, 1.0)) * radAvg;
|
||||||
float curlScale = 0.22 * radAvg * clamp(0.65 + 0.45 * abs(em.params.z), 0.55, 1.10);
|
|
||||||
vec3 evalPos = advectedPos + stepCurl * curlScale;
|
vec3 evalPos = advectedPos + stepCurl * curlScale;
|
||||||
|
|
||||||
float segT = ab2 > 1e-5 ? clamp(dot(evalPos - A, ab) / ab2, 0.0, 1.0) : 0.0;
|
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;
|
vec3 radialVec = evalPos - closest;
|
||||||
float distNorm = length(radialVec) / max(0.15, rad);
|
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):
|
// True Aetheria gradient-offset pattern (Volumetric.cginc:210-215):
|
||||||
// triNoise3d ONLY offsets the smooth radial SDF gradient by a small centered displacement << 1.0
|
// 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);
|
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;
|
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
|
// 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);
|
float localTemp = max(em.endRadiusTemp.w * coreRadial, shock * 0.22);
|
||||||
tempSum += localTemp * rho_k;
|
tempSum += localTemp * rho_k;
|
||||||
noiseSum += clamp((n1 - 0.45 * n2) * 2.5 + 0.25, 0.0, 1.0) * 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);
|
vec3 localUpOrRadial = safeNorm(radialSum);
|
||||||
|
|
||||||
// Layer 1 & 2: Aetheria inverse-density charcoal soot contour (CloudShader.shader:96-97 / Volumetric.cginc:234)
|
// 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
|
// 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.4 * rawDens);
|
float sootContour = 1.0 / (1.0 + 4.6 * rawDens);
|
||||||
float rimBias = 0.65 + 0.45 * clamp(dot(localUpOrRadial, sunDir), -1.0, 1.0);
|
float sunAlignment = clamp(dot(localUpOrRadial, sunDir), -1.0, 1.0);
|
||||||
vec3 vaporAlbedo = mix(albedo, max(albedo, vec3(0.24, 0.23, 0.22)), 0.35 * sootContour);
|
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);
|
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
|
// Layer 3: Sharp turbulent core-only combustion peeking through dark soot crevices
|
||||||
vec3 plasmaEmit = vec3(0.0);
|
vec3 plasmaEmit = vec3(0.0);
|
||||||
float coreSignal = coreTemp * (0.85 + 0.30 * stepNoise);
|
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) {
|
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);
|
vec3 bb = blackbodyRamp(coreTemp);
|
||||||
float plasmaMix = plasmaSum / rhoSum;
|
float plasmaMix = plasmaSum / rhoSum;
|
||||||
if (plasmaMix > 0.01) {
|
if (plasmaMix > 0.01) {
|
||||||
bb = mix(bb, albedo * (1.55 + 2.05 * coreTemp), 0.75 * plasmaMix);
|
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;
|
float sigmaT = rawDens * extScale;
|
||||||
|
|
@ -501,7 +514,7 @@ void main() {
|
||||||
L += T * stepLight;
|
L += T * stepLight;
|
||||||
T *= stepTrans;
|
T *= stepTrans;
|
||||||
steps++;
|
steps++;
|
||||||
if (T < 0.015) {
|
if (T < 0.03) {
|
||||||
T = 0.0;
|
T = 0.0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ void main() {
|
||||||
VolumetricEmitter em = u_emitters.emitters[tid];
|
VolumetricEmitter em = u_emitters.emitters[tid];
|
||||||
float rA = em.posRadius.w;
|
float rA = em.posRadius.w;
|
||||||
float rB = em.params.y;
|
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 wA = em.posRadius.xyz - u_frame.camPosTime.xyz;
|
||||||
vec3 wB = em.endRadiusTemp.xyz - u_frame.camPosTime.xyz;
|
vec3 wB = em.endRadiusTemp.xyz - u_frame.camPosTime.xyz;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue