code wiki / (root) / nx_skin_ita.nx

nx_skin_ita.nx

buildroot/runtime/nx_skin_ita.nx

11339 B249 linesdepth 2pulls 2 transitivereach 193 importersview sourcekind librarytopic skin
docsdependenciesstructsconstsfunctions

about

nx_skin_ita.nx -- SKIN ALBEDO DERIVED FROM THE GENOME, VIA A PUBLISHED STANDARD (charsim R0, debt 1786549493 residue a). LIB, no main (ecosystem convention). WHAT IT REPLACES AND WHY. nx_nxa_texbake_lib baked skin from TWELVE free sRGB constants (NTB_FACE_R=228, NTB_TORS_G=184, ...). Nothing derived them, nothing could falsify them, and every bred creature got the identical skin -- a fixed ramp wearing the shape of a material model. Rule 25 says build intelligence, never fewer options; rule 11 says a threshold nobody can point to a source for is a defect. This organ removes all twelve. THE STANDARD. Dermatology classifies constitutive skin colour by the INDIVIDUAL TYPOLOGY ANGLE (Chardon et al. 1991), defined in CIE L*a*b* as ITA = atan((L* - 50) / b*) in degrees, with six published categories separated at 55, 41, 28, 10 and -30 degrees. Those five boundaries are the ONLY classification numbers in this file, and each is stored as its TANGENT so the whole organ runs in integers with no trigonometry at all: comparing ITA against an angle is exactly comparing (L* - 50) / b* against that angle's tangent. WHAT IS DERIVED vs WHAT IS CHOSEN -- stated plainly, because a reader who cannot tell will trust the chosen ones as measured (the fabricated-constant class): DERIVED from the standard: the five class boundaries; the lightness endpoints of the locus, which fall out of the boundary tangents rather than being picked (see si_lstar_of_gene). CHOSEN, and this is a MODEL not a measurement: that skin lies on a straight locus of fixed a* and b* (literature-typical redness and yellowness), and the four per-region lightness offsets. They are expressed as offsets in L*, a perceptually uniform axis, so "slightly lighter" means the same thing everywhere -- which is precisely what twelve free sRGB numbers could not express. The IMPRECISION accepted: fixed-point, with the fifth root taken at 1e3 so one output step is under half an 8-bit code. Colour is exact to the byte after the final search. NO SECOND TRANSFER CURVE. si_srgb_of_lab finds the sRGB byte by searching the FORWARD IEC 61966-2-1 transfer, so this organ carries the generating function, not a rival copy of nx_eink_tone's baked table. The gate proves they agree on that organ's own banked anchor (sRGB 128 -> linear 21586 -> L* 53.59); consolidating both onto one shared lib is filed, not done here. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 1 imports · 38 importers

nx_syscalls.nx nx_skin_ita.nx nx_avatar_splat.nx nx_craft_before_placement_t316.nx nx_id_palette.nx nx_movement_base_engine_t139.nx nx_nxa_texbake_decode_t279.nx nx_nxa_texbake_lib.nx nx_nxa_texbake_region_capacity_t27 nx_nxa_texbake_region_edge_t278.nx nx_nxa_texbake_region_lib.nx nx_skin_ita_gate.nx

diagram shows first 10 each side; +0 more imports, +28 more importers in the complete lists below.

imports: nx_syscalls.nx

imported by: nx_avatar_splat.nxnx_craft_before_placement_t316.nxnx_id_palette.nxnx_movement_base_engine_t139.nxnx_nxa_texbake_decode_t279.nxnx_nxa_texbake_lib.nxnx_nxa_texbake_region_capacity_t278.nxnx_nxa_texbake_region_edge_t278.nxnx_nxa_texbake_region_lib.nxnx_skin_ita_gate.nxnx_skinsample_lib.nxnx_wasm_craft.nxnx_wasm_craft_body_t137.nxnx_wasm_craft_contact_candidate.nxnx_wasm_craft_dunes_t70.nxnx_wasm_craft_gait_candidate.nxnx_wasm_craft_gait_candidate_t139.nxnx_wasm_craft_imported_body_t41.nxnx_wasm_craft_imported_body_t42.nxnx_wasm_craft_imported_body_t49.nxnx_wasm_craft_imported_t262.nxnx_wasm_craft_inspection_bounds_t181.nxnx_wasm_craft_inspection_distance_t218.nxnx_wasm_craft_inspection_t142.nxnx_wasm_craft_journal_index_t21.nxnx_wasm_craft_journal_index_t21_before_t44.nxnx_wasm_craft_lookup_candidate.nxnx_wasm_craft_move_t72.nxnx_wasm_craft_pre_inspection_t142.nxnx_wasm_craft_recovery_t20.nxnx_wasm_craft_relief_adopt_t143.nxnx_wasm_craft_relief_save_t143.nxnx_wasm_craft_relief_t143.nxnx_wasm_craft_residency_t44.nxnx_wasm_craft_turn_candidate_t139.nxnx_wasm_craft_visitors_canonical_t142.nxnx_wasm_craft_visitors_inspection_t142.nxnx_wasm_craft_visitors_t140.nx

