I'm having trouble setting up ESM shadow mapping with completely static shadow maps (I'll mark shadow maps as dirty manually).
Here is my current setup:
Code: Select all
compositor_node_shadow DefaultShadowNode
{
technique focused
texture atlas 2048 4096 PF_L16 no_fsaa uav
texture tmpGaussianFilter 2048 4096 PF_L16 no_fsaa depth_pool 0 uav
texture tmpCubemap 1024 1024 PF_L16 cubemap no_fsaa
shadow_map 0 atlas uv 0.0000 0.0000 0.5000 0.2500 light 0
shadow_map 1 atlas uv 0.0000 0.2500 0.5000 0.2500 light 1
shadow_map 2 atlas uv 0.0000 0.5000 0.5000 0.2500 light 2
shadow_map 3 atlas uv 0.0000 0.7500 0.5000 0.2500 light 3
shadow_map 4 atlas uv 0.5000 0.0000 0.5000 0.2500 light 4
shadow_map 5 atlas uv 0.5000 0.2500 0.5000 0.2500 light 5
shadow_map 6 atlas uv 0.5000 0.5000 0.5000 0.2500 light 6
shadow_map 7 atlas uv 0.5000 0.7500 0.5000 0.2500 light 7
/*
target atlas
{
pass clear
{
colour_value 1 1 1 1
}
}
*/
shadow_map_target_type directional spot point
{
shadow_map 0
{
pass clear
{
colour_value 1 1 1 1
shadow_map_full_viewport yes
}
}
}
shadow_map_target_type directional
{
shadow_map 0 1 2 3 4 5 6 7
{
pass render_scene
{
visibility_mask 0x00ffffff
}
}
}
shadow_map_target_type point
{
shadow_map_repeat 0 1 2 3 4 5 6 7
{
target tmpCubemap +X : cubemap_target_shadow {}
target tmpCubemap -X : cubemap_target_shadow {}
target tmpCubemap +Y : cubemap_target_shadow {}
target tmpCubemap -Y : cubemap_target_shadow {}
target tmpCubemap +Z : cubemap_target_shadow {}
target tmpCubemap -Z : cubemap_target_shadow {}
shadow_map
{
pass render_quad
{
material Ogre/DPSM/CubeToDpsmColour
input 0 tmpCubemap
}
}
}
}
shadow_map_target_type spot
{
shadow_map 0 1 2 3 4 5 6 7
{
pass render_scene
{
visibility_mask 0x00ffffff
overlays off
rq_first 0
rq_last 250
}
}
}
shadow_map_target_type directional spot point
{
shadow_map 0
{
pass compute
{
job ESM/GaussianLogFilterH
input 0 atlas
uav 0 tmpGaussianFilter write
}
pass compute
{
job ESM/GaussianLogFilterV
input 0 tmpGaussianFilter
uav 0 atlas write
}
}
}
}
1. I'm not using pssm even for directional lights because there maybe no directional lights, and I don't want to waste memory because other types of lights can't use these shadow_maps. Is it ok?
2. The special visibility_mask is used to exclude certain internal objects like PCC's proxy geometry.
3. Only shadows of spot lights seem to work. For point lights, it looks like the whole point is occluded, but with RenderDoc I can see the shadow map looks good (looks like a normal dual-paraboloid thing).
4. When only one directional light is casting shadow, the pixel shader for rendering shadow receivers even did not use any shadow maps (I confirmed in RenderDoc that there is no shadow map in texture input, and there are no shadow map sampling code generated for those pixels)
I only used ESM + static shadow maps once 1 year ago, I think at that time both point lights and spot lights are working, though I didn't test directional lights back then.
I also did some quick experimenting with fully dynamic lights (removed all code to fix shadow maps to lights and copied ShadowMappingDebug's ESM node), but no shadow (even for spotlights) are shown.
Maybe I did something stupid, but I'm very unfamiliar with shadow related codes so I don't know how to debug... Thanks!