nmarshall commited on
Commit
8604dd1
·
1 Parent(s): 7b2dc1c

qvm: original model leaf geometry

Browse files
docs/ASSET_PIPELINE_TODO.md CHANGED
@@ -754,3 +754,6 @@ Research progress: RE-694 [report](research/MD3_BINDINGS.md); remaining native/c
754
 
755
 
756
  Research progress: RE-695 [report](research/MD3_VM_BRIDGE.md); remaining native/content/runtime/platform scope stays open.
 
 
 
 
754
 
755
 
756
  Research progress: RE-695 [report](research/MD3_VM_BRIDGE.md); remaining native/content/runtime/platform scope stays open.
757
+
758
+
759
+ Research progress: RE-696 [report](research/MD3_ORIGINAL_LEAF.md); remaining native/content/runtime/platform scope stays open.
docs/FINDINGS.md CHANGED
@@ -1100,3 +1100,6 @@ Bounded qagame paths recover bomb-plant/inactivity correction requests, direct f
1100
 
1101
 
1102
  **RE-695 — Original MD3 bytes through QVM vertex decoder:** Verbatim original MD3 headers/surfaces/indices/frame bytes execute through23929 and match independent signed-coordinate interpolation for all eight selected models. [Evidence](research/MD3_VM_BRIDGE.md).
 
 
 
 
1100
 
1101
 
1102
  **RE-695 — Original MD3 bytes through QVM vertex decoder:** Verbatim original MD3 headers/surfaces/indices/frame bytes execute through23929 and match independent signed-coordinate interpolation for all eight selected models. [Evidence](research/MD3_VM_BRIDGE.md).
1103
+
1104
+
1105
+ **RE-696 — Complete QVM leaf geometry on original player models:** Complete23092 processes all eight original selected MD3 models; aimed rays produce real source hit records and distant rays miss across first/last animation frames. [Evidence](research/MD3_ORIGINAL_LEAF.md).
docs/PROVISIONAL_TODO.md CHANGED
@@ -1086,3 +1086,6 @@ Research progress: RE-694 [report](research/MD3_BINDINGS.md); remaining native/c
1086
 
1087
 
1088
  Research progress: RE-695 [report](research/MD3_VM_BRIDGE.md); remaining native/content/runtime/platform scope stays open.
 
 
 
 
1086
 
1087
 
1088
  Research progress: RE-695 [report](research/MD3_VM_BRIDGE.md); remaining native/content/runtime/platform scope stays open.
1089
+
1090
+
1091
+ Research progress: RE-696 [report](research/MD3_ORIGINAL_LEAF.md); remaining native/content/runtime/platform scope stays open.
docs/RESEARCH_LEDGER.md CHANGED
@@ -1122,3 +1122,8 @@ Actual21581 initialization requests Athena/Orion LOD3 lower→upper→head→hel
1122
  ## 2026-10-21 — RE-695 Original MD3 bytes through QVM vertex decoder (separate task commit)
1123
 
1124
  Verbatim original MD3 headers/surfaces/indices/frame bytes execute through23929 and match independent signed-coordinate interpolation for all eight selected models. 48 source-decoder probes check first/last/reversed frames and three fractions; four tests cover all coordinate words, actual offset arithmetic and invalid frame-window rejection. Full suite: 1235 tests pass. Report regenerates byte-identically (84934 bytes). Storage/filter, links and whitespace checks pass. No assets/Rust runtime/shared VM evaluator changed; native/reference/legal/full platform scope remains open.
 
 
 
 
 
 
1122
  ## 2026-10-21 — RE-695 Original MD3 bytes through QVM vertex decoder (separate task commit)
1123
 
1124
  Verbatim original MD3 headers/surfaces/indices/frame bytes execute through23929 and match independent signed-coordinate interpolation for all eight selected models. 48 source-decoder probes check first/last/reversed frames and three fractions; four tests cover all coordinate words, actual offset arithmetic and invalid frame-window rejection. Full suite: 1235 tests pass. Report regenerates byte-identically (84934 bytes). Storage/filter, links and whitespace checks pass. No assets/Rust runtime/shared VM evaluator changed; native/reference/legal/full platform scope remains open.
1125
+
1126
+
1127
+ ## 2026-10-21 — RE-696 Complete QVM leaf geometry on original player models (separate task commit)
1128
+
1129
+ Complete23092 processes all eight original selected MD3 models; aimed rays produce real source hit records and distant rays miss across first/last animation frames. 24 independent whole-context oracles check original packed surfaces, all source geometry/classification/publication, original hashes and frames835/978. Full suite: 1239 tests pass. Report regenerates byte-identically (978713 bytes). Storage/filter, links and whitespace checks pass. No assets/Rust runtime/shared VM evaluator changed; native/reference/legal/full platform scope remains open.
docs/REVERSE_ENGINEERING_TODO.md CHANGED
@@ -1129,3 +1129,6 @@ Purpose: turn the supplied installation into an evidence-backed specification of
1129
 
