Hello Andrew,
the PSVSM implementation in our app makes big steps forward.-)
and now I´am trying to get better performance and get some "negative pixels" away.
There are three things i have some problems. (most in understanding.-))
The Thing1
I found your tips in the
2006-GDC-Variance-Shadow-Maps.ppt
Ways to improve Stability
When using floating-point formats
Rescale the numeric range to fall in [-1, 1]
Gets an extra bit of precision from the sign
and interpreted as like below
Code:
[COLOR="DarkOrange"]//rescale the numeric range to [0 1][/COLOR]
float linstep_0p1(float min, float max, float v)
{
return clamp((v - min) / (max - min), 0, 1);
}
[COLOR="DarkOrange"]//rescale the numeric range to [-1 1] to get an extra bit of prescion from the sign[/COLOR]
[COLOR="Blue"]float linstep_m1p1(float min, float max, float v)[/COLOR]
{
return clamp( lerp(-1, 1, (v - min) / (max - min)), -1, 1);
}
float RescaleDistToLight(float Distance)
{
if (VSM_bRescaleDTL)
{
if(VSM_bExtraPrecisionBit)
{
return linstep_m1p1(VSM_LightNearFar.x, VSM_LightNearFar.y, Distance);
}
else
{
return linstep_0p1(VSM_LightNearFar.x, VSM_LightNearFar.y, Distance);
}
}
else
{
return Distance;
}
}
did i interpreted your idea right? However it gives me more precision when iám using
64Bit RGBA float 16 when using float
linstep_m1p1()
The Thing2
Your tip:
Four-component floating-point formats
Store extra precision in extra components
Must still filter linearly!!!
i interpreted as
Code:
// Store extra precision in BA Chanel of RGBA
float4 EncodeRGBA(float2 moments) {
float4 output = 0.0f;
const float factor = [COLOR="DarkOrange"]64.0f[/COLOR];
output.rg = frac(moments * factor) / factor;
output.ba = moments - output.rg;
return output;
}
Code:
float2 DecodeRGBA(float4 input) {
return input.xy + input.zw;
}
What do you mean with must must still filter linearly?
It boosts the accuracy by using
64Bit RGBA float 16
does it make sense to use it with a
128Bit RGBA float 32 ,too.
and i must change
Code:
const float factor = [COLOR="DarkOrange"]64.0f[/COLOR];
to
Code:
const float factor = [COLOR="DarkOrange"]128.0f[/COLOR];
I did not understand what happens here.-(
The BiggestThing3
The last visual artifact, mostly visible during driving the car in VSM and PSVSM
is visible in areas where the surface geometry stands near to perpendicular to the Shadow camera direction vector. (Artifacts i have marked in red ellipses).
I tried to overwrite this areas with a SelfShadow Term, looks nice but it´s not correct rendering.
Do you have an idea what to do here.
Unblurred screenshot.
Blurred Screenshot
Blurred + SelfShadowing
multiplied with
Code:
float normalDotLight = dot(normalize(Input.Normal), normalize(Input.LightDir));
float4 selfShadow = (EnableSelfShadowing ? saturate(normalDotLight * SelfShadowingSaturate) : 1.0f);
However, Slideshow has bigger Resolution.
http://picasaweb.google.com/4Sascha/VSMPVSM#slideshow/5327496129378546386
And an additional one, with PSVSM.
Hard to get good performance with DX9.-) but it´s gets better and better.
Thanks for your help. I could say your papers has start an addiction in shadows to me.-) When car is driving through shadow areas and all the other physicalized objects cast correct smooth shadows, that´s really give as extra portion of immersion.
Bye,
sasa