I need to alter the pass section of a 3dsmax viewport shader based on a boolean ticky

Basically I want to achieve the following - the only difference being that I want it to work


    {
	  VertexShader = compile vs_3_0 VS(g_LightPos);
	  CullMode = ccw;
	  ZEnable = true;
	  ZWriteEnable = true;
	 AlphaBlendEnable = true;

          if(g_enableAdditive)
          {
	     SrcBlend = One;
             DestBlend = One;
           }
          else
          {
            SrcBlend = SrcAlpha;
            DestBlend = invSrcAlpha;
           }


      
      PixelShader  = compile ps_3_0 PSConstant(g_LightCol, 1);
    }

I’ve already got this working using an extra technique but that’s not a good solution for me as it doesn’t sit well with my exporter scripts and also because I already have 4 different techniques that all require the ability to enable additive blending

I’m aware that I can’t use conditional statements in Pass, I’ve found this if statement - Conditional operator in HLSL's pass - Stack Overflow which appears to solve my problem but I don’t know the language well enough to adapt the solution to my own code.

Could somebody point me in the right direction or at maybe explain (in idiot speak) what the solution does/means

ta very much :slight_smile: