See props behind a 3D2D panel

Hello everyone please read everything before reply.

I just finish my baking system but i saw this :

Yes we can see props behind the panel. I’ve already try to use cam.IgnoreZ(true) and use surface.??? but it’s still don’t working properly.

Here is the part of my code :



function ENT:Draw()
	self:DrawModel()

	if isBaking == 1 then

		local ang = self:GetAngles()
		local pos = self:GetPos() + Vector(10,26,58)


		ang:RotateAroundAxis(self:GetRight() , 90)
		ang:RotateAroundAxis(self:GetUp(), 10)
		ang:RotateAroundAxis(self:GetForward(), 90)

		cam.Start3D2D(pos , ang ,1)

			surface.SetDrawColor(41, 41, 41)
			surface.DrawRect(0, 0, 52, 40)
			surface.SetDrawColor(70, 70, 70)
			surface.DrawRect(1, 1, 50, 38)

		cam.End3D2D()


		local angbk = self:GetAngles()
		local posbk = self:LocalToWorld(Vector(14,-17,35))


		angbk:RotateAroundAxis(self:GetRight() , -90)
		angbk:RotateAroundAxis(self:GetUp(), 10)
		angbk:RotateAroundAxis(self:GetForward(), 90)

		cam.Start3D2D(posbk , angbk , 0.2)

			local finishtime = self:GetNWInt("FinishBakeTime")
			local finishbar = (finishtime-CurTime())*40
			draw.SimpleText("Cooking","BkFont", -5, -15,Color(0,255,0))
			draw.SimpleText("Please Wait...","BkFont2", 36, 50,Color(0,255,0))
			draw.RoundedBox(0,-15,-100,200,40,Color(20,20,20))
			draw.RoundedBox(0,-15,-100,finishbar,40,Color(150,255,150))

		cam.End3D2D()

	end
end


Thanks for answer,
Have a nice day,
Yazrihm.

suppr you addon

Set your render group to BOTH

Here is a screen :

My code :



function ENT:Draw(RENDERGROUP_BOTH)
	self:DrawModel()

	local isBaking = self:GetNWInt("isBaking")

	if isBaking == 1 then

		local ang = self:GetAngles()
		local pos = self:LocalToWorld(Vector(10,26,58))


		ang:RotateAroundAxis(self:GetRight() , 90)
		ang:RotateAroundAxis(self:GetUp(), 10)
		ang:RotateAroundAxis(self:GetForward(), 90)

		cam.Start3D2D(pos , ang ,1)

			surface.SetDrawColor(41, 41, 41)
			surface.DrawRect(0, 0, 52, 40)
			surface.SetDrawColor(70, 70, 70)
			surface.DrawRect(1, 1, 50, 38)

		cam.End3D2D()


		local angbk = self:GetAngles()
		local posbk = self:LocalToWorld(Vector(14,-17,35))


		angbk:RotateAroundAxis(self:GetRight() , -90)
		angbk:RotateAroundAxis(self:GetUp(), 10)
		angbk:RotateAroundAxis(self:GetForward(), 90)

		cam.Start3D2D(posbk , angbk , 0.2)

			local finishtime = self:GetNWInt("FinishBakeTime")
			local finishbar = (finishtime-CurTime())*40
			draw.SimpleText("Cooking","BkFont", -5, -15,Color(0,255,0))
			draw.SimpleText("Please Wait...","BkFont2", 36, 50,Color(0,255,0))
			draw.RoundedBox(0,-15,-100,200,40,Color(20,20,20))
			draw.RoundedBox(0,-15,-100,finishbar,40,Color(150,255,150))

		cam.End3D2D()

	end

	////////////////      INTERACTION MENU        /////////////


	local angim = self:GetAngles()
	local posim = self:LocalToWorld(Vector(21,-12,13))
	local ply = LocalPlayer()
	local eyetrace = ply:GetEyeTrace()

	angim:RotateAroundAxis(self:GetRight() , -89)
	angim:RotateAroundAxis(self:GetUp(), 60)
	angim:RotateAroundAxis(self:GetForward(), 89)

	if eyetrace.Entity:GetClass() == "cooker" then
		if self:GetNWInt("isBaking") == 0 then
			cam.Start3D2D(posim , angim , 0.2)
				cam.IgnoreZ(false)
				draw.SimpleText("Press 'E'","BkImFont1",0,0,Color(20,255,20))
				draw.SimpleText("to choose the recipe","BkImFont2",-10,60,Color(20,255,20))
			cam.End3D2D()
		end
	end
end


ENT.RenderGroup = RENDERGROUP_BOTH

Still won’t work.
Code ( shared.lua ) :



ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.RenderGroup = 9


Why is the render group 9

RENDERGROUP_BOTH == 9

With


RENDERGROUP_BOTH

or 9 it’s not working.

Use ENT:DrawTranslucent() instead of ENT:Draw()

:confused:

Code :



