Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.

    Read our full announcement for more information and let us know if you have any questions.

Question See through mesh with tool Hololens

Discussion in 'AR' started by Sashell_, Jun 14, 2022.

  1. Sashell_


    Jul 14, 2021

    I'm programing some stuff for AR, and I would like to do this : The player has a tool, let's say a glass plane, and when he puts the plane on a 3D mesh object, he can see inside (everything on the object thats between the tool and the player's eyes is masked).

    It's like i cut through the object, but as i move the tool away the parts that were masked reapears.

    Thing is, I've got no idea how to do that ^^" (I'm working with URP also). I guess this will be a matter of shaders and stuff...

    Can anyone help ?

  2. davidmo_unity


    Unity Technologies

    Jun 18, 2019
    What you likely want is a stencil shader that prevents the mesh from rendering wherever the stencil has written to. This would be a custom material on your "glass plane" that should render before opaques (URP also uses this property to do rendering ordering for a given camera) write to the stencil, then your mesh should only render where the stencil has not been written to.

    You might be able to crib off of this shader in our ARFoundation samples
    Sashell_ likes this.