1130
 
1131
  - [x] RE-695 Original MD3 bytes through QVM vertex decoder ([report](research/MD3_VM_BRIDGE.md)).
 
 
 
 
1129
 
1130
 
1131
  - [x] RE-695 Original MD3 bytes through QVM vertex decoder ([report](research/MD3_VM_BRIDGE.md)).
1132
+
1133
+
1134
+ - [x] RE-696 Complete QVM leaf geometry on original player models ([report](research/MD3_ORIGINAL_LEAF.md)).
docs/research/MD3_ORIGINAL_LEAF.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Complete QVM leaf geometry on original player models
2
+
3
+ RE-696. Reproduce with `python3 scripts/analyze_md3_original_leaf.py`; check with `python3 scripts/test_md3_original_leaf.py`. The [machine report](md3-original-leaf.json) retains source identity and bounded fixtures.
4
+
5
+ The sparse original-byte bridge now feeds complete23092, including every surface/triangle loop and actual string/category children. Identity node transforms and finite rays remain explicit fixtures. Aimed rays are constructed from an original nondegenerate triangle; geometric outcomes are computed by source, not supplied. All24 contexts match independent full-model geometry oracles, including hit vectors, part indices, records and final bounds. Original data remain unchanged. Source sqrt is modeled and actual native loader18183/process/world-collision parity remains open.
6
+
7
+ No original executable/full QVM/native collision/physics/rendering executes. Native responses and legal input domains are supplied or unverified where stated; full runtime/macOS/Linux Rust/Bevy/Solari gameplay remains open.
docs/research/README.md CHANGED
@@ -687,3 +687,6 @@ The extension collector adds five focused tests for native tail calls, command-r
687
 
688
 
689
  [RE-695: Original MD3 bytes through QVM vertex decoder](MD3_VM_BRIDGE.md). Reproduce with `python3 scripts/analyze_md3_vm_bridge.py`; check with `python3 scripts/test_md3_vm_bridge.py`.
 
 
 
 
687
 
688
 
689
  [RE-695: Original MD3 bytes through QVM vertex decoder](MD3_VM_BRIDGE.md). Reproduce with `python3 scripts/analyze_md3_vm_bridge.py`; check with `python3 scripts/test_md3_vm_bridge.py`.
690
+
691
+
692
+ [RE-696: Complete QVM leaf geometry on original player models](MD3_ORIGINAL_LEAF.md). Reproduce with `python3 scripts/analyze_md3_original_leaf.py`; check with `python3 scripts/test_md3_original_leaf.py`.
docs/research/md3-original-leaf.json ADDED
The diff for this file is too large to render. See raw diff
 
scripts/analyze_md3_original_leaf.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Original player MD3 surfaces through complete23092 geometry and classification."""
3
+ import hashlib,math
4
+ from pathlib import Path
5
+ from qvm_research_support import source
6
+ from md3 import MD3
7
+ from md3_vm import map_md3
8
+ from md3_qvm_support import describe,node_record
9
+ from analyze_md3_contract import selected
10
+ from analyze_qvm_surface_category import support
11
+ from analyze_qvm_complete_leaf import leaf,words,CONTEXT,ORIGIN,DIRECTION,NODE
12
+ from analyze_qvm_acceleration import word
13
+ from analyze_qvm import write_json
14
+ ADDRESS=0x70000000
15
+
16
+ def aimed_ray(model,frame):
17
+ for s in model.surfaces:
18
+ for j in range(s.triangles):
19
+ v=[model.vertex(s,frame,k)['position'] for k in model.triangle(s,j)];a=[v[1][k]-v[0][k] for k in range(3)];b=[v[2][k]-v[0][k] for k in range(3)];normal=[a[1]*b[2]-a[2]*b[1],a[2]*b[0]-a[0]*b[2],a[0]*b[1]-a[1]*b[0]];length=math.sqrt(sum(x*x for x in normal))
20
+ if length>1e-4:
21
+ n=[x/length for x in normal];point=[sum(p[k] for p in v)/3 for k in range(3)];return [point[k]+10*n[k] for k in range(3)],[-x for x in n]
22
+ raise ValueError('no nondegenerate original triangle')
23
+
24
+ def main():
25
+ q,raw,h,ins=source();rows=[]
26
+ for path in selected():
27
+ data=path.read_bytes();model=MD3(data)
28
+ for frame in sorted({0,model.frames-1}):
29
+ for hit in [False,True]:
30
+ m,bs=support(raw,h);map_md3(m,bs,model,ADDRESS,[frame]);node_record(m,NODE,ADDRESS,frame)
31
+ for o in range(0,308,4):m[CONTEXT+o]=0
32
+ origin,direction=aimed_ray(model,frame) if hit else ((10000,10000,10000),(1,0,0))
33
+ for p,v in [(ORIGIN,origin),(DIRECTION,direction)]:
34
+ for j,x in enumerate(v):m[p+4*j]=word(x)
35
+ args={8:NODE,12:ORIGIN,16:DIRECTION,20:CONTEXT};inputs=describe(m,args,model);m,r=leaf(ins,m,bs,args,limit=1000000);r.update({'path':str(path),'sha256':hashlib.sha256(data).hexdigest(),'frame':frame,'aimed_at_original_triangle':hit,'input':inputs});rows.append(r)
36
+ write_json(Path('docs/research/md3-original-leaf.json'),{'source':q['source'],'sha256':q['sha256'],'probes':rows,'limits':'Complete23092 on unmodified original selected MD3 bytes, first/last static frames and explicit identity nodes/rays. Native sqrt modeled; no original loader/process/native trace parity. Geometric outcomes are actual source results.'})
37
+ if __name__=='__main__':main()
scripts/analyze_qvm_complete_leaf.py CHANGED
@@ -16,13 +16,13 @@ ORIGIN=CONTEXT+512
16
  DIRECTION=ORIGIN+16
17
 
18
  def words(m,p,count=77):return [m[p+4*j]&0xffffffff for j in range(count)]
19
- def leaf(ins,m,bs,args,base=LOCAL):
20
  m=dict(m);before=words(m,args[20])
21
  for o,v in args.items():m[base+432+o]=v
22
  def sqrt(i,m,a):v=word(math.sqrt(number(a[8])));return m,v,{'argument':a[8]&0xffffffff,'result':v,'finite_sqrt_model':True}
23
  def strlen(i,m,a):m,r=length(i,m,a[8]);return m,r['length'],{'length':r['length'],'execution':r['execution']}
24
  def category(i,m,a):m,r=classify(i,m,bs,a[8],a[12]);return m,r['result_pointer'],{'result_pointer':r['result_pointer'],'category':r['category'],'trace_sha256':r['execution']['trace_sha256'],'trace_length':r['execution']['trace_length']}
25
- m,e=resume(ins,23093,25339,m,base,handlers={-107:sqrt,36038:strlen,21493:category},byte_inputs=bs,limit=131072)
26
  return m,{'arguments':args,'before':before,'after':words(m,args[20]),'execution':e}
27
 
28
  def fixture(raw,h,kind='head',ray='front',count=0):
 
16
  DIRECTION=ORIGIN+16
17
 
18
  def words(m,p,count=77):return [m[p+4*j]&0xffffffff for j in range(count)]
19
+ def leaf(ins,m,bs,args,base=LOCAL,limit=131072):
20
  m=dict(m);before=words(m,args[20])
21
  for o,v in args.items():m[base+432+o]=v
22
  def sqrt(i,m,a):v=word(math.sqrt(number(a[8])));return m,v,{'argument':a[8]&0xffffffff,'result':v,'finite_sqrt_model':True}
23
  def strlen(i,m,a):m,r=length(i,m,a[8]);return m,r['length'],{'length':r['length'],'execution':r['execution']}
24
  def category(i,m,a):m,r=classify(i,m,bs,a[8],a[12]);return m,r['result_pointer'],{'result_pointer':r['result_pointer'],'category':r['category'],'trace_sha256':r['execution']['trace_sha256'],'trace_length':r['execution']['trace_length']}
25
+ m,e=resume(ins,23093,25339,m,base,handlers={-107:sqrt,36038:strlen,21493:category},byte_inputs=bs,limit=limit)
26
  return m,{'arguments':args,'before':before,'after':words(m,args[20]),'execution':e}
27
 
28
  def fixture(raw,h,kind='head',ray='front',count=0):
scripts/md3_qvm_support.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Original model inputs for independent QVM geometry checks."""
2
+ from analyze_qvm_slide_prefix import vec
3
+ from analyze_qvm_acceleration import word
4
+
5
+ def describe(m,args,model):
6
+ node=args[8];a=m[node];b=m[node+4]
7
+ if a!=b:raise ValueError('original geometry oracle currently requires equal frame indices')
8
+ chain=[];p=node;seen=set()
9
+ while p:
10
+ if p in seen:raise ValueError('cyclic original model fixture hierarchy')
11
+ seen.add(p);chain.append([[m[p+12+16*r+4*c]&0xffffffff for c in range(4)] for r in range(4)]);p=m[p+96]
12
+ return {'surfaces':[{'name':s.name,'packed_vertices':[model.vertex(s,a,j)['packed'] for j in range(s.vertices)],'triangles':[model.triangle(s,j) for j in range(s.triangles)]} for s in model.surfaces],'origin':vec(m,args[12]),'direction':vec(m,args[16]),'null_word4':m[4],'basis_chain':chain,'node_origin':vec(m,node+76)}
13
+
14
+ def node_record(m,p,model_address,frame=0):
15
+ for o in range(0,112,4):m[p+o]=0
16
+ m[p]=frame;m[p+4]=frame;m[p+8]=word(.5);m[p+88]=model_address
17
+ for o in [12,32,52,72]:m[p+o]=word(1)
scripts/test_md3_original_leaf.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import hashlib,json,unittest
2
+ from pathlib import Path
3
+ from test_qvm_complete_leaf import expected
4
+ class OriginalLeafTests(unittest.TestCase):
5
+ @classmethod
6
+ def setUpClass(cls):cls.rows=json.loads(Path('docs/research/md3-original-leaf.json').read_text())['probes']
7
+ def test_independent_entire_original_model_contexts(self):
8
+ self.assertEqual(len(self.rows),24)
9
+ for p in self.rows:self.assertEqual(p['after'],expected(p),p['path'])
10
+ def test_aimed_rays_hit_and_distant_rays_miss(self):
11
+ for p in self.rows:self.assertEqual(p['after'][16]>0,p['aimed_at_original_triangle']);self.assertLessEqual(p['after'][16],10)
12
+ def test_eight_original_identities_and_last_animation_frames(self):
13
+ self.assertEqual(len({p['path'] for p in self.rows}),8);self.assertTrue(any(p['frame']==835 for p in self.rows));self.assertTrue(any(p['frame']==978 for p in self.rows))
14
+ for p in self.rows[::3]:self.assertEqual(hashlib.sha256(Path(p['path']).read_bytes()).hexdigest(),p['sha256'])
15
+ def test_geometric_outcomes_have_no_supplied_hit_children(self):
16
+ for p in self.rows:self.assertTrue(set(c['target'] for c in p['execution']['calls'])<={-107,36038,21493});self.assertEqual(p['execution']['stop'],25339)
17
+ if __name__=='__main__':unittest.main()
scripts/test_qvm_complete_leaf.py CHANGED
@@ -14,7 +14,7 @@ def expected(p):
14
  b=[[n(x) for x in row] for row in matrix(a['basis_chain'])];o=list(map(n,a['node_origin']));vertices=[[word(f(f(f(f(n(v[0])*b[0][c])+f(n(v[1])*b[1][c]))+f(n(v[2])*b[2][c]))+o[c])) for c in range(3)] for v in vertices]
15
  c={'vertices':vertices,'origin':a['origin'],'direction':a['direction']};hit,det,u,v,t=candidate(c)
16
  if not hit:continue
17
- c.update({'u':u,'v':v,'parameter':t});normal,edges,point=geometry({'candidate':c});category={'h_head':1,'u_torso':3,'l_rfoot':14,'g_vest':4,'u_arml':5,'u_armr':6}.get(s['name'],a['null_word4'])
18
  if n(t)<n(near):near=t;r[3:6]=point;r[9:12]=normal;r[15]=index
19
  if n(t)>n(far):far=t;r[:3]=point;r[6:9]=normal;r[14]=index
20
  count=r[16]
 
14
  b=[[n(x) for x in row] for row in matrix(a['basis_chain'])];o=list(map(n,a['node_origin']));vertices=[[word(f(f(f(f(n(v[0])*b[0][c])+f(n(v[1])*b[1][c]))+f(n(v[2])*b[2][c]))+o[c])) for c in range(3)] for v in vertices]
15
  c={'vertices':vertices,'origin':a['origin'],'direction':a['direction']};hit,det,u,v,t=candidate(c)
16
  if not hit:continue
17
+ c.update({'u':u,'v':v,'parameter':t});normal,edges,point=geometry({'candidate':c});category={'h_head':1,'u_torso':3,'l_rfoot':14,'g_vest':4,'u_arml':5,'u_armr':6,'g_helmet':2,'l_groin':7,'l_butt':8,'l_lthigh':9,'l_rthigh':10,'l_lleg':11,'l_rleg':12,'l_lfoot':13}.get(s['name'],a['null_word4'])
18
  if n(t)<n(near):near=t;r[3:6]=point;r[9:12]=normal;r[15]=index
19
  if n(t)>n(far):far=t;r[:3]=point;r[6:9]=normal;r[14]=index
20
  count=r[16]