nx_nxa_texbake_lib.nx
buildroot/runtime/nx_nxa_texbake_lib.nx
about
nx_nxa_texbake_lib.nx -- ★TEXTURE LADDER rungs 2b+3+4 (debt 1786546859, successor of the TEXC format rung):
(2b) REGION GROUPING: every joint classified Face|Torso|Limbs|Gens from its OWN bind anatomy (permil of
the vertex z-span + laterality -- the same normalization basis nx_nxa_dyna uses, joint ladder is
shorter than the mesh so the VERTEX span is the ruler).
(3) ALBEDO BAKE: fills the TEXC atlas (grid g read FROM the TEXC section -- the wire format is the SSOT,
two copies of one capacity are two capacities) with per-region skin albedo + a WHISPER of fine grain.
Real skin is EVEN -- the coarse-blotch regression is banked (HONEST_vs_REAL_PEOPLE); grain is +-3.
(4) SAMPLER VIEW: binds the baked atlas to the trimesh renderer's EXISTING per-fragment image-texture
path (tm_set_image + tm_vuv + smooth=2 -- it was already there; this wires TEXC into it) and renders
a lit, z-buffered, textured turntable of the asset. check-before-build: NO new rasterizer.
Output atlas format == TM_IMG contract: res*res*3 u8 RGB row-major.
FAIL-CLOSED: no TEXC -> refuse (run nx_nxa_texc first); counts mismatch -> refuse. Deterministic by seed.
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 8 imports · 13 importers
diagram shows first 10 each side; +0 more imports, +3 more importers in the complete lists below.
imports: nx_syscalls.nxnx_nxa.nxnx_nxa_texc_lib.nxnx_trimesh.nxnx_png.nxnx_skin_ita.nxnx_relief_lib.nxnx_normal_encoding_contract.nx
imported by: nx_char_asset.nxnx_char_asset_material_candidate_t340.nxnx_gltf_skin_recipe_candidate_t340.nxnx_normal_decode_candidate_t279.nxnx_normal_decode_gate_t279.nxnx_nxa_texbake.nxnx_nxa_texbake_gate.nxnx_nxa_texbake_region_capacity_t278.nxnx_nxa_texbake_region_edge_t278.nxnx_nxa_texbake_region_lib.nxnx_nxa_texm.nxnx_sdfrender_sss_gate.nxnx_skin_pbr_gate.nx
structs
| none |
consts
| 21 | const NTB_MAGIC_4096: i64 = 4096 |
| 22 | const NTB_MAGIC_4095: i64 = 4095 |
| 23 | const NTB_MAGIC_65536: i64 = 65536 |
| 24 | const NTB_MAGIC_1400: i64 = 1400 |
| 25 | const NTB_MAGIC_3200: i64 = 3200 |
| 26 | const NTB_MAGIC_5600: i64 = 5600 |
| 27 | const NTB_MAGIC_2600: i64 = 2600 |
| 30 | const NTB_FACE: i64 = 0 |
| 31 | const NTB_TORSO: i64 = 1 |
| 32 | const NTB_LIMBS: i64 = 2 |
| 33 | const NTB_GENS: i64 = 3 |
| 35 | const NTB_FACE_PERMIL: i64 = 860 |
| 36 | const NTB_GENS_LO: i64 = 540 |
| 37 | const NTB_GENS_HI: i64 = 620 |
| 38 | const NTB_LAT_DIV: i64 = 12 |
| 39 | const NTB_MID_DIV: i64 = 40 |
| 40 | const NTB_LEG_PERMIL: i64 = 500 |
| 46 | const NTB_DEFAULT_HUE: i64 = 500 // the genome midpoint, used only when a caller supplies no genome |
| 48 | const NTB_VOID_R: i64 = 118 |
| 49 | const NTB_VOID_G: i64 = 118 |
| 50 | const NTB_VOID_B: i64 = 124 |
| 52 | const NTB_HASH_A: i64 = 374761393 |
| 53 | const NTB_HASH_B: i64 = 668265263 |
| 54 | const NTB_HASH_C: i64 = 1274126177 |
| 56 | const NTB_W: i64 = 300 |
| 57 | const NTB_H: i64 = 460 |
| 58 | const NTB_BG: i64 = 24 + 26*256 + 34*65536 |
| 59 | const NTB_FLESH: i64 = 222 + 184*256 + 158*65536 |
| 60 | const NTB_MODEL_H: i64 = 1900 |
| 62 | const NTB_E_BAD: i64 = 3 |
| 63 | const NTB_E_NOSEC: i64 = 4 |
| 64 | const NTB_E_MISMATCH: i64 = 5 |
| 224 | const NTB_MAP_ALBEDO: i64 = 0 |
| 225 | const NTB_MAP_SPEC: i64 = 1 |
| 226 | const NTB_MAP_GLOSS: i64 = 2 |
| 227 | const NTB_MAP_NORMAL: i64 = 3 |
| 228 | const NTB_NMAP: i64 = 4 |
| 232 | const NTB_IOR_SKIN: i64 = 1400 // x1000 |
| 233 | const NTB_ONE: i64 = 1000 |
| 236 | const NTB_ROUGH_BASE: i64 = 500 |
| 237 | const NTB_ROUGH_FACE: i64 = 0 - 80 |
| 238 | const NTB_ROUGH_TORSO: i64 = 0 |
| 239 | const NTB_ROUGH_LIMBS: i64 = 60 |
| 240 | const NTB_ROUGH_GENS: i64 = 20 |
functions
| 67 | func ntb_idx3(a: i64, b: i64, c: i64, nv: i64) -> i64 |
| 84 | func ntb_axspan(w: *i64, vwo: i64, nv: i64, ax: i64) -> i64 |
| 96 | func ntb_up_axis(w: *i64, vwo: i64, nv: i64) -> i64 |
| 103 | func ntb_region(permil: i64, absx: i64, spanz: i64) -> i64 called by 1: ntb_regions |
| 113 | func ntb_regions(b: *u8, flen: i64, regout: *i64, permout: *i64) -> i64 |
| 151 | func ntb_albedo_genome(hue: i64, reg: i64, out3: *i64) -> i64 |
| 157 | func ntb_bake_gene(b: *u8, flen: i64, res: i64, seed: i64, hue: i64, out: *u8) -> i64 called by 2: ntb_bake_pbrntb_bake calls 7: nxa_findnxa_tag4nt_errsys_mmapntb_regionsntb_albedo_genome+1 |
| 252 | func ntb_f0_skin() -> i64 |
| 258 | func ntb_rough_of_region(reg: i64) -> i64 |
| 267 | func ntb_texel_um(res: i64) -> i64 { return rlf_texel_um(res) } calls 1: rlf_texel_um |
| 268 | func ntb_relief_h(x: i64, y: i64, res: i64, seed: i64) -> i64 { return rlf_relief_h(x, y, res, seed) } |
| 277 | func ntb_encode_normal_um(dzx_um: i64, dzy_um: i64, run_um: i64, out3: *i64) -> i64 called by 7: ntb_encode_normalntr_bake_tilentr_runntr_normal_chartntr_bake_tilentr_normal_chart+1 calls 1: tm_isqrt |
| 288 | func ntb_encode_normal(dhx: i64, dhy: i64, res: i64, out3: *i64) -> i64 |
| 292 | func ntb_normal_at(x: i64, y: i64, res: i64, seed: i64, out3: *i64) -> i64 |
| 300 | func ntb_fill_row(hb: *i64, base: i64, y: i64, res: i64, seed: i64) -> i64 |
| 308 | func ntb_bake_pbr(b: *u8, flen: i64, res: i64, seed: i64, hue: i64, map_id: i64, out: *u8) -> i64 |
| 415 | func ntb_bake(b: *u8, flen: i64, res: i64, seed: i64, out: *u8) -> i64 |
| 420 | func ntb_write_atlas_png(atlas: *u8, res: i64, path: *u8) -> i64 |
| 433 | func ntb_view(b: *u8, flen: i64, res: i64, seed: i64, outpng: *u8) -> i64 |