Help with multi-purpose replacement shader for camera

Hello! So I’m designing a replacement shader that the camera can alternatively be set to during gameplay. The goal is to color objects based on their position in the map. Therefore, moving objects flash like a rainbow.

So far, it works on 3D objects, but it’s a replacement shader. This means that once it’s applied to the camera, EVERYTHING will be rendered this way. Unfortunately, billboarded trees don’t even appear. I want to fix this.

In the code below, I tried to fuse Unity’s default tree billboard shader with my trippy rainbow one. The idea was to see if billboarded trees could render normally in the rainbow shader mode before I change the tree’s part.

The billboarded trees still are not showing up at all. Here’s my code. I’m new to programming shaders, and I’d like to know what I’m doing wrong. At the end of the day, I want the shader to be capable of rendering everything in this rainbow fashion. Opaques, sprites, billboarded trees, etc.

Shader "Custom/EI" {
	Properties {
		_Inv ("Inv", float) = 1 //Global float which controls positivity or negativity of colors. Will make an int soon.
		_MainTex ("Base (RGB) Alpha (A)", 2D) = "white" {} //_MainTex taken from Unity tree billboard shader.
	}
	SubShader { 
		Pass { // First pass should be all 3D objects. This has been working so far
			Tags {"LightMode" = "ForwardBase" "RenderType" = "Opaque"}
			CGPROGRAM
			
			#pragma vertex vert
			#pragma fragment frag
			#include "UnityCG.cginc"
			
			float _Inv;
			
			struct vertexInput {
				float4 vertex : POSITION;
				float3 normal : NORMAL;
			};
			struct vertexOutput {
				float4 pos : SV_POSITION;
				float4 col : COLOR;
			};
			
			float3 jnoise(float3 b) { //Returns a color based on given 3D coordnates
				float x = saturate((sin(b.x)+1.1)/2);
				float y = saturate((sin(b.y)+1.1)/2);
				float z = saturate((cos(b.z)+1.1)/2);
				float mag = 3/(x+y+z);
				return float3(x,y,z)*mag*0.5f;
			}
			
			vertexOutput vert(vertexInput v) {
				vertexOutput o;
				float3 normalDirection = normalize(mul(float4(v.normal,0.0), _World2Object).xyz);
				float3 viewdir = WorldSpaceViewDir(v.vertex);
				
				float3 diffuseReflection = dot(normalDirection, viewdir);
				//Get normal of vertex relative to camera. d"n" means d-"normal"
				float dn = clamp(diffuseReflection.x / distance(_WorldSpaceCameraPos, mul(_Object2World, v.vertex)), 0, 1);
				if (_Inv == 1) dn = 1-dn;
				float4 oo = mul(_Object2World, float4(0.0,0.0,0.0,1.0) ); //"oo" means "object origin"
				o.col = float4(jnoise(oo.xyz),1) * float4(dn,dn,dn,1); //Coord color multiplied by normal shade.
				o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
				return o;
			}
			
			float4 frag(vertexOutput i) : COLOR {
				return i.col;
			}
			
			ENDCG
		}
		Pass { // Second pass taken directly from Unity's tree billboard shader. Pasted here to see
				//if billboard trees would be rendered normally using replacement shader.
			Tags {"LightMode"="ForwardBase" "Queue" = "Transparent-100" "IgnoreProjector"="True" "RenderType"="TreeBillboard" }
			ColorMask rgb
			Blend SrcAlpha OneMinusSrcAlpha
			ZWrite Off Cull Off
			
			CGPROGRAM
			#pragma vertex vert
			#pragma fragment frag
			#pragma multi_compile_fog
			#include "UnityCG.cginc"
			#include "TerrainEngine.cginc"

			struct v2f {
				float4 pos : SV_POSITION;
				fixed4 color : COLOR0;
				float2 uv : TEXCOORD0;
				UNITY_FOG_COORDS(1)
			};

			v2f vert (appdata_tree_billboard v) {
				v2f o;
				TerrainBillboardTree(v.vertex, v.texcoord1.xy, v.texcoord.y);	
				o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
				o.uv.x = v.texcoord.x;
				o.uv.y = v.texcoord.y > 0;
				o.color = v.color;
				UNITY_TRANSFER_FOG(o,o.pos);
				return o;
			}

			sampler2D _MainTex;
			fixed4 frag(v2f input) : SV_Target
			{
				fixed4 col = tex2D( _MainTex, input.uv);
				col.rgb *= input.color.rgb;
				clip(col.a);
				UNITY_APPLY_FOG(input.fogCoord, col);
				return col;
			}
			ENDCG			
		}
	}
}

Thank you to everyone who can offer any help!

Hi! I am having similar issue. Did you manage to create the replacement shader for Tree Creator trees?