Collapse
In this task, you will reverse the direction of an existing smooth horizontal gradient. Currently, the gradient transitions from white on the left to black on the right. Your goal is to modify the fragment shader so that the gradient flows in the opposite direction—black on the left to white on the right.
To achieve this, you’ll use the x-coordinate of each pixel (normalized to a range of 0.0 to 1.0) to calculate the grayscale value directly. By inverting the relationship between the x-coordinate and the color intensity, you can reverse the gradient.
By the end, the screen should display a smooth gradient where the left edge is completely black, the right edge is completely white, and the middle transitions smoothly between the two—effectively reversing the original gradient.
Fetching Status...