Need to convert 3d Position to 2d

I’m trying to convert 3d data to 2d with a set camera position, however, Camera:WorldToScreenPoint doesn’t like “Fake Camera’s”, or camera’s that aren’t actually being used.
With a fake camera it simply returns the ViewportSize to be 1,1
image
However I have no way of actually changing that number, which I would prefer to be something like 500,500.
Is there any way to avoid this issue, or alternatively get the results without using Camera:WorldToScreenPoint, while still being able to input a “Camera’s CFrame”, and the Vector3 Point in which I wish to convert?

Can you show me your script, this should technically work?

local VirtualCamera = Instance.new("Camera")
VirtualCamera.Parent = game.Workspace

while wait() do
	VirtualCamera.CFrame = CFrame.new(-1,1,1)*CFrame.lookAt(Vector3.new(-1,1,1),Vector3.new(0,0,0))
	local vec1,on1 = VirtualCamera:WorldToScreenPoint(Vector3.new(0,1,0))
	local vec2,on2 = VirtualCamera:WorldToScreenPoint(Vector3.new(0,-1,0))
	local p1 = script.p:Clone()
	local p2 = script.p:Clone()
	for i,v in pairs(script.Parent.Frame:GetChildren()) do
		v:Destroy()
	end
	p1.Parent = script.Parent.Frame
	p2.Parent = script.Parent.Frame
	p1.Position = UDim2.new(0,vec1.X,0,vec1.Y)
	p2.Position = UDim2.new(0,vec2.X,0,vec2.Y)
	p1.Visible = on1
	p2.Visible = on2
	print(vec1,vec2)
end

Feeding it the VirtualCamera’s doesn’t work, however if I just make the VirtualCamera use the actual camera, it works perfectly. The issue is on the VirtualCamera, it has no ViewportSize, so it fails to work.
I want it so I dont have to hook it to the players camera and move it around, plus I want it to have a set ViewportSize of 500,500, rather than using the players ViewportSize, as scaling may look weird.

ViewportSize describes the dimensions, in pixels, of the client’s viewport. You have to reposition the camera if you want it to catch more of your game.

https://developer.roblox.com/en-us/api-reference/property/Camera/ViewportSize

That’s not the issue, the ViewportSize is being set to 1,1 because of the fact that Roblox Studio views it as not being used since its not the “CurrentCamera”, which setting it to that would ruin what I’m attempting to do and cause the player to view from the Virtual Camera’s perspective, ruining the experience, also the ViewportSize wouldn’t end up being the 500,500 or whatever I want it to be set as, it’d be the player’s set viewport size instead.
I need a way to convert a 3d Point to a 2d Point with the ability to input the 3d Point I want converted, the Camera CFrame, and possibly the camera’s viewport size.

Why do you need to use a Camera that isn’t the CurrentCamera? As far as I am aware ViewportSize is updated internally by Roblox, however you may be able to get a ViewportSize if you set the Camera to be a ViewportFrame’s current camera. This will be extremely hacky if it does work, and you will need to create this Camera during run time.

I would like to use the camera to abuse its :WorldToScreenPoint function in order to project a 3d space into a 2d frame in order to give an almost wireframe look for a object renderer of sorts. I’m 99% sure you’d be able to do this with math’s, however I’m completely stupid when it comes to this kind of stuff for 3d to 2d projection.

I found a Stack Overflow topic on this that links to a Wikipedia article and includes a basic translation from 3D world space to 2D screen space. vector - How can I convert 3D space coordinates to 2D space coordinates? - Stack Overflow

I’ve already seen that, I was just curious if there was any way to just abuse the :WorldToScreenPoint because I really don’t want to have to do a crap ton of math, but I guess I’ll just have to unless someone else is able to find a better solution.

You could try out my Viewport method, I have no idea if it works but I am assuming Roblox updates ViewportSize when a Camera is set to a CurrentCamera. You could also try to momentarily change CurrentCamera to that Camera instance to see if it updates viewport size.