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. Dismiss Notice

How I might create invisible textures?

Discussion in 'Editor & General Support' started by Mr_Bee, Jul 23, 2013.

  1. Mr_Bee

    Mr_Bee

    Joined:
    Jul 22, 2013
    Posts:
    3
    This is my first post here as I have recently joined and getting my feet wet in Unity. I'm trying my first attempt at a video game which I have titled Fog of War. I'm planning to post a thread for it in the Works in Progress section once I have more to show off. Right now I'm currently reaching a wall, or darkness in the actual programming of the game which is why I'm posting this here.

    Fog is a sort of innovative take on the boardgames genre. It's similar to Chess and Checkers but with a very distinctive difference. You aren't normally able to see your opponent's piece identity. All pieces look the same like Checkers, and generally move the same, but most attack differently. The trick is remembering your opponent's placement and movement and keeping track of it. The less you are able to remember the more it comes down to reading your opponent's moves and mind games. I first designed this game with a friend in college and it turned out to be a lot of fun.

    I have already created multiple paper/pencil prototypes which I've given out to people interested in the game development. I'm now trying to convert Fog into a PC game and eventual iOS game which will allow you to challenge other players. My knowledge of programming is beginner rate, but I understand the basics on a fundamental level.

    As mentioned before I'm in a bit of a bind. I'm trying to figure how I might make a piece's identity (which is displayed by a symmetrical symbol) visible to the player who owns it, but invisible to the opposing player? Right now the symbol of identity is simply part of the texture of the mesh and is wide open for any and all cameras to see.

    Could anybody help me out or give me suggestions on how to go about this?
     
    Last edited: Jul 23, 2013
  2. drift501

    drift501

    Joined:
    Apr 20, 2012
    Posts:
    76
    I would use layers for this. I'm assuming this is a multiplayer game so what you could do is create a red and a blue layer and put the blue teams pieces in the blue team layer and the opposite for the red team. The blue team players camera would then render all the normal layers including the blue layer but not the red layer, opposite for the red players camera.
     
  3. Mr_Bee

    Mr_Bee

    Joined:
    Jul 22, 2013
    Posts:
    3
    Well that sounds convenient enough. But I'm unfamiliar with what you mean by "layers". Could you explain in more depth how you do this? Or link me to a place that would clear it up?
     
  4. porglezomp

    porglezomp

    Joined:
    Aug 21, 2012
    Posts:
    40
    In the top bar of the inspector you have some drop-downs, including one marked "Layer". If you click on that, and select "Add Layer..." you'll be able to define a new layer to use.
    You'll want to create one layer for each team.
    Then, you can go into your camera and edit its "Culling Mask". This is the list of layers that render for that camera.
    Setting the Culling Mask in a script
     
  5. Mr_Bee

    Mr_Bee

    Joined:
    Jul 22, 2013
    Posts:
    3
    Ahh, sorry I didn't get back to you sooner. (Lack of internet issues)

    Thanks for the tip. I'll try that out and see if it works out.