2015-05-24 05:53:26 -07:00
|
|
|
// license:BSD-3-Clause
|
2015-05-12 00:18:09 -07:00
|
|
|
// copyright-holders:Ryan Holtz,ImJezze
|
Initial shader import (nw)
Focus: 8-sample blur that averages 7 samples around a center sample.
Phosphor: Not currently used, treated as a pass-through by drawd3d.c, but could be used to implement additional convolutions in a second pass.
Pincushion: Used (when commented in in drawd3d.c) to pincushion an entire full-screen texture but not otherwise apply any convolutions.
Post: The meat and potatoes. It does scanlines, it does aperture masking, it does dot crawl, it does chroma subsampling, it does YIQ colorspace convolution, it does RGB colorspace convolution, it does pincushioning, it walks, it talks, it does the dishes, it'll screw your wife for you, and if you don't have a wife it will find one for you, get you married to her, and screw her for you, IT IS THAT GOOD, LADIES AND GENTLEMEN.
Primary: Simple passthrough for UI and artwork.
2011-05-16 09:55:34 -07:00
|
|
|
//-----------------------------------------------------------------------------
|
2011-05-17 17:35:16 -07:00
|
|
|
// Scanline & Shadowmask Effect
|
Initial shader import (nw)
Focus: 8-sample blur that averages 7 samples around a center sample.
Phosphor: Not currently used, treated as a pass-through by drawd3d.c, but could be used to implement additional convolutions in a second pass.
Pincushion: Used (when commented in in drawd3d.c) to pincushion an entire full-screen texture but not otherwise apply any convolutions.
Post: The meat and potatoes. It does scanlines, it does aperture masking, it does dot crawl, it does chroma subsampling, it does YIQ colorspace convolution, it does RGB colorspace convolution, it does pincushioning, it walks, it talks, it does the dishes, it'll screw your wife for you, and if you don't have a wife it will find one for you, get you married to her, and screw her for you, IT IS THAT GOOD, LADIES AND GENTLEMEN.
Primary: Simple passthrough for UI and artwork.
2011-05-16 09:55:34 -07:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2015-12-31 07:32:35 -08:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Sampler Definitions
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2013-08-29 18:05:13 -07:00
|
|
|
texture DiffuseTexture;
|
Initial shader import (nw)
Focus: 8-sample blur that averages 7 samples around a center sample.
Phosphor: Not currently used, treated as a pass-through by drawd3d.c, but could be used to implement additional convolutions in a second pass.
Pincushion: Used (when commented in in drawd3d.c) to pincushion an entire full-screen texture but not otherwise apply any convolutions.
Post: The meat and potatoes. It does scanlines, it does aperture masking, it does dot crawl, it does chroma subsampling, it does YIQ colorspace convolution, it does RGB colorspace convolution, it does pincushioning, it walks, it talks, it does the dishes, it'll screw your wife for you, and if you don't have a wife it will find one for you, get you married to her, and screw her for you, IT IS THAT GOOD, LADIES AND GENTLEMEN.
Primary: Simple passthrough for UI and artwork.
2011-05-16 09:55:34 -07:00
|
|
|
|
|
|
|
sampler DiffuseSampler = sampler_state
|
|
|
|
{
|
2015-05-03 05:41:05 -07:00
|
|
|
Texture = <DiffuseTexture>;
|
2014-01-23 16:30:29 -08:00
|
|
|
MipFilter = LINEAR;
|
|
|
|
MinFilter = LINEAR;
|
|
|
|
MagFilter = LINEAR;
|
|
|
|
AddressU = CLAMP;
|
|
|
|
AddressV = CLAMP;
|
|
|
|
AddressW = CLAMP;
|
Initial shader import (nw)
Focus: 8-sample blur that averages 7 samples around a center sample.
Phosphor: Not currently used, treated as a pass-through by drawd3d.c, but could be used to implement additional convolutions in a second pass.
Pincushion: Used (when commented in in drawd3d.c) to pincushion an entire full-screen texture but not otherwise apply any convolutions.
Post: The meat and potatoes. It does scanlines, it does aperture masking, it does dot crawl, it does chroma subsampling, it does YIQ colorspace convolution, it does RGB colorspace convolution, it does pincushioning, it walks, it talks, it does the dishes, it'll screw your wife for you, and if you don't have a wife it will find one for you, get you married to her, and screw her for you, IT IS THAT GOOD, LADIES AND GENTLEMEN.
Primary: Simple passthrough for UI and artwork.
2011-05-16 09:55:34 -07:00
|
|
|
};
|
|
|
|
|
2013-08-29 18:05:13 -07:00
|
|
|
texture ShadowTexture;
|
Initial shader import (nw)
Focus: 8-sample blur that averages 7 samples around a center sample.
Phosphor: Not currently used, treated as a pass-through by drawd3d.c, but could be used to implement additional convolutions in a second pass.
Pincushion: Used (when commented in in drawd3d.c) to pincushion an entire full-screen texture but not otherwise apply any convolutions.
Post: The meat and potatoes. It does scanlines, it does aperture masking, it does dot crawl, it does chroma subsampling, it does YIQ colorspace convolution, it does RGB colorspace convolution, it does pincushioning, it walks, it talks, it does the dishes, it'll screw your wife for you, and if you don't have a wife it will find one for you, get you married to her, and screw her for you, IT IS THAT GOOD, LADIES AND GENTLEMEN.
Primary: Simple passthrough for UI and artwork.
2011-05-16 09:55:34 -07:00
|
|
|
|
|
|
|
sampler ShadowSampler = sampler_state
|
|
|
|
{
|
2015-05-03 05:41:05 -07:00
|
|
|
Texture = <ShadowTexture>;
|
2014-01-23 16:30:29 -08:00
|
|
|
MipFilter = LINEAR;
|
|
|
|
MinFilter = LINEAR;
|
|
|
|
MagFilter = LINEAR;
|
|
|
|
AddressU = WRAP;
|
|
|
|
AddressV = WRAP;
|
|
|
|
AddressW = WRAP;
|
Initial shader import (nw)
Focus: 8-sample blur that averages 7 samples around a center sample.
Phosphor: Not currently used, treated as a pass-through by drawd3d.c, but could be used to implement additional convolutions in a second pass.
Pincushion: Used (when commented in in drawd3d.c) to pincushion an entire full-screen texture but not otherwise apply any convolutions.
Post: The meat and potatoes. It does scanlines, it does aperture masking, it does dot crawl, it does chroma subsampling, it does YIQ colorspace convolution, it does RGB colorspace convolution, it does pincushioning, it walks, it talks, it does the dishes, it'll screw your wife for you, and if you don't have a wife it will find one for you, get you married to her, and screw her for you, IT IS THAT GOOD, LADIES AND GENTLEMEN.
Primary: Simple passthrough for UI and artwork.
2011-05-16 09:55:34 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Vertex Definitions
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2015-05-03 05:41:05 -07:00
|
|
|
struct VS_INPUT
|
Initial shader import (nw)
Focus: 8-sample blur that averages 7 samples around a center sample.
Phosphor: Not currently used, treated as a pass-through by drawd3d.c, but could be used to implement additional convolutions in a second pass.
Pincushion: Used (when commented in in drawd3d.c) to pincushion an entire full-screen texture but not otherwise apply any convolutions.
Post: The meat and potatoes. It does scanlines, it does aperture masking, it does dot crawl, it does chroma subsampling, it does YIQ colorspace convolution, it does RGB colorspace convolution, it does pincushioning, it walks, it talks, it does the dishes, it'll screw your wife for you, and if you don't have a wife it will find one for you, get you married to her, and screw her for you, IT IS THAT GOOD, LADIES AND GENTLEMEN.
Primary: Simple passthrough for UI and artwork.
2011-05-16 09:55:34 -07:00
|
|
|
{
|
2014-01-23 16:30:29 -08:00
|
|
|
float4 Position : POSITION;
|
|
|
|
float4 Color : COLOR0;
|
|
|
|
float2 TexCoord : TEXCOORD0;
|
Initial shader import (nw)
Focus: 8-sample blur that averages 7 samples around a center sample.
Phosphor: Not currently used, treated as a pass-through by drawd3d.c, but could be used to implement additional convolutions in a second pass.
Pincushion: Used (when commented in in drawd3d.c) to pincushion an entire full-screen texture but not otherwise apply any convolutions.
Post: The meat and potatoes. It does scanlines, it does aperture masking, it does dot crawl, it does chroma subsampling, it does YIQ colorspace convolution, it does RGB colorspace convolution, it does pincushioning, it walks, it talks, it does the dishes, it'll screw your wife for you, and if you don't have a wife it will find one for you, get you married to her, and screw her for you, IT IS THAT GOOD, LADIES AND GENTLEMEN.
Primary: Simple passthrough for UI and artwork.
2011-05-16 09:55:34 -07:00
|
|
|
};
|
|
|
|
|
2015-05-03 05:41:05 -07:00
|
|
|
struct VS_OUTPUT
|
Initial shader import (nw)
Focus: 8-sample blur that averages 7 samples around a center sample.
Phosphor: Not currently used, treated as a pass-through by drawd3d.c, but could be used to implement additional convolutions in a second pass.
Pincushion: Used (when commented in in drawd3d.c) to pincushion an entire full-screen texture but not otherwise apply any convolutions.
Post: The meat and potatoes. It does scanlines, it does aperture masking, it does dot crawl, it does chroma subsampling, it does YIQ colorspace convolution, it does RGB colorspace convolution, it does pincushioning, it walks, it talks, it does the dishes, it'll screw your wife for you, and if you don't have a wife it will find one for you, get you married to her, and screw her for you, IT IS THAT GOOD, LADIES AND GENTLEMEN.
Primary: Simple passthrough for UI and artwork.
2011-05-16 09:55:34 -07:00
|
|
|
{
|
2014-01-23 16:30:29 -08:00
|
|
|
float4 Position : POSITION;
|
|
|
|
float4 Color : COLOR0;
|
|
|
|
float2 TexCoord : TEXCOORD0;
|
2015-05-03 05:41:05 -07:00
|
|
|
float2 ScreenCoord : TEXCOORD1;
|
Initial shader import (nw)
Focus: 8-sample blur that averages 7 samples around a center sample.
Phosphor: Not currently used, treated as a pass-through by drawd3d.c, but could be used to implement additional convolutions in a second pass.
Pincushion: Used (when commented in in drawd3d.c) to pincushion an entire full-screen texture but not otherwise apply any convolutions.
Post: The meat and potatoes. It does scanlines, it does aperture masking, it does dot crawl, it does chroma subsampling, it does YIQ colorspace convolution, it does RGB colorspace convolution, it does pincushioning, it walks, it talks, it does the dishes, it'll screw your wife for you, and if you don't have a wife it will find one for you, get you married to her, and screw her for you, IT IS THAT GOOD, LADIES AND GENTLEMEN.
Primary: Simple passthrough for UI and artwork.
2011-05-16 09:55:34 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct PS_INPUT
|
|
|
|
{
|
2014-01-23 16:30:29 -08:00
|
|
|
float4 Color : COLOR0;
|
|
|
|
float2 TexCoord : TEXCOORD0;
|
2015-05-03 05:41:05 -07:00
|
|
|
float2 ScreenCoord : TEXCOORD1;
|
Initial shader import (nw)
Focus: 8-sample blur that averages 7 samples around a center sample.
Phosphor: Not currently used, treated as a pass-through by drawd3d.c, but could be used to implement additional convolutions in a second pass.
Pincushion: Used (when commented in in drawd3d.c) to pincushion an entire full-screen texture but not otherwise apply any convolutions.
Post: The meat and potatoes. It does scanlines, it does aperture masking, it does dot crawl, it does chroma subsampling, it does YIQ colorspace convolution, it does RGB colorspace convolution, it does pincushioning, it walks, it talks, it does the dishes, it'll screw your wife for you, and if you don't have a wife it will find one for you, get you married to her, and screw her for you, IT IS THAT GOOD, LADIES AND GENTLEMEN.
Primary: Simple passthrough for UI and artwork.
2011-05-16 09:55:34 -07:00
|
|
|
};
|
|
|
|
|
2015-10-18 10:16:46 -07:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Constants
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
static const float PI = 3.1415927f;
|
|
|
|
|
Initial shader import (nw)
Focus: 8-sample blur that averages 7 samples around a center sample.
Phosphor: Not currently used, treated as a pass-through by drawd3d.c, but could be used to implement additional convolutions in a second pass.
Pincushion: Used (when commented in in drawd3d.c) to pincushion an entire full-screen texture but not otherwise apply any convolutions.
Post: The meat and potatoes. It does scanlines, it does aperture masking, it does dot crawl, it does chroma subsampling, it does YIQ colorspace convolution, it does RGB colorspace convolution, it does pincushioning, it walks, it talks, it does the dishes, it'll screw your wife for you, and if you don't have a wife it will find one for you, get you married to her, and screw her for you, IT IS THAT GOOD, LADIES AND GENTLEMEN.
Primary: Simple passthrough for UI and artwork.
2011-05-16 09:55:34 -07:00
|
|
|
//-----------------------------------------------------------------------------
|
2011-05-17 17:35:16 -07:00
|
|
|
// Scanline & Shadowmask Vertex Shader
|
Initial shader import (nw)
Focus: 8-sample blur that averages 7 samples around a center sample.
Phosphor: Not currently used, treated as a pass-through by drawd3d.c, but could be used to implement additional convolutions in a second pass.
Pincushion: Used (when commented in in drawd3d.c) to pincushion an entire full-screen texture but not otherwise apply any convolutions.
Post: The meat and potatoes. It does scanlines, it does aperture masking, it does dot crawl, it does chroma subsampling, it does YIQ colorspace convolution, it does RGB colorspace convolution, it does pincushioning, it walks, it talks, it does the dishes, it'll screw your wife for you, and if you don't have a wife it will find one for you, get you married to her, and screw her for you, IT IS THAT GOOD, LADIES AND GENTLEMEN.
Primary: Simple passthrough for UI and artwork.
2011-05-16 09:55:34 -07:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2015-05-03 05:41:05 -07:00
|
|
|
uniform float2 ScreenDims; // size of the window or fullscreen
|
|
|
|
uniform float2 SourceDims; // size of the texture in power-of-two size
|
2015-11-17 10:37:56 -08:00
|
|
|
uniform float2 SourceRect; // size of the uv rectangle
|
2015-09-26 09:22:51 -07:00
|
|
|
uniform float2 TargetDims; // size of the target surface
|
2015-07-19 03:28:51 -07:00
|
|
|
|
2015-05-03 05:41:05 -07:00
|
|
|
uniform float2 ShadowDims = float2(32.0f, 32.0f); // size of the shadow texture (extended to power-of-two size)
|
|
|
|
uniform float2 ShadowUVOffset = float2(0.0f, 0.0f);
|
|
|
|
|
2015-12-31 07:59:23 -08:00
|
|
|
uniform bool SwapXY = false;
|
2015-07-12 14:28:38 -07:00
|
|
|
|
2015-09-26 09:22:51 -07:00
|
|
|
uniform bool PrepareBloom = false; // disables some effects for rendering bloom textures
|
2015-07-12 14:28:38 -07:00
|
|
|
uniform bool PrepareVector = false;
|
Initial shader import (nw)
Focus: 8-sample blur that averages 7 samples around a center sample.
Phosphor: Not currently used, treated as a pass-through by drawd3d.c, but could be used to implement additional convolutions in a second pass.
Pincushion: Used (when commented in in drawd3d.c) to pincushion an entire full-screen texture but not otherwise apply any convolutions.
Post: The meat and potatoes. It does scanlines, it does aperture masking, it does dot crawl, it does chroma subsampling, it does YIQ colorspace convolution, it does RGB colorspace convolution, it does pincushioning, it walks, it talks, it does the dishes, it'll screw your wife for you, and if you don't have a wife it will find one for you, get you married to her, and screw her for you, IT IS THAT GOOD, LADIES AND GENTLEMEN.
Primary: Simple passthrough for UI and artwork.
2011-05-16 09:55:34 -07:00
|
|
|
|
|
|
|
VS_OUTPUT vs_main(VS_INPUT Input)
|
|
|
|
{
|
2014-01-23 16:30:29 -08:00
|
|
|
VS_OUTPUT Output = (VS_OUTPUT)0;
|
2015-05-03 05:41:05 -07:00
|
|
|
|
2015-05-09 02:40:23 -07:00
|
|
|
float2 shadowUVOffset = ShadowUVOffset;
|
2015-12-31 07:59:23 -08:00
|
|
|
shadowUVOffset = SwapXY
|
2015-05-09 02:40:23 -07:00
|
|
|
? shadowUVOffset.yx
|
|
|
|
: shadowUVOffset.xy;
|
2015-05-03 05:41:05 -07:00
|
|
|
|
2015-09-26 09:22:51 -07:00
|
|
|
float2 ScreenCoordOffset = 0.0f;
|
|
|
|
ScreenCoordOffset += shadowUVOffset;
|
2015-05-03 05:41:05 -07:00
|
|
|
|
2015-08-02 08:31:54 -07:00
|
|
|
Output.ScreenCoord = Input.Position.xy;
|
2015-09-26 09:22:51 -07:00
|
|
|
Output.ScreenCoord += ScreenCoordOffset;
|
2015-05-03 05:41:05 -07:00
|
|
|
|
2015-08-02 08:31:54 -07:00
|
|
|
Output.Position = float4(Input.Position.xyz, 1.0f);
|
2014-01-23 16:30:29 -08:00
|
|
|
Output.Position.xy /= ScreenDims;
|
2015-05-03 05:41:05 -07:00
|
|
|
Output.Position.y = 1.0f - Output.Position.y; // flip y
|
|
|
|
Output.Position.xy -= 0.5f; // center
|
|
|
|
Output.Position.xy *= 2.0f; // zoom
|
|
|
|
|
2015-08-02 08:31:54 -07:00
|
|
|
Output.TexCoord = PrepareVector
|
|
|
|
? Input.Position.xy / ScreenDims
|
2015-09-26 09:22:51 -07:00
|
|
|
: Input.TexCoord;
|
|
|
|
Output.TexCoord += 0.5f / TargetDims; // half texel offset correction (DX9)
|
2015-05-03 05:41:05 -07:00
|
|
|
|
2014-01-23 16:30:29 -08:00
|
|
|
Output.Color = Input.Color;
|
|
|
|
|
|
|
|
return Output;
|
Initial shader import (nw)
Focus: 8-sample blur that averages 7 samples around a center sample.
Phosphor: Not currently used, treated as a pass-through by drawd3d.c, but could be used to implement additional convolutions in a second pass.
Pincushion: Used (when commented in in drawd3d.c) to pincushion an entire full-screen texture but not otherwise apply any convolutions.
Post: The meat and potatoes. It does scanlines, it does aperture masking, it does dot crawl, it does chroma subsampling, it does YIQ colorspace convolution, it does RGB colorspace convolution, it does pincushioning, it walks, it talks, it does the dishes, it'll screw your wife for you, and if you don't have a wife it will find one for you, get you married to her, and screw her for you, IT IS THAT GOOD, LADIES AND GENTLEMEN.
Primary: Simple passthrough for UI and artwork.
2011-05-16 09:55:34 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2015-12-31 07:32:35 -08:00
|
|
|
// Scanline & Shadowmask Pixel Shader
|
Initial shader import (nw)
Focus: 8-sample blur that averages 7 samples around a center sample.
Phosphor: Not currently used, treated as a pass-through by drawd3d.c, but could be used to implement additional convolutions in a second pass.
Pincushion: Used (when commented in in drawd3d.c) to pincushion an entire full-screen texture but not otherwise apply any convolutions.
Post: The meat and potatoes. It does scanlines, it does aperture masking, it does dot crawl, it does chroma subsampling, it does YIQ colorspace convolution, it does RGB colorspace convolution, it does pincushioning, it walks, it talks, it does the dishes, it'll screw your wife for you, and if you don't have a wife it will find one for you, get you married to her, and screw her for you, IT IS THAT GOOD, LADIES AND GENTLEMEN.
Primary: Simple passthrough for UI and artwork.
2011-05-16 09:55:34 -07:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2015-11-17 10:37:56 -08:00
|
|
|
uniform float2 ScreenScale = float2(1.0f, 1.0f);
|
|
|
|
uniform float2 ScreenOffset = float2(0.0f, 0.0f);
|
|
|
|
|
2015-12-25 11:02:47 -08:00
|
|
|
uniform float ScanlineAlpha = 0.0f;
|
Initial shader import (nw)
Focus: 8-sample blur that averages 7 samples around a center sample.
Phosphor: Not currently used, treated as a pass-through by drawd3d.c, but could be used to implement additional convolutions in a second pass.
Pincushion: Used (when commented in in drawd3d.c) to pincushion an entire full-screen texture but not otherwise apply any convolutions.
Post: The meat and potatoes. It does scanlines, it does aperture masking, it does dot crawl, it does chroma subsampling, it does YIQ colorspace convolution, it does RGB colorspace convolution, it does pincushioning, it walks, it talks, it does the dishes, it'll screw your wife for you, and if you don't have a wife it will find one for you, get you married to her, and screw her for you, IT IS THAT GOOD, LADIES AND GENTLEMEN.
Primary: Simple passthrough for UI and artwork.
2011-05-16 09:55:34 -07:00
|
|
|
uniform float ScanlineScale = 1.0f;
|
|
|
|
uniform float ScanlineBrightScale = 1.0f;
|
|
|
|
uniform float ScanlineBrightOffset = 1.0f;
|
|
|
|
uniform float ScanlineOffset = 1.0f;
|
2015-05-03 05:41:05 -07:00
|
|
|
uniform float ScanlineHeight = 1.0f;
|
|
|
|
|
2015-12-25 11:02:47 -08:00
|
|
|
uniform float3 BackColor = float3(0.0f, 0.0f, 0.0f);
|
|
|
|
|
2015-12-26 03:27:07 -08:00
|
|
|
uniform int ShadowTileMode = 0; // 0 based on screen dimension, 1 based on source dimension
|
2013-08-29 18:05:13 -07:00
|
|
|
uniform float ShadowAlpha = 0.0f;
|
2015-05-03 05:41:05 -07:00
|
|
|
uniform float2 ShadowCount = float2(6.0f, 6.0f);
|
|
|
|
uniform float2 ShadowUV = float2(0.25f, 0.25f);
|
Initial shader import (nw)
Focus: 8-sample blur that averages 7 samples around a center sample.
Phosphor: Not currently used, treated as a pass-through by drawd3d.c, but could be used to implement additional convolutions in a second pass.
Pincushion: Used (when commented in in drawd3d.c) to pincushion an entire full-screen texture but not otherwise apply any convolutions.
Post: The meat and potatoes. It does scanlines, it does aperture masking, it does dot crawl, it does chroma subsampling, it does YIQ colorspace convolution, it does RGB colorspace convolution, it does pincushioning, it walks, it talks, it does the dishes, it'll screw your wife for you, and if you don't have a wife it will find one for you, get you married to her, and screw her for you, IT IS THAT GOOD, LADIES AND GENTLEMEN.
Primary: Simple passthrough for UI and artwork.
2011-05-16 09:55:34 -07:00
|
|
|
|
2011-06-11 16:46:24 -07:00
|
|
|
uniform float3 Power = float3(1.0f, 1.0f, 1.0f);
|
|
|
|
uniform float3 Floor = float3(0.0f, 0.0f, 0.0f);
|
2011-06-06 14:25:38 -07:00
|
|
|
|
2015-11-17 10:37:56 -08:00
|
|
|
float2 GetAdjustedCoords(float2 coord, float2 centerOffset)
|
|
|
|
{
|
|
|
|
// center coordinates
|
|
|
|
coord -= centerOffset;
|
|
|
|
|
|
|
|
// apply screen scale
|
|
|
|
coord /= ScreenScale;
|
|
|
|
|
|
|
|
// un-center coordinates
|
|
|
|
coord += centerOffset;
|
|
|
|
|
|
|
|
// apply screen offset
|
|
|
|
coord += (centerOffset * 2.0) * ScreenOffset;
|
|
|
|
|
|
|
|
return coord;
|
|
|
|
}
|
|
|
|
|
Initial shader import (nw)
Focus: 8-sample blur that averages 7 samples around a center sample.
Phosphor: Not currently used, treated as a pass-through by drawd3d.c, but could be used to implement additional convolutions in a second pass.
Pincushion: Used (when commented in in drawd3d.c) to pincushion an entire full-screen texture but not otherwise apply any convolutions.
Post: The meat and potatoes. It does scanlines, it does aperture masking, it does dot crawl, it does chroma subsampling, it does YIQ colorspace convolution, it does RGB colorspace convolution, it does pincushioning, it walks, it talks, it does the dishes, it'll screw your wife for you, and if you don't have a wife it will find one for you, get you married to her, and screw her for you, IT IS THAT GOOD, LADIES AND GENTLEMEN.
Primary: Simple passthrough for UI and artwork.
2011-05-16 09:55:34 -07:00
|
|
|
float4 ps_main(PS_INPUT Input) : COLOR
|
|
|
|
{
|
2015-05-03 05:41:05 -07:00
|
|
|
float2 ScreenTexelDims = 1.0f / ScreenDims;
|
2015-12-25 11:02:47 -08:00
|
|
|
float2 SourceTexelDims = 1.0f / SourceDims;
|
2015-05-03 05:41:05 -07:00
|
|
|
|
2015-12-31 07:59:23 -08:00
|
|
|
float2 HalfSourceRect = SourceRect * 0.5f;
|
2015-11-17 10:37:56 -08:00
|
|
|
|
2015-05-03 05:41:05 -07:00
|
|
|
float2 ScreenCoord = Input.ScreenCoord / ScreenDims;
|
2015-11-17 10:37:56 -08:00
|
|
|
float2 BaseCoord = GetAdjustedCoords(Input.TexCoord, HalfSourceRect);
|
2015-05-03 05:41:05 -07:00
|
|
|
|
2015-09-26 09:22:51 -07:00
|
|
|
// Color
|
2015-05-03 05:41:05 -07:00
|
|
|
float4 BaseColor = tex2D(DiffuseSampler, BaseCoord);
|
|
|
|
BaseColor.a = 1.0f;
|
|
|
|
|
2015-11-17 10:37:56 -08:00
|
|
|
if (BaseCoord.x < 0.0f || BaseCoord.y < 0.0f)
|
|
|
|
{
|
|
|
|
BaseColor.rgb = 0.0f;
|
|
|
|
}
|
|
|
|
|
2015-05-03 05:41:05 -07:00
|
|
|
// Mask Simulation (may not affect bloom)
|
|
|
|
if (!PrepareBloom)
|
|
|
|
{
|
2015-05-15 10:54:52 -07:00
|
|
|
float2 shadowDims = ShadowDims;
|
2015-12-31 07:59:23 -08:00
|
|
|
shadowDims = SwapXY
|
2015-05-15 10:54:52 -07:00
|
|
|
? shadowDims.yx
|
|
|
|
: shadowDims.xy;
|
2015-05-09 02:40:23 -07:00
|
|
|
|
2015-05-03 05:41:05 -07:00
|
|
|
float2 shadowUV = ShadowUV;
|
2015-12-31 07:59:23 -08:00
|
|
|
// shadowUV = SwapXY
|
2015-05-09 02:40:23 -07:00
|
|
|
// ? shadowUV.yx
|
|
|
|
// : shadowUV.xy;
|
|
|
|
|
2015-12-26 03:27:07 -08:00
|
|
|
float2 screenCoord = ShadowTileMode == 0 ? ScreenCoord : BaseCoord;
|
2015-12-31 07:59:23 -08:00
|
|
|
screenCoord = SwapXY
|
2015-05-03 05:41:05 -07:00
|
|
|
? screenCoord.yx
|
|
|
|
: screenCoord.xy;
|
2015-05-09 02:40:23 -07:00
|
|
|
|
|
|
|
float2 shadowCount = ShadowCount;
|
2015-12-31 07:59:23 -08:00
|
|
|
shadowCount = SwapXY
|
2015-05-09 02:40:23 -07:00
|
|
|
? shadowCount.yx
|
|
|
|
: shadowCount.xy;
|
|
|
|
|
2015-12-26 03:27:07 -08:00
|
|
|
float2 shadowTile = ((ShadowTileMode == 0 ? ScreenTexelDims : SourceTexelDims) * shadowCount);
|
2015-12-31 07:59:23 -08:00
|
|
|
shadowTile = SwapXY
|
2015-05-03 05:41:05 -07:00
|
|
|
? shadowTile.yx
|
|
|
|
: shadowTile.xy;
|
|
|
|
|
|
|
|
float2 ShadowFrac = frac(screenCoord / shadowTile);
|
|
|
|
float2 ShadowCoord = (ShadowFrac * shadowUV);
|
2015-05-15 10:54:52 -07:00
|
|
|
ShadowCoord += 0.5f / shadowDims; // half texel offset
|
2015-12-31 07:59:23 -08:00
|
|
|
// ShadowCoord = SwapXY
|
2015-05-09 02:40:23 -07:00
|
|
|
// ? ShadowCoord.yx
|
|
|
|
// : ShadowCoord.xy;
|
|
|
|
|
2015-12-25 11:02:47 -08:00
|
|
|
float4 ShadowColor = tex2D(ShadowSampler, ShadowCoord);
|
|
|
|
float3 ShadowMaskColor = lerp(1.0f, ShadowColor.rgb, ShadowAlpha);
|
|
|
|
float ShadowMaskClear = (1.0f - ShadowColor.a) * ShadowAlpha;
|
2015-05-03 05:41:05 -07:00
|
|
|
|
2015-12-25 11:02:47 -08:00
|
|
|
// apply shadow mask color
|
|
|
|
BaseColor.rgb *= ShadowMaskColor;
|
|
|
|
// clear shadow mask by background color
|
|
|
|
BaseColor.rgb = lerp(BaseColor.rgb, BackColor, ShadowMaskClear);
|
2015-05-03 05:41:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// Color Compression (may not affect bloom)
|
|
|
|
if (!PrepareBloom)
|
|
|
|
{
|
|
|
|
// increasing the floor of the signal without affecting the ceiling
|
|
|
|
BaseColor.rgb = Floor + (1.0f - Floor) * BaseColor.rgb;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Color Power (may affect bloom)
|
|
|
|
BaseColor.r = pow(BaseColor.r, Power.r);
|
|
|
|
BaseColor.g = pow(BaseColor.g, Power.g);
|
|
|
|
BaseColor.b = pow(BaseColor.b, Power.b);
|
|
|
|
|
|
|
|
// Scanline Simulation (may not affect bloom)
|
|
|
|
if (!PrepareBloom)
|
|
|
|
{
|
2015-12-24 05:06:01 -08:00
|
|
|
// Scanline Simulation (may not affect vector screen)
|
|
|
|
if (!PrepareVector)
|
2015-09-26 09:22:51 -07:00
|
|
|
{
|
|
|
|
float InnerSine = BaseCoord.y * ScanlineScale * SourceDims.y;
|
|
|
|
float ScanJitter = ScanlineOffset * SourceDims.y;
|
|
|
|
float ScanBrightMod = sin(InnerSine * PI + ScanJitter);
|
|
|
|
float3 ScanColor = lerp(1.0f, (pow(ScanBrightMod * ScanBrightMod, ScanlineHeight) * ScanlineBrightScale + 1.0f + ScanlineBrightOffset) * 0.5f, ScanlineAlpha);
|
|
|
|
|
|
|
|
BaseColor.rgb *= ScanColor;
|
|
|
|
}
|
2015-05-03 05:41:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// Output
|
2015-07-12 14:28:38 -07:00
|
|
|
float4 Output = PrepareVector
|
|
|
|
? BaseColor * (Input.Color + float4(1.0f, 1.0f, 1.0f, 0.0f))
|
|
|
|
: BaseColor * Input.Color;
|
2014-01-23 16:30:29 -08:00
|
|
|
Output.a = 1.0f;
|
|
|
|
|
|
|
|
return Output;
|
Initial shader import (nw)
Focus: 8-sample blur that averages 7 samples around a center sample.
Phosphor: Not currently used, treated as a pass-through by drawd3d.c, but could be used to implement additional convolutions in a second pass.
Pincushion: Used (when commented in in drawd3d.c) to pincushion an entire full-screen texture but not otherwise apply any convolutions.
Post: The meat and potatoes. It does scanlines, it does aperture masking, it does dot crawl, it does chroma subsampling, it does YIQ colorspace convolution, it does RGB colorspace convolution, it does pincushioning, it walks, it talks, it does the dishes, it'll screw your wife for you, and if you don't have a wife it will find one for you, get you married to her, and screw her for you, IT IS THAT GOOD, LADIES AND GENTLEMEN.
Primary: Simple passthrough for UI and artwork.
2011-05-16 09:55:34 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2015-12-31 07:32:35 -08:00
|
|
|
// Scanline & Shadowmask Technique
|
Initial shader import (nw)
Focus: 8-sample blur that averages 7 samples around a center sample.
Phosphor: Not currently used, treated as a pass-through by drawd3d.c, but could be used to implement additional convolutions in a second pass.
Pincushion: Used (when commented in in drawd3d.c) to pincushion an entire full-screen texture but not otherwise apply any convolutions.
Post: The meat and potatoes. It does scanlines, it does aperture masking, it does dot crawl, it does chroma subsampling, it does YIQ colorspace convolution, it does RGB colorspace convolution, it does pincushioning, it walks, it talks, it does the dishes, it'll screw your wife for you, and if you don't have a wife it will find one for you, get you married to her, and screw her for you, IT IS THAT GOOD, LADIES AND GENTLEMEN.
Primary: Simple passthrough for UI and artwork.
2011-05-16 09:55:34 -07:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2015-12-31 07:32:35 -08:00
|
|
|
technique DefaultTechnique
|
Initial shader import (nw)
Focus: 8-sample blur that averages 7 samples around a center sample.
Phosphor: Not currently used, treated as a pass-through by drawd3d.c, but could be used to implement additional convolutions in a second pass.
Pincushion: Used (when commented in in drawd3d.c) to pincushion an entire full-screen texture but not otherwise apply any convolutions.
Post: The meat and potatoes. It does scanlines, it does aperture masking, it does dot crawl, it does chroma subsampling, it does YIQ colorspace convolution, it does RGB colorspace convolution, it does pincushioning, it walks, it talks, it does the dishes, it'll screw your wife for you, and if you don't have a wife it will find one for you, get you married to her, and screw her for you, IT IS THAT GOOD, LADIES AND GENTLEMEN.
Primary: Simple passthrough for UI and artwork.
2011-05-16 09:55:34 -07:00
|
|
|
{
|
2014-01-23 16:30:29 -08:00
|
|
|
pass Pass0
|
|
|
|
{
|
|
|
|
Lighting = FALSE;
|
Initial shader import (nw)
Focus: 8-sample blur that averages 7 samples around a center sample.
Phosphor: Not currently used, treated as a pass-through by drawd3d.c, but could be used to implement additional convolutions in a second pass.
Pincushion: Used (when commented in in drawd3d.c) to pincushion an entire full-screen texture but not otherwise apply any convolutions.
Post: The meat and potatoes. It does scanlines, it does aperture masking, it does dot crawl, it does chroma subsampling, it does YIQ colorspace convolution, it does RGB colorspace convolution, it does pincushioning, it walks, it talks, it does the dishes, it'll screw your wife for you, and if you don't have a wife it will find one for you, get you married to her, and screw her for you, IT IS THAT GOOD, LADIES AND GENTLEMEN.
Primary: Simple passthrough for UI and artwork.
2011-05-16 09:55:34 -07:00
|
|
|
|
2014-01-23 16:30:29 -08:00
|
|
|
VertexShader = compile vs_3_0 vs_main();
|
2015-05-03 05:41:05 -07:00
|
|
|
PixelShader = compile ps_3_0 ps_main();
|
2014-01-23 16:30:29 -08:00
|
|
|
}
|
2015-05-03 05:41:05 -07:00
|
|
|
}
|