So, I got this shader from… God knows where so many months ago. It’s been so long. But, the thing is it renders very transparent. It gets washed out by its background behind it. Does anyone know enough about shaders to add a float clamped from 0 to 1, or 0 to 255 that controls transparency? I know how to program in C#, however, I do not know how all this programming for the graphics card works.
Thanks! -Michael
Shader "Holographic Sight Shader"{
Properties
{
_MainTex ("Base (RGB)", 2D)="white"{}
_ReticleSize("ReticleSize",float)=2.0
}
SubShader
{
Tags {"Queue"="Transparent""IgnoreProjector"="True""RenderType"="Transparent"}
Blend SrcAlpha One
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata_t
{
float4 vertex : POSITION;
};
struct v2f
{
float4 vertex : SV_POSITION;
half2 texcoord : TEXCOORD0;
};
sampler2D _MainTex;
float _ReticleSize;
v2f vert (appdata_t v)
{
v2f o;
o.vertex= mul(UNITY_MATRIX_MVP, v.vertex);
o.texcoord= v.vertex.xy*_ReticleSize-mul((float3x3)_World2Object, _WorldSpaceCameraPos-mul(_Object2World, float4(0,0,0,1))).xy*_ReticleSize+float2(0.5,0.5);
return o;
}
fixed4 frag (v2f i): COLOR
{
fixed4 col = tex2D(_MainTex, i.texcoord);
return col;
}
ENDCG
}
}
}