Search Unity

Intersecting Geometry

Discussion in 'Shaders' started by Dezeris85, Feb 10, 2022.

  1. Dezeris85

    Dezeris85

    Joined:
    Dec 16, 2016
    Posts:
    24
    Hey guys trying to figure how the guy in the video went about his shader. All he says is he used the command buffer to render a thickness reference. Can anyone point me in the right direction been looking for awhile now and no success finding what I want. Other then this video and a tutorial that goes about it differently, I'll also post that. I haven't been able to get it working . Maybe one of you can try and see if it works for you? Then ill know I'm screwing up.

    Video Example:


    Tutorial using Amplify Shader Editor:
    https://stackoverflow.com/questions...-shader-for-box-bounding-using-amplify-shader
     
    Last edited: Feb 10, 2022
  2. comettailz

    comettailz

    Joined:
    Feb 1, 2022
    Posts:
    14
    Seems like you could achieve this by setting the depth testing operation as "Greater or Equal", while culling front faces.

    Interestingly, the video shown also lets you "cut holes" in the intersectee, through which the background/scene is shown.
    I am not sure how this was achieved in the video shown - but I image a simple (though inefficient) way could be to render such objects into an offscreen texture.
    You could compare the intersector and intersectee depth values - in order to mask out this render texture - which will give you control over the blending.

    Also, you could probably achieve the cutout effect using stencil buffer.
     
    Last edited: Feb 12, 2022
  3. RichardGoesToNightSchool

    RichardGoesToNightSchool

    Joined:
    Dec 9, 2020
    Posts:
    27
    He does mention that he's using a render texture to store additional information

    Another reference I found
    https://github.com/hecomi/UnityScreenSpaceBoolean
     
  4. Dezeris85

    Dezeris85

    Joined:
    Dec 16, 2016
    Posts:
    24