diff --git a/Editor/WeatherWindow.cpp b/Editor/WeatherWindow.cpp index d8eb1a2f5..bed490d87 100644 --- a/Editor/WeatherWindow.cpp +++ b/Editor/WeatherWindow.cpp @@ -407,7 +407,7 @@ void WeatherWindow::Create(EditorComponent* editor) weather.zenith = args.color.toFloat3(); break; case 3: - weather.oceanParameters.waterColor = args.color.toFloat3(); + weather.oceanParameters.waterColor = args.color.toFloat4(); break; } }); @@ -574,7 +574,7 @@ void WeatherWindow::Update() colorPicker.SetPickColor(wiColor::fromFloat3(weather.zenith)); break; case 3: - colorPicker.SetPickColor(wiColor::fromFloat3(weather.oceanParameters.waterColor)); + colorPicker.SetPickColor(wiColor::fromFloat4(weather.oceanParameters.waterColor)); break; } diff --git a/WickedEngine/ArchiveVersionHistory.txt b/WickedEngine/ArchiveVersionHistory.txt index b7daf080c..9481e21ad 100644 --- a/WickedEngine/ArchiveVersionHistory.txt +++ b/WickedEngine/ArchiveVersionHistory.txt @@ -1,5 +1,6 @@ This file contains changelog of wiArchive versions +67: ocean water color float3 -> float4 (alpha in effect now) 66: serialized WeatherComponent::atmosphereParameters and skyExposure 65: serialized CameraComponent focal_length, aperture_size and aperture_shape 64: serialized per-emitter gravity, velocity, drag and random_color diff --git a/WickedEngine/shaders/ShaderInterop_Ocean.h b/WickedEngine/shaders/ShaderInterop_Ocean.h index 371354540..72af65f9d 100644 --- a/WickedEngine/shaders/ShaderInterop_Ocean.h +++ b/WickedEngine/shaders/ShaderInterop_Ocean.h @@ -30,13 +30,18 @@ CBUFFER(Ocean_Simulation_PerFrameCB, CBSLOT_OTHER_OCEAN_SIMULATION_PERFRAME) CBUFFER(Ocean_RenderCB, CBSLOT_OTHER_OCEAN_RENDER) { - float3 xOceanWaterColor; - float xOceanTexelLength; + float4 xOceanWaterColor; float4 xOceanScreenSpaceParams; + + float xOceanTexelLength; float xOceanPatchSizeRecip; float xOceanMapHalfTexel; float xOceanWaterHeight; + float xOceanSurfaceDisplacementTolerance; + float xOceanPadding1; + float xOceanPadding2; + float xOceanPadding3; }; #endif // WI_SHADERINTEROP_OCEAN_H diff --git a/WickedEngine/shaders/objectHF.hlsli b/WickedEngine/shaders/objectHF.hlsli index 202f03182..bdcca7251 100644 --- a/WickedEngine/shaders/objectHF.hlsli +++ b/WickedEngine/shaders/objectHF.hlsli @@ -1782,7 +1782,6 @@ float4 main(PixelInput input) : SV_TARGET #ifdef WATER - color.a = 1; //NORMALMAP float2 bumpColor0 = 0; @@ -1885,6 +1884,7 @@ float4 main(PixelInput input) : SV_TARGET } // WATER FOG: surface.refraction.a = 1 - saturate(color.a * 0.1 * depth_difference); + color.a = 1; #endif // WATER diff --git a/WickedEngine/shaders/oceanSurfacePS.hlsl b/WickedEngine/shaders/oceanSurfacePS.hlsl index ab6ad2006..4d1f029b5 100644 --- a/WickedEngine/shaders/oceanSurfacePS.hlsl +++ b/WickedEngine/shaders/oceanSurfacePS.hlsl @@ -12,7 +12,7 @@ float4 main(PSIn input) : SV_TARGET { float2 gradient = texture_gradientmap.Sample(sampler_aniso_wrap, input.uv).xy; - float4 color = float4(xOceanWaterColor, 1); + float4 color = xOceanWaterColor; float opacity = 1; // keep edge diffuse shading float3 V = g_xCamera_CamPos - input.pos3D; float dist = length(V); @@ -61,6 +61,7 @@ float4 main(PSIn input) : SV_TARGET } // WATER FOG: surface.refraction.a = 1 - saturate(color.a * 0.1f * depth_difference); + color.a = 1; ApplyLighting(surface, lighting, color); diff --git a/WickedEngine/shaders/rtreflectionLIB.hlsl b/WickedEngine/shaders/rtreflectionLIB.hlsl index 37199cb9b..c5d08db26 100644 --- a/WickedEngine/shaders/rtreflectionLIB.hlsl +++ b/WickedEngine/shaders/rtreflectionLIB.hlsl @@ -56,10 +56,10 @@ void RTReflection_Raygen() { // When reprojection is invalid, trace the surface parameters: RayDesc ray; - ray.Origin = P - V * 0.01; + ray.Origin = P - V * 0.005; ray.Direction = V; - ray.TMin = 0.001; - ray.TMax = 0.1; + ray.TMin = 0; + ray.TMax = 0.01; RayPayload payload; payload.data = -1; // indicate closesthit shader will just fill normal and roughness @@ -122,7 +122,7 @@ void RTReflection_Raygen() float seed = g_xFrame_Time; RayDesc ray; - ray.TMin = 0.05; + ray.TMin = 0.01; ray.TMax = rtreflection_range; ray.Origin = P; ray.Direction = normalize(R); diff --git a/WickedEngine/shaders/rtshadow_denoise_temporalCS.hlsl b/WickedEngine/shaders/rtshadow_denoise_temporalCS.hlsl index 8751890dd..914b2390f 100644 --- a/WickedEngine/shaders/rtshadow_denoise_temporalCS.hlsl +++ b/WickedEngine/shaders/rtshadow_denoise_temporalCS.hlsl @@ -68,6 +68,9 @@ inline void ResolverAABB(in uint shadow_index, float sharpness, float exposureSc [numthreads(POSTPROCESS_BLOCKSIZE, POSTPROCESS_BLOCKSIZE, 1)] void main(uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID, uint3 Gid : SV_GroupID, uint groupIndex : SV_GroupIndex) { + if (texture_depth.Load(uint3(DTid.xy, 1)) == 0) + return; + // first 4 lights are denoised output[DTid.xy].r = 0; output[DTid.xy].r |= (uint(denoised[DTid.xy].r * 255) & 0xFF) << 0; diff --git a/WickedEngine/shaders/screenspaceshadowCS.hlsl b/WickedEngine/shaders/screenspaceshadowCS.hlsl index 1a62b212d..17b1b9349 100644 --- a/WickedEngine/shaders/screenspaceshadowCS.hlsl +++ b/WickedEngine/shaders/screenspaceshadowCS.hlsl @@ -100,7 +100,7 @@ void main(uint3 DTid : SV_DispatchThreadID, uint3 Gid : SV_GroupID, uint3 GTid : Surface surface; surface.init(); surface.pixel = DTid.xy; - surface.P = P + N * 0.01; + surface.P = P; surface.N = N; const uint2 tileIndex = uint2(floor(surface.pixel * 2 / TILED_CULLING_BLOCKSIZE)); @@ -326,7 +326,7 @@ void main(uint3 DTid : SV_DispatchThreadID, uint3 Gid : SV_GroupID, uint3 GTid : if (is_saturated(proj.xy)) { const float ray_depth_real = proj.w; - const float ray_depth_sample = texture_lineardepth.SampleLevel(sampler_point_clamp, proj.xy, 0) * g_xCamera_ZFarP; + const float ray_depth_sample = texture_lineardepth.SampleLevel(sampler_point_clamp, proj.xy, 1) * g_xCamera_ZFarP; const float ray_depth_delta = ray_depth_real - ray_depth_sample; if (ray_depth_delta > 0 && ray_depth_delta < thickness) { diff --git a/WickedEngine/shaders/ssr_medianCS.hlsl b/WickedEngine/shaders/ssr_medianCS.hlsl index 007280dcd..b34f65522 100644 --- a/WickedEngine/shaders/ssr_medianCS.hlsl +++ b/WickedEngine/shaders/ssr_medianCS.hlsl @@ -16,6 +16,9 @@ RWTEXTURE2D(output, float4, 0); [numthreads(POSTPROCESS_BLOCKSIZE, POSTPROCESS_BLOCKSIZE, 1)] void main(uint3 DTid : SV_DispatchThreadID) { + if (texture_depth.Load(uint3(DTid.xy, 1)) == 0) + return; + const float2 uv = (DTid.xy + 0.5f) * xPPResolution_rcp; half4 v[25]; diff --git a/WickedEngine/shaders/ssr_temporalCS.hlsl b/WickedEngine/shaders/ssr_temporalCS.hlsl index 9814f35ab..2a1f2095e 100644 --- a/WickedEngine/shaders/ssr_temporalCS.hlsl +++ b/WickedEngine/shaders/ssr_temporalCS.hlsl @@ -95,6 +95,9 @@ inline void ResolverAABB(Texture2D currentColor, SamplerState currentSam [numthreads(POSTPROCESS_BLOCKSIZE, POSTPROCESS_BLOCKSIZE, 1)] void main(uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID, uint3 Gid : SV_GroupID, uint groupIndex : SV_GroupIndex) { + if (texture_depth.Load(uint3(DTid.xy, 1)) == 0) + return; + const float2 uv = (DTid.xy + 0.5f) * xPPResolution_rcp; const float2 velocity = texture_gbuffer2.SampleLevel(sampler_point_clamp, uv, 0).xy; diff --git a/WickedEngine/wiArchive.cpp b/WickedEngine/wiArchive.cpp index b80ec6270..40f095e06 100644 --- a/WickedEngine/wiArchive.cpp +++ b/WickedEngine/wiArchive.cpp @@ -4,7 +4,7 @@ #include // this should always be only INCREMENTED and only if a new serialization is implemeted somewhere! -uint64_t __archiveVersion = 66; +uint64_t __archiveVersion = 67; // this is the version number of which below the archive is not compatible with the current version uint64_t __archiveVersionBarrier = 22; diff --git a/WickedEngine/wiOcean.h b/WickedEngine/wiOcean.h index cbdef26ce..2531ad3a7 100644 --- a/WickedEngine/wiOcean.h +++ b/WickedEngine/wiOcean.h @@ -31,7 +31,7 @@ public: float choppy_scale = 1.3f; - XMFLOAT3 waterColor = XMFLOAT3(0.0f, 3.0f / 255.0f, 31.0f / 255.0f); + XMFLOAT4 waterColor = XMFLOAT4(0.0f, 3.0f / 255.0f, 31.0f / 255.0f, 1); float waterHeight = 0.0f; uint32_t surfaceDetail = 4; float surfaceDisplacementTolerance = 2; diff --git a/WickedEngine/wiScene_Serializers.cpp b/WickedEngine/wiScene_Serializers.cpp index 0665a296c..e20c70c79 100644 --- a/WickedEngine/wiScene_Serializers.cpp +++ b/WickedEngine/wiScene_Serializers.cpp @@ -943,7 +943,18 @@ namespace wiScene archive >> oceanParameters.wind_speed; archive >> oceanParameters.wind_dependency; archive >> oceanParameters.choppy_scale; - archive >> oceanParameters.waterColor; + if (archive.GetVersion() < 67) + { + XMFLOAT3 waterColor; + archive >> waterColor; + oceanParameters.waterColor.x = waterColor.x; + oceanParameters.waterColor.y = waterColor.y; + oceanParameters.waterColor.z = waterColor.z; + } + else + { + archive >> oceanParameters.waterColor; + } archive >> oceanParameters.waterHeight; archive >> oceanParameters.surfaceDetail; archive >> oceanParameters.surfaceDisplacementTolerance; diff --git a/WickedEngine/wiVersion.cpp b/WickedEngine/wiVersion.cpp index d914ca83c..02484eb57 100644 --- a/WickedEngine/wiVersion.cpp +++ b/WickedEngine/wiVersion.cpp @@ -9,7 +9,7 @@ namespace wiVersion // minor features, major updates, breaking compatibility changes const int minor = 56; // minor bug fixes, alterations, refactors, updates - const int revision = 22; + const int revision = 23; const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);