Cut 10b Soul Pass #2 + juicy art pass: near-lens fade, adaptive Bitonic sort, 64K stochastic opaque curl sparks, and thick Aetheria smoke/fire

This commit is contained in:
Meta Vens 2026-12-05 20:19:51 +01:00
commit 9051cdba06
8 changed files with 391 additions and 272 deletions

View file

@ -280,7 +280,7 @@ public partial class AtmosphereSystem : Node
baked.SunLightEnergy, baked.SunLightEnergy,
baked.SunLightColor, baked.SunLightColor,
ambCol, ambCol,
extinctionScale: mapKind == ArenaMapKind.Sion ? 0.58f : 0.52f); extinctionScale: mapKind == ArenaMapKind.Sion ? 1.85f : 1.70f);
} }
} }

View file

@ -4,13 +4,13 @@ using Godot;
namespace RustToDust.Client; namespace RustToDust.Client;
/// <summary> /// <summary>
/// Flow-coupled GPU particle system (<see cref="GpuParticles3D"/>, 8,192 capacity) driven by /// Flow-coupled GPU particle system (<see cref="GpuParticles3D"/>, 65,536 capacity) driven by
/// the global <c>rtd_flow_field</c> <see cref="Texture3Drd"/> for tiny kite-stretched HDR sparks, /// the global <c>rtd_flow_field</c> <see cref="Texture3Drd"/> + <c>Tri3D</c> curl streams for
/// buoyant embers, flow-entrained dust motes, and 0.08s muzzle starbursts. /// stochastic opaque HDR sparks, buoyant embers, flow-entrained dust motes, and muzzle starbursts.
/// </summary> /// </summary>
public partial class GpuSparksSystem : Node3D public partial class GpuSparksSystem : Node3D
{ {
public const int Capacity = 8192; public const int Capacity = 65536;
public const int TypeVelocitySpark = 0; public const int TypeVelocitySpark = 0;
public const int TypeBuoyantEmber = 1; public const int TypeBuoyantEmber = 1;
@ -100,28 +100,29 @@ public partial class GpuSparksSystem : Node3D
EmitRaw(pos, Vector3.Zero, hdrColor, Math.Clamp(sizeM, 0.25f, 0.90f), Math.Clamp(lifetimeSec, 0.05f, 0.14f), TypeMuzzleStarburst, 0f); EmitRaw(pos, Vector3.Zero, hdrColor, Math.Clamp(sizeM, 0.25f, 0.90f), Math.Clamp(lifetimeSec, 0.05f, 0.14f), TypeMuzzleStarburst, 0f);
} }
public void EmitSparkBurst(Vector3 pos, Vector3 normal, int count, Color hdrColor, float speed, float widthM = 0.042f) public void EmitSparkBurst(Vector3 pos, Vector3 normal, int count, Color hdrColor, float speed, float widthM = 0.026f)
{ {
EnsureInitialized(); EnsureInitialized();
Vector3 n = normal.LengthSquared() > 1e-4f ? normal.Normalized() : Vector3.Up; Vector3 n = normal.LengthSquared() > 1e-4f ? normal.Normalized() : Vector3.Up;
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
Vector3 rand = new(NextSigned(), MathF.Abs(NextSigned()) + 0.30f, NextSigned()); Vector3 rand = new(NextSigned(), MathF.Abs(NextSigned()) + 0.28f, NextSigned());
Vector3 dir = (n * 0.72f + rand).Normalized(); Vector3 dir = (n * 0.65f + rand).Normalized();
float spd = speed * (0.55f + 0.80f * NextFloat()); float spd = speed * (0.55f + 0.85f * NextFloat());
float life = 0.22f + 0.26f * NextFloat(); float life = 0.24f + 0.34f * NextFloat();
EmitRaw(pos, dir * spd, hdrColor, widthM, life, TypeVelocitySpark, 0.85f); Vector3 spawnPos = pos + new Vector3(NextSigned() * 0.14f, NextFloat() * 0.12f, NextSigned() * 0.14f);
EmitRaw(spawnPos, dir * spd, hdrColor, widthM, life, TypeVelocitySpark, 0.85f);
} }
} }
public void EmitEmberBurst(Vector3 pos, int count, Color hdrColor, float spreadSpeed, float widthM = 0.055f) public void EmitEmberBurst(Vector3 pos, int count, Color hdrColor, float spreadSpeed, float widthM = 0.030f)
{ {
EnsureInitialized(); EnsureInitialized();
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
Vector3 vel = new(NextSigned() * spreadSpeed, 2.5f + NextFloat() * 5.0f, NextSigned() * spreadSpeed); Vector3 vel = new(NextSigned() * spreadSpeed, 2.5f + NextFloat() * 5.5f, NextSigned() * spreadSpeed);
float life = 0.85f + NextFloat() * 1.15f; float life = 0.90f + NextFloat() * 1.25f;
EmitRaw(pos + new Vector3(NextSigned() * 0.6f, NextFloat() * 0.6f, NextSigned() * 0.6f), vel, hdrColor, widthM, life, TypeBuoyantEmber, 1.6f); EmitRaw(pos + new Vector3(NextSigned() * 0.7f, NextFloat() * 0.6f, NextSigned() * 0.7f), vel, hdrColor, widthM, life, TypeBuoyantEmber, 1.5f);
} }
} }
@ -154,25 +155,26 @@ public partial class GpuSparksSystem : Node3D
{ {
EnsureInitialized(); EnsureInitialized();
float scale = isContender ? 1.2f : 0.85f; float scale = isContender ? 1.2f : 0.85f;
Color sparkHdr = new(4.2f, 2.4f, 0.75f, 0.98f); Color sparkHdr = new(4.8f, 2.6f, 0.65f, 0.98f);
for (int i = 0; i < 2; i++) int sparkCount = isContender ? 14 : 8;
for (int i = 0; i < sparkCount; i++)
{ {
Vector3 vel = new(NextSigned() * 6.5f, -(11f + NextFloat() * 7f), NextSigned() * 6.5f); Vector3 vel = new(NextSigned() * 7.5f, -(11f + NextFloat() * 7f), NextSigned() * 7.5f);
EmitRaw(podBasePos + new Vector3(NextSigned() * 0.6f, 0.1f, NextSigned() * 0.6f), vel, sparkHdr, 0.048f * scale, 0.24f + NextFloat() * 0.14f, TypeVelocitySpark, 1.2f); EmitRaw(podBasePos + new Vector3(NextSigned() * 0.7f, 0.1f, NextSigned() * 0.7f), vel, sparkHdr, 0.028f * scale, 0.24f + NextFloat() * 0.16f, TypeVelocitySpark, 1.2f);
} }
if (agl < 60f) if (agl < 60f)
{ {
float washT = Math.Clamp(1f - agl / 60f, 0.2f, 1f); float washT = Math.Clamp(1f - agl / 60f, 0.2f, 1f);
Vector3 groundPos = podBasePos - new Vector3(0f, MathF.Max(0f, agl), 0f) + new Vector3(0f, 0.22f, 0f); Vector3 groundPos = podBasePos - new Vector3(0f, MathF.Max(0f, agl), 0f) + new Vector3(0f, 0.22f, 0f);
Color dustCol = new(groundTint.R * 1.1f, groundTint.G * 1.1f, groundTint.B * 1.1f, 0.75f * washT); Color dustCol = new(groundTint.R * 1.1f, groundTint.G * 1.1f, groundTint.B * 1.1f, 0.78f * washT);
int moteCount = isContender ? 4 : 2; int moteCount = isContender ? 24 : 14;
for (int d = 0; d < moteCount; d++) for (int d = 0; d < moteCount; d++)
{ {
float ang = NextFloat() * MathF.Tau; float ang = NextFloat() * MathF.Tau;
float spd = (7.5f + NextFloat() * 8.5f) * washT * scale; float spd = (7.5f + NextFloat() * 8.5f) * washT * scale;
Vector3 vel = new(MathF.Cos(ang) * spd, 1.0f + NextFloat() * 1.4f, MathF.Sin(ang) * spd); Vector3 vel = new(MathF.Cos(ang) * spd, 1.0f + NextFloat() * 1.6f, MathF.Sin(ang) * spd);
EmitRaw(groundPos + new Vector3(MathF.Cos(ang) * 0.9f, 0f, MathF.Sin(ang) * 0.9f), vel, dustCol, 0.07f * scale, 0.55f + NextFloat() * 0.25f, TypeDustMote, 3.4f); EmitRaw(groundPos + new Vector3(MathF.Cos(ang) * 0.9f, 0f, MathF.Sin(ang) * 0.9f), vel, dustCol, 0.055f * scale, 0.55f + NextFloat() * 0.30f, TypeDustMote, 3.4f);
} }
} }
} }
@ -181,9 +183,9 @@ public partial class GpuSparksSystem : Node3D
{ {
EnsureInitialized(); EnsureInitialized();
float scale = isContender ? 1.3f : 0.95f; float scale = isContender ? 1.3f : 0.95f;
EmitSparkBurst(pos + normal * 0.45f, normal, isContender ? 16 : 8, new Color(4.5f, 2.5f, 0.75f, 0.98f), 18f * scale, 0.048f); EmitSparkBurst(pos + normal * 0.45f, normal, isContender ? 160 : 90, new Color(5.2f, 2.8f, 0.70f, 0.98f), 19f * scale, 0.028f);
EmitEmberBurst(pos + normal * 0.45f, isContender ? 10 : 5, new Color(3.6f, 1.6f, 0.45f, 0.95f), 6.5f * scale, 0.055f); EmitEmberBurst(pos + normal * 0.45f, isContender ? 85 : 48, new Color(4.0f, 1.6f, 0.35f, 0.95f), 7.5f * scale, 0.032f);
EmitDustMotes(pos + normal * 0.25f, normal, isContender ? 14 : 8, groundTint with { A = 0.80f }, 10f * scale, 0.075f); EmitDustMotes(pos + normal * 0.25f, normal, isContender ? 75 : 45, groundTint with { A = 0.82f }, 10f * scale, 0.058f);
} }
private void EmitRaw(Vector3 pos, Vector3 vel, Color hdrColor, float widthM, float lifetimeSec, int type, float drag) private void EmitRaw(Vector3 pos, Vector3 vel, Color hdrColor, float widthM, float lifetimeSec, int type, float drag)

