MGFX

MGFX is the Lux rendering package for Garry's Mod immediate UI effects. It is distributed as the standalone lux-mgfx package set and is documented in its own site:

This page is only the Lux-site entry point. Use the standalone MGFX documentation for API details, shader notes, performance guidance, and the Lux-based architecture.

Install it per project:

luxc install @lux/mgfx --from github:TimeWatcher/lux-mgfx

Use with Plain GLua

MGFX is not limited to projects that already write Lux source. For existing VGUI panels, gamemode UI, or gradual migration work, use the generated loader-based distribution and call the installed MGFX.* facade from plain GLua:

function PANEL:Paint(w, h)
  MGFX.StartPanel(self, w, h)
  MGFX.RoundedBoxEx(0, 0, w, h, {
    radius = 10,
    fill = MGFX.LinearGradient(
      0,
      0,
      1,
      1,
      Color(30, 130, 255, 230),
      Color(255, 210, 110, 230)
    ),
  })
  MGFX.EndPanel()
end

The distribution still comes from the Lux MGFX package. The difference is that the loader has already been generated, initializes the client runtime, and installs MGFX globally for non-Lux callers.

Use from Lux

Install the optional MGFX facade
import * as mgfx from "@lux/mgfx"
import * as console from "@lux/mgfx/console"

client fn installMgfx() {
  local api = mgfx.installGlobal("MGFX")
  console.install(api)
}

New Lux code should prefer explicit module imports such as mgfx.paint, mgfx.style, mgfx.frame, and mgfx.widgets. The MGFX.* global facade is for GLua-facing code, old panels, console demos, and gradual migration.

What Lux Handles

@lux/mgfx is client-only. When a project imports it, luxc gmod build compiles the required module parts, keeps realm exports client-scoped, emits generated Lua, and generates the GMod loader. The package root comes from the project lockfile after installation; it is not bundled with luxc. Do not copy the old MGFX Lua autorun loader into a Lux project.

MGFX is also a practical example of Lux package design: one package is split into submodules such as frame, paint, style, text, widgets, materials, and shaderpack, while module parts share internal scope and export only the public API.

License

MGFX is licensed separately for non-commercial use. Commercial use requires a separate written license from the copyright holder. The standalone MGFX docs repository contains the current license files and deployment notes.