nx_specular_falloff.nx
buildroot/runtime/nx_specular_falloff.nx
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
imports: nx_syscalls.nxnx_image.nx
imported by: nx_mannequin_index.nxnx_mannequin_index_test.nx
structs
| none |
consts
| 32 | const NX_SPEC_RES_PEAK_X: i64 = 0 |
| 33 | const NX_SPEC_RES_PEAK_Y: i64 = 1 |
| 34 | const NX_SPEC_RES_PEAK_Y_LUM: i64 = 2 |
| 35 | const NX_SPEC_RES_FWHM: i64 = 3 |
| 36 | const NX_SPEC_RES_SCORE: i64 = 4 |
| 37 | const NX_SPEC_RES_VERDICT: i64 = 5 |
| 38 | const NX_SPEC_RES_FIELDS: i64 = 6 |
| 40 | const NX_SPEC_VERDICT_PLASTIC: i64 = 0 |
| 41 | const NX_SPEC_VERDICT_AMBIGUOUS: i64 = 1 |
| 42 | const NX_SPEC_VERDICT_NATURAL: i64 = 2 |
| 45 | const NX_SPEC_FWHM_PLASTIC_Q10: i64 = 20 // 0.02 of diag |
| 46 | const NX_SPEC_FWHM_NATURAL_Q10: i64 = 40 // 0.04 of diag |
functions
| 49 | func nx_spec_isqrt(x: i64) -> i64 called by 1: nx_specular_falloff |
| 62 | func nx_specular_falloff(rgb: *Image, mask: *Image, result: *i64) -> i64 |