From 5593d57d48d0924c4748a6250f1294a7967bf934 Mon Sep 17 00:00:00 2001 From: Cyd Date: Tue, 14 Jul 2026 13:49:34 -0500 Subject: [PATCH] Renderer: IR/thermal palette, bilinear default, searchlight (fog) + night egg - IR / predator-vision thermal: the cockpit IR button toggles it via the wire (dpl_Effect on action 0x1b, mode -1 ON / -2 OFF -> board.pvision). vrview_gl present pass remaps scene luminance to a thermal palette (default heat/Predator; mono|green|amber via VRVIEW_PVISION_PALETTE; VRVIEW_PVISION / bridge 'v' key force it on). Exact palette + HUD-exempt pending crew review. - Texture filter default flipped to bilinear (operator preference); the i860 board itself point-sampled, so VRVIEW_FILTER=nearest reverts. (A CRT present-pass bleed/scanline prototype was built and rejected; removed.) - Searchlight: no code needed -- night A/B proved it is a VIEW-FOG push-back (fog near 5->60, far 400->500 on), already rendered by the existing view fog path. Not a light cone. Added TESTNITE.EGG (arena1/night/fog) + gauge_arena_night_pipe.conf for the test. Co-Authored-By: Claude Opus 4.8 --- ALPHA_1/REL410/BT/TESTNITE.EGG | 229 ++++++++++++++++++ dpl3-revive/patha/vrboard.py | 17 +- dpl3-revive/patha/vrview_gl.py | 50 +++- .../render-bridge/gauge_arena_night_pipe.conf | 79 ++++++ emulator/render-bridge/live_bridge.py | 9 + 5 files changed, 371 insertions(+), 13 deletions(-) create mode 100644 ALPHA_1/REL410/BT/TESTNITE.EGG create mode 100644 emulator/render-bridge/gauge_arena_night_pipe.conf diff --git a/ALPHA_1/REL410/BT/TESTNITE.EGG b/ALPHA_1/REL410/BT/TESTNITE.EGG new file mode 100644 index 0000000..035f31e --- /dev/null +++ b/ALPHA_1/REL410/BT/TESTNITE.EGG @@ -0,0 +1,229 @@ +[mission] +adventure=BattleTech +map=arena1 +scenario=freeforall +time=night +weather=fog +temperature=27 +length=600 +[ordinals] +bitmap=Ordinal::BitMap::1 +bitmap=Ordinal::BitMap::2 +bitmap=Ordinal::BitMap::3 +bitmap=Ordinal::BitMap::4 +[Ordinal::BitMap::1] +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=000038000003C000001FF00000000F00 +bitmap=0000F8000003C000003FF80000000F00 +bitmap=0001F8000003C00000707C0000000F00 +bitmap=0001F8000003C00000603C0000000F00 +bitmap=00007801FC0FF00000003C3DF807FF00 +bitmap=00007803FE0FF00000003C3FFC0FFF00 +bitmap=00007803C703C00000003C3E3C1F0F00 +bitmap=000078078303C0000000783C1E1E0F00 +bitmap=000078078003C0000000783C1E1E0F00 +bitmap=00007807C003C0000000F03C1E1E0F00 +bitmap=00007807F003C0000001E03C1E1E0F00 +bitmap=00007803FC03C0000003C03C1E1E0F00 +bitmap=00007801FE03C0000007803C1E1E0F00 +bitmap=000078007F03C000000F003C1E1E0F00 +bitmap=000078001F03C000001E003C1E1E0F00 +bitmap=000078000F03C000003C003C1E1E0F00 +bitmap=000078060F03C0000078003C1E1E0F00 +bitmap=000078071E03E0000078003C1E1F1F00 +bitmap=00007803FE01F000007FFC3C1E0FFF00 +bitmap=00007801FC00F000007FFC3C1E07EF00 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +x=128 +y=32 +width=8 +[Ordinal::BitMap::2] +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=001FFF0000003C0000003C03C0780000 +bitmap=001FFF0000003C0000007C03C0780000 +bitmap=00000E0000003C000000FC03C0780000 +bitmap=00003C0000003C000001BC03C0780000 +bitmap=0000700F3E1FFC000003BC0FF07BF000 +bitmap=0001E00F7E3FFC0000073C0FF07FF800 +bitmap=0003800FFE7C3C0000063C03C07C7800 +bitmap=0007F80FFE783C00000C3C03C0783C00 +bitmap=0007FE0F80783C0000183C03C0783C00 +bitmap=00001E0F00783C0000383C03C0783C00 +bitmap=00000F0F00783C0000703C03C0783C00 +bitmap=00000F0F00783C00007FFF03C0783C00 +bitmap=00000F0F00783C00007FFF03C0783C00 +bitmap=00000F0F00783C0000003C03C0783C00 +bitmap=00000F0F00783C0000003C03C0783C00 +bitmap=00000F0F00783C0000003C03C0783C00 +bitmap=00180F0F00783C0000003C03C0783C00 +bitmap=001C1F0F007C7C0000003C03E0783C00 +bitmap=000FFE0F003FFC0000003C01F0783C00 +bitmap=0007FC0F001FBC0000003C00F0783C00 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +x=128 +y=32 +width=8 +[Ordinal::BitMap::3] +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=001FFF03C07800000000FC03C0780000 +bitmap=001FFF03C07800000003FC03C0780000 +bitmap=001E0003C07800000007C003C0780000 +bitmap=001E0003C0780000000F0003C0780000 +bitmap=001E000FF07BF000000F000FF07BF000 +bitmap=001E000FF07FF800001E000FF07FF800 +bitmap=001E0003C07C7800001E0003C07C7800 +bitmap=001FFC03C0783C00001EFC03C0783C00 +bitmap=001FFE03C0783C00001FFE03C0783C00 +bitmap=00001F03C0783C00001F1F03C0783C00 +bitmap=00000F03C0783C00001E0F03C0783C00 +bitmap=00000F03C0783C00001E0F03C0783C00 +bitmap=00000F03C0783C00001E0F03C0783C00 +bitmap=00000F03C0783C00001E0F03C0783C00 +bitmap=00000F03C0783C00001E0F03C0783C00 +bitmap=00000F03C0783C00001E0F03C0783C00 +bitmap=00180F03C0783C00001E0F03C0783C00 +bitmap=001C1F03E0783C00001F1F03E0783C00 +bitmap=000FFE01F0783C00000FFE01F0783C00 +bitmap=0007FC00F0783C000007FC00F0783C00 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +x=128 +y=32 +width=8 +[Ordinal::BitMap::4] +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=001FFF03C07800000007FC03C0780000 +bitmap=001FFF03C0780000000FFE03C0780000 +bitmap=00000F03C0780000001F1F03C0780000 +bitmap=00000F03C0780000001E0F03C0780000 +bitmap=00000F0FF07BF000001E0F0FF07BF000 +bitmap=00001F0FF07FF800001E0F0FF07FF800 +bitmap=00001E03C07C7800001E0F03C07C7800 +bitmap=00003E03C0783C00001E0F03C0783C00 +bitmap=00003C03C0783C00000F1E03C0783C00 +bitmap=00003C03C0783C000007FC03C0783C00 +bitmap=00007803C0783C000007FC03C0783C00 +bitmap=00007803C0783C00000F1E03C0783C00 +bitmap=00007803C0783C00001E0F03C0783C00 +bitmap=0000F003C0783C00001E0F03C0783C00 +bitmap=0000F003C0783C00001E0F03C0783C00 +bitmap=0000F003C0783C00001E0F03C0783C00 +bitmap=0000F003C0783C00001E0F03C0783C00 +bitmap=0000F003E0783C00000F1E03E0783C00 +bitmap=0000F001F0783C00000FFE01F0783C00 +bitmap=0000F000F0783C000007FC00F0783C00 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +x=128 +y=32 +width=8 +[pilots] +pilot=200.0.0.113 +[200.0.0.113] +hostType=0 +advancedDamage=1 +loadzones=1 +name=cyd +bitmapindex=1 +experience=veteran +badge=VGL +patch=Yellow +role=Role::Default +dropzone=one +vehicle=madcat +vehicleValue=0 +color=White +[largebitmap] +bitmap=BitMap::Large::cyd +[BitMap::Large::cyd] +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=000000000000000000003C0000000000 +bitmap=000000000000000000003C0000000000 +bitmap=000000000000000000003C0000000000 +bitmap=000000000000000000003C0000000000 +bitmap=000000000000FCF00E0FBC0000000000 +bitmap=000000000003FE781C1FFC0000000000 +bitmap=000000000007FE781C3C7C0000000000 +bitmap=00000000000F82783C3C3C0000000000 +bitmap=00000000001F003C38783C0000000000 +bitmap=00000000001E003C78783C0000000000 +bitmap=00000000001E003C70783C0000000000 +bitmap=00000000001E003E70783C0000000000 +bitmap=00000000001E001EE0783C0000000000 +bitmap=00000000001E001EE0783C0000000000 +bitmap=00000000001F001FE0783C0000000000 +bitmap=00000000000F020FC07C7C0000000000 +bitmap=000000000007FE0FC03FFC0000000000 +bitmap=000000000003FE0F803FFC0000000000 +bitmap=000000000000FC07800F3C0000000000 +bitmap=00000000000000070000000000000000 +bitmap=00000000000000070000000000000000 +bitmap=000000000000000F0000000000000000 +bitmap=000000000000000E0000000000000000 +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000000000 +x=128 +y=32 +width=8 +[smallbitmap] +bitmap=BitMap::Small::cyd +[BitMap::Small::cyd] +bitmap=00000000000000000000000000000000 +bitmap=00000000000000000000000000600000 +bitmap=00000000006000000000000000600000 +bitmap=000001EC33E000000000030666600000 +bitmap=000003066660000000000303C6600000 +bitmap=00000303C66000000000030186600000 +bitmap=000001E183E000000000000300000000 +bitmap=00000003000000000000000000000000 +x=64 +y=16 +width=4 +[Role::Default] +model=dfltrole +[Role::NoReturn] +model=noretun diff --git a/dpl3-revive/patha/vrboard.py b/dpl3-revive/patha/vrboard.py index 86a4338..c66ad21 100644 --- a/dpl3-revive/patha/vrboard.py +++ b/dpl3-revive/patha/vrboard.py @@ -103,6 +103,9 @@ class VirtualBoard: self.anim = {} # handle -> latest 0x1d (9f mat + 3f t, COMPOSES) self.anim_abs = {} # handle -> latest 0x1f record (REPLACES) self.anim4 = {} # handle -> latest 0x1b (16f 4x4) + self.pvision = False # IR / "predator vision" thermal + self.pvision_mat = None # view-colour transform (dpl_Effect + # type-0, action 0x1b, mode -1 ON/-2 OFF) self.morphs = {} # morphed geom -> (a, b, alpha) self.names = {} # 0x8000xxxx name id -> handle (0x22) self.sfx = {} # SPECIALFX defs by code (0x1c) @@ -270,8 +273,18 @@ class VirtualBoard: self.names[nm] = h return b'' if msg.action == 0x1b and len(msg.payload) >= 72: - # per-frame full-matrix DCS update: [zone][dcs][4x4 row-major] - # (SDEMO; fire-and-forget; row-3 junk words = uninitialized host mem) + # dpl_Effect type-0 (view colour) + zone matrix refresh share + # this action: [word0][handle][4x4 row-major]. word0 = -1/-2 is + # the IR/"predator vision" toggle (BTL4OPT FUN_0045fe44 -> + # dpl_Effect(0,0,{grey,grey,grey,mode}); the 4x4 is the colour + # transform). Otherwise word0 is a zone handle (SDEMO per-frame + # matrix update; fire-and-forget, row-3 junk = uninit host mem). + mode = struct.unpack_from(' red -> yellow -> white heat ramp + vec3 c = mix(vec3(0.0), vec3(1.0, 0.0, 0.0), clamp(t / 0.40, 0.0, 1.0)); + c = mix(c, vec3(1.0, 1.0, 0.0), clamp((t - 0.40) / 0.40, 0.0, 1.0)); + c = mix(c, vec3(1.0), clamp((t - 0.80) / 0.20, 0.0, 1.0)); + return c; +} +void main() { vec3 c = texture(u_tex, v_uv).rgb; - f_color = vec4(pow(c, vec3(1.0 / 1.25)), 1.0); + if (u_pv == 1) { // thermal false-colour from scene luminance + float lum = dot(c, vec3(0.299, 0.587, 0.114)); + if (u_pvmode == 0) c = vec3(lum); + else if (u_pvmode == 1) c = vec3(lum * 0.15, lum, lum * 0.15); + else if (u_pvmode == 2) c = vec3(lum, lum * 0.72, lum * 0.18); + else c = heat(lum); + } + f_color = vec4(pow(c, vec3(1.0 / 1.25)), 1.0); // Division DAC gamma } """ +# IR / "predator vision" thermal view. The game toggles it via dpl_Effect on +# action 0x1b (mode -1 ON / -2 OFF) -> board.pvision; VRVIEW_PVISION=1 or the +# bridge 'v' key forces it on for evaluation without pressing the cockpit IR +# button. Palette: VRVIEW_PVISION_PALETTE = mono|green|amber|heat (default +# heat/Predator-style, operator's interim pick 2026-07-14; exact original TBD). +PVISION = [os.environ.get('VRVIEW_PVISION', '0') != '0'] +_PV_MODES = {'mono': 0, 'green': 1, 'amber': 2, 'heat': 3} + HUD_VS = """ #version 330 @@ -345,12 +368,12 @@ class GLRenderer(vrview.Renderer): h, w = rgb.shape[:2] data = np.ascontiguousarray(np.clip(rgb, 0, 255).astype(np.uint8)) tex = self.ctx.texture((w, h), 3, data.tobytes()) - # AUTHENTIC = point sampling: the i860 texture inner loop (VRENDER/ - # AS860/SCANLINE.SS) does ONE fld.l per pixel from the interpolated - # u,v -- no bilinear fetch existed on the board. VRVIEW_FILTER=linear - # opts into smoothing for modern taste. - mag = (self.moderngl.LINEAR if os.environ.get('VRVIEW_FILTER') == 'linear' - else self.moderngl.NEAREST) + # DEFAULT = bilinear (operator preference 2026-07-14). The i860 board + # itself POINT-sampled (VRENDER/AS860/SCANLINE.SS: one fld.l per pixel, + # no bilinear) -- VRVIEW_FILTER=nearest reverts to that raw board look; + # linear is the smoother default (closer to the pods' CRT display). + mag = (self.moderngl.NEAREST if os.environ.get('VRVIEW_FILTER') == 'nearest' + else self.moderngl.LINEAR) # VRVIEW_MIPMAP=1: keep the point-sampled look up close but add mipmaps # so MINIFIED high-frequency textures (RP's checkerboard track floor) # stop aliasing/moireing -- that shimmer-in-motion reads as "flashing @@ -358,9 +381,9 @@ class GLRenderer(vrview.Renderer): # RP's decal-frequency floor needs it to be watchable. Off by default. if os.environ.get('VRVIEW_MIPMAP', '0') != '0': tex.build_mipmaps() - mip = (self.moderngl.LINEAR_MIPMAP_LINEAR - if os.environ.get('VRVIEW_FILTER') == 'linear' - else self.moderngl.NEAREST_MIPMAP_LINEAR) + mip = (self.moderngl.NEAREST_MIPMAP_LINEAR + if os.environ.get('VRVIEW_FILTER') == 'nearest' + else self.moderngl.LINEAR_MIPMAP_LINEAR) tex.filter = (mip, mag) try: tex.anisotropy = float(os.environ.get('VRVIEW_ANISO', '8')) @@ -555,6 +578,11 @@ class GLRenderer(vrview.Renderer): ctx.disable(mgl.DEPTH_TEST) self._fbo_tex.use(0) self._set(self._present_prog, 'u_tex', 0) + self._set(self._present_prog, 'u_pv', + 1 if (PVISION[0] or getattr(board, 'pvision', False)) else 0) + self._set(self._present_prog, 'u_pvmode', + _PV_MODES.get(os.environ.get('VRVIEW_PVISION_PALETTE', + 'heat'), 3)) self._present_vao.render(mgl.TRIANGLES, vertices=3) pg.display.flip() cam = self.cam_matrix(board) diff --git a/emulator/render-bridge/gauge_arena_night_pipe.conf b/emulator/render-bridge/gauge_arena_night_pipe.conf new file mode 100644 index 0000000..208c030 --- /dev/null +++ b/emulator/render-bridge/gauge_arena_night_pipe.conf @@ -0,0 +1,79 @@ +[sdl] +output=opengl +# higher,higher not highest: HIGH_PRIORITY_CLASS starved the host desktop; +# with the retry patches a rare dropout self-recovers (see gauge_rio.conf). +priority=higher,higher +[dosbox] +memsize=32 +machine=svga_s3 +[cpu] +core=dynamic +cputype=pentium +cycles=max +[sblaster] +sbtype=sb16 +sbbase=220 +irq=5 +dma=1 +hdma=5 +[mixer] +# match the EMU8000s' native rate (no resample) and buffer ~60ms so brief +# emulation-thread stalls (RIO retry recovery) don't audibly chop +rate=44100 +blocksize=1024 +prebuffer=60 +[ne2000] +# real pods loaded the ODI stack in AUTOEXEC before ANY game launch -- +# weapons-fire test: bare -egg run WITH the packet stack resident (the game's +# WATTCP identity is 200.0.0.113 from REL410\BT\WATTCP.CFG). nicbase 340: +# 300 clashes with the VDB and blanks heads. backend=slirp: THIS build lacks +# pcap ("Backend not supported"); slirp = user-mode NAT, no LAN peers, but +# the packet driver functions and accepts sends -- enough for a solo fire +# test. For pod<->console runs use a pcap-enabled build (net_full.conf). +ne2000=true +nicbase=340 +nicirq=3 +backend=slirp +[serial] +# RIO on COM1 with the low-latency options (rxpollus/rxburst) so the board's +# few-ms ACK deadline is met; plasma display on COM2 (real pod has both). +serial1=namedpipe pipe:vrio rxpollus:100 rxburst:16 +serial2=namedpipe pipe:vplasma +[autoexec] +mount c "C:\VWE\TeslaRel410\ALPHA_1" +mount d "C:\VWE\TeslaRel410\emulator\net-boot" +d: +echo === loading NE2000 packet-driver stack (as production AUTOEXEC did) === +d:\lsl +d:\ne2000 +d:\odipkt +c: +cd \REL410\BT +set VIDEOFORMAT=svga +rem production pod card init (PARAMETR.BAT:181-186): DIAGNOSE + AWEUTIL per +rem card -- AWEUTIL /S does the EMU8000 bring-up and DRAM detect the HMI SOS +rem driver relies on; skipping it left the cards uninitialized (silent). +rem aweutil /s SKIPPED for now: it verifies the AWE32 GM ROM, which the +rem emulated cards lack (hangs in a retry loop) -- restore once the ROM is +rem dumped from a real card. diagnose /s kept (passes, sets mixer config). +set BLASTER=A220 I5 D1 H5 P330 T6 +c:\sb16\diagnose /s +set BLASTER=A240 I7 D3 H6 P300 T6 +c:\sb16\diagnose /s +set BLASTER=A220 I5 D1 H5 P330 T6 +set TEMP=c:\ +rem arena1 city mission (testnite.egg: map=arena1, time=day), RIO attached, +rem bare -egg launch (no netnub) = the user's real-world test-egg setup. +set HEAPSIZE=15000000 +set L4GAUGE=640x480x16 +call setenv.bat r f s p +32rtm.exe -x +rem stdout -> log: this optimized build still emits DEBUG_STREAM lines (the +rem RIO retry spam proved it) -- capture the weapon fire-refusal reason. +rem DOS flushes in 4KB chunks; the tail lands on clean exit (mission timer). +btl4opt.exe -egg testnite.egg > c:\weaponlog.txt +32rtm.exe -u +echo ALPHA1-RUN-DONE +pause + + diff --git a/emulator/render-bridge/live_bridge.py b/emulator/render-bridge/live_bridge.py index 6f1ec3e..31a0f39 100644 --- a/emulator/render-bridge/live_bridge.py +++ b/emulator/render-bridge/live_bridge.py @@ -454,6 +454,15 @@ def render(board): flush=True) except Exception: pass + if ev.key == pg.K_v: # IR/thermal (pvision) manual toggle + try: + import vrview_gl + vrview_gl.PVISION[0] = not vrview_gl.PVISION[0] + print(f"IR/thermal (pvision) " + f"{'ON' if vrview_gl.PVISION[0] else 'OFF'}", + flush=True) + except Exception: + pass if hstep or fstep: print(f"eye trim: height {UPOFF[0]:+.1f} " f"forward {FWDOFF[0]:+.1f}", flush=True)