// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
// Simplified Additive Particle shader. Differences from regular Additive Particle one:
// - no Tint color
// - no Smooth particle support
// - no AlphaTest
// - no ColorMask
Shader "SG/Mobile/Particles/Premult - UVScroll"
{
Properties
{
_MainTex ("Particle Texture", 2D) = "white" {}
_XSpeed ("X Texture Speed", float) = 0
_YSpeed ("Y Texture Speed", float) = 0
}
Category
{
Tags
{
"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"
}
// Blend SrcAlpha OneMinusSrcAlpha
// Blend One OneMinusSrcAlpha
Blend SrcAlpha One
Cull Off Lighting Off ZWrite Off
BindChannels
{
Bind "Color", color
Bind "Vertex", vertex
Bind "TexCoord", texcoord
}
SubShader
{
Pass
{
CGPROGRAM
// Upgrade NOTE: excluded shader from Xbox360; has structs without semantics (struct v2f members worldPos)
#pragma vertex vert
#pragma fragment frag
#pragma fragmentoption ARB_precision_hint_fastest
#pragma multi_compile_particles
#pragma multi_compile_fog
#include "UnityCG.cginc"
sampler2D _MainTex;
uniform half _XSpeed;
uniform half _YSpeed;
float4 _MainTex_ST;
struct appdata_t
{
float4 vertex : POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
};
struct v2f
{
float4 vertex : POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
UNITY_FOG_COORDS(1)
};
v2f vert(appdata_t v)
{
v2f o;
o.color = v.color;
o.vertex = UnityObjectToClipPos(v.vertex);
o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex) + float2(
fmod(_XSpeed * _Time[1], 1), fmod(_YSpeed * _Time[1], 1));
UNITY_TRANSFER_FOG(o, o.vertex);
return o;
}
sampler2D _CameraDepthTexture;
float _InvFade;
fixed4 frag(v2f i) : COLOR
{
fixed4 c = 2 * i.color * tex2D(_MainTex, i.texcoord) * i.color.a;
UNITY_APPLY_FOG_COLOR(i.fogCoord, c, fixed4(0,0,0,0));
return c;
}
ENDCG
}
}
}
}
Hi!
Can you try removing the BindChannels block?
Also, which Unity version are you on?
Thanks Aleksandr, it seems to work now. Care to share why?
It’s using 2020.1.9 + urp 8.2 + nxaddon
BindChannels is back from the days of fixed function shaders. You already have the appdata_t
struct in there, which defines all this. I suppose there was some conflict between those two
1 Like
oh ok I’ll try to remember that when excavating artifacts from the past
1 Like
And I’ll put something like “Add a warning when using old construct with programmable shaders” to our backlog
1 Like