Search Unity

Question Transparent plane that will hide all shadows of other objects behind it.

Discussion in 'General Graphics' started by Akeadi, Dec 26, 2022.

  1. Akeadi

    Akeadi

    Joined:
    Nov 1, 2019
    Posts:
    1
    Hello.
    I have a question. How to make a transparent plane behind which shadows of other objects will NOT be rendered?


    I will be very grateful for any ideas and ways to solve the problem.
     
  2. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    I think you'd have to create a custom shader to accomplish this. This question is better suited for the General Graphics sub-forum.
     
  3. burningmime

    burningmime

    Joined:
    Jan 25, 2014
    Posts:
    845
    What are you trying to achieve? Can you post a diagram or picture? There might be a better way.

    The ways I can think of to do this in a generalized way (allowing viewing the plane from any angle, having shadow-casting stuff on both sides of the plane just not allowing shadows to cross the plane) are VERY complicated and might require stuff like hacking the render pipeline (or having your own SRP).

    EDIT: For an example of a tricky case, consider a scene containing only a tree (single mesh). The branches of the tree need to cast shadows on each other and the tree trunk. Now put the plane in the middle of the tree. Do these self-shadows go through the plane? If not, are both sides of the tree independently able to shadow themselves?
     
    Last edited: Jan 2, 2023
  4. c0d3_m0nk3y

    c0d3_m0nk3y

    Joined:
    Oct 21, 2021
    Posts:
    675