Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Problem lighting shared objects in split screen multiplayer

Discussion in 'General Graphics' started by Franolich, Oct 14, 2015.

  1. Franolich

    Franolich

    Joined:
    Feb 12, 2013
    Posts:
    6
    I am learning Unity by creating a split-screen multiplayer 3D platform game. It has the following layers set up:
    • Shared objects - static platforms, scenery, etc
    • Player 1 objects - player 1, lifts, disappearing platforms, enemies, etc
    • Player 2 objects - player 2, (copies of...) lifts, disappearing platforms, enemies, etc
    Actually there are more player specific layers but the above is sufficient to demonstrate my problem.

    Other setup details:
    • The player 1 camera has a culling mask to only render shared and player 1 objects. Similarly for player 2.
    • The scene is lit by two directional lights in the Default layer with culling masks set to Everything.
    • Layer-based physics is in use to ensure there is no interaction between player 1 and player 2 objects.
    Shadows are being rendered correctly in that shared objects cast shadows visible to both players while shadows cast by player 1 objects are only visible to player 1.

    However additional lights that should only be visible to player 1 are also seen by player 2. Setting a light's culling mask to only include player 1 objects is no good as I need it to light shared object also. But adding shared objects to the culling mask makes the effects of the light visible to player 2.

    One solution is to have no shared objects, ie copies of all objects for player 1 and for player 2, but this seems undesirable. So I am wondering if there is another way around this lighting problem.
     
    Last edited: Oct 15, 2015