Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make LCD retention compensation optional #668

Merged
merged 1 commit into from
Dec 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions subframe-bfi/shaders/crt-beam-simulator.slang
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ layout(push_constant) uniform Push
uint FrameCount;
uint TotalSubFrames;
uint CurrentSubFrame;
float GAIN_VS_BLUR, GAMMA, FPS_DIVISOR;
float GAIN_VS_BLUR, GAMMA, FPS_DIVISOR, LCD_ANTI_RETENTION_TOGGLE;
} params;

//------------------ Constants migrated to runtime params --------------------//
Expand All @@ -119,6 +119,9 @@ layout(push_constant) uniform Push
#define FPS_DIVISOR (1. / params.FPS_DIVISOR)
//^^ Slow down or speed up the simulation

#pragma parameter LCD_ANTI_RETENTION_TOGGLE "LCD Anti-Retention On/Off" 1.0 0.0 1.0 1.0
bool LCD_ANTI_RETENTION = bool(params.LCD_ANTI_RETENTION_TOGGLE);

//----------------------------------------------------------------------------//

//-----------------------Shadertoy Compatibility Macros-----------------------//
Expand Down Expand Up @@ -180,7 +183,8 @@ layout(std140, set = 0, binding = 0) uniform UBO
// - Scientific Reason: https://forums.blurbusters.com/viewtopic.php?t=7539 BFI interaction with LCD voltage polarity inversion
// - Known Side effect: You've decoupled the CRT simulators' own VSYNC from the real displays' VSYNC. But magically, there's no tearing artifacts :-)
// - Not needed for OLEDs, safe to turn off, but should be ON by default to be foolproof.
#define LCD_ANTI_RETENTION true
//#define LCD_ANTI_RETENTION true
//^^moved to runtime parameter
#define LCD_INVERSION_COMPENSATION_SLEW 0.001

// CRT SCAN DIRECTION. Can be useful to counteract an OS rotation of your display
Expand Down