Overriding Halo shader

Hi all

I’m trying to change the halo component appearance so that the gradient is a bit steeper toward the end, because I want it to be a halo around the edge of a sphere. Currently it’s too weak. I hope that makes sense.

My current idea is to change the shader behind the Halo component. In the Unity docs they say grab the built in shaders from http://unity3d.com/unity/download/archive/ and simply put the overriding shader in a Resources folder. And that’s it. But I do that and I make some changes to the shader (below) and nothing seems to happen. I can see that Unity is building the shader and coming up errors, but it doesn’t seem to be replacing the Halo component shader.

Any ideas? Thanks

file: Internal-Halo.shader

Shader "Hidden/Internal-Halo" {
SubShader {
Tags {“RenderType”=“Overlay”}
ZWrite off Cull off // NOTE: ‘Cull off’ is important as the halo meshes flip handedness each time… BUG: #1220
Fog { Color (0,0,0,0) }
Blend OneMinusDstColor One
AlphaTest Greater 0
ColorMask RGB
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include “UnityCG.cginc”
sampler2D _HaloFalloff;
struct appdata_t {
float4 vertex : POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
};
struct v2f {
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
};
float4 _HaloFalloff_ST;
v2f vert (appdata_t v)
{
v2f o;
o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
o.color = half4(1,0,0,1); // Changed to constant value
o.texcoord = TRANSFORM_TEX(v.texcoord,_HaloFalloff);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
half a = tex2D(_HaloFalloff, i.texcoord).a;
return half4 (half3(1,0,0) * a, a); // Changed to constant value
}
ENDCG
}
}
}

Also I don’t see an option to format for code, anyone know?

1 Like

I saw someone mention creating a custom billboard to get around a similar issue. I just started learning about shaders yesterday, so does that sound like a reason solution to anyone?

I know this is old, but the docs seem to be incomplete about this. If you go into Edit → Project Settings → Graphics, you can change the Light Halo from “Build-In shader” to “Custom shader” and choose yours.

1 Like

Hey, thanks for the reply. Not so much use anymore for me, but maybe it’ll help someone else. Always good to know anyway.

It helps me, thanks :slight_smile: