Amerio.Stephane Posted October 25 Posted October 25 Hi, I've always been bothered by the way shadow cascades works in Unigine, when compared to some other engine. As I understand, CSM level 0 would be the highest quality, decreasing for each new level. But when I activate Helper/Shadow Cascade, the level 0 is never where I would expect it... In this image, the sun is behind the camera on the right. The CSM center is the green spot, which is actually computed independently of the camera orientation. So If I turn the camera around (toward the sun, but still looking at the ground): .. I now only see the last two levels, so the lowest possible shadow quality... Your CSM is in fact computed relative to the sun angles, not the camera. Why this choice? In fact, most of the time the shadow Level 0 would only be visible if the camera is near the ground (quite rare in a flight simulator...). This has always forced us to use a high resolution shadow texture. Looking back to some gamedev tutorials, I found this link, which detail how the CSM should be relative to the camera, not the sun frustum: Tutorial 49 - Cascaded Shadow Mapping Any insight?
silent Posted October 27 Posted October 27 Hi Stephane, Shadow cascades are intentionally kept static to prevent unwanted shaking or wobbling of shadows when the camera is rotated, which can occur with more traditional approaches. For long distance shadows you would anyway need to increase resolution, since the dualization of traditional shadow cascades are quite low for visibility distances more than several km (pixel density is quite low). You also can adjust cascade borders and shift cascades position as you need. Maybe that would produce better result in some cases. You can also combine these shadows with screen-space shadows for rendering very distant objects. This approach is relatively inexpensive, though it may introduce some additional screen-space artifacts. Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
Amerio.Stephane Posted October 27 Author Posted October 27 I understand, and your point is valid (making the shadow map stable in time and resistant to camera rotation). But in this case, wouldn't it be better to assume the 'sun' is always at infinity right above the camera? so the cascade level 0 position would always be the closest to the camera, right below it? In the case of a flight sim, the sheer quantity of object to be drawn has put us to restrict shadow visibility distance quite low in the past (<300m) and most of the time, the level 0 was simply never seen so its computation was wasted. And screen space was not a viable option (too many artifacts on the ground, especially with projection blending).
Recommended Posts