WickedEngine icon indicating copy to clipboard operation
WickedEngine copied to clipboard

Shadowmap artifacts

Open ershovdz opened this issue 2 years ago • 4 comments

Is it possible to fix (or to make less noticeable) these shadowmap artifacts (aliasing, shadow acne) ? May be I can change some settings to resolve it ? shadowmap_artifacts

Scene for example: 1111.zip

ershovdz avatar Sep 02 '22 14:09 ershovdz

Hello, I have changed a litle the split for cascaded shadows in wiRenderer.cpp at line 2287 like this : const float splits[CASCADE_COUNT + 1] = { referenceSplitClamp * 0.0f, // near plane referenceSplitClamp * 0.01f, // near-mid split referenceSplitClamp * 0.05f, // mid-far split referenceSplitClamp * 1.0f, // far plane };

And changed a litle the scaling factor of your scene (litle bigger) to have this result. Maybe there is some better way, I don't know. Shadows

Cop46 avatar Sep 02 '22 15:09 Cop46

Thanks, it's a little better !

ershovdz avatar Sep 02 '22 16:09 ershovdz

You can increase shadow resolution, try the suggestions above by Cop46, or modify depth bias for shadow rendering pipelines (they are hard coded in wiRenderer.cpp, but I don't recommend modifying those)

turanszkij avatar Sep 02 '22 17:09 turanszkij

The shadow rendering pipelines are using rasterizers[RSTYPE_SHADOW] and rasterizers[RSTYPE_SHADOW_DOUBLESIDED], those are created around here currently: https://github.com/turanszkij/WickedEngine/blob/master/WickedEngine/wiRenderer.cpp#L1865 The depth bias parameters are:

rs.depth_bias = -1;
rs.depth_bias_clamp = 0;
rs.slope_scaled_depth_bias = -4.0f;

turanszkij avatar Sep 02 '22 17:09 turanszkij