Search Unity

Circular Camera Mask?

Discussion in 'Scripting' started by Treasureman, Feb 11, 2016.

  1. Treasureman

    Treasureman

    Joined:
    Jul 5, 2014
    Posts:
    563
    I want to make a circular minimap using a camera attached to my player. The problem, obviously, is that the cameras are square. What's an easy way to make my camera circular? Can I mask it under a UI Image?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,745
    I've not used masks personally but there are a few asset store items that seem to do this sort of stencil/masking stuff.

    You could also make a geometric circle in a 3D program (like Blender) and set the UVs so they are centered in the UV space, then use a RenderTexture as the source texture to feed the camera's view to that texture, then place it in view of your main camera.
     
  3. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,537
    What is your minimap constructed of?

    Is it a UI element that just shows an image?

    Is it a camera view of another part of the scene (like a birdseye, or you have some separate GameObjects elsewhere in the scene that represent it)?

    Are you rendering a seconds camera's view to a RenderTexture, and displaying that somewhere?