added option for DoF to affect dither resolution
This commit is contained in:
parent
aab1ed34ab
commit
6517f1e2b2
4 changed files with 15 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
||||||
#version 120
|
#version 120
|
||||||
|
|
||||||
#define pixelSize 2 // the size of pixels [1 2 4 8 16]
|
#define pixelSize 2 // the size of pixels [1 2 4 8 16]
|
||||||
|
float renderRes = pixelSize;
|
||||||
|
|
||||||
#define dithering // whether or not to apply dithering
|
#define dithering // whether or not to apply dithering
|
||||||
#define colorMode 0 // hsv/rgb [0 1]
|
#define colorMode 0 // hsv/rgb [0 1]
|
||||||
|
@ -63,7 +64,9 @@ const int indexMatrix8x8[64] = int[](0, 32, 8, 40, 2, 34, 10, 42,
|
||||||
63, 31, 55, 23, 61, 29, 53, 21);
|
63, 31, 55, 23, 61, 29, 53, 21);
|
||||||
|
|
||||||
float indexValue() {
|
float indexValue() {
|
||||||
#if pixelSize > 1
|
#if defined(dof) && defined(dofRes)
|
||||||
|
vec2 coord = gl_FragCoord.xy / renderRes;
|
||||||
|
#elif pixelSize > 1
|
||||||
vec2 coord = gl_FragCoord.xy / pixelSize;
|
vec2 coord = gl_FragCoord.xy / pixelSize;
|
||||||
#else
|
#else
|
||||||
vec2 coord = gl_FragCoord.xy;
|
vec2 coord = gl_FragCoord.xy;
|
||||||
|
|
|
@ -38,6 +38,10 @@ option.tWarp.comment=Emulates affine texture mapping responsible for warping tex
|
||||||
screen.FX=FX
|
screen.FX=FX
|
||||||
option.dof=Depth of Field
|
option.dof=Depth of Field
|
||||||
option.dof.comment=Downscale out-of-focus objects
|
option.dof.comment=Downscale out-of-focus objects
|
||||||
|
option.dofRes=DoF Dither
|
||||||
|
option.dofRes.comment=Whether DoF focus affects dither resolution.
|
||||||
|
value.dofRes.0=Static
|
||||||
|
value.dofRes.1=Dynamic
|
||||||
option.worldCurvature=World Curvature
|
option.worldCurvature=World Curvature
|
||||||
value.worldCurvature.0=Off
|
value.worldCurvature.0=Off
|
||||||
value.worldCurvature.1=Chunk
|
value.worldCurvature.1=Chunk
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
|
|
||||||
//#define dof
|
//#define dof
|
||||||
|
#define dofRes
|
||||||
|
|
||||||
uniform float centerDepthSmooth;
|
uniform float centerDepthSmooth;
|
||||||
uniform sampler2D depthtex1;
|
uniform sampler2D depthtex1;
|
||||||
|
@ -9,11 +10,15 @@ const float centerDepthSmoothHalfLife = 16f;
|
||||||
vec2 depthOfField() {
|
vec2 depthOfField() {
|
||||||
float depth = texture2D(depthtex1, texcoord).x;
|
float depth = texture2D(depthtex1, texcoord).x;
|
||||||
float distance = depth - centerDepthSmooth;
|
float distance = depth - centerDepthSmooth;
|
||||||
int stops = min(int(distance * 96), 5);
|
int stops = max(min(int(distance * 96), 5), 0);
|
||||||
|
|
||||||
float virtualSize = pow(float(pixelSize), 1 + stops);//1 + stops);
|
float virtualSize = pow(float(pixelSize), 1 + stops);//1 + stops);
|
||||||
vec2 view = vec2(viewWidth, viewHeight) / virtualSize;
|
vec2 view = vec2(viewWidth, viewHeight) / virtualSize;
|
||||||
float offset = (ceil(virtualSize * 0.5) - 0.5) / virtualSize;
|
float offset = (ceil(virtualSize * 0.5) - 0.5) / virtualSize;
|
||||||
|
|
||||||
|
#ifdef dofRes
|
||||||
|
renderRes = virtualSize;
|
||||||
|
#endif
|
||||||
return (floor(texcoord * view) + offset) / view;
|
return (floor(texcoord * view) + offset) / view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ screen.COLOR=colorMode dithering <empty> rgbSteps <empty> <empty> hueSteps satSt
|
||||||
screen.PSX=vWarp tWarp
|
screen.PSX=vWarp tWarp
|
||||||
|
|
||||||
# fx
|
# fx
|
||||||
screen.FX=dof worldCurvature
|
screen.FX=dof dofRes
|
||||||
|
|
||||||
# -- CONDITIONALS --
|
# -- CONDITIONALS --
|
||||||
gbuffers_hand.enabled=tWarp
|
gbuffers_hand.enabled=tWarp
|
||||||
|
|
Loading…
Reference in a new issue