HammeriteShaderGlobals
Core: lighting. Inherits RefCounted
The global shader uniforms Hammerite's materials read. Enabling the plugin declares any the project has not (see the core README); a material reading one that is not declared fails to compile.
Prefixed because shader globals are project-wide, like a class_name: an unprefixed exposure would be the host's own exposure as well. A game sets two of them: AMBIENT_LIGHT, and EXPOSURE unless a HammeriteEyeAdaptation3D drives it. HammeriteLightCurve publishes the light-curve ones. The rest, from SHOW_GRID on, are the editor's view state, and a game only declares them.
Methods
| Returns | Method |
|---|---|
PackedStringArray | declare_missing() static |
PackedStringArray | undeclared() static |
Constants
EXPOSURE
const EXPOSURE = &"hammerite_exposure"
Float multiplier on the final lit colour. HammeriteEyeAdaptation3D drives it every frame.
AMBIENT_LIGHT
const AMBIENT_LIGHT = &"hammerite_ambient_light"
Vec4 whose RGB is the floor of light every lit surface gets - brushes, props, decals, water - added before the light curve: the ambient knob. Nothing in Hammerite sets it, so until a game does, every surface has the default 0.1.
LIGHT_CURVE
const LIGHT_CURVE = &"hammerite_light_curve"
Sampler2D lookup of the light curve; published by HammeriteLightCurve.publish().
LIGHT_CURVE_ENABLED
const LIGHT_CURVE_ENABLED = &"hammerite_light_curve_enabled"
Bool, whether the shaders apply the light curve at all; published by HammeriteLightCurve.
LIGHT_CURVE_LIT_SURFACE_LEVEL
const LIGHT_CURVE_LIT_SURFACE_LEVEL = &"hammerite_light_curve_lit_surface_level"
Float, HammeriteLightCurve.lit_surface_level as published.
LIGHT_CURVE_LIFT
const LIGHT_CURVE_LIFT = &"hammerite_light_curve_lift"
Float, how much of the shadow lift is in effect; published by HammeriteLightCurve.
LIGHT_CURVE_LIFT_TINT
const LIGHT_CURVE_LIFT_TINT = &"hammerite_light_curve_lift_tint"
Vec4, HammeriteLightCurve.lift_tint as published.
SHOW_GRID
const SHOW_GRID = &"hammerite_show_grid"
Bool, whether brush materials draw the editor grid over surfaces. The editor sets it.
GRID_SCALE
const GRID_SCALE = &"hammerite_grid_scale"
Float, the editor grid's spacing in map units. The editor sets it.
VIS_UNLIT
const VIS_UNLIT = &"hammerite_vis_unlit"
Bool, editor visualisation: surfaces drawn with their textures and no lighting.
VIS_LIGHTMAP
const VIS_LIGHTMAP = &"hammerite_vis_lightmap"
Bool, editor visualisation: the lightmap's light alone, with no surface colour or exposure.
VIS_LIGHTMAP_DENSITY
const VIS_LIGHTMAP_DENSITY = &"hammerite_vis_lightmap_scale"
Bool, editor visualisation: a grid showing each surface's lightmap texel density. The uniform keeps the name it had as VIS_LIGHTMAP_SCALE, so a project that declared it need not again.
VIS_CAUSTICS
const VIS_CAUSTICS = &"hammerite_vis_caustics"
Bool, editor visualisation: the baked caustics and the water they came through.
SELECTION_XRAY
const SELECTION_XRAY = &"hammerite_selection_xray"
Bool, whether the editor's selection outline is drawn through occluding geometry.
ALL
const ALL = Dictionary[StringName, int]({&"hammerite_ambient_light": 16, &"hammerite_exposure": 13, &"hammerite_grid_scale": 13, &"hammerite_light_curve": 24, &"hammerite_light_curve_enabled": 0, &"hammerite_light_curve_lift": 13, &"hammerite_light_curve_lift_tint": 16, &"hammerite_light_curve_lit_surface_level": 13, &"hammerite_selection_xray": 0, &"hammerite_show_grid": 0, &"hammerite_vis_caustics": 0, &"hammerite_vis_lightmap": 0, &"hammerite_vis_lightmap_scale": 0, &"hammerite_vis_unlit": 0})
Every one of them, as name -> RenderingServer.GlobalShaderParameterType.
DEFAULTS
const DEFAULTS = Dictionary[StringName, Variant]({&"hammerite_ambient_light": Vector4(0.1, 0.1, 0.1, 0.1), &"hammerite_exposure": 1.0, &"hammerite_grid_scale": 64.0, &"hammerite_light_curve": "", &"hammerite_light_curve_enabled": false, &"hammerite_light_curve_lift": 0.0, &"hammerite_light_curve_lift_tint": Vector4(1, 1, 1, 0), &"hammerite_light_curve_lit_surface_level": 0.3, &"hammerite_selection_xray": false, &"hammerite_show_grid": false, &"hammerite_vis_caustics": false, &"hammerite_vis_lightmap": false, &"hammerite_vis_lightmap_scale": false, &"hammerite_vis_unlit": false})
What declare_missing() gives each one. A project's own declaration is never overwritten.
Method descriptions
declare_missing()
static func declare_missing() -> PackedStringArray
Declare in Project Settings each of ALL the project has not, with its DEFAULTS value, and in the running renderer too so materials compile without a restart. Returns the names it declared; saving the settings is the caller's.
undeclared()
static func undeclared() -> PackedStringArray
Which of ALL this project has not declared.