updated motion blur
This commit is contained in:
@@ -1,21 +1,22 @@
|
||||
#define DILATE_VELOCITY
|
||||
|
||||
#include "postProcessHF.hlsli"
|
||||
#include "reconstructPositionHF.hlsli"
|
||||
|
||||
|
||||
float4 main(VertexToPixelPostProcess PSIn) : SV_TARGET
|
||||
{
|
||||
float3 color = float3(0,0,0);
|
||||
float numSampling = 0.0f;
|
||||
float3 color = 0;
|
||||
float numSampling = 1.0f;
|
||||
|
||||
float2 vel = texture_gbuffer1.Load(uint3(PSIn.pos.xy, 0)).zw;
|
||||
float2 vel = GetVelocity(PSIn.pos.xy);
|
||||
vel *= 0.025f;
|
||||
|
||||
numSampling++;
|
||||
|
||||
[unroll]
|
||||
for(float i=-7.5f;i<=7.5f;i+=1.0f){
|
||||
color.rgb += xTexture.SampleLevel(Sampler,saturate(PSIn.tex+vel*i*0.5f),0).rgb;
|
||||
color.rgb += xTexture.SampleLevel(sampler_linear_clamp,saturate(PSIn.tex+vel*i*0.5f),0).rgb;
|
||||
numSampling++;
|
||||
}
|
||||
|
||||
return float4(color/numSampling,1);
|
||||
return float4(color / numSampling, 1);
|
||||
}
|
||||
@@ -5,13 +5,34 @@
|
||||
#include "packHF.hlsli"
|
||||
#include "depthConvertHF.hlsli"
|
||||
|
||||
/*inline float getDepth(float4 c)
|
||||
|
||||
float2 GetVelocity(in int2 pixel)
|
||||
{
|
||||
float z_b = c.x;
|
||||
float z_n = 2.0 * z_b - 1.0;
|
||||
float lin = 2.0 * zNearP * zFarP / (zFarP + zNearP - z_n * (zFarP - zNearP));
|
||||
return lin*0.01f;
|
||||
}*/
|
||||
#ifdef DILATE_VELOCITY
|
||||
float bestDepth = g_xFrame_MainCamera_ZFarP;
|
||||
int2 bestPixel = int2(0, 0);
|
||||
|
||||
[unroll]
|
||||
for (int i = -1; i <= 1; ++i)
|
||||
{
|
||||
[unroll]
|
||||
for (int j = -1; j <= 1; ++j)
|
||||
{
|
||||
float depth = texture_lineardepth[pixel];
|
||||
[flatten]
|
||||
if (depth < bestDepth)
|
||||
{
|
||||
bestDepth = depth;
|
||||
bestPixel = pixel + int2(i, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return texture_gbuffer1[bestPixel].zw;
|
||||
#else
|
||||
return texture_gbuffer1[pixel].zw;
|
||||
#endif // DILATE_VELOCITY
|
||||
}
|
||||
|
||||
float loadDepth(float2 texCoord)
|
||||
{
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// This can retrieve better velocity vectors so moving objects could be better anti aliased:
|
||||
#define DILATE_VELOCITY
|
||||
|
||||
#include "postProcessHF.hlsli"
|
||||
#include "reconstructPositionHF.hlsli"
|
||||
#include "tonemapHF.hlsli"
|
||||
@@ -5,38 +8,6 @@
|
||||
// This hack can improve bright areas:
|
||||
#define HDR_CORRECTION
|
||||
|
||||
// This can retrieve better velocity vectors so moving objects could be better anti aliased:
|
||||
#define DILATE_VELOCITY
|
||||
|
||||
|
||||
float2 GetVelocity(in int2 pixel)
|
||||
{
|
||||
#ifdef DILATE_VELOCITY
|
||||
float bestDepth = g_xFrame_MainCamera_ZFarP;
|
||||
int2 bestPixel = int2(0, 0);
|
||||
|
||||
[unroll]
|
||||
for (int i = -1; i <= 1; ++i)
|
||||
{
|
||||
[unroll]
|
||||
for (int j = -1; j <= 1; ++j)
|
||||
{
|
||||
float depth = texture_lineardepth[pixel];
|
||||
[flatten]
|
||||
if (depth < bestDepth)
|
||||
{
|
||||
bestDepth = depth;
|
||||
bestPixel = pixel + int2(i, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return texture_gbuffer1[bestPixel].zw;
|
||||
#else
|
||||
return texture_gbuffer1[pixel].zw;
|
||||
#endif // DILATE_VELOCITY
|
||||
}
|
||||
|
||||
float4 main(VertexToPixelPostProcess PSIn) : SV_TARGET
|
||||
{
|
||||
float2 velocity = GetVelocity(PSIn.pos.xy);
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace wiVersion
|
||||
// minor features, major updates
|
||||
const int minor = 12;
|
||||
// minor bug fixes, alterations, refactors, updates
|
||||
const int revision = 7;
|
||||
const int revision = 8;
|
||||
|
||||
|
||||
long GetVersion()
|
||||
|
||||
Reference in New Issue
Block a user