This is modified Tut-Shadow-Mapping-Advanced.
Used paraboloid shadow map instead projection and PCF filter to smooth edges of shadow.
alas no luck with this for me
it exits here (line 193):
if (base.win.getGsg().getSupportsShadowFilter()):
mci.setShader(Shader.load('shadow.sha'))
else:
#>>> exits here
sys.exit()#mci.setShader(Shader.load('shadow-nosupport.sha'))
looks like we’re doomed to not have working shadows forever with panda3d…
‘shadow-nosupport.sha’ is only for cards which doesn’t support shadow filter, which means you have to calc perspective divide in the shader.
taken from the shadow mapping sample :
with shadow filter support :
float shade = tex2Dproj(k_Ldepthmap,l_shadowcoord);
without :
float4 proj = l_shadowcoord / l_shadowcoord.w;
float mapval = tex2D(k_Ldepthmap,proj.xy);
float shade = (mapval > proj.z);
You should probably use shadow2D(Proj) and a shadow sampler to get the advantages of hardware PCF.
Thanks for the advice, but …
or i doing something wrong?
void fshader(in float2 l_texcoord0 : TEXCOORD0,
in float4 l_shadowcoord : TEXCOORD1,
in float l_smooth : TEXCOORD2,
in float4 l_lightclip : TEXCOORD3,
uniform sampler2D tex_0 : TEXUNIT0,
uniform sampler2DShadow k_Ldepthmap : TEXUNIT1,
uniform float4 k_ambient,
uniform float4 k_texDisable,
out float4 o_color:COLOR)
{
float3 circleoffs = float3(l_lightclip.xy / l_lightclip.w, 0);
float falloff = saturate(1.0 - dot(circleoffs, circleoffs));
float4 baseColor = saturate(tex2D(tex_0, l_texcoord0) + k_texDisable);
float shade = shadow2D(k_Ldepthmap,l_shadowcoord)*0.5;
o_color = baseColor * ( falloff * shade * l_smooth + k_ambient.x )*2;
}
I did not include the shadow-nosupport.sha, but if you want - fixed version here: panda3d.org.ru/files/Shadows.zip
A funny side effect. Hypertrophied PCF filter looks like soft shadows
thankyou ninth - I suggest the maintainers to put this demo in place of the actual in the official bunch, being a little nicer and working better
Who?
ah I was off for a couple of months and look at that.
but nonetheless this demo should be put at least on CVS to replace the old one.
![](https://discourse.panda3d.org/letter_avatar_proxy/v4/letter/a/ba8739/48.png)
but nonetheless this demo should be put at least on CVS to replace the old one.
No, this does not replace the standard demo - look at the result of the depth-texture rendering in this demo and in standart (key “V”).
My vaiant uses parabolic distortion for the depth map, giving a ray of light with an angle close to 180 degrees.
Perhaps, as an alternative…