• Create Account

Evsm artifacts - light bleeding after shadow's preblur

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

2 replies to this topic

#1evillgames  Members   -  Reputation: 148

Like
0Likes
Like

Posted 21 June 2012 - 10:59 AM

hey guys - i use standart code from INTEL:


static const float2 g_EVSMExponents = float2(
// 20.0f, 10.0f
40.0f, 20.0f
);

// Convert depth to EVSM coefficients
// Input depth should be in [0, 1]
float2 WarpDepth(float depth, float2 exponents)
{
// Rescale depth into [-1, 1]
depth = 2.0f * depth - 1.0f;
float pos =  exp( exponents.x * depth);
float neg = -exp(-exponents.y * depth);
return float2(pos, neg);
}

// Convert depth value to EVSM representation
{
float2 exponents = g_EVSMExponents;
float2 warpedDepth = WarpDepth(depth, exponents);
return  float4(warpedDepth.xy, warpedDepth.xy * warpedDepth.xy);
}


lighting:

float ChebyshevUpperBound(float2 moments, float mean, float minVariance)
{
// Compute variance
float variance = moments.y - (moments.x * moments.x);
variance = max(variance, minVariance);

// Compute probabilistic upper bound
float d = mean - moments.x;
float pMax = variance / (variance + (d * d));

// One-tailed Chebyshev
return (mean <= moments.x ? 1.0f : pMax);
}

static const float2 g_EVSMExponents = float2(
40.0f, 20.0f
//20.0f, 10.0f
);

static const float g_EVSM_Derivation =
//0.0001f
0.00001f
;

// Convert depth to EVSM coefficients
// Input depth should be in [0, 1]
float2 WarpDepth(float depth, float2 exponents)
{
// Rescale depth into [-1, 1]
depth = 2.0f * depth - 1.0f;
float pos =  exp( exponents.x * depth);
float neg = -exp(-exponents.y * depth);
return float2(pos, neg);
}

float EVSM(float2 uv,float depth)
{
//	if(uv.x>1||uv.y>1||uv.x<0||uv.y<0) return 0; // discard fragments outside spot projector

float2 exponents = g_EVSMExponents;
float2 warpedDepth = WarpDepth(depth, exponents);

// Perform the linear filtering

// Derivative of warping at depth
float2 depthScale = g_EVSM_Derivation * exponents * warpedDepth;
float2 minVariance = depthScale * depthScale;

// Compute the upper bounds of the visibility function both for x and y
float posContrib = ChebyshevUpperBound(occluder.xz, warpedDepth.x, minVariance.x);
float negContrib = ChebyshevUpperBound(occluder.yw, warpedDepth.y, minVariance.y);

return min(posContrib, negContrib);
}


when i use that without any preblur - it is ok, but after blurring i get this shit - it looks like light bleeding - i guess....... what is wrong ? i can give you additive info if u do wish

#2evillgames  Members   -  Reputation: 148

Like
0Likes
Like

Posted 19 July 2012 - 09:58 AM

up

#3Tasty Texel  Members   -  Reputation: 915

Like
0Likes
Like

Posted 20 July 2012 - 05:27 PM

Perhaps the way you blur it is wrong.

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

PARTNERS