diff options
Diffstat (limited to 'hlsl')
| -rw-r--r-- | hlsl/phosphor.fx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/hlsl/phosphor.fx b/hlsl/phosphor.fx index 7d665b44749..40bc049bbc2 100644 --- a/hlsl/phosphor.fx +++ b/hlsl/phosphor.fx @@ -94,19 +94,23 @@ VS_OUTPUT vs_main(VS_INPUT Input) //----------------------------------------------------------------------------- uniform float3 Phosphor = float3(0.0f, 0.0f, 0.0f); +uniform float dt = 0.0f; +static const float f = 30.0f; float4 ps_main(PS_INPUT Input) : COLOR { float4 CurrPix = tex2D(DiffuseSampler, Input.TexCoord); - float3 PrevPix = tex2D(PreviousSampler, Input.PrevCoord).rgb * float3(Phosphor.r, Phosphor.g, Phosphor.b); + float3 PrevPix = tex2D(PreviousSampler, Input.PrevCoord).rgb; + PrevPix.r *= Phosphor.r == 0 ? 0 : pow(Phosphor.r, f * dt); + PrevPix.g *= Phosphor.g == 0 ? 0 : pow(Phosphor.g, f * dt); + PrevPix.b *= Phosphor.b == 0 ? 0 : pow(Phosphor.b, f * dt); float RedMax = max(CurrPix.r, PrevPix.r); float GreenMax = max(CurrPix.g, PrevPix.g); float BlueMax = max(CurrPix.b, PrevPix.b); - return Passthrough - ? CurrPix - : float4(RedMax, GreenMax, BlueMax, CurrPix.a); + return Passthrough ? + CurrPix : float4(RedMax, GreenMax, BlueMax, CurrPix.a); } //----------------------------------------------------------------------------- |
