Hi Wang

How are your improvements on VDSM doing? I have some issues with implementing a 
good looking PCF into VDSM shader, but somehow it do not get the results I 
desired:


Code:


float readShadowValue(in sampler2DShadow shadowTexture, in vec4 shadowUV) {
  return shadow2DProj(shadowTexture, shadowUV).r;
}

...
const float invTexel = " << 1.0f / textureSize.x() << ";
float readPCFValue(in sampler2DShadow shadowTexture, in vec4 shadowUV) {
  float shadowTerm = readShadowValue(shadowTexture, shadowUV);
  shadowTerm += readShadowValue(shadowTexture, shadowUV - vec4(invTexel, 0.0, 
0.0, 0.0));
  shadowTerm += readShadowValue(shadowTexture, shadowUV + vec4(invTexel, 0.0, 
0.0, 0.0));
  shadowTerm += readShadowValue(shadowTexture, shadowUV - vec4(0.0, invTexel, 
0.0, 0.0));
  shadowTerm += readShadowValue(shadowTexture, shadowUV + vec4(0.0, invTexel, 
0.0, 0.0));
  shadowTerm += readShadowValue(shadowTexture, shadowUV - vec4(invTexel, 
invTexel, 0.0, 0.0));
  shadowTerm += readShadowValue(shadowTexture, shadowUV + vec4(invTexel, 
invTexel, 0.0, 0.0));
  shadowTerm += readShadowValue(shadowTexture, shadowUV - 
vec4(invTexel,-invTexel, 0.0, 0.0));
  shadowTerm += readShadowValue(shadowTexture, shadowUV + 
vec4(invTexel,-invTexel, 0.0, 0.0));
  return shadowTerm / 9.0;
}




Cheers,
Daniel

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=61523#61523





_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to