Depth Texture explained - Godot

Поділитися
Вставка
  • Опубліковано 15 вер 2023
  • At first when you open godot shader and get the value for depth texture it is hard to understand how to use the data which godot provide to us in shader, In this video I tried to clear everything about depth texture or depth buffer in godot
    depth buffer is useful in many cases like for water shader

КОМЕНТАРІ • 24

  • @mohsenzare2511
    @mohsenzare2511  10 місяців тому +2

    I noticed that in Matrix indices I made a mistake I wrote M33, instead I should write M22, But the math and the rest is correct

  • @Chevifier
    @Chevifier 10 місяців тому +5

    This is amazing, I knew about depth textures but never had someone explained the math behind it.👏

  • @cha8802
    @cha8802 9 місяців тому +3

    After struggling to understand how depth textures worked in godot all day this video finally made it click for me. Great explanation! Thanks for sharing :)

  • @williamgodwin5582
    @williamgodwin5582 10 місяців тому +5

    What interests me most is how much depth sampling affects performance. Some people write that this is not significant today, while others, on the contrary, believe that it significantly reduces performance.

    • @mohsenzare2511
      @mohsenzare2511  10 місяців тому +2

      Yeah William, I think as it should grab the depth behind the plane it render the plane in a separate render like a transparent object, I am not sure maybe it the plane will behave like a transparent object
      But for making the a realistic water you have to use it
      And you are right if you make a mobile game it is better to not use this stuff

    • @williamgodwin5582
      @williamgodwin5582 10 місяців тому +1

      @@mohsenzare2511 I was thinking more about objects color and normals blending

  • @chienbanane3168
    @chienbanane3168 6 місяців тому +1

    This helped a lot, thanks!

  • @melpeslier
    @melpeslier 9 місяців тому +1

    You are a BOSS, good explanations and it is the godot doc's missing content.
    Won't you contribute and give more explanations right in the doc ?

    • @mohsenzare2511
      @mohsenzare2511  9 місяців тому +1

      Thanks for your comment, I never participate in Docs, But if I have time and I can help why not, I will look forward to it

  • @Boildroid
    @Boildroid 4 місяці тому

    what kind of books you suggest to learn shaders?

  • @spectrecular9721
    @spectrecular9721 26 днів тому

    Been struggling to grab the depth of a 3D scene in Godot 4.2 to be used in a fullscreen post-processing 'canvas_item' shader, as depth information is only available in 'spatial' shaders and unless I'm missing something, it seems depth information isn't stored in textures made via a SubViewport. Any tips?

  • @BeyCuber
    @BeyCuber 9 місяців тому

    Hi Mohsen, thank you for the great video! I had a very basic question. When you do depth = texture(depth_tex, SCREEN_UV).r, what is the meaning of the ".r"? And what would it mean if I did ".x" instead or something?

    • @mohsenzare2511
      @mohsenzare2511  9 місяців тому +1

      texture(depth_tex,SCREEN_UV) always return a vec4 with 4 component even if you sample a black and white texture with one channel, Depth Texture has also one channel and by .r or .x (Both work the same) means I just want to grab the red component, if you put .rb for example it means i want to grab red and blue channel in the format of vect2, You should read more about the concept of the shader I recommend to read "the book of shader", Search that on google

    • @BeyCuber
      @BeyCuber 9 місяців тому

      @@mohsenzare2511 Thanks so much!

  • @DoubledEthan
    @DoubledEthan 10 місяців тому +1

    Hi, i am learning c++ but for godot 4.1 (latest) i can't find a normal tutorial for beginners. Can you do it?

    • @mohsenzare2511
      @mohsenzare2511  10 місяців тому

      I have a Gd Extension video series on my channel, Which explain how to start programming with c++ in Godot

  • @roquestral
    @roquestral 4 місяці тому

    did not work for me on 4.1.3 :(

  • @artisanpixel
    @artisanpixel 10 місяців тому

    How come the depth texture doesn't include the plane?
    Nice video by the way :)

    • @mohsenzare2511
      @mohsenzare2511  10 місяців тому +1

      This is how it work, if it include the plane it has not use to us
      it shows everything behind the plane
      Thanks man

  • @catafest
    @catafest 9 місяців тому +1

    you don't have an discord account ?

    • @mohsenzare2511
      @mohsenzare2511  9 місяців тому

      Yeah, you can join with this link: discord.gg/2HuPFZksxd