function ENT:Draw()
	self:DrawModel()

	local isBaking = self:GetNWInt("isBaking")

	if isBaking == 1 then

		local ang = self:GetAngles()
		local pos = self:LocalToWorld(Vector(10,26,58))


		ang:RotateAroundAxis(self:GetRight() , 90)
		ang:RotateAroundAxis(self:GetUp(), 10)
		ang:RotateAroundAxis(self:GetForward(), 90)

		cam.Start3D2D(pos , ang ,1)

			surface.SetDrawColor(41, 41, 41)
			surface.DrawRect(0, 0, 52, 40)
			surface.SetDrawColor(70, 70, 70)
			surface.DrawRect(1, 1, 50, 38)

		cam.End3D2D()


		local angbk = self:GetAngles()
		local posbk = self:LocalToWorld(Vector(14,-17,35))


		angbk:RotateAroundAxis(self:GetRight() , -90)
		angbk:RotateAroundAxis(self:GetUp(), 10)
		angbk:RotateAroundAxis(self:GetForward(), 90)

		cam.Start3D2D(posbk , angbk , 0.2)

			local finishtime = self:GetNWInt("FinishBakeTime")
			local finishbar = (finishtime-CurTime())*40
			draw.SimpleText("Cooking","BkFont", -5, -15,Color(0,255,0))
			draw.SimpleText("Please Wait...","BkFont2", 36, 50,Color(0,255,0))
			draw.RoundedBox(0,-15,-100,200,40,Color(20,20,20))
			draw.RoundedBox(0,-15,-100,finishbar,40,Color(150,255,150))

		cam.End3D2D()

	end

	////////////////      INTERACTION MENU        /////////////


	local angim = self:GetAngles()
	local posim = self:LocalToWorld(Vector(21,-12,13))
	local ply = LocalPlayer()
	local eyetrace = ply:GetEyeTrace()

	angim:RotateAroundAxis(self:GetRight() , -89)
	angim:RotateAroundAxis(self:GetUp(), 60)
	angim:RotateAroundAxis(self:GetForward(), 89)

	if eyetrace.Entity:GetClass() == "cooker" then
		if self:GetNWInt("isBaking") == 0 then
			cam.Start3D2D(posim , angim , 0.2)
				cam.IgnoreZ(false)
				draw.SimpleText("Press 'E'","BkImFont1",0,0,Color(20,255,20))
				draw.SimpleText("to choose the recipe","BkImFont2",-10,60,Color(20,255,20))
			cam.End3D2D()
		end
	end
end

function ENT:DrawTranslucent()
	
	self:Draw()

end


don’t call draw from DrawTranslucent.



ENT:Draw()
    self:DrawModel()
end

ENT:DrawTranslucent()
    -- do your 3d2d stuff here
end


It’s drawing nothing :



function ENT:Draw()
	self:DrawModel()
end
function ENT:DrawTranslucent()
	
	local isBaking = self:GetNWInt("isBaking")

	if isBaking == 1 then

		local ang = self:GetAngles()
		local pos = self:LocalToWorld(Vector(10,26,58))


		ang:RotateAroundAxis(self:GetRight() , 90)
		ang:RotateAroundAxis(self:GetUp(), 10)
		ang:RotateAroundAxis(self:GetForward(), 90)

		cam.Start3D2D(pos , ang ,1)

			surface.SetDrawColor(41, 41, 41)
			surface.DrawRect(0, 0, 52, 40)
			surface.SetDrawColor(70, 70, 70)
			surface.DrawRect(1, 1, 50, 38)

		cam.End3D2D()


		local angbk = self:GetAngles()
		local posbk = self:LocalToWorld(Vector(14,-17,35))


		angbk:RotateAroundAxis(self:GetRight() , -90)
		angbk:RotateAroundAxis(self:GetUp(), 10)
		angbk:RotateAroundAxis(self:GetForward(), 90)

		cam.Start3D2D(posbk , angbk , 0.2)

			local finishtime = self:GetNWInt("FinishBakeTime")
			local finishbar = (finishtime-CurTime())*40
			draw.SimpleText("Cooking","BkFont", -5, -15,Color(0,255,0))
			draw.SimpleText("Please Wait...","BkFont2", 36, 50,Color(0,255,0))
			draw.RoundedBox(0,-15,-100,200,40,Color(20,20,20))
			draw.RoundedBox(0,-15,-100,finishbar,40,Color(150,255,150))

		cam.End3D2D()

	end

	////////////////      INTERACTION MENU        /////////////


	local angim = self:GetAngles()
	local posim = self:LocalToWorld(Vector(21,-12,13))
	local ply = LocalPlayer()
	local eyetrace = ply:GetEyeTrace()

	angim:RotateAroundAxis(self:GetRight() , -89)
	angim:RotateAroundAxis(self:GetUp(), 60)
	angim:RotateAroundAxis(self:GetForward(), 89)

	if eyetrace.Entity:GetClass() == "cooker" then
		if self:GetNWInt("isBaking") == 0 then
			cam.Start3D2D(posim , angim , 0.2)
				cam.IgnoreZ(false)
				draw.SimpleText("Press 'E'","BkImFont1",0,0,Color(20,255,20))
				draw.SimpleText("to choose the recipe","BkImFont2",-10,60,Color(20,255,20))
			cam.End3D2D()
		end
	end
end


then the rendergroup of your custom entity is not set to RENDERGROUP_BOTH

Your render group is still set to opaque. That’s the only way that barrel will draw over your 3d2d.

Thanks thanks and thanks