Some small fixes, that I noticed.

This commit is contained in:
Asmodean 2014-11-06 10:56:33 +00:00
parent 937e475169
commit df0a9c4683
3 changed files with 61 additions and 47 deletions

View File

@ -29,8 +29,8 @@
#define BILINEAR_FILTERING 0 //#BiLinear Fullscreen Texture Filtering. BiLinear filtering - light to medium filtering of textures. [2D]
#define BICUBIC_FILTERING 0 //#Bicubic Fullscreen Texture Filtering. BiCubic filtering - medium to strong filtering of textures. [2D]
#define GAUSSIAN_FILTERING 0 //#Gaussian Fullscreen Texture Filtering. Gaussian filtering - strong to extra strong filtering of textures. [2D]
#define BICUBLIC_SCALER 0 //#Bicubic Interpolation Scaling. Uses BCS on up scaling, and downsampling of games, for smoother scaling.
#define LANCZOS_SCALER 0 //#Lanczos Interpolation Scaling. Uses Lanczos on up scaling, and downsampling of games for smoother scaling.
#define BICUBLIC_SCALAR 0 //#Bicubic Interpolation Scaling. Uses BCS on up scaling, and downsampling of games, for smoother scaling.
#define LANCZOS_SCALAR 0 //#Lanczos Interpolation Scaling. Uses Lanczos on up scaling, and downsampling of games for smoother scaling.
//-#[LIGHTING & COLOUR] [1=ON|0=OFF] #READ: These can all be turned on & off independently of each other. [For High Dynamic Range(HDR) use Bloom & Tonemapping together]
#define BLENDED_BLOOM 1 //#High Quality Bloom, using blend techniques. Blooms naturally, per environment.
@ -53,7 +53,7 @@
------------------------------------------------------------------------------*/
//##[FXAA OPTIONS]##
#define FxaaSubpixMax 0.50 //[0.00 to 1.00] Amount of subpixel aliasing removal. Higher values: softer. Lower values: sharper. 0.00: Edge only.
#define FxaaSubpixMax 0.25 //[0.00 to 1.00] Amount of subpixel aliasing removal. Higher values: softer. Lower values: sharper. 0.00: Edge only.
#define FxaaQuality 4 //[1|2|3|4] Overall Fxaa quality preset (pixel coverage). 1: Low, 2: Medium, 3: High, 4: Ultra.
#define FxaaEarlyExit 1 //[0 or 1] Use Fxaa early exit pathing. When enabled: Only luma edge pixels are antialiased. When disabled: the entire scene is antialiased(FSAA).
@ -71,18 +71,18 @@
#define GaussianSpread 0.75 //[0.50 to 4.00] The filtering spread & offset levels. Controls the sampling spread of the filtering.
//##[BLOOM OPTIONS]##
#define BloomType BlendBloom //[BlendScreen, BlendOverlay, BlendBloom, BlendAddLight] The type of blending for the bloom (Default: BlendBloom).
#define BloomStrength 0.200 //[0.100 to 1.000] Overall strength of the bloom. You may want to readjust for each blend type.
#define BloomType BlendGlow //[BlendGlow, BlendLuma, BlendAddLight, BlendScreen, BlendOverlay] The type of blending for the bloom.
#define BloomStrength 0.250 //[0.100 to 1.000] Overall strength of the bloom. You may want to readjust for each blend type.
#define BlendStrength 1.000 //[0.100 to 1.000] Strength of the bloom blend. Lower for less blending, higher for more. (Default: 1.000).
#define BlendSpread 4.000 //[1.000 to 8.000] Width of the bloom 'glow' spread. 0.000 = off. Scales with BloomStrength. (Default: 4.000).
#define BloomWidth 4.000 //[1.000 to 8.000] Width of the bloom 'glow' spread. 0.000 = off. Scales with BloomStrength. (Default: 4.000).
#define BloomReds 1.00 //[0.00 to 8.00] Red channel component of the RGB correction curve. Higher values equals red reduction. 1.00 is default.
#define BloomGreens 1.00 //[0.00 to 8.00] Green channel component of the RGB correction curve. Higher values equals green reduction. 1.00 is default.
#define BloomBlues 1.00 //[0.00 to 8.00] Blue channel component of the RGB correction curve. Higher values equals blue reduction. 1.00 is default.
//##[TONEMAP OPTIONS]##
#define TonemapType 1 //[1 or 2] Type of tone mapping operator. 1 is natural map, 2 is cinematic(darker) map. (Default: 1)
#define ToneAmount 0.25 //[0.00 to 1.00] Tonemap strength (scene correction) higher for stronger tone mapping, lower for lighter. (Default: ~ 0.25)
#define BlackLevels 0.30 //[0.00 to 1.00] Black level balance (shadow correction). Increase to lighten blacks, lower to deepen them. (Default: ~ 0.30)
#define ToneAmount 0.30 //[0.10 to 1.00] Tonemap strength (scene correction) higher for stronger tone mapping, lower for lighter. (Default: ~ 0.25)
#define BlackLevels 0.30 //[0.10 to 1.00] Black level balance (shadow correction). Increase to lighten blacks, lower to deepen them. (Default: ~ 0.30)
#define Exposure 1.00 //[0.10 to 2.00] White correction (brightness) Higher values for more Exposure, lower for less.
#define Luminance 1.00 //[0.10 to 2.00] Luminance average (luminance correction) Higher values to decrease luminance average, lower values to increase luminance.
#define WhitePoint 1.02 //[0.10 to 2.00] Whitepoint avg (lum correction) Use to alter the scene whitepoint average. Raising can give a cinema look.
@ -95,9 +95,9 @@
//##[FILMIC OPTIONS]##
#define FilmicProcess 0 //[0 or 1] Filmic cross processing. Alters the mood of the scene, for more of a filmic look. Typically best suited to realistic style games.
#define RedShift 0.60 //[0.10 to 1.00] Red colour component shift of the filmic tone shift. Alters the red balance of the shift. Requires FilmicProcess.
#define GreenShift 0.50 //[0.10 to 1.00] Green colour component shift of the filmic tone shift. Alters the green balance of the shift. Requires FilmicProcess.
#define BlueShift 0.50 //[0.10 to 1.00] Blue colour component shift of the filmic tone shift. Alters the blue balance of the shift. Requires FilmicProcess.
#define RedShift 0.50 //[0.10 to 1.00] Red colour component shift of the filmic tone shift. Alters the red balance of the shift. Requires FilmicProcess.
#define GreenShift 0.45 //[0.10 to 1.00] Green colour component shift of the filmic tone shift. Alters the green balance of the shift. Requires FilmicProcess.
#define BlueShift 0.45 //[0.10 to 1.00] Blue colour component shift of the filmic tone shift. Alters the blue balance of the shift. Requires FilmicProcess.
#define ShiftRatio 0.25 //[0.10 to 1.00] The blending ratio for the base colour and the colour shift. Higher for a stronger effect. Requires FilmicProcess.
//##[SHARPEN OPTIONS]##
@ -117,7 +117,7 @@
//##[CSHADE OPTIONS]##
#define EdgeStrength 1.50 //[0.00 to 4.00] Overall strength of the cel edge outline effect. 0.00 = no outlines.
#define EdgeFilter 0.60 //[0.10 to 2.00] Filters out fainter cel edges. Use it for balancing the cel edge density. EG: for faces, foliage, etc. Raise to filter out more edges.
#define EdgeThickness 1.25 //[0.50 to 4.00] Thickness of the cel edges. Increase for thicker outlining. Note: when downsampling, you may need to raise this further to keep the edges as noticeable.
#define EdgeThickness 1.00 //[0.50 to 4.00] Thickness of the cel edges. Increase for thicker outlining. Note: when downsampling, raise this further to keep the edges as noticeable.
#define PaletteType 2 //[1|2|3] The colour palette to use. 1 is Game Original, 2 is Animated Shading, 3 is Water Painting (Default is 2: Animated Shading). #!Options below don't affect palette 1.
#define UseYuvLuma 0 //[0 or 1] Uses YUV luma calculations, or base colour luma calculations. Yuv luma can produce a better shaded look, but if it looks odd, disable it for that game.
#define LumaConversion 1 //[0 or 1] Uses BT.601, or BT.709, RGB<-YUV->RGB conversions. Some games prefer 601, but most prefer 709. BT.709 is typically recommended.

