Z can be dropped due to the fact that only screen coordinates are needed. But the (x2d, y2d, w) corresponds exactly to the (x,y,z) in 3D. Hence, f(x,y,z) can be applied to compute world space attribute at the 2D homogenous coordinate.
Affine function is important to ensure that attributes can be interpolated in screen space linearly. That f/w is affine in screen space also means that 1/w is affine in screen space. Hence both of them can be interpolated linearly in screen space. Finally, f = (f/w) / (1/w) to compute the world space attribute in screen space.
goku2021
An explanation of why 1/w is affine in screen space coordinates:
Z can be dropped due to the fact that only screen coordinates are needed. But the (x2d, y2d, w) corresponds exactly to the (x,y,z) in 3D. Hence, f(x,y,z) can be applied to compute world space attribute at the 2D homogenous coordinate.
Affine function is important to ensure that attributes can be interpolated in screen space linearly. That f/w is affine in screen space also means that 1/w is affine in screen space. Hence both of them can be interpolated linearly in screen space. Finally, f = (f/w) / (1/w) to compute the world space attribute in screen space.