View file

@ -231,8 +231,8 @@ public partial class ParticlePool : Node3D
float massScale = Math.Clamp(pulse.MassKg / 2600f, 0.72f, 1.55f); float massScale = Math.Clamp(pulse.MassKg / 2600f, 0.72f, 1.55f);
float loadScale = Math.Clamp(pulse.LoadG, 0.5f, 1.8f); float loadScale = Math.Clamp(pulse.LoadG, 0.5f, 1.8f);
int count = pulse.MassKg >= 3600f ? 6 : 4; int count = pulse.MassKg >= 3600f ? 42 : 26;
_gpuSparks?.EmitDustMotes(footPos, Vector3.Up, count, groundTint with { A = 0.72f }, 3.4f * massScale * MathF.Sqrt(loadScale), 0.06f * massScale); _gpuSparks?.EmitDustMotes(footPos, Vector3.Up, count, groundTint with { A = 0.76f }, 3.4f * massScale * MathF.Sqrt(loadScale), 0.048f * massScale);
_volumetrics?.EmitFootstepOrTirePuff(footPos, groundTint, massScale); _volumetrics?.EmitFootstepOrTirePuff(footPos, groundTint, massScale);
} }
@ -245,7 +245,7 @@ public partial class ParticlePool : Node3D
} }
float scale = Math.Clamp(intensity, 0.5f, 1.5f); float scale = Math.Clamp(intensity, 0.5f, 1.5f);
_gpuSparks?.EmitDustMotes(worldPos, Vector3.Up, 3, groundTint with { A = 0.65f }, 2.6f * scale, 0.055f * scale); _gpuSparks?.EmitDustMotes(worldPos, Vector3.Up, 18, groundTint with { A = 0.70f }, 2.6f * scale, 0.045f * scale);
_volumetrics?.EmitFootstepOrTirePuff(worldPos, groundTint, scale * 0.9f); _volumetrics?.EmitFootstepOrTirePuff(worldPos, groundTint, scale * 0.9f);
} }
@ -260,7 +260,7 @@ public partial class ParticlePool : Node3D
_volumetrics?.EmitThermalVentPlume(worldPos, thermalRatio); _volumetrics?.EmitThermalVentPlume(worldPos, thermalRatio);
if (thermalRatio >= 0.94f) if (thermalRatio >= 0.94f)
{ {
_gpuSparks?.EmitSparkBurst(worldPos, Vector3.Up, 3, new Color(4.0f, 2.2f, 0.55f, 0.96f), 6.5f, 0.038f); _gpuSparks?.EmitSparkBurst(worldPos, Vector3.Up, 20, new Color(4.6f, 2.4f, 0.55f, 0.96f), 6.5f, 0.026f);
} }
} }
@ -275,7 +275,7 @@ public partial class ParticlePool : Node3D
_volumetrics?.EmitDamageSmokePlume(worldPos, coreHpRatio); _volumetrics?.EmitDamageSmokePlume(worldPos, coreHpRatio);
if (coreHpRatio < 0.24f) if (coreHpRatio < 0.24f)
{ {
_gpuSparks?.EmitEmberBurst(worldPos, 2, new Color(3.8f, 1.8f, 0.45f, 0.92f), 2.2f, 0.045f); _gpuSparks?.EmitEmberBurst(worldPos, 16, new Color(4.2f, 1.8f, 0.35f, 0.94f), 2.4f, 0.030f);
} }
} }
@ -287,9 +287,14 @@ public partial class ParticlePool : Node3D
return; return;
} }
Color hdr = new(accentCol.R * 4.2f, accentCol.G * 4.2f, accentCol.B * 4.2f, 0.98f); Color moltenHdr = new(4.8f, 2.6f, 0.65f, 0.98f);
_gpuSparks?.EmitSparkBurst(pos, Vector3.Up, Math.Clamp(sparkCount * 3, 6, 24), hdr, 14f * radiusScale, 0.044f); Color subtleTint = new(
_gpuSparks?.EmitEmberBurst(pos, Math.Clamp(sparkCount, 3, 12), hdr * 0.85f, 4.5f * radiusScale, 0.052f); Mathf.Lerp(moltenHdr.R, accentCol.R * 3.8f, 0.25f),
Mathf.Lerp(moltenHdr.G, accentCol.G * 3.8f, 0.25f),
Mathf.Lerp(moltenHdr.B, accentCol.B * 3.8f, 0.25f),
0.98f);
_gpuSparks?.EmitSparkBurst(pos, Vector3.Up, Math.Clamp(sparkCount * 16, 48, 160), subtleTint, 15f * radiusScale, 0.028f);
_gpuSparks?.EmitEmberBurst(pos, Math.Clamp(sparkCount * 7, 22, 80), moltenHdr * 0.85f, 5.0f * radiusScale, 0.032f);
} }
public void EmitThermalPoolEmber(Vector3 pos, float radius, Color accentCol, Vector3 camPos, bool hasCam) public void EmitThermalPoolEmber(Vector3 pos, float radius, Color accentCol, Vector3 camPos, bool hasCam)
@ -312,7 +317,7 @@ public partial class ParticlePool : Node3D
} }
_volumetrics?.EmitPodReentryPlume(podPos, podVel, heatGlow, isContender); _volumetrics?.EmitPodReentryPlume(podPos, podVel, heatGlow, isContender);
_gpuSparks?.EmitEmberBurst(podPos, isContender ? 3 : 2, new Color(4.0f, 2.2f, 0.65f, 0.95f), 2.5f, 0.048f); _gpuSparks?.EmitEmberBurst(podPos, isContender ? 20 : 12, new Color(4.4f, 2.2f, 0.55f, 0.95f), 2.8f, 0.030f);
} }
public void EmitPodRetroBurn( public void EmitPodRetroBurn(
@ -464,13 +469,13 @@ public partial class ParticlePool : Node3D
switch (wClass) switch (wClass)
{ {
case WeaponVisualClass.KineticLight: case WeaponVisualClass.KineticLight:
_gpuSparks?.EmitMuzzleStarburst(start, new Color(3.8f, 2.8f, 1.1f, 0.96f), isPd ? 0.42f : 0.30f, 0.07f); _gpuSparks?.EmitMuzzleStarburst(start, new Color(4.2f, 2.8f, 1.0f, 0.96f), isPd ? 0.42f : 0.30f, 0.07f);
_gpuSparks?.EmitSparkBurst(start, aimDir, 3, new Color(4.0f, 2.8f, 0.9f, 0.95f), 11f, 0.035f); _gpuSparks?.EmitSparkBurst(start, aimDir, 18, new Color(4.5f, 2.8f, 0.8f, 0.96f), 11f, 0.024f);
break; break;
case WeaponVisualClass.Autocannon: case WeaponVisualClass.Autocannon:
_gpuSparks?.EmitMuzzleStarburst(start, new Color(4.4f, 2.6f, 0.75f, 0.98f), 0.56f, 0.08f); _gpuSparks?.EmitMuzzleStarburst(start, new Color(4.6f, 2.6f, 0.75f, 0.98f), 0.56f, 0.08f);
_gpuSparks?.EmitSparkBurst(start, aimDir, 5, new Color(4.2f, 2.5f, 0.7f, 0.96f), 13f, 0.04f); _gpuSparks?.EmitSparkBurst(start, aimDir, 32, new Color(4.8f, 2.6f, 0.65f, 0.96f), 13f, 0.026f);
_volumetrics?.EmitMuzzleBreechPuff(start, end, sampleGroundTint(start.X, start.Z), wClass, isRecoilless: false); _volumetrics?.EmitMuzzleBreechPuff(start, end, sampleGroundTint(start.X, start.Z), wClass, isRecoilless: false);
if (!hasCam || start.DistanceSquaredTo(camPos) <= 45f * 45f) if (!hasCam || start.DistanceSquaredTo(camPos) <= 45f * 45f)
{ {
@ -479,8 +484,8 @@ public partial class ParticlePool : Node3D
break; break;
case WeaponVisualClass.Explosive: case WeaponVisualClass.Explosive:
_gpuSparks?.EmitMuzzleStarburst(start, new Color(4.8f, 2.6f, 0.70f, 0.98f), isRecoilless ? 0.78f : 0.48f, 0.09f); _gpuSparks?.EmitMuzzleStarburst(start, new Color(5.0f, 2.6f, 0.70f, 0.98f), isRecoilless ? 0.78f : 0.48f, 0.09f);
_gpuSparks?.EmitSparkBurst(start, aimDir, isRecoilless ? 8 : 4, new Color(4.5f, 2.4f, 0.65f, 0.98f), 15f, 0.042f); _gpuSparks?.EmitSparkBurst(start, aimDir, isRecoilless ? 64 : 32, new Color(5.0f, 2.5f, 0.60f, 0.98f), 15f, 0.028f);
_volumetrics?.EmitMuzzleBreechPuff(start, end, sampleGroundTint(start.X, start.Z), wClass, isRecoilless); _volumetrics?.EmitMuzzleBreechPuff(start, end, sampleGroundTint(start.X, start.Z), wClass, isRecoilless);
if (!hasCam || start.DistanceSquaredTo(camPos) <= 65f * 65f) if (!hasCam || start.DistanceSquaredTo(camPos) <= 65f * 65f)
{ {
@ -490,7 +495,7 @@ public partial class ParticlePool : Node3D
case WeaponVisualClass.ThermalBeam: case WeaponVisualClass.ThermalBeam:
{ {
Color beamCol = isLance ? new Color(4.5f, 3.2f, 0.95f, 0.96f) : new Color(0.95f, 3.6f, 4.5f, 0.96f); Color beamCol = isLance ? new Color(4.8f, 3.2f, 0.95f, 0.96f) : new Color(2.8f, 3.4f, 3.8f, 0.96f);
_gpuSparks?.EmitMuzzleStarburst(start, beamCol, isLance ? 0.68f : 0.48f, 0.09f); _gpuSparks?.EmitMuzzleStarburst(start, beamCol, isLance ? 0.68f : 0.48f, 0.09f);
if (!hasCam || start.DistanceSquaredTo(camPos) <= 45f * 45f) if (!hasCam || start.DistanceSquaredTo(camPos) <= 45f * 45f)
{ {
@ -502,9 +507,9 @@ public partial class ParticlePool : Node3D
case WeaponVisualClass.GaussRail: case WeaponVisualClass.GaussRail:
{ {
Color gaussHdr = new(0.85f, 3.5f, 4.8f, 0.98f); Color gaussHdr = new(3.6f, 2.8f, 1.8f, 0.98f);
_gpuSparks?.EmitMuzzleStarburst(start, gaussHdr, 0.72f, 0.09f); _gpuSparks?.EmitMuzzleStarburst(start, new Color(1.4f, 3.5f, 4.8f, 0.98f), 0.72f, 0.09f);
_gpuSparks?.EmitSparkBurst(start, aimDir, 10, gaussHdr, 19f, 0.04f); _gpuSparks?.EmitSparkBurst(start, aimDir, 56, gaussHdr, 19f, 0.026f);
if (!hasCam || start.DistanceSquaredTo(camPos) <= 65f * 65f) if (!hasCam || start.DistanceSquaredTo(camPos) <= 65f * 65f)
{ {
SpawnFlashLight(start, new Color(0.22f, 0.78f, 1.0f), 4.2f, 14f, 0.11f, priority: 5); SpawnFlashLight(start, new Color(0.22f, 0.78f, 1.0f), 4.2f, 14f, 0.11f, priority: 5);
@ -514,9 +519,9 @@ public partial class ParticlePool : Node3D
case WeaponVisualClass.PlasmaPpc: case WeaponVisualClass.PlasmaPpc:
{ {
Color plasmaHdr = new(0.65f, 3.4f, 4.2f, 0.96f); Color plasmaHdr = new(3.4f, 2.8f, 1.6f, 0.96f);
_gpuSparks?.EmitMuzzleStarburst(start, plasmaHdr, 0.65f, 0.09f); _gpuSparks?.EmitMuzzleStarburst(start, new Color(1.0f, 3.4f, 4.2f, 0.96f), 0.65f, 0.09f);
_gpuSparks?.EmitSparkBurst(start, aimDir, 6, plasmaHdr, 12f, 0.042f); _gpuSparks?.EmitSparkBurst(start, aimDir, 38, plasmaHdr, 12f, 0.028f);
if (!hasCam || start.DistanceSquaredTo(camPos) <= 55f * 55f) if (!hasCam || start.DistanceSquaredTo(camPos) <= 55f * 55f)
{ {
SpawnFlashLight(start, new Color(0.16f, 0.88f, 0.95f), 3.4f, 12f, 0.12f, priority: 4); SpawnFlashLight(start, new Color(0.16f, 0.88f, 0.95f), 3.4f, 12f, 0.12f, priority: 4);
@ -525,13 +530,13 @@ public partial class ParticlePool : Node3D
} }
case WeaponVisualClass.RocketSalvo: case WeaponVisualClass.RocketSalvo:
_gpuSparks?.EmitMuzzleStarburst(start, new Color(4.4f, 2.6f, 0.75f, 0.96f), 0.62f, 0.095f); _gpuSparks?.EmitMuzzleStarburst(start, new Color(4.8f, 2.6f, 0.75f, 0.96f), 0.62f, 0.095f);
_gpuSparks?.EmitSparkBurst(start, aimDir, 6, new Color(4.2f, 2.4f, 0.65f, 0.96f), 13f, 0.042f); _gpuSparks?.EmitSparkBurst(start, aimDir, 42, new Color(4.8f, 2.4f, 0.60f, 0.96f), 13f, 0.028f);
_volumetrics?.EmitMuzzleBreechPuff(start, end, sampleGroundTint(start.X, start.Z), wClass, isRecoilless: false); _volumetrics?.EmitMuzzleBreechPuff(start, end, sampleGroundTint(start.X, start.Z), wClass, isRecoilless: false);
break; break;
case WeaponVisualClass.SwarmSmart: case WeaponVisualClass.SwarmSmart:
_gpuSparks?.EmitMuzzleStarburst(start, new Color(2.2f, 4.0f, 1.0f, 0.96f), 0.48f, 0.085f); _gpuSparks?.EmitMuzzleStarburst(start, new Color(2.8f, 3.8f, 1.2f, 0.96f), 0.48f, 0.085f);
break; break;
} }
} }
@ -572,7 +577,8 @@ public partial class ParticlePool : Node3D
if (hit.IsAirburst || (wClass == WeaponVisualClass.KineticLight && string.Equals(hit.WeaponId, "pd_flak", StringComparison.Ordinal))) if (hit.IsAirburst || (wClass == WeaponVisualClass.KineticLight && string.Equals(hit.WeaponId, "pd_flak", StringComparison.Ordinal)))
{ {
_volumetrics?.EmitExplosiveHit(pos, normal, groundTint, wClass, isRecoilless: false, isAirburst: true); _volumetrics?.EmitExplosiveHit(pos, normal, groundTint, wClass, isRecoilless: false, isAirburst: true);
_gpuSparks?.EmitSparkBurst(pos, normal, 10, new Color(4.5f, 2.6f, 0.75f, 0.98f), 14f, 0.042f); _gpuSparks?.EmitSparkBurst(pos, normal, 76, new Color(5.0f, 2.7f, 0.70f, 0.98f), 14f, 0.026f);
_gpuSparks?.EmitEmberBurst(pos, 28, new Color(4.0f, 1.8f, 0.35f, 0.95f), 4.5f, 0.030f);
return; return;
} }
@ -581,17 +587,17 @@ public partial class ParticlePool : Node3D
case WeaponVisualClass.KineticLight: case WeaponVisualClass.KineticLight:
if (isTerrain) if (isTerrain)
{ {
_gpuSparks?.EmitDustMotes(pos, normal, 5, groundTint with { A = 0.72f }, 4.5f, 0.055f); _gpuSparks?.EmitDustMotes(pos, normal, 36, groundTint with { A = 0.76f }, 4.5f, 0.045f);
} }
else else
{ {
_gpuSparks?.EmitSparkBurst(pos, normal, 7, new Color(4.4f, 3.2f, 1.2f, 0.96f), 11f, 0.036f); _gpuSparks?.EmitSparkBurst(pos, normal, 62, new Color(4.8f, 3.0f, 0.95f, 0.96f), 11f, 0.024f);
} }
break; break;
case WeaponVisualClass.Autocannon: case WeaponVisualClass.Autocannon:
_gpuSparks?.EmitSparkBurst(pos, normal, 9, new Color(4.4f, 2.6f, 0.75f, 0.98f), 13.5f, 0.04f); _gpuSparks?.EmitSparkBurst(pos, normal, 76, new Color(4.8f, 2.6f, 0.70f, 0.98f), 13.5f, 0.026f);
_gpuSparks?.EmitDustMotes(pos, normal, 6, groundTint with { A = 0.75f }, 5.5f, 0.06f); _gpuSparks?.EmitDustMotes(pos, normal, 42, groundTint with { A = 0.78f }, 5.5f, 0.048f);
_volumetrics?.EmitFootstepOrTirePuff(pos, groundTint, 1.0f); _volumetrics?.EmitFootstepOrTirePuff(pos, groundTint, 1.0f);
break; break;
@ -599,8 +605,9 @@ public partial class ParticlePool : Node3D
{ {
bool isRecoilless = string.Equals(hit.WeaponId, "recoilless", StringComparison.Ordinal); bool isRecoilless = string.Equals(hit.WeaponId, "recoilless", StringComparison.Ordinal);
_volumetrics?.EmitExplosiveHit(pos, normal, groundTint, wClass, isRecoilless, isAirburst: false); _volumetrics?.EmitExplosiveHit(pos, normal, groundTint, wClass, isRecoilless, isAirburst: false);
_gpuSparks?.EmitSparkBurst(pos, normal, isRecoilless ? 16 : 10, new Color(4.8f, 2.5f, 0.7f, 0.98f), 17f, 0.044f); _gpuSparks?.EmitSparkBurst(pos, normal, isRecoilless ? 140 : 88, new Color(5.2f, 2.6f, 0.65f, 0.98f), 17f, 0.028f);
_gpuSparks?.EmitDustMotes(pos, normal, isRecoilless ? 10 : 6, groundTint with { A = 0.78f }, 7.5f, 0.068f); _gpuSparks?.EmitEmberBurst(pos, isRecoilless ? 54 : 32, new Color(4.2f, 1.7f, 0.35f, 0.95f), 5.5f, 0.032f);
_gpuSparks?.EmitDustMotes(pos, normal, isRecoilless ? 68 : 44, groundTint with { A = 0.80f }, 7.5f, 0.052f);
if (!hasCam || pos.DistanceSquaredTo(camPos) <= 75f * 75f) if (!hasCam || pos.DistanceSquaredTo(camPos) <= 75f * 75f)
{ {
SpawnFlashLight(pos + normal * 0.45f, new Color(1.0f, 0.55f, 0.16f), isRecoilless ? 4.8f : 3.2f, isRecoilless ? 14.5f : 11f, 0.14f, priority: 7); SpawnFlashLight(pos + normal * 0.45f, new Color(1.0f, 0.55f, 0.16f), isRecoilless ? 4.8f : 3.2f, isRecoilless ? 14.5f : 11f, 0.14f, priority: 7);
@ -610,12 +617,12 @@ public partial class ParticlePool : Node3D
case WeaponVisualClass.ThermalBeam: case WeaponVisualClass.ThermalBeam:
_volumetrics?.EmitExplosiveHit(pos, normal, groundTint, wClass, isRecoilless: false, isAirburst: false); _volumetrics?.EmitExplosiveHit(pos, normal, groundTint, wClass, isRecoilless: false, isAirburst: false);
_gpuSparks?.EmitSparkBurst(pos, normal, 10, new Color(1.6f, 3.8f, 4.6f, 0.98f), 13f, 0.04f); _gpuSparks?.EmitSparkBurst(pos, normal, 68, new Color(4.6f, 2.8f, 1.4f, 0.98f), 13f, 0.026f);
break; break;
case WeaponVisualClass.GaussRail: case WeaponVisualClass.GaussRail:
_gpuSparks?.EmitSparkBurst(pos, normal, 16, new Color(1.0f, 3.6f, 4.8f, 0.98f), 20f, 0.042f); _gpuSparks?.EmitSparkBurst(pos, normal, 96, new Color(4.2f, 3.0f, 1.8f, 0.98f), 20f, 0.026f);
_gpuSparks?.EmitDustMotes(pos, normal, 8, groundTint with { A = 0.76f }, 6.5f, 0.06f); _gpuSparks?.EmitDustMotes(pos, normal, 48, groundTint with { A = 0.78f }, 6.5f, 0.048f);
_volumetrics?.EmitFootstepOrTirePuff(pos, groundTint, 1.2f); _volumetrics?.EmitFootstepOrTirePuff(pos, groundTint, 1.2f);
if (!hasCam || pos.DistanceSquaredTo(camPos) <= 65f * 65f) if (!hasCam || pos.DistanceSquaredTo(camPos) <= 65f * 65f)
{ {
@ -625,14 +632,15 @@ public partial class ParticlePool : Node3D
case WeaponVisualClass.PlasmaPpc: case WeaponVisualClass.PlasmaPpc:
_volumetrics?.EmitExplosiveHit(pos, normal, groundTint, wClass, isRecoilless: false, isAirburst: false); _volumetrics?.EmitExplosiveHit(pos, normal, groundTint, wClass, isRecoilless: false, isAirburst: false);
_gpuSparks?.EmitSparkBurst(pos, normal, 14, new Color(0.95f, 3.8f, 4.6f, 0.98f), 15f, 0.044f); _gpuSparks?.EmitSparkBurst(pos, normal, 84, new Color(4.0f, 2.8f, 1.6f, 0.98f), 15f, 0.028f);
_gpuSparks?.EmitEmberBurst(pos, 6, new Color(0.75f, 3.2f, 4.0f, 0.92f), 4.5f, 0.05f); _gpuSparks?.EmitEmberBurst(pos, 40, new Color(3.6f, 2.0f, 0.85f, 0.92f), 4.5f, 0.032f);
break; break;
case WeaponVisualClass.RocketSalvo: case WeaponVisualClass.RocketSalvo:
_volumetrics?.EmitExplosiveHit(pos, normal, groundTint, wClass, isRecoilless: false, isAirburst: false); _volumetrics?.EmitExplosiveHit(pos, normal, groundTint, wClass, isRecoilless: false, isAirburst: false);
_gpuSparks?.EmitSparkBurst(pos, normal, 14, new Color(4.6f, 2.6f, 0.75f, 0.98f), 16f, 0.044f); _gpuSparks?.EmitSparkBurst(pos, normal, 112, new Color(5.0f, 2.7f, 0.65f, 0.98f), 16f, 0.028f);
_gpuSparks?.EmitDustMotes(pos, normal, 8, groundTint with { A = 0.78f }, 7.0f, 0.068f); _gpuSparks?.EmitEmberBurst(pos, 38, new Color(4.0f, 1.7f, 0.35f, 0.95f), 5.0f, 0.032f);
_gpuSparks?.EmitDustMotes(pos, normal, 56, groundTint with { A = 0.80f }, 7.0f, 0.052f);
if (!hasCam || pos.DistanceSquaredTo(camPos) <= 75f * 75f) if (!hasCam || pos.DistanceSquaredTo(camPos) <= 75f * 75f)
{ {
SpawnFlashLight(pos + normal * 0.45f, new Color(1.0f, 0.56f, 0.16f), 4.5f, 14f, 0.14f, priority: 7); SpawnFlashLight(pos + normal * 0.45f, new Color(1.0f, 0.56f, 0.16f), 4.5f, 14f, 0.14f, priority: 7);
@ -641,7 +649,7 @@ public partial class ParticlePool : Node3D
case WeaponVisualClass.SwarmSmart: case WeaponVisualClass.SwarmSmart:
_volumetrics?.EmitExplosiveHit(pos, normal, groundTint, wClass, isRecoilless: false, isAirburst: false); _volumetrics?.EmitExplosiveHit(pos, normal, groundTint, wClass, isRecoilless: false, isAirburst: false);
_gpuSparks?.EmitSparkBurst(pos, normal, 10, new Color(2.2f, 4.2f, 1.0f, 0.98f), 13f, 0.04f); _gpuSparks?.EmitSparkBurst(pos, normal, 68, new Color(4.2f, 2.8f, 0.85f, 0.98f), 13f, 0.026f);
break; break;
} }
} }
@ -660,8 +668,9 @@ public partial class ParticlePool : Node3D
Color gTint = sampleGroundTint(pos.X, pos.Z); Color gTint = sampleGroundTint(pos.X, pos.Z);
_volumetrics?.EmitChassisExplosion(pos, massKg, gTint); _volumetrics?.EmitChassisExplosion(pos, massKg, gTint);
_gpuSparks?.EmitSparkBurst(pos, Vector3.Up, 32, new Color(5.0f, 2.8f, 0.75f, 0.98f), 22f, 0.046f); _gpuSparks?.EmitSparkBurst(pos, Vector3.Up, 260, new Color(5.6f, 2.9f, 0.70f, 0.98f), 22f, 0.028f);
_gpuSparks?.EmitEmberBurst(pos, 16, new Color(4.0f, 1.8f, 0.45f, 0.95f), 7.0f, 0.055f); _gpuSparks?.EmitEmberBurst(pos, 140, new Color(4.4f, 1.8f, 0.35f, 0.95f), 7.5f, 0.034f);
_gpuSparks?.EmitDustMotes(pos, Vector3.Up, 64, gTint with { A = 0.82f }, 9.0f, 0.056f);
if (!hasCam || pos.DistanceSquaredTo(camPos) <= 95f * 95f) if (!hasCam || pos.DistanceSquaredTo(camPos) <= 95f * 95f)
{ {

View file

@ -399,12 +399,12 @@ public sealed class VolumetricEmitterPool
radiusA1: 5.2f * scale, radiusA1: 5.2f * scale,
radiusB0: 2.2f * scale, radiusB0: 2.2f * scale,
radiusB1: 6.4f * scale, radiusB1: 6.4f * scale,
density0: 1.55f, density0: 2.35f,
density1: 0.55f, density1: 0.80f,
temp0: 1.50f, temp0: 1.95f,
temp1: 0.08f, temp1: 0.10f,
tint0: new Color(0.14f, 0.11f, 0.09f), tint0: new Color(0.10f, 0.08f, 0.07f),
tint1: new Color(0.06f, 0.055f, 0.055f), tint1: new Color(0.05f, 0.048f, 0.048f),
lifetime: 3.4f, lifetime: 3.4f,
flowSpeed: 0.85f, flowSpeed: 0.85f,
softness: 0.42f, softness: 0.42f,
@ -486,8 +486,8 @@ public sealed class VolumetricEmitterPool
: gLin * 0.48f + new Color(0.06f, 0.045f, 0.04f); : gLin * 0.48f + new Color(0.06f, 0.045f, 0.04f);
Color tint1 = new(0.06f, 0.055f, 0.05f); Color tint1 = new(0.06f, 0.055f, 0.05f);
float temp0 = (isPlasma || isThermal) ? 0.95f : (isAirburst || isRecoilless || wClass == WeaponVisualClass.RocketSalvo ? 1.25f : 0.85f); float temp0 = (isPlasma || isThermal) ? 1.25f : (isAirburst || isRecoilless || wClass == WeaponVisualClass.RocketSalvo ? 1.65f : 1.15f);
float life = (isRecoilless || wClass == WeaponVisualClass.RocketSalvo) ? 1.45f : (isThermal ? 0.45f : 0.85f); float life = (isRecoilless || wClass == WeaponVisualClass.RocketSalvo) ? 1.55f : (isThermal ? 0.50f : 0.95f);
SpawnEmitter( SpawnEmitter(
type, type,
@ -499,8 +499,8 @@ public sealed class VolumetricEmitterPool
radiusA1: 2.8f * scale, radiusA1: 2.8f * scale,
radiusB0: 1.1f * scale, radiusB0: 1.1f * scale,
radiusB1: 3.4f * scale, radiusB1: 3.4f * scale,
density0: 1.15f, density0: 1.85f,
density1: 0.16f, density1: 0.26f,
temp0: temp0, temp0: temp0,
temp1: -0.35f, temp1: -0.35f,
tint0: tint0, tint0: tint0,
@ -550,9 +550,9 @@ public sealed class VolumetricEmitterPool
radiusA1: 1.55f * scale, radiusA1: 1.55f * scale,
radiusB0: 0.75f * scale, radiusB0: 0.75f * scale,
radiusB1: 2.15f * scale, radiusB1: 2.15f * scale,
density0: 0.85f, density0: 1.35f,
density1: 0.10f, density1: 0.18f,
temp0: isRecoilless ? 0.45f : 0.25f, temp0: isRecoilless ? 0.65f : 0.35f,
temp1: 0f, temp1: 0f,
tint0: smokeTint, tint0: smokeTint,
tint1: smokeTint * 0.75f, tint1: smokeTint * 0.75f,
@ -595,12 +595,12 @@ public sealed class VolumetricEmitterPool
radiusA1: 3.8f * scale, radiusA1: 3.8f * scale,
radiusB0: 1.4f * scale, radiusB0: 1.4f * scale,
radiusB1: 4.5f * scale, radiusB1: 4.5f * scale,
density0: 1.35f, density0: 2.15f,
density1: 0.25f, density1: 0.42f,
temp0: 1.25f, temp0: 1.65f,
temp1: 0.05f, temp1: 0.08f,
tint0: accentCol * 0.6f + new Color(0.22f, 0.18f, 0.15f), tint0: accentCol * 0.45f + new Color(0.14f, 0.11f, 0.09f),
tint1: new Color(0.14f, 0.13f, 0.12f), tint1: new Color(0.08f, 0.075f, 0.07f),
lifetime: 2.1f, lifetime: 2.1f,
flowSpeed: 0.8f, flowSpeed: 0.8f,
softness: 0.40f, softness: 0.40f,
@ -757,10 +757,10 @@ public sealed class VolumetricEmitterPool
radiusA1: 1.6f * scale, radiusA1: 1.6f * scale,
radiusB0: 1.65f * scale, radiusB0: 1.65f * scale,
radiusB1: 3.4f * scale, radiusB1: 3.4f * scale,
density0: 1.25f, density0: 1.85f,
density1: 0.15f, density1: 0.24f,
temp0: 1.20f, temp0: 1.55f,
temp1: 0.12f, temp1: 0.14f,
tint0: new Color(0.60f, 0.48f, 0.38f), tint0: new Color(0.60f, 0.48f, 0.38f),
tint1: groundTint * 0.72f, tint1: groundTint * 0.72f,
lifetime: 0.26f, lifetime: 0.26f,
@ -826,9 +826,9 @@ public sealed class VolumetricEmitterPool
radiusA1: 5.5f * scale, radiusA1: 5.5f * scale,
radiusB0: 1.9f * scale, radiusB0: 1.9f * scale,
radiusB1: 6.2f * scale, radiusB1: 6.2f * scale,
density0: 1.18f, density0: 1.85f,
density1: 0.18f, density1: 0.30f,
temp0: 0.95f, temp0: 1.35f,
temp1: 0.0f, temp1: 0.0f,
tint0: groundTint * 0.82f, tint0: groundTint * 0.82f,
tint1: groundTint * 0.55f, tint1: groundTint * 0.55f,
@ -902,12 +902,12 @@ public sealed class VolumetricEmitterPool
radiusA1: 1.95f + dmgT * 0.65f, radiusA1: 1.95f + dmgT * 0.65f,
radiusB0: 0.75f, radiusB0: 0.75f,
radiusB1: 2.35f + dmgT * 0.75f, radiusB1: 2.35f + dmgT * 0.75f,
density0: 0.95f, density0: 1.65f,
density1: 0.12f, density1: 0.24f,
temp0: dmgT > 0.30f ? 0.55f + dmgT * 0.40f : 0.08f, temp0: dmgT > 0.30f ? 0.85f + dmgT * 0.55f : 0.12f,
temp1: 0f, temp1: 0f,
tint0: new Color(0.18f, 0.16f, 0.15f), tint0: new Color(0.11f, 0.10f, 0.095f),
tint1: new Color(0.10f, 0.10f, 0.10f), tint1: new Color(0.06f, 0.06f, 0.06f),
lifetime: 0.95f, lifetime: 0.95f,
flowSpeed: 0.7f, flowSpeed: 0.7f,
softness: 0.42f, softness: 0.42f,
@ -934,8 +934,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.52f, density0: 0.90f,
density1: 0.05f, density1: 0.10f,
temp0: 0f, temp0: 0f,
temp1: 0f, temp1: 0f,
tint0: gLin * 1.1f, tint0: gLin * 1.1f,

View file

@ -1,5 +1,5 @@
shader_type spatial; shader_type spatial;
render_mode unshaded, cull_disabled, blend_mix, depth_draw_never; render_mode unshaded, cull_disabled, depth_draw_opaque;
varying vec4 v_color; varying vec4 v_color;
varying vec2 v_uvCentered; varying vec2 v_uvCentered;
@ -11,7 +11,7 @@ void vertex() {
vec3 worldPos = MODEL_MATRIX[3].xyz; vec3 worldPos = MODEL_MATRIX[3].xyz;
vec3 velWorld = MODEL_MATRIX[0].xyz; vec3 velWorld = MODEL_MATRIX[0].xyz;
float widthM = max(0.015, INSTANCE_CUSTOM.x); float widthM = max(0.012, INSTANCE_CUSTOM.x);
float ageNorm = clamp(INSTANCE_CUSTOM.y / max(0.01, INSTANCE_CUSTOM.z), 0.0, 1.0); float ageNorm = clamp(INSTANCE_CUSTOM.y / max(0.01, INSTANCE_CUSTOM.z), 0.0, 1.0);
float pType = floor(INSTANCE_CUSTOM.w + 0.001); float pType = floor(INSTANCE_CUSTOM.w + 0.001);
@ -21,7 +21,7 @@ void vertex() {
v_uvCentered = UV * 2.0 - vec2(1.0); v_uvCentered = UV * 2.0 - vec2(1.0);
// Kite-stretch trick: rotate quad coordinates 45 degrees so pointed ears align directly along velocity: // Kite-stretch trick: rotate quad coordinates 45 degrees so pointed ears align directly along velocity:
// (-1,-1) -> u=-1,v=0 (tail tip); (+1,+1) -> u=+1,v=0 (nose tip); (+1,-1)/( -1,+1) -> v=±1 (side ears) // (-1,-1) -> u=-1,v=0 (tail tip); (+1,+1) -> u=+1,v=0 (nose tip); (+1,-1)/(-1,+1) -> v=±1 (side ears)
float uKite = 0.5 * (v_uvCentered.x + v_uvCentered.y); float uKite = 0.5 * (v_uvCentered.x + v_uvCentered.y);
float vKite = 0.5 * (v_uvCentered.x - v_uvCentered.y); float vKite = 0.5 * (v_uvCentered.x - v_uvCentered.y);
v_kite = vec2(uKite, vKite); v_kite = vec2(uKite, vKite);
@ -32,11 +32,6 @@ void vertex() {
float toCamLen2 = dot(toCamVec, toCamVec); float toCamLen2 = dot(toCamVec, toCamVec);
vec3 toCam = toCamLen2 > 1e-6 ? toCamVec * inversesqrt(toCamLen2) : INV_VIEW_MATRIX[2].xyz; vec3 toCam = toCamLen2 > 1e-6 ? toCamVec * inversesqrt(toCamLen2) : INV_VIEW_MATRIX[2].xyz;
vec3 axisWorld;
vec3 perpWorld;
float halfWidth;
float halfLen;
if (pType > 2.5) { if (pType > 2.5) {
// Type 3: Stationary 4-point HDR muzzle starburst // Type 3: Stationary 4-point HDR muzzle starburst
float pulse = sin(ageNorm * 3.14159265); float pulse = sin(ageNorm * 3.14159265);
@ -48,21 +43,26 @@ void vertex() {
float speed = length(velWorld); float speed = length(velWorld);
vec3 vProj = velWorld - toCam * dot(velWorld, toCam); vec3 vProj = velWorld - toCam * dot(velWorld, toCam);
float vProjLen2 = dot(vProj, vProj); float vProjLen2 = dot(vProj, vProj);
axisWorld = vProjLen2 > 1e-4 ? vProj * inversesqrt(vProjLen2) : camRight; vec3 axisWorld = vProjLen2 > 1e-4 ? vProj * inversesqrt(vProjLen2) : camRight;
vec3 rawPerp = cross(toCam, axisWorld); vec3 rawPerp = cross(toCam, axisWorld);
float rawPerpLen2 = dot(rawPerp, rawPerp); float rawPerpLen2 = dot(rawPerp, rawPerp);
perpWorld = rawPerpLen2 > 1e-6 ? rawPerp * inversesqrt(rawPerpLen2) : camUp; vec3 perpWorld = rawPerpLen2 > 1e-6 ? rawPerp * inversesqrt(rawPerpLen2) : camUp;
float dist = sqrt(toCamLen2);
float halfWidth;
float halfLen;
if (pType > 1.5) { if (pType > 1.5) {
// Type 2: Tiny flow-blown grit / dust mote // Type 2: Tiny flow-blown grit / dust mote
float minGritPx = sqrt(toCamLen2) * 0.0011; float minGritPx = dist * 0.0010;
halfWidth = max(clamp(widthM * (0.85 + 0.35 * ageNorm), 0.025, 0.07), minGritPx); halfWidth = max(clamp(widthM * (0.75 + 0.30 * ageNorm), 0.020, 0.055), minGritPx);
halfLen = halfWidth + clamp(speed * 0.012, 0.01, 0.16); halfLen = halfWidth + clamp(speed * 0.006, 0.01, 0.09);
} else { } else {
// Type 0 (VelocitySpark) & Type 1 (BuoyantEmber): strictly tiny width + velocity-stretched kite ears // Type 0 (VelocitySpark) & Type 1 (BuoyantEmber): crisp short punchy streaks (halfLen capped 0.04..0.16m)
float minSparkPx = sqrt(toCamLen2) * 0.0018; float minSparkPx = dist * 0.0012;
halfWidth = max(clamp(widthM * mix(1.0, 0.45, ageNorm), 0.015, 0.042), minSparkPx); halfWidth = max(clamp(widthM * mix(0.82, 0.38, ageNorm), 0.012, 0.030), minSparkPx);
halfLen = max(halfWidth * 2.4, clamp(halfWidth * 1.6 + speed * 0.028, 0.08, 0.48)); float baseLen = clamp(halfWidth * 1.6 + speed * 0.008, 0.04, 0.16);
halfLen = max(halfWidth * 1.8, min(0.16, max(baseLen, minSparkPx * 2.6)));
} }
vec3 displacedWorld = worldPos + axisWorld * (uKite * halfLen) + perpWorld * (vKite * halfWidth); vec3 displacedWorld = worldPos + axisWorld * (uKite * halfLen) + perpWorld * (vKite * halfWidth);
@ -73,10 +73,14 @@ void vertex() {
void fragment() { void fragment() {
float fade = (1.0 - v_ageNorm * v_ageNorm) * clamp(v_color.a, 0.0, 1.0); float fade = (1.0 - v_ageNorm * v_ageNorm) * clamp(v_color.a, 0.0, 1.0);
if (fade < 0.01) { if (fade < 0.02) {
discard; discard;
} }
// Temporally animated Interleaved Gradient Noise for stochastic opaque TAA coverage (depth_draw_opaque)
float frameIdx = mod(floor(TIME * 60.0), 64.0);
float dither = fract(52.9829189 * fract(dot(FRAGCOORD.xy + 5.588238 * frameIdx, vec2(0.06711056, 0.00583715))));
if (v_type > 2.5) { if (v_type > 2.5) {
// 4-point HDR muzzle starburst // 4-point HDR muzzle starburst
float r = length(v_uvCentered); float r = length(v_uvCentered);
@ -87,38 +91,45 @@ void fragment() {
float cy = exp(-abs(v_uvCentered.x) * 9.5) * smoothstep(1.0, 0.05, abs(v_uvCentered.y)); float cy = exp(-abs(v_uvCentered.x) * 9.5) * smoothstep(1.0, 0.05, abs(v_uvCentered.y));
float core = smoothstep(0.55, 0.0, r); float core = smoothstep(0.55, 0.0, r);
float mask = max(core, max(cx, cy) * 0.90); float mask = max(core, max(cx, cy) * 0.90);
float alpha = clamp(mask * fade, 0.0, 1.0); float coverage = clamp(mask * fade * 1.25, 0.0, 1.0);
if (alpha < 0.01) { if (coverage <= dither) {
discard; discard;
} }
ALBEDO = max(v_color.rgb, vec3(0.0)) * (1.0 + core * 0.9); ALBEDO = max(v_color.rgb, vec3(0.0)) * (1.0 + core * 0.95);
ALPHA = alpha;
} else if (v_type > 1.5) { } else if (v_type > 1.5) {
// Tiny flow-entrained grit speck // Flow-entrained grit / dust mote
float r = length(v_kite); float r = length(v_kite);
if (r > 0.92) { if (r > 0.92) {
discard; discard;
} }
float alpha = smoothstep(0.92, 0.18, r) * fade * 0.78; float coverage = smoothstep(0.92, 0.14, r) * fade * 0.85;
if (alpha < 0.01) { if (coverage <= dither) {
discard; discard;
} }
ALBEDO = max(v_color.rgb, vec3(0.0)); ALBEDO = max(v_color.rgb, vec3(0.0));
ALPHA = alpha;
} else { } else {
// Kite-stretched HDR spark / ember: razor diamond falloff with hot core // Molten slag spark / ember: white-gold -> amber -> deep copper-orange cooling ramp
float rKite = length(vec2(v_kite.x, v_kite.y * 1.15)); float rKite = length(vec2(v_kite.x, v_kite.y * 1.15));
if (rKite > 1.0) { if (rKite > 1.0) {
discard; discard;
} }
float core = pow(clamp(1.0 - rKite, 0.0, 1.0), 1.55); float core = pow(clamp(1.0 - rKite, 0.0, 1.0), 1.45);
float hotCenter = smoothstep(0.45, 0.0, rKite); float hotCenter = smoothstep(0.50, 0.0, rKite);
float alpha = clamp(core * fade, 0.0, 1.0); float coverage = clamp(core * fade * 1.20, 0.0, 1.0);
if (alpha < 0.01) { if (coverage <= dither) {
discard; discard;
} }
vec3 baseRgb = max(v_color.rgb, vec3(0.0));
ALBEDO = mix(baseRgb, baseRgb * 1.65 + vec3(1.2), hotCenter * 0.45); vec3 whiteGold = vec3(6.2, 4.2, 1.65);
ALPHA = alpha; vec3 moltenAmber = vec3(4.3, 1.85, 0.30);
vec3 copperEmber = vec3(1.85, 0.42, 0.05);
vec3 ramp = v_ageNorm < 0.38
? mix(whiteGold, moltenAmber, v_ageNorm / 0.38)
: mix(moltenAmber, copperEmber, clamp((v_ageNorm - 0.38) / 0.62, 0.0, 1.0));
// Subtle caller tint (20%) so plasma/thermal slag still reads predominantly as molten fire
vec3 tintRgb = max(v_color.rgb, vec3(0.0));
vec3 moltenRgb = mix(ramp, tintRgb, 0.20);
ALBEDO = mix(moltenRgb, whiteGold * 1.15, hotCenter * (1.0 - 0.55 * v_ageNorm));
} }
} }

View file

@ -5,11 +5,91 @@ global uniform sampler3D rtd_flow_field;
global uniform vec3 rtd_flow_origin; global uniform vec3 rtd_flow_origin;
global uniform vec3 rtd_flow_inv_extent; global uniform vec3 rtd_flow_inv_extent;
float tri(float x) {
return abs(fract(x) - 0.5);
}
vec3 tri3(vec3 p) {
return vec3(
tri(p.z + tri(p.y)),
tri(p.z + tri(p.x)),
tri(p.y + tri(p.x))
);
}
vec3 safeNorm(vec3 v) {
float l2 = dot(v, v);
return l2 > 1e-8 ? v * inversesqrt(l2) : vec3(0.0, 1.0, 0.0);
}
vec3 aetheriaCurl(vec3 pos, float flowScale, float scrollSpeed, float t) {
vec3 field = pos / max(0.5, flowScale);
float s1 = t * scrollSpeed;
float s2 = t * scrollSpeed * 1.61803398875;
vec3 t1 = safeNorm(tri3(field - vec3(0.0, s1, 0.0)));
vec3 t2 = safeNorm(tri3(field * 1.61803398875 - vec3(0.0, s2, 0.0)));
return cross(t1, t2);
}
uint hashU32(uint x) {
x ^= x >> 16u;
x *= 0x7FEB352Du;
x ^= x >> 15u;
x *= 0x846CA68Bu;
x ^= x >> 16u;
return x;
}
float hash01(uint x) {
return float(hashU32(x) & 0x00FFFFFFu) / 16777216.0;
}
void start() { void start() {
ACTIVE = true; ACTIVE = true;
float pType = floor(CUSTOM.w + 0.001);
if (pType > 2.5) {
// Type 3: MuzzleStarburst stays stationary at muzzle
VELOCITY = vec3(0.0);
TRANSFORM[0].xyz = vec3(1.0, 0.0, 0.0);
TRANSFORM[1].xyz = vec3(0.0, 1.0, 0.0);
TRANSFORM[2].xyz = vec3(0.0, 0.0, 1.0);
} else {
uint seed = INDEX ^ (NUMBER * 747796405u) ^ floatBitsToUint(TIME);
float r0 = hash01(seed + 1u);
float r1 = hash01(seed + 17u);
float r2 = hash01(seed + 53u);
float r3 = hash01(seed + 131u);
float r4 = hash01(seed + 257u);
float r5 = hash01(seed + 509u);
// Wide log-normal speed dispersion (0.25x..2.8x) + 3D directional chaos to shatter radial shell fans
float gauss = (r0 + r1 - 1.0) * 1.45;
float speedMult = clamp(exp(gauss * 0.72), 0.25, 2.80);
float baseSpeed = length(VELOCITY);
vec3 dirJitter = vec3(r2 * 2.0 - 1.0, r4 * 2.0 - 1.0, r5 * 2.0 - 1.0);
VELOCITY = VELOCITY * speedMult + dirJitter * (baseSpeed * 0.30);
// Sub-frame / burst-window birth offset (0..55ms) with immediate curl + gravity advection
float dt0 = r3 * 0.055;
vec3 curl0 = aetheriaCurl(TRANSFORM[3].xyz, 3.0, 0.90, TIME);
if (pType < 0.5) {
VELOCITY += curl0 * (18.0 * dt0);
VELOCITY.y -= 11.0 * dt0;
} else if (pType < 1.5) {
VELOCITY += curl0 * (14.0 * dt0);
VELOCITY.y += 2.6 * dt0;
} else {
VELOCITY += curl0 * (10.0 * dt0);
VELOCITY.y -= 1.2 * dt0;
}
TRANSFORM[3].xyz += VELOCITY * dt0;
CUSTOM.y = min(CUSTOM.z * 0.35, dt0 * 0.65);
TRANSFORM[0].xyz = VELOCITY; TRANSFORM[0].xyz = VELOCITY;
TRANSFORM[1].xyz = vec3(0.0, 1.0, 0.0); TRANSFORM[1].xyz = vec3(0.0, 1.0, 0.0);
TRANSFORM[2].xyz = vec3(0.0, 0.0, 1.0); TRANSFORM[2].xyz = vec3(0.0, 0.0, 1.0);
}
} }
void process() { void process() {
@ -38,25 +118,29 @@ void process() {
vec3 flowVel = flowSample.rgb; vec3 flowVel = flowSample.rgb;
float shockP = flowSample.a; float shockP = flowSample.a;
vec3 curl = aetheriaCurl(worldPos, 3.2, 0.85, TIME);
if (pType < 0.5) { if (pType < 0.5) {
// Type 0: VelocitySpark (ballistic + flow drag + shock kick) // Type 0: VelocitySpark (ballistic + wispy Tri3D curl streams + flow drag + shock kick)
VELOCITY += (flowVel - VELOCITY) * min(1.0, drag * DELTA); VELOCITY += (flowVel - VELOCITY) * min(1.0, drag * DELTA);
VELOCITY += curl * (22.0 * DELTA);
VELOCITY.y -= 11.0 * DELTA; VELOCITY.y -= 11.0 * DELTA;
if (shockP > 0.25) { if (shockP > 0.20) {
VELOCITY += flowVel * (shockP * 0.45 * DELTA); VELOCITY += flowVel * (shockP * 0.55 * DELTA);
} }
} else if (pType < 1.5) { } else if (pType < 1.5) {
// Type 1: BuoyantEmber (upward buoyancy + thermal swirl) // Type 1: BuoyantEmber (upward buoyancy + swirling Tri3D thermal streams)
VELOCITY += (flowVel - VELOCITY) * min(1.0, drag * DELTA); VELOCITY += (flowVel - VELOCITY) * min(1.0, drag * DELTA);
VELOCITY.y += 2.2 * DELTA; VELOCITY += curl * (15.5 * DELTA);
if (shockP > 0.25) { VELOCITY.y += 3.0 * DELTA;
VELOCITY += flowVel * (shockP * 0.65 * DELTA); if (shockP > 0.20) {
VELOCITY += flowVel * (shockP * 0.70 * DELTA);
} }
} else { } else {
// Type 2: DustMote (heavily flow-entrained ground grit) // Type 2: DustMote (heavily flow-entrained ground grit + curl wisps)
float dustDrag = max(drag, 3.2); float dustDrag = max(drag, 3.2);
VELOCITY += (flowVel - VELOCITY) * min(1.0, dustDrag * DELTA); VELOCITY += (flowVel - VELOCITY) * min(1.0, dustDrag * DELTA);
VELOCITY += curl * (11.0 * DELTA);
VELOCITY.y -= 1.2 * DELTA; VELOCITY.y -= 1.2 * DELTA;
} }

View file

@ -191,16 +191,16 @@ bool intersectCapsule(vec3 ro, vec3 rd, vec3 A, vec3 B, float R, out float outNe
} }
vec3 blackbodyRamp(float temp) { vec3 blackbodyRamp(float temp) {
// Tuned for AgX (TonemapAgxWhite=6.0) + GlowHdrThreshold=1.0: preserves rich orange-amber fire without clipping to white // Tuned for AgX (TonemapAgxWhite=6.0) + GlowHdrThreshold=1.0: blazing white-gold cores -> molten orange-red edges
vec3 c0 = vec3(0.40, 0.03, 0.002); vec3 c0 = vec3(0.55, 0.04, 0.003);
vec3 c1 = vec3(1.45, 0.20, 0.012); vec3 c1 = vec3(1.85, 0.28, 0.015);
vec3 c2 = vec3(2.85, 0.68, 0.055); vec3 c2 = vec3(3.60, 0.92, 0.075);
vec3 c3 = vec3(4.20, 1.65, 0.24); vec3 c3 = vec3(5.60, 2.35, 0.34);
vec3 c4 = vec3(5.60, 3.10, 0.85); vec3 c4 = vec3(7.60, 4.45, 1.35);
if (temp < 0.35) return mix(c0, c1, smoothstep(0.12, 0.35, temp)); if (temp < 0.35) return mix(c0, c1, smoothstep(0.10, 0.35, temp));
if (temp < 0.70) return mix(c1, c2, (temp - 0.35) / 0.35); if (temp < 0.72) return mix(c1, c2, (temp - 0.35) / 0.37);
if (temp < 1.05) return mix(c2, c3, (temp - 0.70) / 0.35); if (temp < 1.10) return mix(c2, c3, (temp - 0.72) / 0.38);
return mix(c3, c4, clamp((temp - 1.05) / 0.45, 0.0, 1.0)); return mix(c3, c4, clamp((temp - 1.10) / 0.50, 0.0, 1.0));
} }
float hgPhase(float cosTheta, float g) { float hgPhase(float cosTheta, float g) {
@ -300,7 +300,8 @@ void main() {
float elapsed = u_frame.camPosTime.w; float elapsed = u_frame.camPosTime.w;
vec3 sunDir = u_frame.sunDirIntensity.xyz; vec3 sunDir = u_frame.sunDirIntensity.xyz;
float phase = hgPhase(dot(rd, sunDir), 0.56); float cosTheta = dot(rd, sunDir);
float phase = mix(hgPhase(cosTheta, 0.68), hgPhase(cosTheta, -0.25), 0.22);
vec3 sunRad = u_frame.sunColorExt.rgb * u_frame.sunDirIntensity.w; vec3 sunRad = u_frame.sunColorExt.rgb * u_frame.sunDirIntensity.w;
vec3 ambRad = u_frame.ambientColorFog.rgb; vec3 ambRad = u_frame.ambientColorFog.rgb;
float extScale = u_frame.sunColorExt.w; float extScale = u_frame.sunColorExt.w;
@ -357,6 +358,9 @@ void main() {
continue; continue;
} }
// Near-camera fade (0.8..3.0m) so lens-adjacent plumes never whiteout the viewport or stall raymarching
float nearFade = smoothstep(0.8, 3.0, t);
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; 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)))) vec4 flowSample = (all(greaterThanEqual(flowUv, vec3(0.0))) && all(lessThanEqual(flowUv, vec3(1.0))))
@ -387,13 +391,13 @@ void main() {
// Bound flow + curl displacement strictly inside rBound (1.85 * rad) so zero spherical/tile clipping occurs // 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); vec3 flowOffset = flowSample.rgb * (0.16 + 0.12 * ageNorm);
float fOffLen = length(flowOffset); float fOffLen = length(flowOffset);
if (fOffLen > 0.42 * radAvg) { if (fOffLen > 0.38 * radAvg) {
flowOffset *= (0.42 * radAvg) / fOffLen; flowOffset *= (0.38 * radAvg) / fOffLen;
} }
vec3 advectedPos = worldPos - flowOffset; vec3 advectedPos = worldPos - flowOffset;
vec3 curl = aetheriaFlow(advectedPos + vec3(seed * 13.7), max(1.8, radAvg * 1.45), abs(em.params.z), elapsed); vec3 curl = aetheriaFlow(advectedPos + vec3(seed * 13.7), max(1.5, radAvg * 1.30), abs(em.params.z), elapsed);
vec3 evalPos = advectedPos + curl * (0.34 * radAvg); vec3 evalPos = advectedPos + curl * (0.42 * radAvg);
vec3 A = em.posRadius.xyz; vec3 A = em.posRadius.xyz;
vec3 B = em.endRadiusTemp.xyz; vec3 B = em.endRadiusTemp.xyz;
@ -407,26 +411,28 @@ void main() {
if (distNorm < 1.05) { if (distNorm < 1.05) {
float softness = clamp(em.tintSoftness.a, 0.18, 0.75); float softness = clamp(em.tintSoftness.a, 0.18, 0.75);
float baseFall = 1.0 - smoothstep(1.0 - softness, 1.04, distNorm); float baseFall = 1.0 - smoothstep(1.0 - softness, 1.04, distNorm);
// Sample triNoise3d at Nyquist-safe wavelength (>= 2.0m billows) to eliminate stipple aliasing // High-contrast Aetheria cauliflower billowing folds
float billow = clamp(triNoise3d(evalPos / max(1.55, rad * 1.15) + vec3(seed), elapsed * 0.30) * 1.68, 0.0, 1.0); float billow = clamp(triNoise3d(evalPos / max(1.35, rad * 0.95) + vec3(seed), elapsed * 0.36) * 1.85, 0.0, 1.0);
float eroded = smoothstep(0.08 + 0.34 * distNorm, 0.82, billow * 0.65 + baseFall * 0.72); float rawDensity = billow * 0.62 + baseFall * 0.78 - 0.30 * distNorm;
float rho_k = baseFall * eroded * em.params.x; float eroded = smoothstep(0.18, 0.72, rawDensity);
float rho_k = baseFall * eroded * em.params.x * nearFade;
// Shock-front cavity carving + adiabatic compression rim // Shock-front cavity carving + adiabatic compression rim
rho_k *= clamp(1.0 - shock * 0.45, 0.30, 1.0) * (1.0 + 0.40 * smoothstep(0.2, 0.9, shock)); rho_k *= clamp(1.0 - shock * 0.42, 0.32, 1.0) * (1.0 + 0.45 * smoothstep(0.2, 0.9, shock));
if (rho_k > 1e-4) { if (rho_k > 1e-4) {
rhoSum += rho_k; rhoSum += rho_k;
albedoSum += em.tintSoftness.rgb * rho_k; albedoSum += em.tintSoftness.rgb * rho_k;
float localTemp = max(em.endRadiusTemp.w * (1.0 - 0.62 * distNorm) * (0.62 + 0.58 * billow), shock * 0.24); float coreBoost = smoothstep(0.85, 0.15, distNorm);
float localTemp = max(em.endRadiusTemp.w * (0.45 + 0.85 * coreBoost) * (0.65 + 0.55 * billow), shock * 0.28);
if (localTemp > 0.16) { if (localTemp > 0.16) {
vec3 bb = blackbodyRamp(localTemp); vec3 bb = blackbodyRamp(localTemp);
if (emType == 3u || emType == 4u) { if (emType == 3u || emType == 4u) {
// Plasma / thermal pool accent-tinted HDR emission // Plasma / thermal pool accent-tinted HDR emission
bb = mix(bb, em.tintSoftness.rgb * (1.35 + 1.85 * localTemp), 0.80); bb = mix(bb, em.tintSoftness.rgb * (1.55 + 2.05 * localTemp), 0.75);
} }
emissionSum += bb * rho_k * (0.65 + 0.55 * localTemp); emissionSum += bb * rho_k * (0.85 + 0.75 * localTemp);
} }
} }
} }
@ -449,14 +455,16 @@ void main() {
float sRad = mix(se.posRadius.w, se.params.y, sSegT); float sRad = mix(se.posRadius.w, se.params.y, sSegT);
float dN = length(sPos - (sA + sAB * sSegT)) / max(0.2, sRad); float dN = length(sPos - (sA + sAB * sSegT)) / max(0.2, sRad);
if (dN < 1.05) { if (dN < 1.05) {
tauSun += (1.0 - smoothstep(0.25, 1.05, dN)) * se.params.x * 0.85; tauSun += (1.0 - smoothstep(0.25, 1.05, dN)) * se.params.x * 0.90;
} }
} }
} }
float sunTrans = exp(-tauSun * extScale * 2.2); float sunTrans = exp(-tauSun * extScale * 1.45);
float powder = 1.0 - exp(-rhoSum * extScale * 2.2);
float lightTerm = mix(sunTrans, sunTrans * (0.45 + 1.35 * powder), 0.75);
vec3 albedo = albedoSum / rhoSum; vec3 albedo = albedoSum / rhoSum;
vec3 scatter = albedo * (sunRad * sunTrans * phase * 1.25 + ambRad * 0.42); vec3 scatter = albedo * (sunRad * lightTerm * (0.42 + phase * 3.4) + ambRad * mix(0.28, 0.55, exp(-tauSun * 0.45)));
float sigmaT = rhoSum * extScale; float sigmaT = rhoSum * extScale;
float stepTrans = exp(-sigmaT * ds); float stepTrans = exp(-sigmaT * ds);
vec3 stepLight = (scatter * sigmaT + emissionSum) * (sigmaT > 1e-4 ? (1.0 - stepTrans) / sigmaT : ds); vec3 stepLight = (scatter * sigmaT + emissionSum) * (sigmaT > 1e-4 ? (1.0 - stepTrans) / sigmaT : ds);
@ -467,6 +475,7 @@ void main() {
break; break;
} }
} }
}
t += ds; t += ds;
steps++; steps++;

View file

@ -169,10 +169,13 @@ void main() {
memoryBarrierShared(); memoryBarrierShared();
barrier(); barrier();
// 128-element Bitonic sort across 128 threads (7 stages, barriers kept in uniform workgroup control flow) // Adaptive Bitonic sort (skip when <= 1; sort smallest power-of-2 >= count up to 128)
for (uint k = 2u; k <= 128u; k <<= 1u) { uint count = sTileCount;
if (count > 1u) {
uint sortN = count <= 16u ? 16u : (count <= 32u ? 32u : (count <= 64u ? 64u : 128u));
for (uint k = 2u; k <= sortN; k <<= 1u) {
for (uint j = k >> 1u; j > 0u; j >>= 1u) { for (uint j = k >> 1u; j > 0u; j >>= 1u) {
if (tid < 128u) { if (tid < sortN) {
uint ixj = tid ^ j; uint ixj = tid ^ j;
if (ixj > tid) { if (ixj > tid) {
bool ascending = ((tid & k) == 0u); bool ascending = ((tid & k) == 0u);
@ -188,6 +191,7 @@ void main() {
barrier(); barrier();
} }
} }
}
if (tid == 0u) { if (tid == 0u) {
uint outCount = min(sTileCount, MAX_TILE_EMITTERS); uint outCount = min(sTileCount, MAX_TILE_EMITTERS);