nx_sdfrender.nx
buildroot/runtime/nx_sdfrender.nx
about
dependencies 4 imports · 63 importers
diagram shows first 10 each side; +0 more imports, +53 more importers in the complete lists below.
imports: nx_syscalls.nxnx_itrig.nxnx_vecmath.nxnx_relief_lib.nx
imported by: nx_assetvariant.nxnx_assetvariant_gate.nxnx_autorig.nxnx_autorig_gate.nxnx_body_figure.nxnx_body_figure_gate.nxnx_bodypose.nxnx_char_asset.nxnx_char_asset_material_candidate_t340.nxnx_char_custom_gate.nxnx_char_layers.nxnx_char_layers_gate.nxnx_creature_motion.nxnx_creature_motion_gate.nxnx_critic_kernel.nxnx_critic_visual.nxnx_face_carve_gate.nxnx_face_feature_diag_t367.nxnx_face_feature_diag_t368.nxnx_face_feature_gate_t367.nxnx_face_feature_gate_t367r1.nxnx_face_feature_gate_t367r2.nxnx_face_feature_gate_t367r3.nxnx_face_feature_gate_t367r4.nxnx_face_feature_gate_t367r5.nxnx_face_r2.nxnx_face_vs_target.nxnx_faceanat.nxnx_gen_content.nxnx_gen_orchestrator.nxnx_gen_unified.nxnx_genloop_gate.nxnx_gltf_export_gate.nxnx_i2mesh_gate.nxnx_makeup.nxnx_makeup_gate.nxnx_meshgen.nxnx_meshgen_cell_audit_t337.nxnx_meshgen_connected_audit_t335.nxnx_meshgen_connected_locations_t335.nxnx_meshgen_domain_candidate_t337.nxnx_meshgen_domain_gate_t337.nxnx_meshgen_domain_locations_t337.nxnx_meshgen_gate.nxnx_meshgen_orientation_candidate_t336.nxnx_meshgen_orientation_gate_t336.nxnx_meshtex.nxnx_motion_photo_gate.nxnx_natstat_optimize.nxnx_obj_export_gate.nxnx_outfit.nxnx_outfit_gate.nxnx_person_face_gate.nxnx_photoreal_critic.nxnx_recombine_novelty_gate.nxnx_render_amp_compare.nxnx_sdf_attribution_gate_t344.nxnx_sdfrender_gate.nxnx_sdfrender_mt.nxnx_sdfrender_sss_gate.nxnx_t2mesh.nxnx_t2mesh_gate.nxnx_variant_mesh_gate.nx
structs
| none |
consts
| 11 | const PARTS_MAGIC_1206: i64 = 1206 |
| 12 | const PARTS_MAGIC_1330: i64 = 1330 |
| 13 | const PARTS_MAGIC_1024: i64 = 1024 |
| 18 | const SK_HASH_BIAS: i64 = 8192 |
| 24 | const PARTS_MAGIC_92821: i64 = 92821 |
| 25 | const PARTS_MAGIC_68917: i64 = 68917 |
| 26 | const PARTS_MAGIC_40503: i64 = 40503 |
| 34 | const MINSTD_MULT: i64 = 48271 |
| 35 | const MINSTD_MOD: i64 = 2147483647 |
| 36 | const PARTS_MAGIC_999999: i64 = 999999 |
| 37 | const PARTS_MAGIC_1048576: i64 = 1048576 |
| 38 | const PARTS_MAGIC_1250: i64 = 1250 |
| 39 | const PARTS_MAGIC_3600: i64 = 3600 |
| 40 | const PARTS_MAGIC_2600: i64 = 2600 |
| 41 | const PARTS_MAGIC_262144: i64 = 262144 |
| 42 | const PARTS_MAGIC_9000: i64 = 9000 |
| 43 | const PARTS_MAGIC_1445: i64 = 1445 |
| 44 | const PARTS_MAGIC_3400: i64 = 3400 |
| 45 | const PARTS_MAGIC_4200: i64 = 4200 |
| 46 | const PARTS_MAGIC_65536: i64 = 65536 |
| 47 | const PARTS_MAGIC_8201: i64 = 8201 |
| 48 | const PARTS_MAGIC_2048: i64 = 2048 |
| 50 | const W: i64 = 512 |
| 51 | const H: i64 = 384 |
| 52 | const HW: i64 = 256 |
| 53 | const HH: i64 = 192 |
| 54 | const FX: i64 = 1024 // fixed-point unit (1.0) |
| 55 | const FOCAL: i64 = 586 // ray focal (fx1024 ndc scale) -- scaled with width to keep the FOV |
| 56 | const KBLEND: i64 = 130 // smin blend radius: joints fuse smoothly but limbs stay DISTINCT (340 melted the whole figure into a blob) |
| 57 | const NPART: i64 = 18 |
| 58 | const PARTS_CAP: i64 = 48 // physical part-array capacity (room for a carved face; side slots moved out) |
| 76 | const SDF_I64: i64 = 8 |
| 77 | const SDF_FB_BYTES: i64 = W * H * SDF_I64 // the framebuffer IS the first field; its size is not a guess |
| 78 | const SDF_PART_FIELDS: i64 = 6 // {cx,cy,cz,rx,ry,rz} |
| 79 | const SDF_ROT_FIELDS: i64 = 2 // {cos256, sin256} |
| 80 | const O_FB: i64 = 0 |
| 81 | const O_PARTS: i64 = O_FB + SDF_FB_BYTES // W*H*8 ; up to PARTS_CAP*6 i64 {cx,cy,cz,rx,ry,rz} |
| 82 | const O_KBLEND: i64 = O_PARTS + PARTS_CAP * SDF_PART_FIELDS * SDF_I64 // per-body smin blend; 0 => default KBLEND |
| 83 | const O_NPART: i64 = O_KBLEND + SDF_I64 // active part count (t2mesh objects vary); 0 => default NPART |
| 84 | const O_OPS: i64 = O_NPART + SDF_I64 // PARTS_CAP i64: per-part op -- 0=union(add), 1=carve(smooth-subtract) |
| 85 | const O_MATS: i64 = O_OPS + PARTS_CAP * SDF_I64 // PARTS_CAP i64: per-part MATERIAL -- 0=skin, 1=EYE |
| 86 | const O_KB2: i64 = O_MATS + PARTS_CAP * SDF_I64 // PARTS_CAP i64: PER-PART smin blend radius; 0 = inherit. |
| 89 | const O_ROT: i64 = O_KB2 + PARTS_CAP * SDF_I64 // PARTS_CAP*2 i64: per-part PITCH orientation (cos256, sin256); 0,0 = |
| 92 | const O_FLOOR: i64 = O_ROT + PARTS_CAP * SDF_ROT_FIELDS * SDF_I64 // 1 i64: 1 = render a GROUND PLANE (figures only) |
| 93 | const O_MTXAMP: i64 = O_FLOOR + SDF_I64 // 1 i64: micro-texture amplitude scale (256 = 1.0x) -- the reverse-judge knob |
| 99 | const O_FTEX: i64 = O_MTXAMP + SDF_I64 // *u8 RGB8 rows (w*h*3); 0 = OFF |
| 100 | const O_FTEXW: i64 = O_FTEX + SDF_I64 |
| 101 | const O_FTEXH: i64 = O_FTEXW + SDF_I64 |
| 102 | const O_FPUC: i64 = O_FTEXH + SDF_I64 |
| 103 | const O_FPVC: i64 = O_FPUC + SDF_I64 |
| 104 | const O_FPSU: i64 = O_FPVC + SDF_I64 |
| 105 | const O_FPSV: i64 = O_FPSU + SDF_I64 |
| 106 | const O_FPVLO: i64 = O_FPSV + SDF_I64 // photo-v projection BAND [vlo,vhi): reference-specific (hairline..chin); |
| 107 | const O_FPVHI: i64 = O_FPVLO + SDF_I64 // vhi<=0 -> full [1,th-2). Photo-space, so transform-invariant (person path). |
| 111 | const O_EYE: i64 = O_FPVHI + SDF_I64 // 1 i64: lateral eye offset (model units); 0 = centered/mono |
| 118 | const O_ROLL: i64 = O_EYE + SDF_I64 // PARTS_CAP*2 i64: per-part ROLL orientation (cos256, sin256) |
| 132 | const SDF_PRIM_FIELDS: i64 = 6 |
| 133 | const SDF_PR_HALFW: i64 = 0 // half the fissure width: the canthi sit at (-halfw, 0) and (+halfw, 0) before roll |
| 134 | const SDF_PR_UP: i64 = 1 // rise of the upper lid arc above the canthal line |
| 135 | const SDF_PR_LOW: i64 = 2 // drop of the lower lid arc below it |
| 136 | const O_PRIM: i64 = O_ROLL + PARTS_CAP * SDF_ROT_FIELDS * SDF_I64 // PARTS_CAP*6 i64: per-part primitive parameters |
| 137 | const SDF_ARENA_BYTES: i64 = O_PRIM + PARTS_CAP * SDF_PRIM_FIELDS * SDF_I64 |
| 138 | const SDF_OP_UNION: i64 = 0 |
| 139 | const SDF_OP_CARVE: i64 = 1 |
| 140 | const SDF_OP_LIDSHELL: i64 = 2 |
| 473 | const HS_BOB: i64 = 1 // the sdf_face default cap+nape (explicit id = a no-op, negative-control-provable) |
| 474 | const HS_LONG: i64 = 2 // deep nape + a back-fall volume down the back |
| 475 | const HS_PIXIE: i64 = 3 // tight cap hugging the skull, nape tucked short |
| 476 | const HS_PONY: i64 = 4 // nape tucked + a high tail behind the crown |
| 477 | const HS_BALD: i64 = 5 // hair parts collapsed inside the skull -> skin scalp renders |
| 739 | const SDF_OP_LIPSWEEP: i64 = 3 |
| 740 | const SDF_PL_ARCH: i64 = 0 // how far back (+z) the commissure sits from the midline |
| 741 | const SDF_PL_TAPER: i64 = 1 // commissure thickness, permil of the midline thickness |
| 742 | const SDF_PL_NOTCH: i64 = 2 // cupid's bow: the dip of the upper outline at the midline, permil of this lip's height (0 on a lower lip) |
| 743 | const SDF_PL_NOTCH_HW: i64 = 3 // half-width of that dip, permil of the half mouth width |
| 744 | const SDF_PL_CURVE: i64 = 4 // rise (+) or drop (-) of the seam at the commissure |
| 745 | const SDF_PL_SIDE: i64 = 5 // +1 = the half above the seam (upper lip), -1 = the half below |
| 746 | const SDF_PERMIL: i64 = 1000 |
| 747 | const SDF_LIP_EDGE: i64 = 6 // the vermilion's colour edge fades over this many model units |
| 748 | const SDF_LIP_FULL: i64 = 100 |
| 901 | const SDF_LASH_BAND: i64 = 7 |
| 955 | const SDF_AT_PART:i64=0 |
| 956 | const SDF_AT_MATERIAL:i64=1 |
| 957 | const SDF_AT_NEAREST:i64=2 |
| 958 | const SDF_AT_RUNNER:i64=3 |
| 959 | const SDF_AT_FIELD:i64=4 |
| 960 | const SDF_AT_COMPOSED:i64=5 |
| 961 | const SDF_AT_TIED:i64=6 |
| 962 | const SDF_AT_RUNNER_PART:i64=7 |
| 963 | const SDF_AT_WORDS:i64=8 |
| 1111 | const SSS_WRAP_R0: i64 = 120 // flat-surface wrap width, red (the proven terminator floor) |
| 1112 | const SSS_WRAP_G0: i64 = 60 |
| 1113 | const SSS_WRAP_B0: i64 = 26 |
| 1114 | const SSS_CURV_GAIN_R: i64 = 96 // widening per unit curvature (curv 0..256), red widest |
| 1115 | const SSS_CURV_GAIN_G: i64 = 40 |
| 1116 | const SSS_CURV_GAIN_B: i64 = 12 |
| 1117 | const SSS_CURV_MAX: i64 = 256 |
| 1118 | const SSS_CURV_SCALE: i64 = 24 // Laplacian sum (SDF units) -> 0..256 curvature; sized so a 1-block |
| 1195 | const SSS_N_FULL: i64 = 256 // this renderer's unit-normal / N.L scale |
| 1243 | const SR_RELIEF_E: i64 = 9 // the shader's OWN central-difference half-step. It was spelled as the |
functions
| 141 | func sdf_set_facetex(base: i64, tex: i64, w: i64, h: i64, uc: i64, vc: i64, su: i64, sv: i64) -> i64 called by 1: sdf_set_facetex_person |
| 154 | func sdf_set_facetex_band(base: i64, vlo: i64, vhi: i64) -> i64 |
| 164 | func sdf_set_facetex_person(base: i64, tex: i64, w: i64, h: i64, uc: i64, vc: i64, su: i64, sv: i64) -> i64 calls 1: sdf_set_facetex |
| 170 | func sdf_bytes() -> i64 { return SDF_ARENA_BYTES } |
| 171 | func sdf_set_floor(base: i64, on: i64) -> i64 { let f: *i64 = (base + O_FLOOR) as *i64; f[0] = on; return 0 } |
| 172 | func sdf_set_mtx_amp(base: i64, amp: i64) -> i64 { let f: *i64 = (base + O_MTXAMP) as *i64; f[0] = amp; return 0 } |
| 173 | func sdf_set_eye(base: i64, dx: i64) -> i64 { let f: *i64 = (base + O_EYE) as *i64; f[0] = dx; return 0 } |
| 174 | func fb_off() -> i64 { return O_FB } |
| 175 | func ww() -> i64 { return W } |
| 176 | func hh() -> i64 { return H } |
| 178 | func sdf_isqrt(v: i64) -> i64 { return vm_isqrt(v) } |
| 179 | func sdf_min(a: i64, b: i64) -> i64 { if a < b { return a } return b } called by 1: sdf_smin |
| 180 | func sdf_abs(a: i64) -> i64 { if a < 0 { return 0 - a } return a } |
| 182 | func sdf_knee(v: i64) -> i64 { if v < 0 { return 0 } if v < 205 { return v } let x: i64 = v - 205; var o: i64 = 205 + x * 50 / (x + 85); if o > 255 { o = 255 } return o } |
| 185 | func sdf_aces(v: i64) -> i64 called by 1: sdf_shade_ray |
| 200 | func sk_hash(a: i64, b: i64, c: i64) -> i64 |
| 207 | func sk_vnoise(x: i64, y: i64, z: i64, C: i64) -> i64 |
| 232 | func sk_pore(x: i64, y: i64, z: i64) -> i64 |
| 266 | func mat_height(qx: i64, qy: i64, qz: i64) -> i64 |
| 272 | func sk_microtex(qx: i64, qy: i64, qz: i64) -> i64 |
| 280 | func sdf_clear_ops(base: i64, n: i64) -> i64 |
| 301 | func sdf_set_rot(base: i64, idx: i64, deg4096: i64) -> i64 |
| 307 | func sdf_set_op(base: i64, idx: i64, v: i64) -> i64 { let op: *i64 = (base + O_OPS) as *i64; op[idx] = v; return 0 } |
| 308 | func sdf_set_mat(base: i64, idx: i64, v: i64) -> i64 { let mt: *i64 = (base + O_MATS) as *i64; mt[idx] = v; return 0 } |
| 309 | func sdf_set_kb(base: i64, idx: i64, v: i64) -> i64 { let k2: *i64 = (base + O_KB2) as *i64; k2[idx] = v; return 0 } |
| 313 | func sdf_body(base: i64) -> i64 called by 17: mainmainmainmainmainmain+11 calls 4: sdf_clear_opssdf_set_floorsdf_set_mtx_ampsdf_set_kb |
| 364 | func sdf_head(base: i64) -> i64 |
| 395 | func sdf_face(base: i64) -> i64 |
| 478 | func sdf_face_hairstyle(base: i64, hs: i64) -> i64 |
| 533 | func sdf_person2(base: i64, scratch: i64, hs: i64) -> i64 |
| 574 | func sdf_person(base: i64, scratch: i64) -> i64 { return sdf_person2(base, scratch, 0) } |
| 579 | func sdf_person_full(base: i64, scratch: i64, hs: i64) -> i64 |
| 620 | func sdf_shift_y(base: i64, dy: i64) -> i64 called by 1: main |
| 636 | func sdf_ellip(px: i64, py: i64, pz: i64, cx: i64, cy: i64, cz: i64, rx: i64, ry: i64, rz: i64) -> i64 |
| 654 | func sdf_ellip_rot(px: i64, py: i64, pz: i64, cx: i64, cy: i64, cz: i64, rx: i64, ry: i64, rz: i64, rc: i64, rs: i64) -> i64 |
| 675 | func sdf_smin(a: i64, b: i64, k: i64) -> i64 |
| 681 | func sdf_smax(a: i64, b: i64, k: i64) -> i64 { return 0 - sdf_smin(0 - a, 0 - b, k) } |
| 684 | func sdf_set_roll(base: i64, idx: i64, deg4096: i64) -> i64 |
| 690 | func sdf_set_prim(base: i64, idx: i64, field: i64, v: i64) -> i64 { let pr: *i64 = (base + O_PRIM) as *i64; pr[idx * SDF_PRIM_FIELDS + field] = v; return 0 } |
| 691 | func sdf_get_prim(base: i64, idx: i64, field: i64) -> i64 { let pr: *i64 = (base + O_PRIM) as *i64; return pr[idx * SDF_PRIM_FIELDS + field] } |
| 697 | func sdf_lidshell(px: i64, py: i64, pz: i64, cx: i64, cy: i64, cz: i64, rin: i64, t: i64, cap: i64, halfw: i64, up: i64, low: i64, rc: i64, rs: i64) -> i64 |
| 750 | func sdf_lip_t(px: i64, cx: i64, halfw: i64) -> i64 |
| 758 | func sdf_lip_f(taper: i64, t: i64) -> i64 |
| 764 | func sdf_lip_h(hh: i64, taper: i64, notch: i64, notch_hw: i64, side: i64, t: i64) -> i64 |
| 774 | func sdf_lipsweep(px: i64, py: i64, pz: i64, cx: i64, cy: i64, cz: i64, halfw: i64, hh: i64, dd: i64, arch: i64, taper: i64, notch: i64, notch_hw: i64, curve: i64, side: i64) -> i64 |
| 802 | func sdf_lipsweep_part(base: i64, i: i64, px: i64, py: i64, pz: i64) -> i64 |
| 809 | func sdf_lip_vermilion(base: i64, px: i64, py: i64, pz: i64) -> i64 |
| 853 | func sdf_part_distance(base:i64,i:i64,px:i64,py:i64,pz:i64)->i64 called by 3: sdf_evalsdf_eval_partsdf_part_attribution calls 4: sdf_lidshellsdf_ellipsdf_ellip_rotsdf_lipsweep_part |
| 870 | func sdf_eval(base: i64, px: i64, py: i64, pz: i64) -> i64 |
| 902 | func sdf_lid_lash(base: i64, idx: i64, px: i64, py: i64) -> i64 |
| 936 | func sdf_eval_part(base:i64,px:i64,py:i64,pz:i64)->i64 |
| 949 | func sdf_surface_material(base:i64,part:i64,px:i64,py:i64)->i64 |
| 967 | func sdf_part_attribution(base:i64,px:i64,py:i64,pz:i64,out:*i64,words:i64)->i64 |
| 988 | func sdf_softshadow(base: i64, ox: i64, oy: i64, oz: i64, lx: i64, ly: i64, lz: i64) -> i64 |
| 1011 | func sdf_ao(base: i64, ox: i64, oy: i64, oz: i64, nx: i64, ny: i64, nz: i64) -> i64 |
| 1037 | func sdf_gi(base: i64, px: i64, py: i64, pz: i64, nx: i64, ny: i64, nz: i64) -> i64 |
| 1127 | func sr_sss_preint_n(ndlr: i64, ndlg: i64, ndlb: i64, curv: i64) -> i64 |
| 1145 | func sr_sss_preint(ndl: i64, curv: i64) -> i64 { return sr_sss_preint_n(ndl, ndl, ndl, curv) } |
| 1148 | func sr_curvature(base: i64, px: i64, py: i64, pz: i64, e: i64, f0: i64) -> i64 |
| 1198 | func sr_relief_wrap() -> i64 { return rlf_tilt_full(SSS_N_FULL) } |
| 1200 | func sr_sss_blur(w: i64) -> i64 { return w * SSS_N_FULL / (w + sr_relief_wrap()) } |
| 1206 | func sr_sss_ndl(nd: i64, gd: i64, blur: i64) -> i64 { return nd + (gd - nd) * blur / SSS_N_FULL } |
| 1246 | func sr_relief_cell() -> i64 { return 2 * SR_RELIEF_E } |
| 1248 | func sr_relief_h(qx: i64, qy: i64, qz: i64) -> i64 { return rlf_relief_h3(qx, qy, qz, sr_relief_cell()) } |
| 1251 | func sr_relief_tilt(dh: i64) -> i64 { return dh * rlf_tilt_full(SSS_N_FULL) / RLF_H_RANGE } |
| 1254 | func sr_relief_grad(px: i64, py: i64, pz: i64, ax: i64) -> i64 |
| 1261 | func sdf_shade_ray(base: i64, rox: i64, roy: i64, roz: i64, rdx: i64, rdy: i64, rdz: i64, skin_r: i64, skin_g: i64, skin_b: i64, misscol: i64) -> i64 called by 8: tile_renderfig_renderc_renderlg_rendercg_renderpg_render+2 calls 20: sdf_evalsdf_isqrtsdf_softshadowsdf_gisdf_acessdf_eval_part+14 |
| 1766 | func sdf_render_rows(base: i64, yaw: i64, camz_units: i64, skin_r: i64, skin_g: i64, skin_b: i64, y0: i64, y1: i64) -> i64 |
| 1819 | func sdf_render(base: i64, yaw: i64, camz_units: i64, skin_r: i64, skin_g: i64, skin_b: i64) -> i64 |