1
\$\begingroup\$

I'm trying to make a multiple pass using two [blending] for each one, but he accuses in one place, there is nothing, I don't understand why

Parse error: syntax error, unexpected TOK_PASS, expecting TOK_SETTEXTURE or '}' at line 28

    SubShader
{
    ZWrite Off
    Tags { "QUEUE"="Transparent" "IGNOREPROJECTOR"="true" "RenderType"="Transparent" "PreviewType"="Plane" }
    Pass
    {
        //transparency
        Blend SrcAlpha One
        CGPROGRAM
            #pragma surface surf Lambert 
            #pragma target 3.0
            struct Input
            {
                //
            };
            sampler2D //;
            void surf (Input IN, inout SurfaceOutput o)
            {
                //
            }
        }
     ENDCG
    }
    Pass
    {
         //alphabend
        Blend SrcAlpha OneMinusSrcAlpha
        CGPROGRAM
        #pragma surface surf Lambert
        #pragma target 3.0

         sampler2D//;
         fixed4 //;

         struct Input 
         {
          //;
         };
         void surf(Input IN, inout SurfaceOutput o)
         {
         //
         }
        ENDCG
    }
}
\$\endgroup\$
0
\$\begingroup\$

Surface shaders wrapped in CGPROGRAM does not need to be surrounded by a Pass block. Simply separate the two passes between CGPROGRAM tags.

i.e.,

ZWrite Off
Tags { "QUEUE"="Transparent" "IGNOREPROJECTOR"="true" "RenderType"="Transparent" "PreviewType"="Plane" }
    //transparency
    Blend SrcAlpha One
    CGPROGRAM
    ...
    void surf (Input IN, inout SurfaceOutput o)
    {
        // Pass 1
    }
    ENDCG

    CGPROGRAM
    ...
    void surf(Input IN, inout SurfaceOutput o)
    {
        // Pass 2
    }
    ENDCG
...
| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.