DEMO Godot shader: Cut a hole in walls

Поділитися
Вставка
  • Опубліковано 20 жов 2024

КОМЕНТАРІ • 7

  • @IA-Ovd
    @IA-Ovd 5 місяців тому

    A tutorial about this shader would be awesome, I've been trying for 1 month to do just this but I'm very new to shaders and I'm not able to get it :(. You do an amazing job!

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

    Is it just me or have you also noticed this camera jittering? The game seems to lag out of nowhere.

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

      Ohh My graphics card barely support 1920, worst when i'm recording. But i'm going to check if anything is wrong

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

    Thanks for this demo, and the explanation of your approach. I want to confirm my understanding of the method:
    1. Get world space coordinates of player and convert to screen space coordinates. This is the center of the hole.
    2. Get AABB box limits of player, convert to screen space coords, and use that to get the radius of the hole.
    3. In the shader, set alpha to zero for that circle in the screen space (calculate gradient or noisy emission edges if needed, also).
    Is that about right? Right now I'm doing mine in a cumbersome way, using a static texture like a vignette/overlay on the screen space, and toggling it for objects that come between the player and camera.
    I also had a version that was a modified version of your cutting plane demo, but modified to discard geometry inside a cylinder between the player and camera. I feel like my solutions are a bit cumbersome and noobish, lmao

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

      Yes, that is how it works. Now I understand about the cylinder, someone had already asked me about it, I don't know if it was you. It's basically emulating the screen space from the camera to the character.
      I'm currently doing the cut version with SDF + effects. It's a tutorial I've been asked for a lot. It will take a while though.

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

      @@pixezy8962 Thanks for the feedback, man! Good to hear I'm on the right track. I remember asking you about a 'workflow friendly' way to implement this so it's easier for any artist/modeler who I collaborate with. I managed to work something out with the fellow I'm working with, so that's good.
      By the way, could I just use the player and camera positions to check if a vertex is in between them, then apply the screen space stuff if true?
      That way, the player is updating their screen space coords, effect radius, and the two reference points to all objects with the 'x-ray' shader, and then the shader calculates what to do based on that?
      Apologies in advance if I'm misusing terms.

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

      ​@@roodtoob I haven't implemented obstacle detection yet, but I think it's as simple as comparing the size of the vector between the camera and the character with the size of the camera and the vertex. As you mention