code wiki / _hdl_build / nx_ng_gen3d.nx
nx_ng_gen3d.nx
buildroot/runtime/_hdl_build/nx_ng_gen3d.nx
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
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
structs
| none |
consts
| 21 | const K_MAGIC_8192: i64 = 8192 |
| 22 | const K_MAGIC_13107: i64 = 13107 |
| 23 | const K_MAGIC_45875: i64 = 45875 |
| 24 | const K_MAGIC_32768: i64 = 32768 |
| 25 | const K_MAGIC_65536: i64 = 65536 |
| 26 | const K_MAGIC_4096: i64 = 4096 |
| 28 | const TLOG: *u8 = "knowledge/status/ng_gen3d.log" |
| 29 | const Q16: i64 = 65536 |
| 30 | const NGS: i64 = 3 // gaussians in the 3D scene (shared across views) |
| 31 | const NPV: i64 = 4 // pixels per view |
| 32 | const EPOCHS: i64 = 4000 |
| 33 | const LRQ: i64 = 4096 |
functions
| 35 | func tpr(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 40 | func tpn(v: i64) -> i64 { nxi_out(v); return 0 } |
| 41 | func t_abs(v: i64) -> i64 { if v<0 { return 0-v } return v } called by 1: main |
| 42 | func tqm(a: i64, b: i64) -> i64 { return (a*b)>>16 } called by 1: main |
| 43 | func 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 } |
| 48 | func tl_wn(fd: i64, v: i64) -> i64 { nxi_fd(fd, v); return 0 } |
| 51 | func view_into(tape: *i64, vals: *i64, st: *i64, cn: *i64, w: *i64, targ: *i64, root_in: i64) -> i64 |
| 69 | func 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 |
| 89 | func main() -> i64 |