structs

none

consts

36const SI_E3: i64 = 1000 // milli-units: L*, a*, b*
37const SI_E4: i64 = 10000 // the f() domain in the L*a*b* transform
38const SI_E5: i64 = 100000 // linear light and XYZ, matching nx_eink_tone's 1e5 convention
39const SI_E7: i64 = 10000000
40const SI_E12: i64 = 1000000000000
44const SI_TAN_55: i64 = 1428
45const SI_TAN_41: i64 = 869
46const SI_TAN_28: i64 = 532
47const SI_TAN_10: i64 = 176
48const SI_TAN_N30: i64 = 0 - 577
53const SI_TAN_N55: i64 = 0 - 1428
54const SI_TAN_62: i64 = 1881
56const SI_C_VERYLIGHT: i64 = 0
57const SI_C_LIGHT: i64 = 1
58const SI_C_INTERMEDIATE: i64 = 2
59const SI_C_TAN: i64 = 3
60const SI_C_BROWN: i64 = 4
61const SI_C_DARK: i64 = 5
62const SI_NCLASS: i64 = 6
65const SI_A_STAR: i64 = 12000 // a* = 12.0, skin redness
66const SI_B_STAR: i64 = 13000 // b* = 13.0, skin yellowness (literature-typical band is ~10-22;
69const SI_L_PIVOT: i64 = 50000 // L* = 50, the pivot the ITA definition is written about
72const SI_DL_FACE: i64 = 1500 // face reads slightly lighter (perfusion, less exposure keratin)
73const SI_DL_TORSO: i64 = 0 // the reference region
74const SI_DL_LIMBS: i64 = 0 - 2000 // limbs read slightly darker
75const SI_DL_GENS: i64 = 0 - 1000
78const SI_GENE_MAX: i64 = 1000 // nx_breeding GN_T_HUE range is 0..1000
84const SI_MODEL_V: i64 = 1
87const SI_F_DELTA: i64 = 2069 // 6/29 x 1e4
88const SI_F_OFF: i64 = 1379 // 4/29 x 1e4
89const SI_F_LINK: i64 = 1284 // 3*(6/29)^2 x 1e4
90const SI_L_ADD: i64 = 16000 // the +16 of L* = 116 f(Y) - 16, x 1e3
91const SI_L_DIV: i64 = 116
92const SI_A_DIV: i64 = 50 // a*/500 expressed in the 1e4 f-domain
93const SI_B_DIV: i64 = 20 // b*/200 expressed in the 1e4 f-domain
95const SI_XN: i64 = 95047
96const SI_ZN: i64 = 108883
98const SI_M_RX: i64 = 32406
99const SI_M_RY: i64 = 0 - 15372
100const SI_M_RZ: i64 = 0 - 4986
101const SI_M_GX: i64 = 0 - 9689
102const SI_M_GY: i64 = 18758
103const SI_M_GZ: i64 = 415
104const SI_M_BX: i64 = 557
105const SI_M_BY: i64 = 0 - 2040
106const SI_M_BZ: i64 = 10570
108const SI_T_KNEE: i64 = 4045 // 0.04045
109const SI_T_SLOPE: i64 = 1292 // 12.92 x 100
110const SI_T_A: i64 = 5500 // 0.055 x 1e5
111const SI_T_S: i64 = 105500 // 1.055 x 1e5
112const SI_BYTE_MAX: i64 = 255

functions

116func si_root5_e3(x_e3: i64) -> i64
called by 1: si_linear_of_byte
133func si_cbrt_e5(x_e5: i64) -> i64
149func si_linear_of_byte(s: i64) -> i64
160func si_byte_of_linear(c_e5: i64) -> i64
179func si_finv_e5(t_e4: i64) -> i64
called by 1: si_srgb_of_lab
185func si_srgb_of_lab(l_e3: i64, a_e3: i64, b_e3: i64, out3: *i64) -> i64
202func si_lstar_of_byte(r: i64, g: i64, b: i64) -> i64
215func si_lstar_of_gene(hue: i64, region_dl: i64) -> i64
224func si_class_of_lstar(l_e3: i64) -> i64
called by 1: main
235func si_albedo_of_gene(hue: i64, region_dl: i64, out3: *i64) -> i64
241func si_model_version() -> i64 { return SI_MODEL_V }
called by 1: main
244func si_dl_of_region(reg: i64) -> i64