Interactive 2D wave optics simulator. Turn any image into a refractive scene, add sources, watch waves refract, diffract and interfere. Probes, intensity maps, video export.
C#
The 8-bit palette index is the preview's default sample format
Alexander Graef63cd5bd21a76
diff --git a/CLAUDE.md b/CLAUDE.mdindex 4069b44..28d7c94 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -64,7 +64,15 @@ WPF shell as it stands:marquee while an export waits for its run or a scratch frame computes) is mirrored on the taskbar buttonthrough WPF's `TaskbarItemInfo` (`MainWindow.Taskbar.cs`, fed from `UpdateBusy`).- **Reduced preview** (2026-10-15, the user's design for weaker machines and a first step towards a browser- build; three View menu entries, persisted user settings, all default Full): View > Preview resolution+ build; three View menu entries, persisted user settings; resolution and frames default Full, **samples default+ 8-bit since 2026-10-16**, the user's call after the colouring was measured: the index is the position in the+ 255-entry palette table that the 16-bit path computes anyway, so at the captured brightness both give the same+ pixels, the store is half the size and the CPU's colouring halves (1.0 ms a 2880 x 1080 layer against 2.0, a table+ lookup); what 16-bit keeps is the brightness turnable after the run without a re-run, which is why it stays in the+ menu, and exports use a full run either way; a `user.config` from before keeps its 2; a Direct3D display path+ was weighed the same day and **not built**: after the index mode it would only remove the bitmap copy and WPF's+ upload, at the price of a Windows-only device pairing in the app, where today only Media Foundation and WIC are+ Windows-bound): View > Preview resolution(Full/Half/Quarter, `PreviewResolution` 1/2/4: the canvas divisor), Preview frames (Full/Half/Quarter,`PreviewFrames` 1/2/4: only every n-th frame is stored) and Preview samples (16-bit float /8-bit palette index, `PreviewSampleBytes` 2/1); ids `MenuPreviewResolution<n>`, `MenuPreviewFrames<n>`,@@ -762,7 +770,8 @@ passing harnesses for comfort, never all of them after an edit.(`{name}` = the suggested name) and `WAVEDUDE_DISCARD_EDITS=1` skips the save question on closing(`Start-App` sets it), because posted keys cannot drive a common dialog or a message box.`_tools/ui_check/PreviewQualityCheck.ps1` (2026-10-15, 34 checks, about 90 s) drives View > Preview- resolution / frames / samples by keyboard on `tiny.wdproj`: a full run (the log line says "100 of 100 frames+ resolution / frames / samples by keyboard on `tiny.wdproj`: 16-bit samples chosen first (8-bit is the default+ since 2026-10-16), then a full run (the log line says "100 of 100 framesstored as 64×48 (full)", frames 97, 98 and 99 all differ), then each choice marks the run stale and theautomatic re-run follows: with every second frame stored the timeline still ends at 99 / step 198 and frame 99shows the same picture as 98 while 97 differs (the log's "50 of 100 frames stored"), at half resolution thediff --git a/WaveDudeNext.WPF/Properties/Settings.Designer.cs b/WaveDudeNext.WPF/Properties/Settings.Designer.csindex 35fb97a..32086b5 100644--- a/WaveDudeNext.WPF/Properties/Settings.Designer.cs+++ b/WaveDudeNext.WPF/Properties/Settings.Designer.cs@@ -215,7 +215,7 @@ namespace WaveDudeNext.WPF.Properties {[global::System.Configuration.UserScopedSettingAttribute()][global::System.Diagnostics.DebuggerNonUserCodeAttribute()]- [global::System.Configuration.DefaultSettingValueAttribute("2")]+ [global::System.Configuration.DefaultSettingValueAttribute("1")]public int PreviewSampleBytes {get {return ((int)(this["PreviewSampleBytes"]));diff --git a/WaveDudeNext.WPF/Properties/Settings.settings b/WaveDudeNext.WPF/Properties/Settings.settingsindex 88d91af..d099549 100644--- a/WaveDudeNext.WPF/Properties/Settings.settings+++ b/WaveDudeNext.WPF/Properties/Settings.settings@@ -51,7 +51,7 @@<Value Profile="(Default)">1</Value></Setting><Setting Name="PreviewSampleBytes" Type="System.Int32" Scope="User">- <Value Profile="(Default)">2</Value>+ <Value Profile="(Default)">1</Value></Setting><Setting Name="LastExportFolder" Type="System.String" Scope="User"><Value Profile="(Default)" />diff --git a/_tools/library_check/Program.cs b/_tools/library_check/Program.csindex 0b8f545..60d9214 100644--- a/_tools/library_check/Program.cs+++ b/_tools/library_check/Program.cs@@ -262,8 +262,15 @@ internal static class Program}int[] lut = ColorLut.Build(ColorSchemeStore.LoadBuiltIn(null).First(s => s.Name == Display.DefaultFieldColorScheme)).Argb;var pixels = new int[w * h];+ // the 8-bit preview format: the index the GPU's capture_index kernel computed, the CPU only looks the colour up+ var indices = new byte[w * h];+ for (int i = 0; i < indices.Length; i++)+ {+ indices[i] = (byte)ColorLut.FieldIndex((float)field[i], 1f);+ }foreach ((string name, Action render) in new (string, Action)[]{+ ("8-bit index", () => FrameRenderer.RenderIndexed(indices, w, h, lut, pixels)),("intensity", () => FrameRenderer.RenderIntensity(intensity, w, h, lut, 1f, pixels)),("field", () => FrameRenderer.RenderField(field, w, h, lut, 1f, pixels)),("field, grey", () => FrameRenderer.RenderField(field, w, h, null, 1f, pixels)),diff --git a/_tools/ui_check/PreviewQualityCheck.ps1 b/_tools/ui_check/PreviewQualityCheck.ps1index 2c3545b..2b53d59 100644--- a/_tools/ui_check/PreviewQualityCheck.ps1+++ b/_tools/ui_check/PreviewQualityCheck.ps1@@ -95,6 +95,7 @@ function Park() {Start-App $exe $projecttry {+ ChooseView 5 0 # 16-bit samples first: 8-bit is the default since 2026-10-16, and the first run must be the full qualityFocusOn "PreviewPlay" # a window never activated has no focused element, and F5 (a routed gesture) then goes nowhereKey 0x74 300 # F5Check "F5 run completes" (WaitFor { (RunStatus) -like "Completed:*" } 30000) (RunStatus)