How to convert 3D units to pixels?

Does anyone knows how to precisely convert a 3D units to pixels?

Say If i want to position a texture using matrix in Vector2(100,100) that is in pixel coordinate what will be the quivalent 3D unit?

Viewport.Unproject() might help.

Awedome.

Thank you very much

Here is some code I use to pick objects with the mouse.
You need to define a plane on which the texture will apear, because just x,y in screen space can be an infinite number of points in world (3D) space. ex [100,100,1], [100,100,2], etc

        Vector2 source = new Vector2(x, y);
        Vector3 v1 = viewport.Unproject(new Vector3(source, 0.0f), camera.Projection, camera.View, Matrix.Identity);
        Vector3 v2 = viewport.Unproject(new Vector3(source, 1.0f), camera.Projection, camera.View, Matrix.Identity);
        Vector3 dir = Vector3.Normalize(v2 - v1);
        float angle = Vector3.Dot(plane.Normal, dir);
        float v1d = Vector3.Dot(plane.Normal, v1);
        Vector3 unpj = v1 + dir * ((plane.D - v1d) / angle);

What are you building? maybe there are better ways ways do what you want to do.
Are you doing a 2D platformers with 3D graphics?

I am trying to use Krypton lighting engine to illuminate my tiles. problem is it requires me to have a 3D units instead of pixel :smiley: Thanks