Error using custom vertex streams (5.6)

Hi all, I want to test out custom vertex streams for particles.

I have a particle system with Render Mode set to Mesh.
I have these set the particle system custom streams:

Position (POSITION.xyz)
Normal (NORMAL.xyz)
Color (COLOR.xyzw)
UV (TEXCOORD0.xy)
Center (TEXCOORD0.zw|w)
Velocity (TEXCOORD1.yzw)

And this in my shader:

...
struct appdata
            {
                float4 vertex : POSITION;
                float3 normal : NORMAL;
                fixed4 color : COLOR;
                float4 texcoord : TEXCOORD0;
                float4 texcoord1 : TEXCOORD1;
            };

            struct v2f
            {
                float4 vertex : SV_POSITION;
                fixed4 color : COLOR;
                float4 texcoord : TEXCOORD0;
                float4 texcoord1 : TEXCOORD1;
            };
...

My problem is the particle system is saying TEXCOORD streams do not match. What am I doing wrong?
If I remove Center and Velocity the error goes away.

Fixed it. I wasn’t setting v2f.texcoord1 in my vertex shader. The error wasn’t very helpful though.

I meet the same error.
Why must v2f.texcoord1 be set in your vertex shader? because the texcoord1 is only an input steamData.

I’m also having this issue. Not sure what I’m doing wrong.

            struct appdata
            {
                float4 vertex : POSITION;
                float4 uv : TEXCOORD0;
                float2 mask_uv : TEXCOORD1;
                fixed4 color : COLOR;
            };

            struct v2f
            {
                float4 uv : TEXCOORD0;
                float2 mask_uv : TEXCOORD1;
                UNITY_FOG_COORDS(1)
                float4 vertex : SV_POSITION;
                fixed4 color : COLOR;
            };

            v2f vert (appdata v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.uv.xy = TRANSFORM_TEX(v.uv.xy, _MainTex);
                o.mask_uv = TRANSFORM_TEX(v.mask_uv, _MaskTex);
                UNITY_TRANSFER_FOG(o,o.vertex);
                o.color = v.color;
                return o;
            }
           
            fixed4 frag (v2f i) : SV_Target
            {
                _PrimaryST.z = fmod((_Time.x * 3) + i.uv.z, 1);
                float2 primaryUV;
                primaryUV.x = i.uv.x * _PrimaryST.x + _PrimaryST.z;
                primaryUV.y = i.uv.y * _PrimaryST.y + _PrimaryST.w;
                fixed4 col1 = tex2D(_MainTex, primaryUV);

                _SecondaryST.z = fmod((_Time.x * 2) + i.uv.z, 1);
                float2 secondaryUV;
                secondaryUV.x = i.uv.x * _SecondaryST.x + _SecondaryST.z;
                secondaryUV.y = i.uv.y * _SecondaryST.y + _SecondaryST.w;
                fixed4 col2 = tex2D(_MainTex, secondaryUV);

                fixed4 maskCol = tex2D(_MaskTex, i.mask_uv);
                // apply fog
                UNITY_APPLY_FOG(i.fogCoord, col);
               
                return (col1.a * col2.a * maskCol.a) * i.color * _Color + pow(col1.a * col2.a * maskCol.a * _AddAmount, _AddPow);
            }

3506739--279779--Screen Shot 2018-05-22 at 8.58.30 PM.png

From the documentation and your error I can see that your custom vertex stream data is also packed into texcoord0 by Unity.
Inside your appdata struct however you are defining a secondary texcoord1 - this might be the cause of the error. Your mask_uv variable is not needed as long as your uv variable (texcoord0) has components to store the additional vertex stream data (packed into the z component).

Edit:
After thinking some more about it the mask_uv variable might stay. The culprit lies elsewhere.
I believe it is related to your code setting only uv.xy inside the vertex shader. You are not writing the z value to the output.

Did this ever get solved? I am having the same issue now.

i’m also getting this error with using unity shader “Particles/Standard Unlit” using default particle system without any touch. it’s wierd.

1 Like