Hi Guys,
I have this problem with my unity projector. All is well until I rotate the view to somewhat a level perspective with my platform. I then get these streak running across my geometry.
I was wondering if anyone knew what this is?
This is my custom unity shader code. I didn’t write it, I got it from one of the forums, but i really like how it only shows the item that I plug in. No lighting, nothing, just it’s default colors. But maybe there is a slight bug in it I don’t know:
Shader "Projector/Custom"
{
Properties
{
_Color ("Main Colour", Color) = (1,1,1,1)
_MainTex ("Cookie", 2D) = "gray" { TexGen ObjectLinear }
//_FalloffTex ("FallOff", 2D) = "white" { TexGen ObjectLinear }
//_far("FarClip", float) = 1
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent+100"}
Pass
{
Lighting Off
Cull Off
ZWrite Off
Offset -1, -1
Tags { "Queue" = "Transparent" "RenderType"="Opaque" }
//Fog { Mode Off }
AlphaTest Greater 0
ColorMask RGB
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma fragmentoption ARB_fog_exp2
#pragma fragmentoption ARB_precision_hint_fastest
#include "UnityCG.cginc"
struct Input
{
float4 vertex : SV_POSITION;
float3 normal : NORMAL;
//float4 color : COLOR;
};
struct v2f
{
float4 pos : SV_POSITION;
float4 uv_Main : TEXCOORD0;
//float4 color : COLOR0;
float koef : COLOR;
};
sampler2D _MainTex;
//sampler2D _FalloffTex;
float4 _Color;
float4x4 _Projector;
//float4x4 _ProjectorClip;
//float _far;
v2f vert(Input v)
{
v2f o;
o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
o.uv_Main = mul (_Projector, v.vertex);
float3 normView = normalize(float3(_Projector[2][0],_Projector[2][1], _Projector[2][2]));
float d = dot(v.normal, normView);
o.koef = d < 0 ? 1 : 0;
return o;
}
half4 frag (v2f i) : COLOR
{
half4 tex = tex2Dproj(_MainTex, UNITY_PROJ_COORD(i.uv_Main)) * _Color * i.koef;
//tex.a = (1 - tex.a);
return tex;
}
ENDCG
}
}
}
The image looks like this: