I have a projection calculation which maps points from 3D space to pixel (image) space, and I want to use it as instead of the standard MVP projections in a vertex shader.
In the image below the lower blue flow is how I understand the pipeline works in GLSL, and the upper green arc is what I want to use instead.
Since GLSL's projection matrix doesn't produce pixel coordinates, but a homogenous vec4 that allows to calculate pixel coords and depth estimation, I need to make some adjustments:
My idea is to take the vec2 pixel coordinates from my calculation, map them to clip space and let openGL finish the conversion to pixel space by itself
Only problem is I'm not entirely sure how to pull this off, as you can see Im missing some essential data about what happens after Clip space
Any ideas?
EDIT: The GLSL implementation of the 3D to 2D projection function can be found here https://www.shadertoy.com/view/fltfW2