Cut 8: Forward+ Vulkan cutover, atmospheric scattering sky, volumetric fog, SSR, 4-split shadows, & linear HDR
This commit is contained in:
parent
c789fe8af8
commit
35626ccd02
21 changed files with 1232 additions and 227 deletions
|
|
@ -27,9 +27,7 @@ public partial class Main : Node3D
|
|||
private ArenaAudioSystem _audio = null!;
|
||||
private Camera3D _camera = null!;
|
||||
private Hud _hud = null!;
|
||||
private DirectionalLight3D _sun = null!;
|
||||
private ProceduralSkyMaterial _skyMat = null!;
|
||||
private Godot.Environment _env = null!;
|
||||
private AtmosphereSystem _atmosphere = null!;
|
||||
private IClientArenaSession? _session;
|
||||
private MatchState? _boundViewState;
|
||||
private bool _wasNetConnected;
|
||||
|
|
@ -90,6 +88,7 @@ public partial class Main : Node3D
|
|||
public CameraJuiceState CameraJuice => _camJuice;
|
||||
public Camera3D Camera => _camera;
|
||||
public Hud Hud => _hud;
|
||||
public AtmosphereSystem Atmosphere => _atmosphere;
|
||||
public ArenaMapKind MapKind => _mapKind;
|
||||
public ArenaMapKind? InitialMapKindOverride { get; set; }
|
||||
public bool InitialSkipDropOverride { get; set; }
|
||||
|
|
@ -102,7 +101,10 @@ public partial class Main : Node3D
|
|||
|
||||
public override void _Ready()
|
||||
{
|
||||
SetupLightingAndSky();
|
||||
GetViewport().UseTaa = true;
|
||||
_atmosphere = new AtmosphereSystem { Name = "AtmosphereSystem" };
|
||||
AddChild(_atmosphere);
|
||||
_atmosphere.EnsureInitialized();
|
||||
|
||||
_terrain = new TerrainRenderer { Name = "Terrain" };
|
||||
AddChild(_terrain);
|
||||
|
|
@ -460,7 +462,7 @@ public partial class Main : Node3D
|
|||
}
|
||||
|
||||
_camera.Far = _mapKind == ArenaMapKind.Sion ? 4200f : 1800f;
|
||||
ApplyEnvironmentForMap(_mapKind);
|
||||
_atmosphere.ApplyMap(_mapKind);
|
||||
|
||||
if (_mapKind == ArenaMapKind.Sion && state.SionMap is not null)
|
||||
{
|
||||
|
|
@ -1485,81 +1487,4 @@ public partial class Main : Node3D
|
|||
{
|
||||
_session?.RequestEquipCargo(cargoIndex, hardpointId);
|
||||
}
|
||||
|
||||
private void SetupLightingAndSky()
|
||||
{
|
||||
_sun = new DirectionalLight3D
|
||||
{
|
||||
Name = "DesertSun",
|
||||
LightColor = new Color(1.0f, 0.92f, 0.78f),
|
||||
LightEnergy = 1.45f,
|
||||
ShadowEnabled = true,
|
||||
DirectionalShadowMode = DirectionalLight3D.ShadowMode.Parallel2Splits,
|
||||
DirectionalShadowMaxDistance = 88f,
|
||||
RotationDegrees = new Vector3(-48f, 32f, 0f)
|
||||
};
|
||||
AddChild(_sun);
|
||||
|
||||
_skyMat = new ProceduralSkyMaterial
|
||||
{
|
||||
SkyTopColor = new Color(0.24f, 0.34f, 0.44f),
|
||||
SkyHorizonColor = new Color(0.76f, 0.56f, 0.37f),
|
||||
GroundBottomColor = new Color(0.32f, 0.22f, 0.14f),
|
||||
GroundHorizonColor = new Color(0.70f, 0.50f, 0.33f)
|
||||
};
|
||||
_env = new Godot.Environment
|
||||
{
|
||||
BackgroundMode = Godot.Environment.BGMode.Sky,
|
||||
Sky = new Sky { SkyMaterial = _skyMat },
|
||||
AmbientLightSource = Godot.Environment.AmbientSource.Sky,
|
||||
AmbientLightEnergy = 0.55f,
|
||||
FogEnabled = true,
|
||||
FogMode = Godot.Environment.FogModeEnum.Depth,
|
||||
FogLightColor = new Color(0.76f, 0.57f, 0.39f),
|
||||
FogDensity = 0.72f,
|
||||
FogDepthBegin = 380f,
|
||||
FogDepthEnd = 1100f
|
||||
};
|
||||
AddChild(new WorldEnvironment { Name = "WorldEnv", Environment = _env });
|
||||
}
|
||||
|
||||
private void ApplyEnvironmentForMap(ArenaMapKind mapKind)
|
||||
{
|
||||
if (mapKind == ArenaMapKind.Sion)
|
||||
{
|
||||
_sun.LightColor = new Color(1.0f, 0.95f, 0.87f);
|
||||
_sun.LightEnergy = 1.25f;
|
||||
_sun.DirectionalShadowMaxDistance = 120f;
|
||||
_sun.RotationDegrees = new Vector3(-42f, 28f, 0f);
|
||||
|
||||
_skyMat.SkyTopColor = new Color(0.18f, 0.36f, 0.62f);
|
||||
_skyMat.SkyHorizonColor = new Color(0.68f, 0.79f, 0.89f);
|
||||
_skyMat.GroundBottomColor = new Color(0.24f, 0.26f, 0.22f);
|
||||
_skyMat.GroundHorizonColor = new Color(0.58f, 0.67f, 0.74f);
|
||||
|
||||
_env.AmbientLightEnergy = 0.42f;
|
||||
_env.FogLightColor = new Color(0.70f, 0.79f, 0.88f);
|
||||
_env.FogDensity = 0.42f;
|
||||
_env.FogDepthBegin = 850f;
|
||||
_env.FogDepthEnd = 3000f;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sun.LightColor = new Color(1.0f, 0.92f, 0.78f);
|
||||
_sun.LightEnergy = 1.45f;
|
||||
_sun.DirectionalShadowMaxDistance = 88f;
|
||||
_sun.RotationDegrees = new Vector3(-48f, 32f, 0f);
|
||||
|
||||
_skyMat.SkyTopColor = new Color(0.24f, 0.34f, 0.44f);
|
||||
_skyMat.SkyHorizonColor = new Color(0.76f, 0.56f, 0.37f);
|
||||
_skyMat.GroundBottomColor = new Color(0.32f, 0.22f, 0.14f);
|
||||
_skyMat.GroundHorizonColor = new Color(0.70f, 0.50f, 0.33f);
|
||||
|
||||
_env.AmbientLightEnergy = 0.55f;
|
||||
_env.FogLightColor = new Color(0.76f, 0.57f, 0.39f);
|
||||
_env.FogDensity = 0.72f;
|
||||
_env.FogDepthBegin = 380f;
|
||||
_env.FogDepthEnd = 1100f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue