Shadow Mapping Unleashed! // OpenGL Tutorial #38

Поделиться
HTML-код
  • Опубликовано: 1 дек 2024

Комментарии • 35

  • @therealjtgill
    @therealjtgill 2 года назад +3

    More than happy to support you on Patreon! This is wonderful content, thank you!

    • @OGLDEV
      @OGLDEV  2 года назад

      Wow, thank you! Welcome to the OpenGL underground!

  • @alvpjh
    @alvpjh 2 года назад

    I appreciate your effort to make these tutorials, thank you

    • @OGLDEV
      @OGLDEV  2 года назад

      My pleasure!

  • @furkanunsal5814
    @furkanunsal5814 2 года назад +1

    I love this series

  • @sagielevy
    @sagielevy 2 месяца назад

    Very cool! I have a question though, wouldn't the Reverse face-culling solution fail if i had a non-closed mesh? I.e. a plane mesh acting as a "wall". Let's say i place perpendicular to the ground, if i understand the solution correctly, it should fail to produce shadows since there won't be any back facing triangles

    • @OGLDEV
      @OGLDEV  2 месяца назад +1

      Correct. With front face culling you need back faces to render into the shadow map.

  • @pedroocm
    @pedroocm 4 месяца назад

    As someone said in another comment, how do you fix the small gap between, for example, the ground and an object on top of it? I've set my bias to zero and there still a tiny but noticeable sliver of "unshadowed" area where an object touches the ground.

    • @pedroocm
      @pedroocm 4 месяца назад

      Jus to clarify, I'm using reverse face culling, but it still happens when the object on top of the ground has no "flooring" (that is, has no faces on it's underside). Is the fix just making sure all objects have faces under them, or is there another way?

    • @OGLDEV
      @OGLDEV  4 месяца назад

      Is the object very thin? The recommendation is to avoid thin geometry when there is a problem of peter panning. Reverse face culling is usually the solution and if you can enable that by having flooring on your objects then that effort is certainly worthwhile.

  • @xotmatrix
    @xotmatrix 2 года назад

    Very informative. Thanks for article links.

    • @OGLDEV
      @OGLDEV  2 года назад

      Glad it was helpful :-)

  • @赟杨
    @赟杨 3 месяца назад

    Do you have a plan to explain the CSM in your tutorial, I can read the blog on your website. I implemented CSM according to LearnOpenGL but I found that the shadow acne is really trick to overcome.

    • @OGLDEV
      @OGLDEV  3 месяца назад +1

      In general yes, though it's not on the immediate roadmap so not sure I'll be able to make it this year.

    • @赟杨
      @赟杨 3 месяца назад

      @@OGLDEV Thank you for your reply. Looking forward to the upcoming video.

  • @clifflin2307
    @clifflin2307 5 месяцев назад

    I'm using reverse face culling for rendering shadows, but there is tiny gap on the border between the object and its shadow. How to solve this issue? Is PCF a possible solution?

    • @OGLDEV
      @OGLDEV  5 месяцев назад

      Sounds like a bias issue.

    • @pedroocm
      @pedroocm 4 месяца назад

      @@OGLDEV What if this still happens with the bias set to zero?

  • @miumpre2839
    @miumpre2839 7 месяцев назад

    Wow total shadow tech video is very good!! I have two question. first flexible bias equation is not consider texSize and not linear so i think it was to be "bias = sin(acos(NDL))*texSize" is it right?? but this equation may be heavy.. :( second your coord and vector plot in blue slide is very efficient to read can i get a name of program for make this?

    • @OGLDEV
      @OGLDEV  6 месяцев назад

      Thanks! Not sure I understand the equation with texSize. Perhaps you can share more details. Regarding the second equestion - I usually create my slides using Google docs. Which specific blue slide are you referring to?

  • @fez3332
    @fez3332 2 года назад +2

    Oh no I have to fix my shadows now, thanks tho!

  • @Josh-hl8jl
    @Josh-hl8jl 8 месяцев назад

    What's the point of calculating the first AABB without translation in the light space matrix if we are just going to end up reverting it back into world space then back to light space with translation and use the AABB based on that.
    edit: oh, we get the center of the first AABB, then calculate the world position of that, and then transform that using light space matrix with translation.

    • @OGLDEV
      @OGLDEV  8 месяцев назад +1

      Exactly, we want to "stick" the light on the center of one of the sides of the bounding box. It's easier to calculate the bounding box in light space so the first transformation to light space is without translation. This keeps it in the same location. The second transformation includes translation to move it back to the origin. I'm pretty sure you can calculate it with less steps but I suspect the calculation itself will be more complex. This calculation is "lazy" in the sense that the frustum and bounding box are calculated each in the coordinate system where it is easiest to do so. This incurs a few coordinate system transformations using the tools that we already have.

  • @astphaire
    @astphaire 6 месяцев назад

    For the tight-fitting light-projection, I feel like I completely understand each component 110%, but putting it all together it's just not anywhere close to working. Does my world space up-axis matter at all? That's the only difference from my code and yours, but I don't think it would make a difference. Also instead of doing tan to find the frustum planes I'm using the inverse projection matrix, maybe that's the issue too.

    • @OGLDEV
      @OGLDEV  6 месяцев назад +1

      Are you on a right or left handed coordinate system? Sometimes this is the reason why people need to tweak my code a bit to make it work for them (I'm using the left handed system). If you're following the same steps you should be able to compare intermediate results between your code and mine. And of course if you know that you've changed something fundamental try to use the original version to pinpoint the problem.

    • @astphaire
      @astphaire 6 месяцев назад

      @@OGLDEV Ahh, yes, I changed the code to find the midpoint on the max-Z plane rather than the min-Z plane, and that seems to have worked. Viewing the light-space through the camera's MVP helped. Thanks for your response, and the tutorial!

    • @OGLDEV
      @OGLDEV  6 месяцев назад

      You're welcome :-)

  • @adityawildan7
    @adityawildan7 Год назад

    Ahh, finally

  • @gentsu8112
    @gentsu8112 2 года назад

    Thank you very much ^^

    • @gentsu8112
      @gentsu8112 2 года назад

      your videos and your website help me a lot to make my dream come true

    • @OGLDEV
      @OGLDEV  2 года назад

      You're welcome! I'm very glad to hear that.