Shader "Custom/EmissiveLaser" { Properties { _MainTex ("Texture", 2D) = "white" {} [HDR]_Color ("Tint Color (HDR)", Color) = (1, 0, 0, 1) _Emission ("Emission Strength", Range(0, 20)) = 5.0 _ScrollSpeed ("Scroll Speed", Float) = 1.0 // Optional niceties for a neon line look: _CoreSharpness("Core Sharpness", Range(0.1, 8)) = 2.0 // higher = tighter core _EdgeSoftness ("Edge Softness", Range(0.0, 1.0)) = 0.35 // higher = wider glow band } SubShader { Tags { "Queue"="Transparent" "RenderType"="Transparent" } LOD 100 // Additive neon Blend One One ZWrite Off Cull Off Lighting Off // Keep normal depth test so it can be occluded by geometry ZTest LEqual Pass { CGPROGRAM #pragma vertex vert #pragma fragment frag #pragma target 3.0 #include "UnityCG.cginc" #pragma multi_compile_fog sampler2D _MainTex; float4 _MainTex_ST; float4 _Color; float _Emission; float _ScrollSpeed; float _CoreSharpness; float _EdgeSoftness; struct appdata { float4 vertex : POSITION; float2 uv : TEXCOORD0; }; struct v2f { float4 pos : SV_POSITION; float2 uv : TEXCOORD0; UNITY_FOG_COORDS(1) }; v2f vert (appdata v) { v2f o; o.pos = UnityObjectToClipPos(v.vertex); // Scroll along U float2 uv = TRANSFORM_TEX(v.uv, _MainTex); uv.x += _Time.y * _ScrollSpeed; o.uv = uv; UNITY_TRANSFER_FOG(o, o.pos); return o; } fixed4 frag (v2f i) : SV_Target { // Base texture (use white if you just want a flat color) fixed4 tex = tex2D(_MainTex, i.uv); // Neon falloff across the width (LineRenderer typically uses V for width 0..1) // Center at 0.5; make a soft bell curve controlled by edge softness & sharpness. float v = abs(i.uv.y - 0.5) * 2.0; // 0 at center, 1 at edges float core = pow(saturate(1.0 - v / max(1e-4, _EdgeSoftness + 1e-4)), _CoreSharpness); // Clamp a little to avoid banding core = saturate(core); // HDR output: bright enough for Bloom to catch (Camera HDR must be ON) float3 rgb = tex.rgb * _Color.rgb * (_Emission); // Multiply by our soft core so edges fade nicely rgb *= core; // Additive blending ignores alpha, but keep it tidy return fixed4(rgb, tex.a * _Color.a); } ENDCG } } }