Crop Image captured by device camera

I am using WebCamTexture class to open camera on my device and capture the picture. But I am not able to crop it in desired shape like oval or some random.


I always get a quad image. I am using one overlay over quad to show the shape of face. The quad has cameraView and overlay hiding the unwanted part but I don’t know how to crop that part. Please help. Its really urgent.

Hey that can be possible with shader. You can use a culling texture to crop the image in the shape you want.

Shader "MaskedTexture"
      _MainTex ("Base (RGB)", 2D) = "white" {}
      _Mask ("Culling Mask", 2D) = "white" {}
      _Cutoff ("Alpha cutoff", Range (0,1)) = 0.1
      Tags {"Queue"="Transparent"}
      Lighting Off
      ZWrite Off
      Blend SrcAlpha OneMinusSrcAlpha
      AlphaTest GEqual [_Cutoff]
         SetTexture [_Mask] {combine texture}
         SetTexture [_MainTex] {combine texture, previous}

Source: unitywiki