I am definitely no expert, but the terminology seems to be quite different from what I have learned and I find this quite confusing.
Khronos Group defined NDC as the Clip space devided by âwâ.
https://registry.khronos.org/OpenGL/specs/gl/glspec46.core.pdf#page=480
So I would interpret what you said as:
NDC is exactly clipSpace.xyz / clipSpace.w.
So first you have your Clip Space as homogeneous coordinates, then you do your perspective division and get NDC, and then in a separate step you calculate the normalized screen space coordinate where you shift your NDC xy from -1 to 1 to 0 to 1 (normalized screen space).
However due to the 3d perspective we are dealing with, the rasterization process does not interpolate correctly between the NDC positions.
So what we do to fix this is to just keep our positions in clip space. And let the rasterizer do the perspective division. And since the rasterizer now has this additional information about the perspective it can simply correctly interpolate between the vertex data, while not causing any distortion.
However since we now input our clip space coords the output will not be in normalized screen space (0 to 1), but NDC (-1 to 1) instead. However we want it to be in screen space.
But can actually do a little trick like Unity does with
float4 ndc = input.positionCS * 0.5f;
input.positionNDC.xy = float2(ndc.x, ndc.y * _ProjectionParams.x) + ndc.w;
input.positionNDC.zw = input.positionCS.zw;
and they end up with
float4 modifiedCS = float4(0.5CS.x + 0.5CS.w, 0.5CS.y + 0.5CS.w, CS.z, CS.w)
So now when the rasterizer does the perspective division by w you will end up with.
float3 normilizedScreenSpace = float3(0.5 * NDC.x + 0.5, 0.5 * NDC.y + 0.5, NDC.w)
where the xy are now perfectly in normalized screen space, meaning your NDC coordinates automatically got converted to normalized screen space.
So its basically a math trick to get the rasterizer to directly output normalized screen space instead of NDC.
Now calling this math trick "Homogeneous normalized device coordinates" seem wrong and very misleading to me. It sure is "Homogeneous", but its is really not NDC, in fact it really tries to not be NDC and instead tries to be normalized screen space.
So calling it "homogeneous normalized screen space" would make a lot more sense imo.
I really dont want to be the guy that picks on every detail but I just found the terminology use confusing and it really did not fit into my understanding. So I wanted to make sure that I understand this correctly.