render.SetLightingMode

From Garry's Mod
Jump to: navigation, search
 render.SetLightingMode( )

Contents

Description

Sets lighting mode when rendering something.

NOTE

Do not forget to restore the default value to avoid unexpected behavior, like the world and the HUD/UI being affected

Arguments

number Mode

Lighting render mode

Possible values are:

  • 0 - Default
  • 1 - Total fullbright, similar to mat_fullbright 1 but excluding some weapon view models
  • 2 - Increased brightness(?), models look fullbright

Examples

Example

Draws a fullbright quad on 2D skybox

local MATERIAL = Material("skybox/trainup")

hook.Add("PostDraw2DSkyBox", "Quaddrawer", function()
	render.OverrideDepthEnable( true, false )
	render.SetLightingMode(2)

	cam.Start3D(Vector(0, 0, 0), EyeAngles())
		render.SetMaterial(MATERIAL)
		render.DrawQuadEasy(Vector(200,0,0), Vector(-1,0,0), 64, 64, Color(255,255,255), 180)
	cam.End3D()

	render.OverrideDepthEnable( false, false )
	render.SetLightingMode(0)
end)


Examples

Example

Display everything the same way as when you set mat_fullbright to 1.

local LightingModeChanged = false
hook.Add( "PreRender", "fullbright", function()
	render.SetLightingMode( 1 )
	LightingModeChanged = true
end )

local function EndOfLightingMod()
	if LightingModeChanged then
		render.SetLightingMode( 0 )
		LightingModeChanged = false
	end
end
hook.Add( "PostRender", "fullbright", EndOfLightingMod )
hook.Add( "PreDrawHUD", "fullbright", EndOfLightingMod )


Personal tools
Navigation