PCSS troubles

Started by
7 comments, last by jameszhao00 12 years, 6 months ago
ok guys.. i just fuck my head with that bug:

i use nvidia composer code and that does not work as it needs

[color="#00ffff"]http://dl.dropbox.co.../pcssf.d001.jpg


[color="#000000"]i do not understand - why do i get harsh edges of shadow ,when pcf has to blur my shadow edges softly.. and here we see sharp..
that looks like blocker's zone is incorrect.. i do not know

there is formulas:

float BlockersearchWidth = SceneScale * LightSize / zReceiver;

float penumbraWidth = (receiver - Blocker) * LightSize / Blocker;

i suppose: SceneScale , LightSize are not correct - but in which limits these values must be ?


[font="Lucida Console"][font="Lucida Console"][/font][/font]
Advertisement
up
You have not posted any code that could be used to help you.
The only code that should be of use is the code that interpolates the samples together, and you omitted it.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid


You have not posted any code that could be used to help you.
The only code that should be of use is the code that interpolates the samples together, and you omitted it.


L. Spiro



sorry - had not understood...

i have 3 functions -

findBlocker
estimatePenumbra
PCF_Filter at last step

which part do you mean ?

thx

PCF_Filter() as well as the way you create your texture and the sampling mode applied to it.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid


[color="#00ffff"][color="#000000"]i do not understand - why do i get harsh edges of shadow ,when pcf has to blur my shadow edges softly.. and here we see sharp..
that looks like blocker's zone is incorrect.. i do not know


Are you trying to use hardware PCF? Your depth texture needs typically to be created with a specific FourCC code (INTZ, i think?) to indicate to the drivers that tex2Dproj maps to the PCF comparison.


numSamples=8
filterWidth=result from penumbra procedure
bias - not used
uv - gl_TexCoord[2].xy/gl_TexCoord[2].w;
LP - gl_TexCoord[2]

gl_TexCoord[2] - lightmvp vertex (i am sure it is ok)

float PCF_Filter(float2 uv, float4 LP,
uniform float bias, float filterWidth, float numSamples)
{
// compute step size for iterating through the kernel
float stepSize = 2 * filterWidth / numSamples;

// compute uv coordinates for upper-left corner of the kernel
uv = uv - float2(filterWidth,filterWidth);

float sum = 0; // sum of successful depth tests

// float incommingDepth = LP.z/LP.w;

// now iterate through the kernel and filter
for (int i=0; i<numSamples; i++)
{
for (int j=0; j<numSamples; j++)
{
// get depth at current texel of the shadow map
vec2 jittered = uv + float2(i*stepSize,j*stepSize);

// accumulate result
sum += LP.z < texture2D(simpleShadowMap, jittered ).x ;
//sum += EVSM(jittered,incommingDepth);
}
}

// return average of the samples
return sum / (numSamples*numSamples);
}



i do not use hardware pcf - all samplers are set to point / nearest ,that means not to use any filtering,you know
up up up up
I remember the following from tinkering with PCSS a year ago:

Your PCF radius is too big for your number of samples

Stuff to try:
- scale down the radius
- increase the number of samples
- sample non-regularly. Poisson disk with rotation worked for me

Also try brightening the shadow so 100% in-shadow isn't that dark. Could make the whole thing less noticeable.

This topic is closed to new replies.

Advertisement