You have it in the image below. Wherever you set texture in editor for any object ( sprite, control nodes) You get to choose what kind of texture it will be. One of those textures is viewporttexture. The same goes for simply calling ViewportTexture.new() in script.
You dont assign viewporttexture to the viewport, viewport is source of viewporttexture.
What do You mean You want to project 3d space to viewport ? WHat do you exactly want to happen ?