ssr update #80

This commit is contained in:
Turanszki Janos
2020-03-17 18:21:41 +00:00
parent 74c3d0de83
commit ff79e16cfe
4 changed files with 9 additions and 4 deletions
+3
View File
@@ -17,6 +17,9 @@ CBUFFER(PostProcessCB, CBSLOT_RENDERER_POSTPROCESS)
#define lineardepth_inputresolution xPPParams0.xy
#define lineardepth_inputresolution_rcp xPPParams0.zw
#define ssr_input_maxmip xPPParams0.x
#define ssr_input_resolution_max xPPParams0.y
#define ssao_range xPPParams0.x
#define ssao_samplecount xPPParams0.y
#define ssao_power xPPParams0.z
+2 -3
View File
@@ -74,7 +74,6 @@ void main(uint3 DTid : SV_DispatchThreadID)
float specularConeTangent = lerp(0.0, roughness * (1.0 - BRDFBias), NdotV * sqrt(roughness));
specularConeTangent *= lerp(saturate(NdotV * 2), 1.0f, sqrt(roughness));
const float maxMipLevel = 11.0f - 1.0f;
const uint2 Random = Rand3DPCG16(int3((DTid.xy + 0.5f), g_xFrame_FrameCount)).xy;
float4 result = 0.0f;
@@ -87,7 +86,7 @@ void main(uint3 DTid : SV_DispatchThreadID)
float2 offsetRotation = (HammersleyRandom(i, NumResolve, Random) * 2.0 - 1.0) * roughnessSequenceSize;
float2x2 offsetRotationMatrix = float2x2(offsetRotation.x, offsetRotation.y, -offsetRotation.y, offsetRotation.x);
float2 offsetUV = offset[i] * (1.0f / xPPResolution);
float2 offsetUV = offset[i] * xPPResolution_rcp;
offsetUV = uv + mul(offsetRotationMatrix, offsetUV) * CalculateTailDirection(N);
float4 raytraceSource = texture_raytrace.SampleLevel(sampler_point_clamp, offsetUV, 0);
@@ -100,7 +99,7 @@ void main(uint3 DTid : SV_DispatchThreadID)
float iterationStep = maskSource.y;
float intersectionCircleRadius = specularConeTangent * length(hitPixel - uv);
float sourceMip = clamp(log2(intersectionCircleRadius * max(xPPResolution.x, xPPResolution.y)), 0.0, maxMipLevel) * resolveMip;
float sourceMip = clamp(log2(intersectionCircleRadius * ssr_input_resolution_max), 0.0, ssr_input_maxmip) * resolveMip;
float4 sampleColor;
sampleColor.rgb = texture_main.SampleLevel(sampler_linear_clamp, hitPixel, sourceMip).xyz;
+3
View File
@@ -8825,6 +8825,7 @@ void Postprocess_SSR(
device->UnbindResources(TEXSLOT_RENDERPATH_SSR, 1, cmd);
const TextureDesc& input_desc = input.GetDesc();
const TextureDesc& desc = output.GetDesc();
static TextureDesc initialized_desc;
@@ -8865,6 +8866,8 @@ void Postprocess_SSR(
cb.xPPResolution.y = desc.Height / 2;
cb.xPPResolution_rcp.x = 1.0f / cb.xPPResolution.x;
cb.xPPResolution_rcp.y = 1.0f / cb.xPPResolution.y;
cb.ssr_input_maxmip = float(input_desc.MipLevels - 1);
cb.ssr_input_resolution_max = (float)std::max(input_desc.Width, input_desc.Height);
device->UpdateBuffer(&constantBuffers[CBTYPE_POSTPROCESS], &cb, cmd);
device->BindConstantBuffer(CS, &constantBuffers[CBTYPE_POSTPROCESS], CB_GETBINDSLOT(PostProcessCB), cmd);
+1 -1
View File
@@ -9,7 +9,7 @@ namespace wiVersion
// minor features, major updates
const int minor = 38;
// minor bug fixes, alterations, refactors, updates
const int revision = 18;
const int revision = 19;
long GetVersion()