I don't understand much about shaders but I looked at Unlit/Transparent Colored (SoftClip) and I changed my shader to use vertix and fragment
the code below is the one responsible for clipping
// Softness factor
float2 factor = abs(IN.worldPos);
float val = 1.0 - max(factor.x, factor.y);
if (val < 0.0) col.a = 0.0;
and this one is responsible for multiply
col = lerp(half4(1,1,1,1), col, col.a);
and I have no clue how to combine the two to work together the last one make its effect either multiply or mask
this is the full current version
Properties
{
_MainTex ("Particle Texture", 2D) = "white" {}
}
Category {
Blend Zero SrcColor
BindChannels {
Bind "Color", color
Bind "Vertex", vertex
Bind "TexCoord", texcoord
}
// ---- Fragment program cards
SubShader {
LOD 200
Tags { "Queue"="Transparent500" "IgnoreProjector"="True" "RenderType"="Transparent" }
Pass {
Cull Off
Lighting Off
ZWrite Off
Offset -1, -1
// Fog { Color (1,1,1,1) }
Fog { Mode Off }
ColorMask RGB
AlphaTest Greater .1
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma fragmentoption ARB_precision_hint_fastest
#include "UnityCG.cginc"
sampler2D _MainTex;
float4 _TintColor;
float4 _MainTex_ST;
float2 _ClipSharpness = float2(20.0, 20.0);
struct appdata_t {
float4 vertex : POSITION;
float4 color : COLOR;
float2 texcoord : TEXCOORD0;
};
struct v2f {
float4 vertex : POSITION;
float4 color : COLOR;
float2 texcoord : TEXCOORD0;
//amal
float2 worldPos : TEXCOORD1;
};
v2f vert (appdata_t v)
{
v2f o;
o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
o.color = v.color;
o.texcoord = TRANSFORM_TEX(v.texcoord,_MainTex);
o.worldPos = TRANSFORM_TEX(v.vertex.xy, _MainTex);
return o;
}
half4 frag (v2f IN) : COLOR
{
// Sample the texture
half4 col = IN.color * tex2D(_MainTex, IN.texcoord);
col = lerp(half4(1,1,1,1), col, col.a);
// Softness factor
float2 factor = abs(IN.worldPos);
float val = 1.0 - max(factor.x, factor.y);
if (val < 0.0) col.a = 0.0;
return col;
}
ENDCG
}
}
// ---- Dual texture cards
SubShader {
Pass {
SetTexture [_MainTex] {
combine texture * primary
}
SetTexture [_MainTex] {
constantColor (1,1,1,1)
combine previous lerp (previous) constant
}
}
}
// ---- Single texture cards (does not do particle colors)
SubShader {
Pass {
SetTexture [_MainTex] {
constantColor (1,1,1,1)
combine texture lerp(texture) constant
}
}
}
}