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

@ -4,13 +4,13 @@ using Godot;
namespace RustToDust.Client;
/// <summary>
/// Flow-coupled GPU particle system (<see cref="GpuParticles3D"/>, 8,192 capacity) driven by
/// the global <c>rtd_flow_field</c> <see cref="Texture3Drd"/> for tiny kite-stretched HDR sparks,
/// buoyant embers, flow-entrained dust motes, and 0.08s muzzle starbursts.
/// Flow-coupled GPU particle system (<see cref="GpuParticles3D"/>, 65,536 capacity) driven by
/// the global <c>rtd_flow_field</c> <see cref="Texture3Drd"/> + <c>Tri3D</c> curl streams for
/// stochastic opaque HDR sparks, buoyant embers, flow-entrained dust motes, and muzzle starbursts.
/// </summary>
public partial class GpuSparksSystem : Node3D
{
public const int Capacity = 8192;
public const int Capacity = 65536;
public const int TypeVelocitySpark = 0;
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);
}
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();
Vector3 n = normal.LengthSquared() > 1e-4f ? normal.Normalized() : Vector3.Up;
for (int i = 0; i < count; i++)
{
Vector3 rand = new(NextSigned(), MathF.Abs(NextSigned()) + 0.30f, NextSigned());
Vector3 dir = (n * 0.72f + rand).Normalized();
float spd = speed * (0.55f + 0.80f * NextFloat());
float life = 0.22f + 0.26f * NextFloat();
EmitRaw(pos, dir * spd, hdrColor, widthM, life, TypeVelocitySpark, 0.85f);
Vector3 rand = new(NextSigned(), MathF.Abs(NextSigned()) + 0.28f, NextSigned());
Vector3 dir = (n * 0.65f + rand).Normalized();
float spd = speed * (0.55f + 0.85f * NextFloat());
float life = 0.24f + 0.34f * NextFloat();
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();
for (int i = 0; i < count; i++)
{
Vector3 vel = new(NextSigned() * spreadSpeed, 2.5f + NextFloat() * 5.0f, NextSigned() * spreadSpeed);
float life = 0.85f + NextFloat() * 1.15f;
EmitRaw(pos + new Vector3(NextSigned() * 0.6f, NextFloat() * 0.6f, NextSigned() * 0.6f), vel, hdrColor, widthM, life, TypeBuoyantEmber, 1.6f);
Vector3 vel = new(NextSigned() * spreadSpeed, 2.5f + NextFloat() * 5.5f, NextSigned() * spreadSpeed);
float life = 0.90f + NextFloat() * 1.25f;
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();
float scale = isContender ? 1.2f : 0.85f;
Color sparkHdr = new(4.2f, 2.4f, 0.75f, 0.98f);
for (int i = 0; i < 2; i++)
Color sparkHdr = new(4.8f, 2.6f, 0.65f, 0.98f);
int sparkCount = isContender ? 14 : 8;
for (int i = 0; i < sparkCount; i++)
{
Vector3 vel = new(NextSigned() * 6.5f, -(11f + NextFloat() * 7f), NextSigned() * 6.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);
Vector3 vel = new(NextSigned() * 7.5f, -(11f + NextFloat() * 7f), NextSigned() * 7.5f);
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)
{
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);
Color dustCol = new(groundTint.R * 1.1f, groundTint.G * 1.1f, groundTint.B * 1.1f, 0.75f * washT);
int moteCount = isContender ? 4 : 2;
Color dustCol = new(groundTint.R * 1.1f, groundTint.G * 1.1f, groundTint.B * 1.1f, 0.78f * washT);
int moteCount = isContender ? 24 : 14;
for (int d = 0; d < moteCount; d++)
{
float ang = NextFloat() * MathF.Tau;
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);
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);
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.055f * scale, 0.55f + NextFloat() * 0.30f, TypeDustMote, 3.4f);
}
}
}
@ -181,9 +183,9 @@ public partial class GpuSparksSystem : Node3D
{
EnsureInitialized();
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);
EmitEmberBurst(pos + normal * 0.45f, isContender ? 10 : 5, new Color(3.6f, 1.6f, 0.45f, 0.95f), 6.5f * scale, 0.055f);
EmitDustMotes(pos + normal * 0.25f, normal, isContender ? 14 : 8, groundTint with { A = 0.80f }, 10f * scale, 0.075f);
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 ? 85 : 48, new Color(4.0f, 1.6f, 0.35f, 0.95f), 7.5f * scale, 0.032f);
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)