diff --git a/Content/Shaders/GI/DDGI.flax b/Content/Shaders/GI/DDGI.flax index 3285a98d5..3f0e3b153 100644 --- a/Content/Shaders/GI/DDGI.flax +++ b/Content/Shaders/GI/DDGI.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a321b884ea74537d1b4f2fd0769cd81ff91280d35ad193c0811b6fc995b9f38d -size 18502 +oid sha256:a5a7f8297f6ce999229521399607d277c63a350dadff2d48fd009b892f48d286 +size 18558 diff --git a/Content/Shaders/GI/GlobalSurfaceAtlas.flax b/Content/Shaders/GI/GlobalSurfaceAtlas.flax index 6184bb640..5852ce04c 100644 --- a/Content/Shaders/GI/GlobalSurfaceAtlas.flax +++ b/Content/Shaders/GI/GlobalSurfaceAtlas.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:22313af733ee40c4789fd184d172b6ad8ea3d46ee3da9b33dd34403a642f76f6 -size 11710 +oid sha256:60f2a063a165e62fa94892eb9869db8e990c15866cb3339ed682b4cd0da9778b +size 11785 diff --git a/Source/Engine/Foliage/FoliageType.cpp b/Source/Engine/Foliage/FoliageType.cpp index 1aa14bacb..75bd33191 100644 --- a/Source/Engine/Foliage/FoliageType.cpp +++ b/Source/Engine/Foliage/FoliageType.cpp @@ -208,11 +208,4 @@ void FoliageType::Deserialize(DeserializeStream& stream, ISerializeModifier* mod DESERIALIZE(PlacementRandomRollAngle); DESERIALIZE_BIT(PlacementAlignToNormal); DESERIALIZE_BIT(PlacementRandomYaw); - - // [Deprecated on 07.02.2022, expires on 07.02.2024] - if (modifier->EngineBuild <= 6330) - DrawModes |= DrawPass::GlobalSDF; - // [Deprecated on 27.04.2022, expires on 27.04.2024] - if (modifier->EngineBuild <= 6331) - DrawModes |= DrawPass::GlobalSurfaceAtlas; } diff --git a/Source/Engine/Foliage/FoliageType.h b/Source/Engine/Foliage/FoliageType.h index 2cef6729c..a70491bfe 100644 --- a/Source/Engine/Foliage/FoliageType.h +++ b/Source/Engine/Foliage/FoliageType.h @@ -132,7 +132,7 @@ public: /// /// The draw passes to use for rendering this foliage type. /// - API_FIELD() DrawPass DrawModes = DrawPass::Default; + API_FIELD() DrawPass DrawModes = DrawPass::Depth | DrawPass::GBuffer | DrawPass::Forward; /// /// The shadows casting mode. diff --git a/Source/Engine/Renderer/GI/GlobalSurfaceAtlasPass.cpp b/Source/Engine/Renderer/GI/GlobalSurfaceAtlasPass.cpp index e278a121a..b1c9095f0 100644 --- a/Source/Engine/Renderer/GI/GlobalSurfaceAtlasPass.cpp +++ b/Source/Engine/Renderer/GI/GlobalSurfaceAtlasPass.cpp @@ -28,6 +28,8 @@ #define GLOBAL_SURFACE_ATLAS_OBJECT_DATA_STRIDE 6 // Amount of float4s per-object #define GLOBAL_SURFACE_ATLAS_TILE_DATA_STRIDE 5 // Amount of float4s per-tile #define GLOBAL_SURFACE_ATLAS_TILE_PADDING 1 // 1px padding to prevent color bleeding between tiles +#define GLOBAL_SURFACE_ATLAS_TILE_SIZE_MIN 8 // The minimum size of the tile +#define GLOBAL_SURFACE_ATLAS_TILE_SIZE_MAX 192 // The maximum size of the tile #define GLOBAL_SURFACE_ATLAS_TILE_PROJ_PLANE_OFFSET 0.1f // Small offset to prevent clipping with the closest triangles (shifts near and far planes) #define GLOBAL_SURFACE_ATLAS_DEBUG_FORCE_REDRAW_TILES 0 // Forces to redraw all object tiles every frame #define GLOBAL_SURFACE_ATLAS_DEBUG_DRAW_OBJECTS 0 // Debug draws object bounds on redraw (and tile draw projection locations) @@ -1013,8 +1015,8 @@ void GlobalSurfaceAtlasPass::RasterizeActor(Actor* actor, void* actorObject, con } // Clamp tile resolution (in pixels) - static_assert(GLOBAL_SURFACE_ATLAS_TILE_PADDING < 8, "Invalid tile size configuration. Minimum tile size must be larger than padding."); - tileResolution = Math::Clamp(tileResolution, 8, 128); + static_assert(GLOBAL_SURFACE_ATLAS_TILE_PADDING < GLOBAL_SURFACE_ATLAS_TILE_SIZE_MIN, "Invalid tile size configuration. Minimum tile size must be larger than padding."); + tileResolution = Math::Clamp(tileResolution, GLOBAL_SURFACE_ATLAS_TILE_SIZE_MIN, GLOBAL_SURFACE_ATLAS_TILE_SIZE_MAX); // Snap tiles resolution (down) which allows to reuse atlas slots once object gets resizes/replaced by other object tileResolution = Math::AlignDown(tileResolution, 8); diff --git a/Source/Shaders/GI/DDGI.shader b/Source/Shaders/GI/DDGI.shader index d5daae4ba..cd1ed41d8 100644 --- a/Source/Shaders/GI/DDGI.shader +++ b/Source/Shaders/GI/DDGI.shader @@ -320,12 +320,13 @@ void CS_UpdateProbes(uint3 DispatchThreadId : SV_DispatchThreadID, uint GroupInd #endif float3 irradianceDelta = result.rgb - previous; float irradianceDeltaMax = Max3(abs(irradianceDelta)); - if (irradianceDeltaMax > 0.25f) + float irradianceDeltaLen = length(irradianceDelta); + if (irradianceDeltaMax > 0.2f) { // Reduce history weight after significant lighting change - historyWeight = max(historyWeight - 0.2f, 0.0f); + historyWeight = max(historyWeight - 0.7f, 0.0f); } - if (irradianceDeltaMax > 0.8f) + if (irradianceDeltaLen > 2.0f) { // Reduce flickering during rapid brightness changes result.rgb = previous + (irradianceDelta * 0.25f); diff --git a/Source/Shaders/GI/GlobalSurfaceAtlas.shader b/Source/Shaders/GI/GlobalSurfaceAtlas.shader index 4f91680d3..e557b4b89 100644 --- a/Source/Shaders/GI/GlobalSurfaceAtlas.shader +++ b/Source/Shaders/GI/GlobalSurfaceAtlas.shader @@ -113,6 +113,9 @@ float4 PS_Lighting(AtlasVertexOutput input) : SV_Target float4x4 tileLocalToWorld = Inverse(tile.WorldToLocal); gBuffer.WorldPos = mul(float4(gBufferTilePos, 1), tileLocalToWorld).xyz; + // Boost material diffuse color to improve GI + gBuffer.Color *= 1.1f; + #if INDIRECT_LIGHT // Sample irradiance float bias = 1.0f;