xhookLua
Game

gfx

Post-process, weather, screen flash and custom GLSL passes; unload or gfx.reset restores changes.

Functions

gfx.set

gfx.set(name, value)
NameTypeDescription
namestringName from the list below.
valueboolean | numberBooleans become 1/0; integers truncate.

Sets a post-process or weather parameter.

  • Unknown names raise an error; values are not clamped.
  • Grade params need "grade" on; bloom_*, dof, motionblur, godrays need their toggle.

gfx.get

gfx.get(name) -> boolean | number
NameTypeDescription
namestringName from the list below.

Current value, set by menu or script.

Returns Boolean for on/off, else number

Unknown names raise an error.

gfx.reset

gfx.reset()

Restores this script's parameters and removes its shaders.

gfx.flash

gfx.flash([r=255, g=255, b=255 [, strength=0.6]])
NameTypeDescription
roptionalnumber0 to 255. Default 255.
goptionalnumber0 to 255. Default 255.
boptionalnumber0 to 255. Default 255.
strengthoptionalnumberRoughly 0 to 1. Default 0.6.

Fires the edgebug flash: vignette, shockwave ring, chromatic pulse.

OpenGL post-process pipeline only.

gfx.shader

gfx.shader(source | nil)
NameTypeDescription
sourcestring | nilGLSL 1.20 fragment shader; nil removes.

Sets the final post-process pass shader; last caller across scripts wins.

  • Declare u_tex, u_resolution, u_time yourself; sample u_tex at gl_TexCoord[0].xy.
  • Compile errors raise nothing and keep the last working shader.

gfx.uniform

gfx.uniform(name, a [, b [, c]])
NameTypeDescription
namestringUniform declared in gfx.shader.
anumber
boptionalnumberMakes a vec2.
coptionalnumberMakes a vec3.

Sets a gfx.shader uniform; values persist every frame.

  • Raises an error with no numbers.
  • Undeclared names are ignored.

gfx.world_shader

gfx.world_shader(source | nil)
NameTypeDescription
sourcestring | nilGLSL 1.20 source; nil removes it.

Adds your xs_world function as the last per-pixel world shading step.

  • Signature: vec3 xs_world(vec3 col, vec3 albedo, vec3 light, vec3 wpos, vec3 normal, vec2 uv).
  • Needs the replacement world renderer; compile errors raise nothing.

gfx.world_uniform

gfx.world_uniform(name, a [, b [, c]])
NameTypeDescription
namestringUniform declared in world_shader.
anumber
boptionalnumberMakes a vec2.
coptionalnumberMakes a vec3.

Sets a gfx.world_shader uniform.

Raises an error with no numbers.

Constants

NameValueDescription
bloomon/offBloom glow.
bloom_intensitynumberGlow strength, menu 0 to 3.
bloom_thresholdnumberGlow cutoff, lower glows more, 0 to 1.
dofon/offDepth of field.
dof_strengthnumberMax blur, menu 0 to 1.
motionbluron/off
motionblur_amountnumberSmear length, menu 0 to 1.
ssaoon/offScreen-space ambient occlusion.
ssron/offScreen-space reflections.
godrayson/offSun shafts.
godrays_intensitynumberMenu 0 to 2.
fxaaon/offAnti-aliasing.
fogon/offPost-process fog.
outlineon/offEdge outline pass.
gradeon/offMaster switch for grade parameters.
tonemapon/offTone mapping (grade).
exposurenumberGrade, menu 0 to 2.
contrastnumberGrade, menu 0.5 to 1.5.
saturationnumberGrade, menu 0 to 2.
temperaturenumberGrade, -1 cool to 1 warm.
vignettenumberGrade, menu 0 to 1.
chromaticnumberChromatic aberration, grade, 0 to 1.
grainnumberFilm grain, grade, 0 to 1.
sharpennumberGrade, menu 0 to 1.
weather_radiusintegerWeather particle spawn radius around player.
windnumberWeather wind speed.
fallspeednumberWeather particle fall speed.
rainon/off
rain_densitynumber
rain_styleinteger0 classic, 1 enhanced streaks.
rain_soundon/offRain ambient sound.
rain_volumenumberRain sound volume.
rain_thunderon/offThunder in the rain ambience.
snowon/off
snow_densitynumber
snow_flake_sizeinteger
snow_flake_lifenumberSeconds before a flake fades.
snow_soundon/offSnow ambient sound.
snow_volumenumberSnow sound volume.
ground_fogon/off
ground_fog_densityinteger
ground_fog_sizenumberFog puff size.
world_fogon/offGlobal world fog.
world_fog_modeinteger0 exp, 1 exp2, 2 linear.
world_fog_startnumberLinear fog start distance, units.
world_fog_endnumberLinear fog end distance, units.
world_fog_densitynumberDensity for exp and exp2 modes.
gfx ยท Lua API ยท xhook