2D view with Z scaling, but no perspective

I’ll probably use wrong terms but hopefully I can explain this to make some kind of sense…

I’d like to set the projection so that objects are scaled based on their Z value, but their X,Y screen position doesn’t change. i.e. if the Z of the camera was changed all the objects would scale about their centers, but the center wouldn’t move.

So it’s the same as what happens with the perspective projection when the camera is at 0,0,0 looking down the Z axis at an object at 0,0,Z but for all objects. Is that possible?

So you sort-of want the effect that each object is rendered with symmetric perspective but that the eye-space Z axis runs straight through the middle of the object?

One way is to set up an orthographic frustum, and use a shader to scale the object about it’s own local origin in object space by a function of the eye-space Z value before transforming it via MVP to clip space.

Aha yes. I hadn’t thought of using a shader. I’d just assumed that since my maths is so bad that there was way to do is just with a glFrustum. Cheers.