How do you scale a model along a world space normalized vector so it appears flat using world position offset?

I would like to “flatten” 3d models on screen to near zero depth so that they look like paper 2D sprites. I would like it to work given any normal direction as a parameter.

I’ve tried a dozen things, and the only thing that comes close is the following:

however, when I rotate the model, it falls apart and i get all sorts of skewing. How can I get this flattening effect but still be able to rotate models? it seems to me like the WPO input is being added to whatever base calculation gets put into the shader? I feel like this is a stupid question, but i’m not wrapping my head around it.

ok, of course it clicked after I wrote it down…

the answer is basically here: c++ - How to project a point onto a plane in 3D? - Stack Overflow .

The trick is to use the camera forward * -1 as your plane normal. This is because world position offset is “adding” vs “setting” the result of your calculation to the vertex as an offset so you basically have to calculate a counter offset. This means calculating the distance to the point from a plane, and then effectively moving the point to the other side of the plane to cancel out it’s position when it’s applied as an offset.
Also, dont work in local space on this one. thats what creates the offsets when rotating. the technique works best in world space where rotations are already applied.