code wiki / (root) / nx_lighting_quality.nx

nx_lighting_quality.nx

buildroot/runtime/nx_lighting_quality.nx

9118 B223 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_lighting_quality.nx -- lighting composition grader. Per honest audit 2026-05-16: lighting quality was unmeasured. This primitive grades a scene's lighting setup on 5 axes adapted from cinematography conventions (three-point lighting + time-of-day appropriateness). AXES (Q14 [0, Q]; higher = better): 0. KEY_FILL_RATIO: key/fill light ratio. Target [2x, 4x] (the classic "1.5-stop key" cinematography rule); outside drops linearly. 1. RIM_PRESENCE: rim_intensity / key_intensity; target [0.3, 0.8]. Rim light separates subject from background. 2. SHADOW_DENSITY: 1 - (min_visible / max_visible) brightness range. Target [0.5, 0.85] (high contrast but not crushed blacks). 3. TIME_OF_DAY_APPROPRIATE: sun_zenith_q14 within reasonable bounds for the lighting setup. Penalty for "noon sun with deep shadows" contradictions. 4. COLOR_TEMPERATURE: warm/cool key vs fill complement (Q14 representation of K_key / K_fill ratio; target [0.9, 1.6] for natural daylight or [0.6, 1.0] for sunset). EMITS LAYER_VERDICT (kind = NX_LAYER_KIND_COLOR -- closest existing kind; lighting/color belong together). genealogy_id: lowell_2000_cinematography + nathan_1999_film_lighting + three_point_lighting_canon lineage_id: nx_lighting_quality_5axis_v1

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_tier.nx nx_layer_verdict.nx nx_lighting_quality.nx

imports: nx_syscalls.nxnx_tier.nxnx_layer_verdict.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap nx_lighting_quality_grade _lq_key_fill_q14 _lq_band_score _lq_rim_q14 _lq_band_score ↻ _lq_shadow_density_q14 _lq_band_score ↻ _lq_time_of_day_q14 _lq_color_temp_q14 _lq_band_score ↻ nx_layer_verdict_init nx_layer_verdict_finalize nx_layer_grade_from_axes nx_lv_axis_verdict

structs

none

consts

39const NX_MAGIC_5500: i64 = 5500
40const NX_MAGIC_5000: i64 = 5000
42const NX_LQ_Q: nx_int = 16384
44const NX_LQ_AXIS_KEY_FILL: nx_int = 0
45const NX_LQ_AXIS_RIM_PRESENCE: nx_int = 1
46const NX_LQ_AXIS_SHADOW_DENSITY: nx_int = 2
47const NX_LQ_AXIS_TIME_OF_DAY: nx_int = 3
48const NX_LQ_AXIS_COLOR_TEMP: nx_int = 4
49const NX_LQ_AXIS_COUNT: nx_int = 5
78const NX_LIGHTING_REC_STRIDE: nx_int = 8
79const NX_LIGHTING_OFF_KEY: nx_int = 0
80const NX_LIGHTING_OFF_FILL: nx_int = 1
81const NX_LIGHTING_OFF_RIM: nx_int = 2
82const NX_LIGHTING_OFF_AMBIENT: nx_int = 3
83const NX_LIGHTING_OFF_SUN_ZENITH: nx_int = 4
84const NX_LIGHTING_OFF_KEY_TEMP: nx_int = 5
85const NX_LIGHTING_OFF_FILL_TEMP: nx_int = 6

functions

51func _lq_band_score(val: nx_int, lo_q: nx_int, hi_q: nx_int) -> nx_int
88func _lq_key_fill_q14(rec: *i64) -> nx_int
97func _lq_rim_q14(rec: *i64) -> nx_int
106func _lq_shadow_density_q14(rec: *i64) -> nx_int
120func _lq_time_of_day_q14(rec: *i64) -> nx_int
137func _lq_color_temp_q14(rec: *i64) -> nx_int
152func nx_lighting_quality_grade(rec: *i64, out_verdict: *i64)
169func main() -> i64