Godot 4: Mesh Masks To See-through Other Objects

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ก.ย. 2024

ความคิดเห็น • 35

  • @Michael-rk9ru
    @Michael-rk9ru 6 หลายเดือนก่อน

    Amazing tutorial! Straight to the point and well explained.
    For anyone else using Godot 3, you can adapt this verbatim and just remove line 4 of the shader for it to work!

  • @Saas_1
    @Saas_1 ปีที่แล้ว +13

    This is one of those tutorials I will certainly come back to a few times!

  • @adrian-ioanmunteanu3027
    @adrian-ioanmunteanu3027 ปีที่แล้ว +1

    lovely
    short and to the point

  • @StoatTamer
    @StoatTamer 2 หลายเดือนก่อน

    I have followed this exactly and everything matches. However I get an error on the ALBEDO = textureLod(SCREEN_TEXTURE, SCREEN_UV, 0.0).rgb;
    Unknown identifier in expression: 'ALBEDO'
    I have no idea what is wrong and this isn't the first time I've had to give up on a shader tutorial because of a very similar error no one else seems to get. Does anyone have any idea what could be wrong?

    • @StoatTamer
      @StoatTamer 2 หลายเดือนก่อน

      OMG in case anyone comes along after me with the same issue, My auto generated template had both void vertex() and void fragment() as default functions. If you put it in the vertex one you get my error, make sure you put it within void fragment()!!!

  • @c.n.9840
    @c.n.9840 6 หลายเดือนก่อน

    is there a way to apply this to 2D?

    • @crigz
      @crigz  6 หลายเดือนก่อน

      For 2D, take a look at the BackBufferCopy node

  • @MikeCore
    @MikeCore ปีที่แล้ว +6

    I don't even use godot, but this was interesting and fun to watch

  • @jupiterbjy
    @jupiterbjy 4 หลายเดือนก่อน +2

    Godot's stencil buffer isn't still merged for years, despite approved half year ago.
    All I can do now is this while my target mesh corresponding to water in this vid has no transparency, so I need to mark it as transparent to make this work.
    Not sure what's more costy on GPU tho, entire ship mesh being drawn without optimizations opaque gives or upcoming stencil buffer..

  • @pepp418
    @pepp418 หลายเดือนก่อน

    Is it possible to get the mesh to do the opposite of this?
    As in: only display the object when it is 'overlapped' by the mesh

  • @question_mark
    @question_mark ปีที่แล้ว +3

    thx =)

  • @ScoutOW2
    @ScoutOW2 4 หลายเดือนก่อน

    Is there a method to target specific meshes or materials, not just any that are transparent?

  • @Alex-nl5cy
    @Alex-nl5cy ปีที่แล้ว +3

    I was looking into buoyancy(because I got sidetracked) so I look forward to seeing it, although every tutorial I've seen out there takes a similar approach.

  • @NewFunnyAnimations
    @NewFunnyAnimations 3 หลายเดือนก่อน

    Thank you for the lesson. Helped me a lot in my work!

  • @ColorauGuiyino
    @ColorauGuiyino ปีที่แล้ว +2

    very clever...

  • @Remerai
    @Remerai ปีที่แล้ว +1

    This helped me figure out (at least a temporary) solution with rendering a player behind a building, with some minor changes to geometry transparency and draw modes. Thanks a bunch!

    • @JTG2003
      @JTG2003 ปีที่แล้ว

      Would you be able to elaborate on this?

  • @rubescorner1909
    @rubescorner1909 ปีที่แล้ว +1

    This is extremely clever but seems flimsy? what if the limitation is removed in a future version of Godot? someone might be very well justified in calling this feature a bug. Could you achieve the same thing by sampling the screen texture and setting all the desired eliminated objects to a lower render priority?

    • @crigz
      @crigz  ปีที่แล้ว +2

      For a proper solution, really, we would need Godot to expose the stencil buffer. Hopefully that will come in a later version of 4.X

    • @-Name-here-
      @-Name-here- 10 หลายเดือนก่อน +1

      I know I'm very late, but I don't feel like this will be touched upon too much for awhile, and if it does major engine changes are coming anyway.
      As of right now this isn't a bug, it's just how the engine works with render priorities, and it's very easy to work with. you can even show other transparent shapes inside of this mask. I was concerned as well, but I think the video makes it out to be more of a bug, when in reality it's how the engine intentionally handles the order in which materials are drawn

  • @Averr1
    @Averr1 ปีที่แล้ว +1

    This is amazing! Do you know if there is any way to make 3d masking of only the objects that you want to mask? To have more control over it.

  • @evprkr3914
    @evprkr3914 ปีที่แล้ว +1

    This is so dead simple, yet I can't get it to work in my project. No idea why. Oddly enough, it'll mask a Sprite3D, but not another MeshInstance. But for some reason, if I set "Transparency" to anything other than 0 on the MeshInstance I'm trying to mask through, THEN it works, but then my mesh is transparent.
    EDIT: Found that if I set "Transparency" in the Surface Material of my mesh to "Alpha", then this works normally. Still not sure why that was necessary.

    • @randomcatdude
      @randomcatdude ปีที่แล้ว +2

      that's because your mesh was being rendered as opaque, which means it appears in the screen texture. only meshes that rendered with transparency are invisible through screen textures.
      setting the transparency to Alpha forced it to be part of the transparent renders, and so that's why it worked then

  • @bertangokalp9002
    @bertangokalp9002 ปีที่แล้ว

    Please do multiplayer tutorial you are my savior if you do this!

  • @mrblumbo6404
    @mrblumbo6404 ปีที่แล้ว

    Is there any form of this for canvas layer shaders, so that they can act on certain 2D textures

  • @HalfAsleepSam
    @HalfAsleepSam ปีที่แล้ว

    Version of the shader code for 3.0?

    • @Michael-rk9ru
      @Michael-rk9ru 6 หลายเดือนก่อน

      I'm on 3.6.beta3, so not sure if it would work the same, but I got this to work by just not including line 4.

  • @fuckngcnt
    @fuckngcnt ปีที่แล้ว

    so let's say i want to be able to see my character's eyebrows through the hair, i would have to give a bit of transparency to the hair mesh in order for this to work, right?

    • @crigz
      @crigz  ปีที่แล้ว

      Yep! Transparent objects don't show up in the screen texture.