raytracing updates; water and ocean shader fog alpha fix;

This commit is contained in:
Turanszki Janos
2021-05-26 10:20:25 +02:00
parent 141703776c
commit 83c4467a54
14 changed files with 43 additions and 16 deletions
+2 -2
View File
@@ -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;
}
+1
View File
@@ -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
+7 -2
View File
@@ -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
+1 -1
View File
@@ -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
+2 -1
View File
@@ -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);
+4 -4
View File
@@ -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);
@@ -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;
@@ -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)
{
+3
View File
@@ -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];
+3
View File
@@ -95,6 +95,9 @@ inline void ResolverAABB(Texture2D<float4> 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;
+1 -1
View File
@@ -4,7 +4,7 @@
#include <fstream>
// 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;
+1 -1
View File
@@ -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;
+12 -1
View File
@@ -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;
+1 -1
View File
@@ -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);