Step - Invert
Task
Write a shader that splits the screen into two parts: the left half should be red and the right half should be black.
Requirements
The shader should avoid using branching or conditional statements in its code, and instead rely on the step function to determine the color of each pixel.
Hint 1
step(0.5, uv.x) is 1.0 on the right half. You need the opposite.
Hint 2
Subtract it from one: 1.0 - step(0.5, uv.x), and use it as the red channel.
Theory
To flip a mask, subtract it from 1.0: zeros become ones and ones become zeros.
float mask = step(0.5, uv.x); // 0.0 left, 1.0 right
float inverted = 1.0 - step(0.5, uv.x); // 1.0 left, 0.0 right
::plot[f="step(edge, x)", f2="1.0 - step(edge, x)", edge=0.5 0..1]
1.0 - mask is the shader way of saying NOT. You'll use it all the time.