Compute orthogonal vector from a world point to camera [Solved]

I’m implementing fog of war for my game, and I stumbled into a problem of figuring out whether or not an object is visible behind the fog.

My fog is a plane with an alphaMap on it.

I implemented a method for picking fog value from alphaMap via a ray.

now i’m a bit stuck, I have a point in the world that I want to check for visibility, so I have origin point for my picking ray, but I don’t know how to obtain a direction.

Anyone knows how to compute the “pinhole” position for perspective camera?


some pictures from the game to give a bit more context:
with fog:
without fog:

Answering my own question: