how to add pcf to shadow maps
I found this link which explains a little about pcf shadow mapping. I looked through the code sample provided and I cannot work out what the offset array is. I'm assuming it is an array of float2 and I know that it will offset the pixel to give the neighbouring ones. I just can't figure out what the offset should be set too.
Link: http://www.gamerendering.com/2008/11/15/percentage-closer-filtering-for-shadow-mapping/
Here is the code
float result;
result = shadow2DProj(shadowMa开发者_运维知识库p,texCoord+offset[0]);
result += shadow2DProj(shadowMap,texCoord+offset[1]);
result += shadow2DProj(shadowMap,texCoord+offset[2]);
result += shadow2DProj(shadowMap,texCoord+offset[3]);
result /= 4.0; // now result will hold the average shading
I must just be missing something simple
Any help is appreciated
Thank you,
Mark
I notice you are using shadow2DProj, as far as I am aware this is a GLSL function and the equivalent in HLSL/CGSL is tex2Dproj. If you are getting a blank screen then this may lead you closer as you should be able to temporarily remove the offset values.
Good luck mate I am new at this too so I know how this is :)
精彩评论