If we have a point in NDC space and we want to transform it to view space using inverse perspective projection, why do we need to apply perspective divide at the end? Shouldn't it be perspective multiplication, since applying the forward perspective projection from view to NDC space has the perspective divide?
I found it here: http://www.cse.chalmers.se/edu/course/TDA362/tutorials/ssao.html
float fragmentDepth = texture(depthTexture, texCoord).r;
// Normalized Device Coordinates (clip space)
vec4 ndc = vec4(texCoord.x * 2.0 - 1.0, texCoord.y * 2.0 - 1.0,
fragmentDepth * 2.0 - 1.0, 1.0);
// Transform to view space
vec3 vs_pos = homogenize(inverseProjectionMatrix * ndc);
where
vec3 homogenize(vec4 v) { return vec3((1.0 / v.w) * v); }