Try looking at how pointshop does it
This piece of code in particular:
function PANEL:Paint()
if ( !IsValid( self.Entity ) ) then return end
local x, y = self:LocalToScreen( 0, 0 )
self:LayoutEntity( self.Entity )
local ang = self.aLookAngle
if ( !ang ) then
ang = (self.vLookatPos-self.vCamPos):Angle()
end
local w, h = self:GetSize()
cam.Start3D( self.vCamPos, ang, self.fFOV, x, y, w, h, 5, 4096 )
cam.IgnoreZ( true )
render.SuppressEngineLighting( true )
render.SetLightingOrigin( self.Entity:GetPos() )
render.ResetModelLighting( self.colAmbientLight.r/255, self.colAmbientLight.g/255, self.colAmbientLight.b/255 )
render.SetColorModulation( self.colColor.r/255, self.colColor.g/255, self.colColor.b/255 )
render.SetBlend( self.colColor.a/255 )
for i=0, 6 do
local col = self.DirectionalLight[ i ]
if ( col ) then
render.SetModelLighting( i, col.r/255, col.g/255, col.b/255 )
end
end
self.Entity:DrawModel()
self:DrawOtherModels()
render.SuppressEngineLighting( false )
cam.IgnoreZ( false )
cam.End3D()
self.LastPaint = RealTime()
end
Might be helpful to achieve what you’re looking for.