I have a shader which creates a walking strobe light effect out of a single mesh. This works perfectly under dx9 but in dx11 the strobe light is only switched off at the end of the cycle.
dx9:
dx11:
Code responsible for the strobing. Note that a light is switched off by lerping between a scale of 0 (0.2 here to make it a bit more visible) and a preset scale.
//Get the fractional part of the time. So 1.23 becomes 0.23
//The group id is added to the time to create a more random look.
half fracTime = frac((_Time2 + input.id.y) * _Speed); //_Time2 _Time.y
//Output 1 if fracTime is bigger then the id, otherwise output 0.
//A and B look like this after the step functions:
//_____-------
//-------_____
half A = step(input.id.x, fracTime);
half B = 1 - step((input.id.x + _TimeStep), fracTime);
//The time that both A and B are true is the time the strobe should be on.
f = (A == B);
//Switch the strobe off by setting the scale to 0. This avoids using if statements.
scale = lerp(0.2, scale, f);
float4 offset = float4(input.corner.x, -input.corner.y + _Yoffset, 0.0, 0.0) * scale;
output.pos = mul(UNITY_MATRIX_MVP, input.center + offset);
Any idea what might cause this? I debugged it in VS and the scale is set correctly. All variables on the dx9 and dx11 side are the same. This is really weird.