Idea: a choice of CRT filters, from clean video monitors to consumer TVs #70
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
needs measurements
question
testing wanted
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot#70
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The idea
Add CRT filter to Graphics: a choice of convincing beam, scanline and phosphor-mask looks, using the work already made by the RetroArch/libretro shader community. Off stays the default, with the existing picture and no extra GPU pass or image allocation.
Start with native Vulkan adaptations of three small, explicitly licensed shaders, offering four looks:
Proposed keys:
crt_filter=0..4in that order, and CRT lines /crt_lines=0..2for 240 / 480 / 720 virtual lines (240 initially). The remake renders well above 240p: this deliberately samples its finished picture onto a virtual CRT raster, independent of Render resolution. Cap that raster to half the output height so scanlines have at least two output pixels. Preserve aspect; do not force 4:3 or add integer scaling. Exact integer multiples give the most regular lines.Placement: after the game's upscaling and the window scaling/sharpness/ultrawide-side treatment, before Longshot's Insert menu and FPS overlay. The game's own HUD is part of the filtered picture. Apply it to each displayed frame after frame generation, so optical flow never tracks the mask. Masks use destination pixels; wide gameplay fills the existing wide rectangle, and centred 16:9 menus keep their current sides/bars.
These shaders expect SDR, not PQ. Expanded HDR can expand the filtered SDR through the existing output pass. Native HDR bypasses the filter, with the saved choice kept and the reason shown, until proper linear-light/HDR presets are validated. No silent PQ-as-sRGB processing.
The first slice adds a virtual-raster downsample and one CRT pass, with reused images. Lottes is the heavier choice; Hyllian and zfast are cheaper by inspection, not yet measured. The PR should show Off against main, full frames and mask close-ups at ordinary and 4K output, and the GPU's own counters without pretending a shared-load run is a quiet benchmark.
Anything else
Recommendation: ship the small native set first. Keep original files and notices unchanged in a new third-party folder, record their commit and hashes, and generate SPIR-V with the existing shader build method. No new runtime dependency is needed.
A custom partial Slang loader looks small but soon needs preset inheritance, aliases, colour-space targets, LUTs, history and feedback. Prefer evaluating an existing preset runtime for a wider selection rather than maintaining an incomplete second one.
Outside this first slice: arbitrary downloaded presets; NTSC/composite signal emulation; persistent phosphor/feedback; bezels/reflections; individually calibrated Sony models; Native HDR; a full shader-parameter editor. Those are useful extensions, not features the first filters should pretend to have.
Survey: the larger collection, licensing gates and runtime choices
All shader links below are pinned to libretro/slang-shaders
2345ee91. Counts are the representative preset graphs, not GPU timings; floating-point targets alone do not mean HDR.Existing runtime: librashader 0.12.1 implements Slang presets with a Vulkan backend and first-class C API. Its implementation is MPL-2.0 OR GPL-3.0-only; C headers are MIT. This offers a compatible licence route, not clearance for shaders loaded through it.
It needs stable Rust 1.88 for the non-WGPU build, Cargo and a native compiler stack; the compiler/reflection/image dependencies remain even with only Vulkan selected. The two native compiler source crates alone are about 6.2 MB compressed. A previous all-backend Windows archive was about 28 MB; a Vulkan-only linked footprint has not been measured. This is materially larger than three precompiled native shaders. The host must handle image layouts, queue/frames-in-flight synchronization and output colour space; loading a preset does not make SDR shaders HDR-correct. Build and integration contract.
There are real precedents: ares uses librashader, DuckStation adapts Lottes natively, and the native zelda3 port has its own GLSL preset loader. These demonstrate the three approaches, not permission to copy unrelated port code.
Questions for maintainers:
Claimed for an initial WIP implementation and Linux/NVIDIA checks. Windows, AMD/Intel and HDR-display results will remain explicit gaps until tested.