code wiki / _hdl_build / nx_photoreal_human_census.nx

nx_photoreal_human_census.nx source

↩ module page · 80 lines · 5924 B

1// nx_photoreal_human_census.nx -- PHOTOREAL digital-human census (Elara tent-pole A). Decomposes the 2// make-a-human-read-as-real pipeline (capture/gen -> geometry/mesh -> skin -> eyes/hair -> render -> the 3// uncanny-valley FAILURE test) and grades OUR standing at done-fidelity, adversarial + liar-killed 4// ("our skin passes the indistinguishable test today" MUST grade GAP). Names the buildable-NOW first rung. 5// license_tier: ORIGINAL expect_exit: 0 6import "nx_syscalls.nx" 7 8func cw(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } 9func cn(v: i64) -> i64 { 10 let b: *u8 = sys_mmap(32) as *u8 11 var x: i64 = v 12 var i: i64 = 31 13 if x == 0 { b[i] = 48 as u8; i = i - 1 } 14 while x > 0 { b[i] = (48 + x % 10) as u8; x = x / 10; i = i - 1 } 15 sys_write(1, (b as i64 + i + 1) as *u8, 31 - i) 16 return 0 17} 18func gs(g: i64) -> *u8 { 19 if g == 2 { return "HAVE " as *u8 } 20 if g == 1 { return "PARTIAL" as *u8 } 21 return "GAP " as *u8 22} 23func row(t: *i64, cell: *u8, g: i64, ev: *u8) -> i64 { 24 cw(" ["); cw(gs(g)); cw("] "); cw(cell); cw("\n "); cw(ev); cw("\n" as *u8) 25 t[g] = t[g] + 1 26 return 0 27} 28 29func main() -> i64 { 30 let t: *i64 = sys_mmap(8 * 8) as *i64 31 cw("=== nx_photoreal_human_census -- our standing on the make-a-human-read-as-real pipeline (adversarial) ===\n" as *u8) 32 33 cw("-- CAPTURE / GENERATION --\n" as *u8) 34 row(t, "generate identity/face (2D) " as *u8, 1, "PARTIAL: image-gen pipeline (Z-Image) exists; a controllable PHOTOREAL identity/face gen at done-fidelity unproven" as *u8) 35 row(t, "generation/scan -> 3D geometry " as *u8, 0, "GAP: no photogrammetry/scan or gen-to-3D. The 2D->3D bridge (pr_photogrammetry/pr_3dscan) is missing" as *u8) 36 37 cw("-- GEOMETRY (the PERFECT MESH pillar) --\n" as *u8) 38 row(t, "clean riggable mesh (quad topo) " as *u8, 0, "GAP: we render SDF/ellipsoid fields + nx_subdiv, NOT a clean-topology quad mesh you can rig/animate/UV" as *u8) 39 row(t, "morphable / blendshape params " as *u8, 1, "PARTIAL: nx_morph (NXM1) morph targets exist (pr_blendshape model); not a full parametric face/body basis" as *u8) 40 row(t, "skeletal rig + skinning " as *u8, 1, "PARTIAL: nx_skeleton + nx_ik + nx_bodybind gated (bones drive flesh); simple vs film rigs" as *u8) 41 row(t, "UV mapping " as *u8, 0, "GAP: no UV unwrap -> can't sample texture maps on skin (pr_uv)" as *u8) 42 43 cw("-- SKIN (what makes flesh read as flesh) --\n" as *u8) 44 row(t, "subsurface scattering (real) " as *u8, 0, "GAP: only a cheap terminator-warmth approx; SOTA = diffusion-profile/separable SSS (pr_sss). THE #1 skin gap" as *u8) 45 row(t, "PBR BRDF (GGX spec + roughness) " as *u8, 0, "GAP: ad-hoc Blinn, not energy-conserving GGX/Cook-Torrance dual-lobe skin spec (pr_brdf/pr_pbr)" as *u8) 46 row(t, "albedo/normal/displacement MAPS " as *u8, 0, "GAP: procedural bump only; no scanned texture maps (needs UV). (nx_swgpu HAS a raster tex path, unwired for skin)" as *u8) 47 row(t, "pore / wrinkle micro-detail " as *u8, 1, "PARTIAL: nx_subdiv has position-hashed DISPLACEMENT fields + our procedural bump; not pore-accurate, unwired to skin" as *u8) 48 49 cw("-- EYES + HAIR (the uncanny-valley KILLERS) --\n" as *u8) 50 row(t, "eyes (sclera/iris/cornea/wetness) " as *u8, 0, "GAP: no eye model. Eyes are the FIRST thing that reads fake (pr_uncanny)" as *u8) 51 row(t, "hair (strand sim + render) " as *u8, 0, "GAP: no hair. Real hair = strands + anisotropic shading + sim" as *u8) 52 53 cw("-- RENDER + FAILURE TEST --\n" as *u8) 54 row(t, "our renderer (raster+raymarch) " as *u8, 2, "HAVE: nx_swgpu + nx_sdfrender w/ soft shadows + AO + specular, integer/deterministic, our codec" as *u8) 55 row(t, "anti-aliasing " as *u8, 2, "HAVE: 2x2 supersampled SDF (smooth edges), gated" as *u8) 56 row(t, "uncanny-valley / indistinguishable " as *u8, 0, "GAP: no close-up face test that measures 'reads as human'. This gate IS the definition-of-done for photoreal (pr_uncanny)" as *u8) 57 58 // liar-kill 59 let pre: i64 = t[2] 60 row(t, "our skin passes indistinguishable NOW" as *u8, 0, "we render a smooth stylized body -- NOT scanned skin, NO eyes/hair, NO real SSS. If this grades HAVE the census lies" as *u8) 61 var liar_ok: i64 = 0 62 if t[2] == pre { liar_ok = 1 } 63 64 let cells: i64 = t[0] + t[1] + t[2] 65 let score: i64 = (t[2] * 2 + t[1]) * 500 / cells 66 cw("--- TALLY --- HAVE " as *u8); cn(t[2]); cw(" PARTIAL " as *u8); cn(t[1]); cw(" GAP " as *u8); cn(t[0]) 67 cw(" cells " as *u8); cn(cells); cw(" score " as *u8); cn(score); cw("permille liar-kill=" as *u8) 68 if liar_ok == 1 { cw("YES\n" as *u8) } else { cw("NO -- INVALID\n" as *u8) } 69 cw("VERDICT (honest): our RENDER PLUMBING is strong (renderer+AA+shadows+AO+codec = HAVE) but every\n" as *u8) 70 cw(" PHOTOREAL-specific axis (real SSS, PBR, texture maps, eyes, hair, clean mesh, UV) is GAP/PARTIAL.\n" as *u8) 71 cw(" Photoreal is FAR -- but the biggest wins are buildable on our CURRENT renderer WITHOUT UV meshes.\n" as *u8) 72 cw("LADDER (each its own gate; ordered by realism-per-effort ON OUR SDF, no mesh-fit needed yet):\n" as *u8) 73 cw(" R1 SKIN SHADER v2: SDF-THICKNESS subsurface (march to estimate translucency) + dual-lobe GGX spec +\n" as *u8) 74 cw(" procedural pore displacement -> 'flesh reads as flesh' (biggest win, buildable now) ->\n" as *u8) 75 cw(" R2 EYES (sclera/iris/cornea/wet spec) on a head close-up -> R3 the UNCANNY/indistinguishable face gate\n" as *u8) 76 cw(" (the done-test) -> R4 HAIR (strand cards) -> THEN the mesh arc: R5 gen->3D + retopo + UV (pillar 2) ->\n" as *u8) 77 cw(" R6 scanned texture-map skin (albedo/normal/displacement) on the UV'd mesh = film-grade.\n" as *u8) 78 if liar_ok == 1 { return 0 } 79 return 1 80}