nx_meshtex.nx
buildroot/runtime/nx_meshtex.nx
about
nx_meshtex.nx -- R4: TEXTURED emitted-mesh renderer. Two fidelity moves the critic's pinned axes need:
(1) EXACT normals -- an SDF-derived mesh's true outward normal is the FIELD GRADIENT (central differences on
sdf_eval), smooth + consistent, unlike winding-dependent face normals (kills the patchy Gouraud);
(2) per-PIXEL procedural SKIN -- pore micro-bump (high-freq) + tone MOTTLE (low-freq), keyed on the fixed
MODEL position (rotation-invariant -> detail sticks to the surface). Per-pixel shading in fx256 (like
nx_swgpu, deterministic). Composes sdf_eval + it_sin4096; own raster loop. NOTE: SDF-gradient normals
need the analytic field (t2mesh objects have it); i2mesh (image-inflation) meshes would use an F-grid
gradient -- a later unify, disclosed. license_tier: ORIGINAL
dependencies 3 imports · 1 importers
imports: nx_syscalls.nxnx_itrig.nxnx_sdfrender.nx
imported by: nx_genloop_gate.nx
structs
| none |
consts
| 12 | const MT_MAGIC_65536: i64 = 65536 |
| 13 | const MT_MAGIC_1024: i64 = 1024 |
| 14 | const MT_MAGIC_4096: i64 = 4096 |
| 15 | const MT_MAGIC_92821: i64 = 92821 |
| 16 | const MT_MAGIC_68917: i64 = 68917 |
| 17 | const MT_MAGIC_40503: i64 = 40503 |
| 19 | const MT_ZFAR: i64 = 1073741824 |
functions
| 21 | func mt_isqrt(v: i64) -> i64 { if v <= 0 { return 0 } var x: i64 = v; var y: i64 = (x + 1) / 2; while y < x { x = y; y = (x + v / x) / 2 } return x } |
| 22 | func mt_min(a: i64, b: i64) -> i64 { if a < b { return a } return b } called by 1: mt_render |
| 23 | func mt_max(a: i64, b: i64) -> i64 { if a > b { return a } return b } called by 1: mt_render |
| 26 | func mt_sdf_normals(base: i64, vb: *i64, nv: i64, nbuf: *i64) -> i64 |
| 46 | func mt_render(vb: *i64, tb: *i64, nbuf: *i64, nv: i64, nf: i64, fb: *i64, zb: *i64, w: i64, h: i64, yaw: i64, camu: i64, focal: i64, skin_r: i64, skin_g: i64, scratch: *i64) -> i64 |