render.RenderView question


This function renders a given position using CamData.

Is it possible to use this to draw in 3d.

function ENT:Draw()
local ang = Angle(0, 270, 90)
local pos = self.Entity:GetPos() + Vector(0, 0, 35)

	local CamData = {}
	CamData.angles = Angle(0, 0, 0)
	CamData.origin = Vector(0,0,0)
	CamData.x = 0
	CamData.y = 0
	CamData.w = 100
	CamData.h = 100
	render.RenderView( CamData )


I’ve tried that but no success, it still draws on the screen in the top left. How can I draw this in 3d then? :expressionless:

I think you need a render target for this. Create a simple 128x128 RT in settings/render_targets and try rendering to that, and then just drawing a rect with your given RT texture.

Alternately, have you tried a 3D camera rather than a 3D2D one?

I have tried this by making the renderview cover the entire screen and then using a stencil buffer and a quad and put the renderview inside that. It works quite well and you can make it like a window or a portal.