Skip to content

MGFXModern GMod FX

Shader-backed immediate rendering for Garry's Mod UI. Start with your runtime, then use the same renderer concepts for shapes, images, meters, text effects, gradients, masks, glow, and backdrop blur.

Quick Start

lua
local mgfx = include("mgfx/init.lua")

function PANEL:Paint(w, h)
    mgfx.StartPanel(self, w, h)

    mgfx.RoundedBoxEx(0, 0, w, h, {
        radius = 10,
        fill = Color(8, 14, 20, 170),
        backdrop = {blur = 8, tint = Color(0, 8, 12, 120)},
        outerGlow = {color = Color(70, 205, 255, 64), width = 12},
    })

    mgfx.ProgressBarEx(24, 84, w - 48, 10, 0.72, {
        radius = 5,
        track = Color(10, 18, 24, 190),
        fill = mgfx.LinearGradient(0, 0, 1, 0, Color(30, 130, 255), Color(255, 210, 110)),
    })

    mgfx.EndPanel()
end
lux
import * as mgfx from "@lux/mgfx"

fn PANEL:Paint(w, h) {
  local draw = mgfx.api
  draw.startPanel(self, w, h)

  draw.roundedBoxEx(0, 0, w, h, {
    radius = 10,
    fill = Color(8, 14, 20, 170),
    backdrop = {blur = 8, tint = Color(0, 8, 12, 120)},
    outerGlow = {color = Color(70, 205, 255, 64), width = 12},
  })

  draw.progressBarEx(24, 84, w - 48, 10, 0.72, {
    radius = 5,
    track = Color(10, 18, 24, 190),
    fill = draw.linearGradient(0, 0, 1, 0, Color(30, 130, 255), Color(255, 210, 110)),
  })

  draw.endPanel();
}

Start Here

Reading Order

  1. Pick Plain GLua or Lux.
  2. Read Core Concepts before copying advanced effects.
  3. Use Effects for shadow, glow, backdrop, and patterns.
  4. Open the API Reference only when you need exact fields.

Scope

MGFX is a renderer, not a UI framework. It does not own layout, input, focus, component lifecycle, transition state, or hit testing. Callers compute the current visual state every frame and pass explicit draw arguments to the Plain GLua API table or mgfx.api.*.

Plain labels should usually use native GMod text or Text. Use TextEx only when you need shader text effects such as gradient faces, glow, stroke, or high-quality shadow.

Maintenance Rules

  • Public API changes must update Core Concepts and the matching API Reference task page.
  • User-facing examples should show GLua and Lux equivalents unless the page is explicitly runtime-specific.
  • Shader parameter layout, gradient LUT, alpha, or shaderpack changes must update Shaders and Packaging.
  • Runtime performance changes must update Performance Model.
  • Do not edit docs-site/ by hand. Update docs/ and rebuild the site.