You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iot/labs/EasyARDemo/Assets/EasyAR/Shaders/CameraImage_Gray.shader

64 lines
1.9 KiB

//================================================================================================================================
//
// Copyright (c) 2015-2019 VisionStar Information Technology (Shanghai) Co., Ltd. All Rights Reserved.
// EasyAR is the registered trademark or trademark of VisionStar Information Technology (Shanghai) Co., Ltd in China
// and other countries for the augmented reality technology developed by VisionStar Information Technology (Shanghai) Co., Ltd.
//
//================================================================================================================================
Shader "EasyAR/CameraImage_Gray"
{
Properties
{
_grayTexture("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType" = "Opaque" }
LOD 100
Pass
{
Cull Off
ZWrite Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
};
sampler2D _grayTexture;
float4 _grayTexture_ST;
float4x4 _TextureRotation;
v2f vert(appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _grayTexture);
o.uv = float2(o.uv.x, 1.0 - o.uv.y);
o.vertex = mul(_TextureRotation, o.vertex);
return o;
}
fixed4 frag(v2f i) : SV_Target
{
fixed4 col = float4(tex2D(_grayTexture, i.uv).aaa, 1.0);
return col;
}
ENDCG
}
}
}