code wiki / (root) / nx_nxa_groom.nx

nx_nxa_groom.nx

buildroot/runtime/nx_nxa_groom.nx

29067 B619 linesdepth 2pulls 3 transitivereach 0 importersview sourcekind tooltopic nxa
docsdependenciesstructsconstsfunctions

about

nx_nxa_groom.nx -- GENERATE THE GROOM: full-scalp procedural hair strands written into the asset's HSTR section, replacing the sampled partial cap that left the back of the head bare (operator-reported 2026-08-26: "the back of the head is shaved"). INFINIGEN-2 PRINCIPLE, APPLIED (operator standing order: those principles for everything): hair is GENERATED from parameters and the mesh's own measured geometry -- no groom asset, no donor, no hand-placed strand. The industry's own groom pipelines (XGen, Ornatrix, Houdini) are procedural for the same reason: a scalp map plus guide growth beats any sampled cap. METHOD (every number derived or parameterized, never tasted): 1. Axes derived from vertex extents (the nx_nxa_dyna derivation, same tree of assumptions). 2. HEAD TOP = highest vertex; HEAD CENTER = centroid of verts in the top head band (the band spans from crown down by a face-height fraction derived from stature). 3. ROOTS: every scalp vertex above the EAR LINE (head centre height) whose radial direction is not into the face cone, deterministically thinned to <= GRO_MAX_STRANDS with a seeded hash (Infinigen principle: seeded, reproducible diversity). 4. GROWTH: 8 points per strand (the HSTR contract, NXHCH_W=24 words). Point i steps seg_len along a direction that starts RADIAL (off the scalp) and blends toward GRAVITY (down the stature axis) as the strand extends -- long hair hangs, crown hair lifts then falls, back hair drapes the nape. Length = stature * length_permil / 1000. 5. Writes HSTR via the proven section-replace machinery (nx_nxa_dyna pattern): input never modified, an existing HSTR is REPLACED, re-runs identical. usage: nx_nxa_groom <in.nxa> <out.nxa> [length_permil=280] [strands=1400] [seed=7] exit 0 OK | 2 usage | 3 bad-nxa | 1 io license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_nxa.nx nx_nxa_groom.nx

imports: nx_syscalls.nxnx_nxa.nx

imported by: nobody (leaf or entry point)

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

main gr_err sys_write gr_slen sys_exit gr_atoi sys_mmap nxa_die sys_write ↻ sys_exit ↻ nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close gr_rd64 nxa_magic gr_tageq gr_out sys_write ↻ gr_slen ↻ gr_num sys_write ↻ sys_mmap ↻ gr_isqrt gr_hash gr_wr64

structs

none

consts

30const GR_HDR: i64 = 32
31const GR_TOCE: i64 = 32
32const GR_MAXSEC: i64 = 64
33const GR_MODE: i64 = 0x1a4
34const GR_PTS: i64 = 8 // points per strand == NXHCH_N(7 segments) + 1: the page contract
35const GR_WORDS: i64 = 24 // GR_PTS * 3 coords == NXHCH_W: the page contract
36const GR_DEF_LEN_PERMIL: i64 = 150 // default hair length as permil of stature: mid-back on a
39const GR_DEF_STRANDS: i64 = 4800 // lock granularity for digital-twin density: ~25 follicles per lock against the ~120k human scalp (follicle-count citation to mirror; the RATIO is the parameter) // page samples down to its 900 guides (step floor), so anything
41const GR_DEF_SEED: i64 = 7
45const GR_HEADBAND_PERMIL: i64 = 60
48const GR_FACE_PERMIL: i64 = 350
52const GR_SWEEP_Q10: i64 = 700
55const GR_GRAVITY_RAMP_Q10: i64 = 520
59const GR_NAPE_PERMIL: i64 = 45
61const GR_LAYER_Q10: i64 = 300
64const GR_WAVE_STEP_Q10: i64 = 640
65const GR_WAVE_AMP_PERMIL: i64 = 80
66const GR_Q10: i64 = 1024
72const GR_COMB_BACK_Q10: i64 = 358
73const GR_COMB_LIFT_Q10: i64 = 154
74const GR_SYN_SALT_A: i64 = 77
75const GR_SYN_SALT_B: i64 = 177
76const GR_SYN_SALT_M: i64 = 277

functions

78func gr_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 2: gr_errgr_out
79func gr_err(s: *u8) -> i64 { sys_write(2, s, gr_slen(s)); return 0 }
called by 1: main calls 2: sys_writegr_slen
80func gr_out(s: *u8) -> i64 { sys_write(1, s, gr_slen(s)); return 0 }
called by 1: main calls 2: sys_writegr_slen
81func gr_num(v: i64) -> i64
called by 1: main calls 2: sys_writesys_mmap
94func gr_rd64(b: *u8, off: i64) -> i64
called by 1: main
100func gr_wr64(b: *u8, off: i64, v: i64) -> i64
called by 1: main
106func gr_tageq(b: *u8, off: i64, t: *u8) -> i64
called by 1: main
111func gr_isqrt(n: i64) -> i64
called by 1: main
118func gr_atoi(s: *u8) -> i64
called by 1: main
125func gr_hash(a: i64, b: i64) -> i64
called by 1: main
133func main(argc: i64, argv: *i64) -> i64