summaryrefslogtreecommitdiffstatshomepage
path: root/hlsl
diff options
context:
space:
mode:
author Westley M. Martinez <anikom15@gmail.com>2016-12-30 15:40:30 -0800
committer Westley M. Martinez <anikom15@gmail.com>2016-12-30 15:40:30 -0800
commit7cda4860ec7ba81b6a05c486c6ef06385224c6b3 (patch)
tree1a8e4012e8f561ae96f6a5ae3230ed3667093d98 /hlsl
parentb2682b7c55c5056042decfa44470fe4d51512fd0 (diff)
Scale and phosphor persistence sliders.
hlsl/phosphor.fx: Scale parameter into tau or gamma. src/osd/modules/render/d3d/d3dhlsl.cpp: src/osd/modules/render/d3d/d3dhlsl.h: src/osd/windows/winmain.cpp: src/osd/windows/winmain.h: Combine tau and beta sliders into one slider labeled 'Time Constant'.
Diffstat (limited to 'hlsl')
-rw-r--r--hlsl/phosphor.fx19
1 files changed, 11 insertions, 8 deletions
diff --git a/hlsl/phosphor.fx b/hlsl/phosphor.fx
index 447bf0242f9..59b2ce98935 100644
--- a/hlsl/phosphor.fx
+++ b/hlsl/phosphor.fx
@@ -99,9 +99,8 @@ uniform bool LCD = false;
uniform int Mode = 0;
uniform float DeltaTime = 0.0f;
uniform float LCDTau = 0.0f;
-uniform float3 Tau = { 0.0f, 0.0f, 0.0f };
+uniform float3 TimeConstant = { 0.0f, 0.0f, 0.0f };
uniform float3 Beta = { 0.0f, 0.0f, 0.0f };
-uniform float3 Gamma = { 0.0f, 0.0f, 0.0f };
float4 ps_main(PS_INPUT Input) : COLOR
{
@@ -122,17 +121,21 @@ float4 ps_main(PS_INPUT Input) : COLOR
b = 0;
}
else if (Mode == 1) {
- r *= Tau.r == 0 ? 0 : exp(-DeltaTime / Tau.r);
- g *= Tau.g == 0 ? 0 : exp(-DeltaTime / Tau.g);
- b *= Tau.b == 0 ? 0 : exp(-DeltaTime / Tau.b);
+ float3 tau = TimeConstant * 0.4342944819;
+
+ r *= tau.r == 0 ? 0 : exp(-DeltaTime / tau.r);
+ g *= tau.g == 0 ? 0 : exp(-DeltaTime / tau.g);
+ b *= tau.b == 0 ? 0 : exp(-DeltaTime / tau.b);
}
else {
+ float3 gamma = 1 / (TimeConstant * 0.04342944819);
+
if (r != 0.0f)
- r = pow(Gamma.r * DeltaTime + pow(1 / r, 1 / Beta.r), -Beta.r);
+ r = pow(gamma.r * DeltaTime + pow(1 / r, 1 / Beta.r), -Beta.r);
if (g != 0.0f)
- g = pow(Gamma.g * DeltaTime + pow(1 / g, 1 / Beta.g), -Beta.g);
+ g = pow(gamma.g * DeltaTime + pow(1 / g, 1 / Beta.g), -Beta.g);
if (b != 0.0f)
- b = pow(Gamma.b * DeltaTime + pow(1 / b, 1 / Beta.b), -Beta.b);
+ b = pow(gamma.b * DeltaTime + pow(1 / b, 1 / Beta.b), -Beta.b);
}
// Prevent burn-in
if (DeltaTime > 0.0f) {