View File

@ -75,8 +75,8 @@ float RGBLuminance(float3 color)
#endif
#if (FxaaQuality == 4)
#define FxaaEdgeThreshold 0.033
#define FxaaEdgeThresholdMin 0.0
#define FxaaEdgeThreshold 0.063
#define FxaaEdgeThresholdMin 0.000
#elif (FxaaQuality == 3)
#define FxaaEdgeThreshold 0.125
#define FxaaEdgeThresholdMin 0.0312
@ -701,11 +701,11 @@ float4 GaussianPass(float4 color, float2 texcoord)
#endif
/*------------------------------------------------------------------------------
[SCALER CODE SECTION]
[BICUBIC SCALAR CODE SECTION]
------------------------------------------------------------------------------*/
#if (BICUBLIC_SCALER == 1)
float4 BicubicScaler(in SamplerState tex, in float2 uv, in float2 texSize)
#if (BICUBLIC_SCALAR == 1)
float4 BicubicScalar(in SamplerState tex, in float2 uv, in float2 texSize)
{
float2 rec_nrCP = float2(1.0/texSize.x, 1.0/texSize.y);
@ -751,24 +751,18 @@ float4 BicubicScaler(in SamplerState tex, in float2 uv, in float2 texSize)
return res;
}
float4 BiCubicScalerPass(float4 color, float2 texcoord)
float4 BiCubicScalarPass(float4 color, float2 texcoord)
{
color = BicubicScaler(TextureSampler, texcoord, screenSize);
color = BicubicScalar(TextureSampler, texcoord, screenSize);
return color;
}
#endif
#if (LANCZOS_SCALER == 1)
float4 weight4(float x)
{
#define FIX(c) max(abs(c), 1e-5);
const float PI = 3.1415926535897932384626433832795;
float4 sample = FIX(PI * float4(1.0 + x, x, 1.0 - x, 2.0 - x));
float4 ret = sin(sample) * sin(sample / 2.0) / (sample * sample);
return ret / dot(ret, float4(1.0, 1.0, 1.0, 1.0));
}
/*------------------------------------------------------------------------------
[LANCZOS SCALAR CODE SECTION]
------------------------------------------------------------------------------*/
#if (LANCZOS_SCALAR == 1)
float3 pixel(float xpos, float ypos)
{
return Texture.Sample(TextureSampler, float2(xpos, ypos)).rgb;
@ -780,15 +774,28 @@ float3 line_run(float ypos, float4 xpos, float4 linetaps)
pixel(xpos.z, ypos), pixel(xpos.w, ypos)));
}
float4 LanczosScaler(float2 texcoord, float2 texSize)
float4 weight4(float x)
{
#define FIX(c) max(abs(c), 1e-5);
const float PI = 3.1415926535897932384626433832795;
float4 sample = FIX(PI * float4(1.0 + x, x, 1.0 - x, 2.0 - x));
float4 ret = sin(sample) * sin(sample / 2.0) / (sample * sample);
return ret / dot(ret, float4(1.0, 1.0, 1.0, 1.0));
}
float4 LanczosScalar(float2 texcoord, float2 texSize)
{
float2 stepxy = 1.0 / texSize;
float2 pos = texcoord + stepxy;
float2 f = frac(pos / stepxy);
float2 xystart = (-2.0 - f) * stepxy + pos;
float4 xpos = float4(xystart.x, xystart.x + stepxy.x, xystart.x +
stepxy.x * 2.0, xystart.x + stepxy.x * 3.0);
float4 xpos = float4(xystart.x,
xystart.x + stepxy.x,
xystart.x + stepxy.x * 2.0,
xystart.x + stepxy.x * 3.0);
float4 linetaps = weight4(f.x);
float4 columntaps = weight4(f.y);
@ -801,9 +808,9 @@ float4 LanczosScaler(float2 texcoord, float2 texSize)
line_run(xystart.y + stepxy.y * 3.0, xpos, linetaps))), 1.0);
}
float4 LanczosScalerPass(float4 color, float2 texcoord)
float4 LanczosScalarPass(float4 color, float2 texcoord)
{
color = LanczosScaler(texcoord, screenSize);
color = LanczosScalar(texcoord, screenSize);
return color;
}
#endif
@ -940,7 +947,7 @@ float4 VibrancePass(float4 color, float2 texcoord)
#if (BLENDED_BLOOM == 1)
float3 BlendAddLight(float3 color, float3 bloom)
{
return color + bloom;
return (color + bloom) * 0.75f;
}
float3 BlendScreen(float3 color, float3 bloom)
@ -948,10 +955,17 @@ float3 BlendScreen(float3 color, float3 bloom)
return (color + bloom) - (color * bloom);
}
float3 BlendBloom(float3 color, float3 bloom)
float3 BlendLuma(float3 color, float3 bloom)
{
float3 coeff = step(0.5, color);
return lerp((color + bloom) - (color * bloom), (bloom + bloom) - (bloom * bloom), coeff);
return lerp((color * bloom), (1.0 - ((1.0 - color) * (1.0 - bloom))), RGBLuminance(color + bloom));
}
float3 BlendGlow(float3 color, float3 bloom)
{
float3 glow = step(0.5, color);
glow = lerp((color + bloom) - (color * bloom), (bloom + bloom) - (bloom * bloom), glow);
return glow;
}
float3 BlendOverlay(float3 color, float3 bloom)
@ -983,7 +997,7 @@ float3 BloomCorrection(float3 color)
color.g = (1.0 / (1.0 + exp(float(-BloomGreens) * (color.g - 0.5))) - Y) / (1.0 - 2.0 * Y);
color.b = (1.0 / (1.0 + exp(float(-BloomBlues) * (color.b - 0.5))) - Z) / (1.0 - 2.0 * Z);
return saturate(color);
return color;
}
float4 BloomPass(float4 color, float2 texcoord)
@ -991,8 +1005,8 @@ float4 BloomPass(float4 color, float2 texcoord)
float defocus = 1.25;
float4 bloom = PyramidFilter(TextureSampler, texcoord, pixelSize * defocus);
float2 dx = float2(invDefocus.x * float(BlendSpread), 0.0);
float2 dy = float2(0.0, invDefocus.y * float(BlendSpread));
float2 dx = float2(invDefocus.x * float(BloomWidth), 0.0);
float2 dy = float2(0.0, invDefocus.y * float(BloomWidth));
float2 dx2 = 2.0 * dx;
float2 dy2 = 2.0 * dy;
@ -1123,7 +1137,7 @@ float4 TonemapPass(float4 color, float2 texcoord) : COLOR0
#if (TonemapType == 1)
float Lp = Yxy.r * float(Exposure) / (float(Luminance) + delta);
#elif (TonemapType == 2)
float Lp = Yxy.r * FilmicTonemap(Yxy.rrr) / RGBLuminance(Yxy.rrr) *
float Lp = Yxy.r * FilmicTonemap(Yxy.rrr).r / RGBLuminance(Yxy.rrr) *
float(Exposure) / (float(Luminance) + delta);
#endif
@ -1585,12 +1599,12 @@ PS_OUTPUT ps_main(VS_OUTPUT input)
color = BiCubicPass(color, texcoord);
#endif
#if (BICUBLIC_SCALER == 1)
color = BiCubicScalerPass(color, texcoord);
#if (BICUBLIC_SCALAR == 1)
color = BiCubicScalarPass(color, texcoord);
#endif
#if (LANCZOS_SCALER == 1)
color = LanczosScalerPass(color, texcoord);
#if (LANCZOS_SCALAR == 1)
color = LanczosScalarPass(color, texcoord);
#endif
#if (UHQ_FXAA == 1)

View File

@ -140,7 +140,7 @@ struct FxaaTex { SamplerState smpl; Texture2D tex; };
#define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0))
#endif
#define FxaaEdgeThreshold 0.033
#define FxaaEdgeThreshold 0.063
#define FxaaEdgeThresholdMin 0.00
#define FXAA_QUALITY__P0 1.0
#define FXAA_QUALITY__P1 1.5