Thanks. Interesting, but I am just looking for a simple and free nomal opaque projector shader but haven't found in the free decal system and can't find a sign of its existence in the paid decal system.
Here's some code to do a solid projector shader. I found a nice additive shader here http://hyunkell.com/blog/rts-style-unit-selection-in-unity-5/ and changed the Blend to "Blend SrcColor OneMinusSrcAlpha" to get it to blend as a solid opaque overlay. Code (CSharp): Shader "Projector/Solid Projector" { Properties { _Color ("Tint Color", Color) = (1,1,1,1) _Attenuation ("Falloff", Range(0.0, 1.0)) = 1.0 _ShadowTex ("Cookie", 2D) = "gray" {} } Subshader { Tags {"Queue"="Transparent"} Pass { ZWrite Off ColorMask RGB Blend SrcColor OneMinusSrcAlpha Offset -1, -1 CGPROGRAM #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" struct v2f { float4 uvShadow : TEXCOORD0; float4 pos : SV_POSITION; }; float4x4 _Projector; float4x4 _ProjectorClip; v2f vert (float4 vertex : POSITION) { v2f o; o.pos = mul (UNITY_MATRIX_MVP, vertex); o.uvShadow = mul (_Projector, vertex); return o; } sampler2D _ShadowTex; fixed4 _Color; float _Attenuation; fixed4 frag (v2f i) : SV_Target { // Apply alpha mask fixed4 texCookie = tex2Dproj (_ShadowTex, UNITY_PROJ_COORD(i.uvShadow)); fixed4 outColor = _Color * texCookie.a; // Attenuation float depth = i.uvShadow.z; // [-1 (near), 1 (far)] return outColor * clamp(1.0 - abs(depth) + _Attenuation, 0.0, 1.0); } ENDCG } } }
I would like something like this as well. The provided code by quixotic7 does not work for me. Unity is currently 5.6. Does anybody know of a way to get a shader to be a completely opaque projector shader for a decal system? I have scoured the internet I feel, but seem to find a great deal of outdated shaders that do not seem to work. I have tried to patchwork my own opaque shader many times but I am not very familiar with writing shaders. Any help on this ancient post would be appreciated.
I'm using Unity 2019.2 and the above code works perfectly for me. Thank you very much for it Quixotic7!