Using render targets to make part of a SWEP's model be see-through?

Hey there. Anyone who’s used FA:S 2.0 or CW 2.0 probably knows what I’m talking about, scoped weapons that upon zooming in make part of the scope invisible, so you can see through it and shoot. In FA:S 2.0 the code for this is as follows(though I have no idea where I would put this, as DrawRenderTarget isn’t an actual SWEP hook but was made so you wouldn’t have to override the drawing hook it’s used in):

[lua] local x, y, old, ang
local sight = surface.GetTextureID(“sprites/scope_pso_illum”)
local sight2 = surface.GetTextureID(“sprites/scope_pso”)
local lens = surface.GetTextureID(“VGUI/fas2/lense”)
local lensring = surface.GetTextureID(“VGUI/fas2/lensring”)
local cd, alpha = {}, 0.5
local Ini = true

function SWEP:DrawRenderTarget()
	if self.AimPos != self.PSO1Pos then
		return
	end
	
	if self.dt.Status == FAS_STAT_ADS and not self.Peeking then
		alpha = math.Approach(alpha, 0, FrameTime() * 5)
	else
		alpha = math.Approach(alpha, 1, FrameTime() * 5)
	end
		
	x, y = ScrW(), ScrH()
	old = render.GetRenderTarget()
	
	ang = self.Wep:GetAttachment(self.Wep:LookupAttachment("muzzle")).Ang
	ang:RotateAroundAxis(ang:Forward(), -90)
	
	cd.angles = ang
	cd.origin = self.Owner:GetShootPos()
	cd.x = 0
	cd.y = 0
	cd.w = 512 
	cd.h = 512
	cd.fov = 4
	cd.drawviewmodel = false
	cd.drawhud = false
	render.SetRenderTarget(self.ScopeRT)
	render.SetViewPort(0, 0, 512, 512)
		
		if alpha < 1 or Ini then
			render.RenderView(cd)
			Ini = false
		end
		
		ang = self.Owner:EyeAngles()
		ang.p = ang.p + self.BlendAng.x
		ang.y = ang.y + self.BlendAng.y
		ang.r = ang.r + self.BlendAng.z
		ang = -ang:Forward()
		local light = render.ComputeLighting(self.Owner:GetShootPos(), ang)
		
		cam.Start2D()
			surface.SetDrawColor(255, 255, 255, 255)
			surface.SetTexture(lensring)
			surface.DrawTexturedRect(0, 0, 512, 512)
			surface.SetTexture(sight2)
			surface.DrawTexturedRect(1, 1, 512, 512)
			surface.SetDrawColor(255, 255, 255, 255)
			surface.SetTexture(sight)
			surface.DrawTexturedRect(0, 0, 512, 512)
			surface.SetDrawColor(150 * light[1], 150 * light[2], 150 * light[3], 255 * alpha)
			surface.SetTexture(lens)
			surface.DrawTexturedRect(0, 0, 512, 512)
		cam.End2D()
		
	render.SetViewPort(0, 0, x, y)
	render.SetRenderTarget(old)
		
	if self.PSO1Glass then
		self.PSO1Glass:SetTexture("$basetexture", self.ScopeRT)
	end
end

end[/lua]

Which hook would this be used in? I want to take a similar approach with rendertargets for a CS:S AUG.