• Breaking News

    Cascade Shadow Maps - Bounding Sphere radius for stabilization Hello, I have been implementing CSM and applying some of the methods found on the Internet for stabilizing the cascades to fix shadow shimmering. While implementing the algorithm, I followed both Microsoft SDK code (link to SDK) and MJP's version (here) (which I found quite clear and great). While the general algorithm works okay I have found out an issue which I'm not exactly sure if it's my fault or if it works as intended. My camera has a FOV of 60º and is divided in three different frustas, each one of them covering a percentage of the whole camera frustum and giving shadows for a given area. For each one of these frustas I compute a Bounding Sphere that contains the corners of it and is centered in the middle point of the frusta. The code works ok and I get a bounding sphere that covers the frusta completely. The issue is that such bounding spheres seem to be so big that they completely overlap each other most of the time and, while fov or depth changes for each of the frustas make the overlap bigger or smaller, they still overlap by more than a half most of the time. This makes the quality of the shadows for the bigger frustas to not be too great as the amount of unused space is quite big. While googling for a solution I also found this blog from The Witness creators in which they detailed their approach and had a similar issue. Nonetheless, I would like to see If somebody knows if there may be something wrong with my approach and how to fix it if possible. Below I attach some captures of the problem and the code for the BS computation. Captures: http://bit.ly/2IWrW6a The code for the computation of the BS can be found below (I decided to skip the code that gets the frustums corners in WS but I'm quite sure it's working okay as I can see the points being in their position in my render): // This code is repeated for each cascade. // Calculate the centroid of the view frustum slice. // cascade_frustas_corners contains all the corners of all the frustas the camera is divided in. // Their positions are already in WS. Vector3 frustumCenter; for (unsigned int j = 0; j < 8; ++j) frustumCenter = frustumCenter + cascade_frustas_corners[cascadeIdx * 8 + j]; frustumCenter *= 1.0f / 8.0f; // Calculate the radius of a bounding sphere surrounding the frustum corners. float sphereRadius = 0.0f; for (unsigned int j = 0; j < 8; ++j) { float dist = (cascade_frustas_corners[cascadeIdx * 8 + j] - frustumCenter).Length(); sphereRadius = std::max(sphereRadius, dist); } // Store the radius for this frusta. sphere_radius_frustas[cascadeIdx] = std::ceil(sphereRadius * 16.0f) / 16.0f; Hopefully somebody can shine some light on my issue. Thank you very much. https://ift.tt/eA8V8J

    Hello, I have been implementing CSM and applying some of the methods found on the Internet for stabilizing the cascades to fix shadow shimmering. While implementing the algorithm, I followed both Microsoft SDK code (link to SDK) and MJP's version (here) (which I found quite clear and great). While the general algorithm works okay I have found out an issue which I'm not exactly sure if it's my fault or if it works as intended. My camera has a FOV of 60º and is divided in three different frustas, each one of them covering a percentage of the whole camera frustum and giving shadows for a given area. For each one of these frustas I compute a Bounding Sphere that contains the corners of it and is centered in the middle point of the frusta. The code works ok and I get a bounding sphere that covers the frusta completely. The issue is that such bounding spheres seem to be so big that they completely overlap each other most of the time and, while fov or depth changes for each of the frustas make the overlap bigger or smaller, they still overlap by more than a half most of the time. This makes the quality of the shadows for the bigger frustas to not be too great as the amount of unused space is quite big. While googling for a solution I also found this blog from The Witness creators in which they detailed their approach and had a similar issue. Nonetheless, I would like to see If somebody knows if there may be something wrong with my approach and how to fix it if possible. Below I attach some captures of the problem and the code for the BS computation. Captures: http://bit.ly/2IWrW6a The code for the computation of the BS can be found below (I decided to skip the code that gets the frustums corners in WS but I'm quite sure it's working okay as I can see the points being in their position in my render): // This code is repeated for each cascade. // Calculate the centroid of the view frustum slice. // cascade_frustas_corners contains all the corners of all the frustas the camera is divided in. // Their positions are already in WS. Vector3 frustumCenter; for (unsigned int j = 0; j < 8; ++j) frustumCenter = frustumCenter + cascade_frustas_corners[cascadeIdx * 8 + j]; frustumCenter *= 1.0f / 8.0f; // Calculate the radius of a bounding sphere surrounding the frustum corners. float sphereRadius = 0.0f; for (unsigned int j = 0; j < 8; ++j) { float dist = (cascade_frustas_corners[cascadeIdx * 8 + j] - frustumCenter).Length(); sphereRadius = std::max(sphereRadius, dist); } // Store the radius for this frusta. sphere_radius_frustas[cascadeIdx] = std::ceil(sphereRadius * 16.0f) / 16.0f; Hopefully somebody can shine some light on my issue. Thank you very much.

    from GameDev.net http://bit.ly/2IEreej

    ليست هناك تعليقات

    Post Top Ad

    ad728

    Post Bottom Ad

    ad728