code wiki / (root) / nx_specular_falloff.nx

nx_specular_falloff.nx

buildroot/runtime/nx_specular_falloff.nx

4817 B144 linesdepth 5pulls 6 transitivereach 2 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_specular_falloff.nx -- measure highlight sharpness (broad=real skin, sharp=plastic). Real skin has wide soft specular highlights (Oren-Nayar / subsurface micro-roughness). Mannequin / plastic renders have narrow tight highlights (sharp Phong-like). The substrate measures the spatial FWHM (full width at half max) of the brightest pixel cluster within the skin mask. Math: 1. Find brightest pixel within skin mask. 2. Measure how many pixels around it have luminance >= half_max. 3. FWHM = sqrt(area_above_half_max). 4. Score Q10: broad FWHM = natural; narrow FWHM = plastic. Output flat-array: result[0] = peak_x result[1] = peak_y result[2] = peak_luminance result[3] = fwhm_pixels (sqrt of area where Y >= peak/2) result[4] = falloff_score_q10 (1024=very broad/natural; 0=very sharp/plastic) result[5] = verdict (0=PLASTIC, 1=AMBIGUOUS, 2=NATURAL)

dependencies 2 imports · 2 importers

nx_syscalls.nx nx_image.nx nx_specular_falloff.nx nx_mannequin_index.nx nx_mannequin_index_test.nx

imports: nx_syscalls.nxnx_image.nx

imported by: nx_mannequin_index.nxnx_mannequin_index_test.nx

structs

none

consts

32const NX_SPEC_RES_PEAK_X: i64 = 0
33const NX_SPEC_RES_PEAK_Y: i64 = 1
34const NX_SPEC_RES_PEAK_Y_LUM: i64 = 2
35const NX_SPEC_RES_FWHM: i64 = 3
36const NX_SPEC_RES_SCORE: i64 = 4
37const NX_SPEC_RES_VERDICT: i64 = 5
38const NX_SPEC_RES_FIELDS: i64 = 6
40const NX_SPEC_VERDICT_PLASTIC: i64 = 0
41const NX_SPEC_VERDICT_AMBIGUOUS: i64 = 1
42const NX_SPEC_VERDICT_NATURAL: i64 = 2
45const NX_SPEC_FWHM_PLASTIC_Q10: i64 = 20 // 0.02 of diag
46const NX_SPEC_FWHM_NATURAL_Q10: i64 = 40 // 0.04 of diag

functions

49func nx_spec_isqrt(x: i64) -> i64
called by 1: nx_specular_falloff
62func nx_specular_falloff(rgb: *Image, mask: *Image, result: *i64) -> i64
called by 1: main calls 2: nx_image_getnx_spec_isqrt