Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

askthedev.com Logo askthedev.com Logo
Sign InSign Up

askthedev.com

Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Ubuntu
  • Python
  • JavaScript
  • Linux
  • Git
  • Windows
  • HTML
  • SQL
  • AWS
  • Docker
  • Kubernetes
Home/ Questions/Q 39364
In Process

askthedev.com Latest Questions

Asked: April 6, 20252025-04-06T06:14:13+05:30 2025-04-06T06:14:13+05:30

Can ddx/ddy functions help determine when to avoid PCF shadow blur in fully shadowed or not-shadowed areas?

anonymous user

I’m working on a project where I cast shadows in both open and closed environments using a directional light that always looks at the player. Since the shadowmap is refreshed regularly based on the player’s position, I can’t rely on a fixed preblurred map. This has pushed me to think about optimizing how I handle shadow blur, especially since this blurring process seems pretty wasteful when there are areas that are either fully shadowed or completely lit.

I’ve heard about the ddx/ddy functions and how they can help in context to bias adjustment, but I’m curious if they could also be useful in determining when to blur shadows versus when to leave them sharp. Like, is there a way these functions could indicate a transition between shadowed and non-shadowed areas? For instance, in sections of the scene where there’s no shadow at all, would it make sense to skip the blur? Or in nearly fully shadowed regions where the difference in light is minimal, would that warrant avoiding the blurring process too?

I know there’s the variance shadow mapping technique that allows preblurring, but I’m specifically looking for real-time solutions to cut down on unnecessary processing. If you’ve worked with these ddx/ddy functions or have any clever tricks up your sleeve for handling shadow blur dynamically, I would really appreciate your insights.

Additionally, if there are alternative methods or techniques you’ve found effective for this kind of shadow management, I’d love to hear about them. Ideally, I want a system that’s not just efficient but also maintains that visual quality we all strive for in lighting and shadows. Thanks in advance for any advice or shared experiences—you might save me a lot of cycles!

  • 0
  • 0
  • 2 2 Answers
  • 0 Followers
  • 0
Share
  • Facebook

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Continue with Google
    or use

    Forgot Password?

    Need An Account, Sign Up Here
    Continue with Google

    2 Answers

    • Voted
    • Oldest
    • Recent
    1. anonymous user
      2025-04-06T06:14:15+05:30Added an answer on April 6, 2025 at 6:14 am

      It sounds like you’re diving into some pretty cool shadow management! Using ddx and ddy can definitely help you get a better handle on when to apply blur. Here’s the way I see it:

      These functions calculate the rate of change in screen space, which can be super handy for determining how quickly the shadows change. If the result from ddx or ddy is low, that probably means the area is relatively uniform, so you might be safe to skip blurring. On the flip side, if there’s a noticeable change, it might be a sign that a blur could help smooth things out.

      As for deciding whether to blur or not based on shadow coverage, it makes total sense! If a section is fully shadowed or fully lit, why waste processing on blurring? You could set a threshold for light intensity or shadow sharpness and only apply blur within certain ranges. This way, areas that don’t need blurring get a free pass, and you save those precious cycles.

      Another trick is to check the shadow map’s depth information. If you see that the depth values are all the same (or very close), it signals consistent lighting—no need to blur here! But when you see depth values diverging, that might indicate a transition zone where blurring could enhance realism.

      For alternatives, consider techniques like Percentage-Closer Filtering (PCF) or using screenspace shadows. They can help improve shadow quality without the heavy cost of dynamic blurring. And, hey, tools like shadow fading can also help mitigate harsh transitions without blurring everything.

      Experiment and see what works best for your project! Balancing efficiency and quality in real-time rendering can be tricky, but sounds like you’re on the right path.

        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    2. anonymous user
      2025-04-06T06:14:15+05:30Added an answer on April 6, 2025 at 6:14 am

      The ddx and ddy derivative functions can indeed assist in optimizing shadow blurring dynamically by allowing you to measure the local rate of change in shadow intensity across the screen-space fragments. Essentially, regions where these derivatives are negligible indicate uniform shadow intensity—either fully lit or fully shadowed—and thus may not benefit significantly from blurring. On the other hand, areas demonstrating higher derivative values reflect transitional regions between light and shadow, clearly marking them as prime candidates for blur. By employing conditional sampling or adaptive blur kernel sizes based on these derivatives, you can efficiently direct computational resources exactly to where they’re visually beneficial, substantially reducing unnecessary processing while preserving the visual integrity of shadows.

      Beyond ddx/ddy usage, other real-time techniques can complement your approach to managing shadow blur efficiently. Screen-space approaches such as analyzing scene depth and normal buffers, combined with shadowmap information convergence tests, enable smarter blur kernel decisions. Techniques like Exponential Shadow Maps (ESMs) or Moment Shadow Maps (MSMs) can provide smoother soft shadow transitions inherently—reducing the degree and frequency of required manual blurring. Additionally, a distance-based or shadow-map-depth-gradient-based temporal accumulation approach allows you to smoothly amortize blur effects over multiple frames without incurring heavy single-frame computational costs. Combining these strategies with derivative-driven blur optimization gives a robust and visually appealing solution suitable for real-time applications.

        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp

    Sidebar

    Recent Answers

    1. anonymous user on How do games using Havok manage rollback netcode without corrupting internal state during save/load operations?
    2. anonymous user on How do games using Havok manage rollback netcode without corrupting internal state during save/load operations?
    3. anonymous user on How can I efficiently determine line of sight between points in various 3D grid geometries without surface intersection?
    4. anonymous user on How can I efficiently determine line of sight between points in various 3D grid geometries without surface intersection?
    5. anonymous user on How can I update the server about my hotbar changes in a FabricMC mod?
    • Home
    • Learn Something
    • Ask a Question
    • Answer Unanswered Questions
    • Privacy Policy
    • Terms & Conditions

    © askthedev ❤️ All Rights Reserved

    Explore

    • Ubuntu
    • Python
    • JavaScript
    • Linux
    • Git
    • Windows
    • HTML
    • SQL
    • AWS
    • Docker
    • Kubernetes

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.