Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Make covered parts of mesh transparent?

Discussion in 'Scripting' started by juiced12, Mar 14, 2020.

  1. juiced12

    juiced12

    Joined:
    Nov 8, 2018
    Posts:
    44
    Hi,

    I've got 4 quads that make up the walls of a room in my scene. I create these via script. I now want to add windows to these walls but for the walls to be transparent when the windows overlayed on top of the wall?

    Can someone point me in the right direction for what I need to do?

    I've seen threads about boolean subtraction and such but a little lost as to where to start.
     
  2. csofranz

    csofranz

    Joined:
    Apr 29, 2017
    Posts:
    1,556
    Do you want the walls to be transparent when the windows overlay (simple) or where the windows overlay (difficult)?

    The first case is easy: disable the wall object behind the window.

    The second part isn't. You need to modify the mesh of the wall itself and not only remove the triangles that are obscured, but create an outline of the 'hole' so the borders are clean. Unity itself isn't well equipped to do this kind of work, as it assumes that all meshes you use are pre-produced in other (better suited) software; Unity is geared towards displaying meshes, not creating them (although you can do that programmatically, but that requires some specific (uncommon) knowledge - perhaps start here).
     
  3. juiced12

    juiced12

    Joined:
    Nov 8, 2018
    Posts:
    44
    Hi Csofranz.

    I can't disable the wall as it is a single mesh containing 2 triangles and is larger than the window itself.

    Hmm.. I thought that I might have to rebuild the wall depending on window placement, however I just wondered whether there was a way to do this in any other way without having to modify the mesh.

    I'll see whether there's anything else I can find. Thanks for replying