code wiki / _hdl_build / nx_ng_gen3d.nx

nx_ng_gen3d.nx

buildroot/runtime/_hdl_build/nx_ng_gen3d.nx

8905 B146 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind tooltopic ng
docsdependenciesstructsconstsfunctions

about

nx_ng_gen3d.nx -- CAP-GEN-3D, generation 12: generative-3D (DreamFusion-class, arxiv 2209.14988). The honest CORE mechanism of text/image-to-3D: a 3D representation is optimized so that its RENDERED 2D VIEWS satisfy a 2D objective (a "prior"), via the DIFFERENTIABLE renderer -- "lifting" 2D supervision into a 3D scene, with no direct 3D supervision. Reuses the splat color-fit on the autograd tape (CAP-GAUSSIAN-SPLAT / CAP-DIFF-RENDER). Honest gated proof of the DEFINING property (why generative-3D needs multiple views / a prior): a 3D scene = N gaussians with shared learnable colors; each VIEW renders as a weighted sum of those shared colors (the gaussian's projected footprint+transmittance in that view). We generate target views from a known scene c*. T1 MULTI-VIEW LIFT -- optimizing colors from TWO 2D views recovers the 3D scene (|c_g - c*_g| small): 2D supervision is distilled into a 3D-consistent representation. T2 SINGLE-VIEW INSUFFICIENT -- view A alone is ill-posed (gaussians 0,1 overlap into one observed pixel -> only their SUM is seen) so c0,c1 are NOT recovered: this is WHY a generative prior / extra views are needed = the load-bearing reason the method exists. T3 BIT-EXACT -- the 2-view solve is deterministic (train twice -> identical integer colors). HONEST: the "prior" here is explicit target views (full DreamFusion = a learned text-to-image diffusion model driving the views via score-distillation = the follow-on); 1D pixels, fixed gaussian geometry. Q16, no float. Sovereign: nx_nofloat_autograd + syscalls. license_tier: ORIGINAL expect_exit: 0

dependencies 3 imports · 0 importers

nx_nofloat_autograd.nx nx_itoa_lib.nx nx_syscalls.nx nx_ng_gen3d.nx

imports: nx_nofloat_autograd.nxnx_itoa_lib.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main tpr sys_write sys_mmap tqm gen_train sys_mmap ↻ nfa_leaf nfa_new view_into nfa_cmul nfa_new ↻ nfa_qmul nfa_vadd nfa_new ↻ nfa_leaf ↻ nfa_mse nfa_new ↻ nfa_backward nfa_qmul ↻ nfa_silud nfa_sigmoid nfa_fxexp nfa_qmul ↻ nfa_isqrt nfa_fxexp ↻ nfa_cosf nfa_reduce2pi nfa_cosq nfa_qmul ↻ nfa_sinf nfa_reduce2pi ↻ nfa_sinq nfa_qmul ↻ nfa_val nfa_grad nfa_sgd t_abs tpn nxi_out

structs

none

consts

21const K_MAGIC_8192: i64 = 8192
22const K_MAGIC_13107: i64 = 13107
23const K_MAGIC_45875: i64 = 45875
24const K_MAGIC_32768: i64 = 32768
25const K_MAGIC_65536: i64 = 65536
26const K_MAGIC_4096: i64 = 4096
28const TLOG: *u8 = "knowledge/status/ng_gen3d.log"
29const Q16: i64 = 65536
30const NGS: i64 = 3 // gaussians in the 3D scene (shared across views)
31const NPV: i64 = 4 // pixels per view
32const EPOCHS: i64 = 4000
33const LRQ: i64 = 4096

functions

35func tpr(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main calls 1: sys_write
40func tpn(v: i64) -> i64 { nxi_out(v); return 0 }
called by 1: main calls 1: nxi_out
41func t_abs(v: i64) -> i64 { if v<0 { return 0-v } return v }
called by 1: main
42func tqm(a: i64, b: i64) -> i64 { return (a*b)>>16 }
called by 1: main
43func tl_ws(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 }
called by 1: main calls 1: sys_write
48func tl_wn(fd: i64, v: i64) -> i64 { nxi_fd(fd, v); return 0 }
called by 1: main calls 1: nxi_fd
51func view_into(tape: *i64, vals: *i64, st: *i64, cn: *i64, w: *i64, targ: *i64, root_in: i64) -> i64
69func gen_train(tape: *i64, vals: *i64, grads: *i64, st: *i64, wA: *i64, tA: *i64, wB: *i64, tB: *i64, use_b: i64, cout: *i64, ll: *i64) -> i64
89func main() -> i64