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.
[34599-screen+shot+2014-10-31+at+1.07.54+pm.png|34599]
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"
{
Properties
{
_MainTex ("Base (RGB)", 2D) = "white" {}
_Mask ("Culling Mask", 2D) = "white" {}
_Cutoff ("Alpha cutoff", Range (0,1)) = 0.1
}
SubShader
{
Tags {"Queue"="Transparent"}
Lighting Off
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
AlphaTest GEqual [_Cutoff]
Pass
{
SetTexture [_Mask] {combine texture}
SetTexture [_MainTex] {combine texture, previous}
}
}
}
Source: unitywiki