Garry's Mod Wiki


  DModelPanel:SetDirectionalLight( number direction, table color )


Sets the directional lighting used on the rendered entity.


1 number direction
The light direction, see BOX enum.
2 table color
The color of the directional lighting.


Displays a model panel with no directional lighting. Dr. Kleiner is only lit by the ambient light set by DModelPanel:SetAmbientLight.

-- Black background panel BGPanel = vgui.Create("DPanel") BGPanel:SetPos(20, 20) BGPanel:SetSize(400, 400) BGPanel:SetBackgroundColor(Color(0, 0, 0, 255)) local mdl = vgui.Create("DModelPanel", BGPanel) mdl:SetSize(BGPanel:GetSize()) -- Setup model and camera mdl:SetModel("models/kleiner.mdl") mdl:SetCamPos(Vector(20, 20, 60)) mdl:SetLookAt(Vector(0, 0, 60)) -- Make Kleiner pace mdl:GetEntity():SetSequence(mdl:GetEntity():LookupSequence("pace_all")) -- Disable directional lighting mdl:SetDirectionalLight(BOX_TOP, Color(0, 0, 0)) mdl:SetDirectionalLight(BOX_FRONT, Color(0, 0, 0)) -- Spin around faster and play animation function mdl:LayoutEntity(ent) ent:SetAngles(Angle( 0, self.LastPaint*60, 0)) self:RunAnimation() end