I need the particles to only spawn on a specific color on an entire group of sprites/line renderers/trail renderers. I don’t know if this is even possible? I think you would need to custom code that, right? But then you would have to set all the sprites to read/write and that has performance issues?
Shader "Custom/ColorRangeParticle" {
Properties {
_MainTex ("Texture", 2D) = "white" {}
_Color ("Color", Color) = (1, 1, 1, 1)
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 100
CGPROGRAM
#pragma surface surf Standard
sampler2D _MainTex;
float4 _Color;
struct Input {
float2 uv_MainTex;
float3 worldPos;
float3 worldNormal;
float3 worldRefl;
};
void surf (Input IN, inout SurfaceOutputStandard o) {
// Sample the texture color
fixed4 color = tex2D(_MainTex, IN.uv_MainTex);
// Test if the color is equal to the specified color
if (color.rgb == _Color.rgb) {
o.Albedo = color.rgb;
o.Alpha = color.a;
} else {
// Set the pixel color to transparent
o.Albedo = 0;
o.Alpha = 0;
}
}
ENDCG
}
FallBack "Diffuse"
}