tag:blogger.com,1999:blog-23591982.post5760665491006758267..comments2023-07-23T11:34:06.707-04:00Comments on Game developer Jay's blog: Soft shadow with shadow map...Jayhttp://www.blogger.com/profile/05307417533099324352noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-23591982.post-38257645438506053362010-04-23T17:00:28.174-04:002010-04-23T17:00:28.174-04:00Thank Marco.
I was surprised by your informative c...Thank Marco.<br />I was surprised by your informative comment.<br /><br />I haven't thought of the combination between ESM and manual bilinear filter.<br /><br />Your code looks very similar to what I implemented yesterday.<br /><br />The last bilinear calculation can be a little bit simplified according to wikipedia: http://en.wikipedia.org/wiki/Bilinear_filtering<br /><br />It can be like this:<br /><br />const float2 percents = frac( unnormCoords + 0.5 );<br /><br />const float u0 = lerp( sample00, sample01, percents.x );<br />const float u1 = lerp( sample10, sample11, percents.x );<br /><br />return lerp( u0, u1, percents.y );<br /><br /><br />For the FP16 surface, I still see some problems.<br /><br />PS3 does not support one channel FP16 surface but support F_W16Z16Y16X16. It seems like I have no way to use just one channel of FP16.<br /><br /><br />I'm very glad to hear the other programmer's experience. :D<br /><br />JayJayhttps://www.blogger.com/profile/05307417533099324352noreply@blogger.comtag:blogger.com,1999:blog-23591982.post-36575055097963082752010-04-23T12:26:08.116-04:002010-04-23T12:26:08.116-04:00Jay,
You can implement bi-linear filtering in sof...Jay,<br /><br />You can implement bi-linear filtering in software. I have ran some tests with ESM on PS3 in this sense a few years ago and it wasn't that much slower than a point filtered implementation.<br /><br />For instance if you already have a function that performs ESM point filtering on FP32 textures, a bi-linear filtering implementation would look like this:<br /><br />float ESMBilinearSample(in float2 textureCoords, in float receiverDepth)<br />{<br /> float2 unnormCoords = textureCoords * mShadowMapSize.xx;<br /><br /> const float a = frac(unnormCoords.x - 0.5f);<br /> const float b = frac(unnormCoords.y - 0.5f); <br /> const float i = floor(unnormCoords.x - 0.5f);<br /> const float j = floor(unnormCoords.y - 0.5f);<br /> <br /> float sample00 = ESMPointSample(float2(i, j) / mShadowMapSize.xx, receiverDepth);<br /> float sample01 = ESMPointSample(float2(i, j + 1) / mShadowMapSize.xx, receiverDepth);<br /> float sample10 = ESMPointSample(float2(i + 1, j) / mShadowMapSize.xx, receiverDepth);<br /> float sample11 = ESMPointSample(float2(i + 1, j + 1) / mShadowMapSize.xx, receiverDepth); <br /> <br /> return (1 - a)*(1 - b)*sample00 + a*(1-b)*sample10 + (1-a)*b*sample01 + a*b*sample11;<br />}<br /><br />If you don't have to support large depth ranges you might simply switch to FP16 texturing (which PS3 can natively bi-linearly filter) and log-filtering.<br /><br />MarcoAnonymousnoreply@blogger.com