mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2025-01-03 16:13:30 +08:00
fixed jitter dof and added it to dh geometry
This commit is contained in:
parent
e0f61f0128
commit
85a1b68bf0
@ -11,6 +11,15 @@ flat varying float EMISSIVE;
|
||||
uniform vec2 texelSize;
|
||||
uniform int framemod8;
|
||||
|
||||
#if DOF_QUALITY == 5
|
||||
uniform int hideGUI;
|
||||
uniform int frameCounter;
|
||||
uniform float aspectRatio;
|
||||
uniform float screenBrightness;
|
||||
uniform float far;
|
||||
#include "/lib/bokeh.glsl"
|
||||
#endif
|
||||
|
||||
const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
|
||||
vec2(-1.,3.)/8.,
|
||||
vec2(5.0,1.)/8.,
|
||||
@ -74,4 +83,22 @@ void main() {
|
||||
float MATERIALS = 0.65;
|
||||
|
||||
normals_and_materials = vec4(normalize(gl_NormalMatrix * gl_Normal), MATERIALS);
|
||||
|
||||
#if DOF_QUALITY == 5
|
||||
vec2 jitter = clamp(jitter_offsets[frameCounter % 64], -1.0, 1.0);
|
||||
jitter = rotate(radians(float(frameCounter))) * jitter;
|
||||
jitter.y *= aspectRatio;
|
||||
jitter.x *= DOF_ANAMORPHIC_RATIO;
|
||||
|
||||
#if MANUAL_FOCUS == -2
|
||||
float focusMul = 0;
|
||||
#elif MANUAL_FOCUS == -1
|
||||
float focusMul = gl_Position.z + (far / 3.0) - mix(pow(512.0, screenBrightness), 512.0 * screenBrightness, 0.25);
|
||||
#else
|
||||
float focusMul = gl_Position.z + (far / 3.0) - MANUAL_FOCUS;
|
||||
#endif
|
||||
|
||||
vec2 totalOffset = (jitter * JITTER_STRENGTH) * focusMul * 1e-2;
|
||||
gl_Position.xy += hideGUI >= 1 ? totalOffset : vec2(0);
|
||||
#endif
|
||||
}
|
@ -27,6 +27,16 @@ uniform float sunElevation;
|
||||
uniform vec2 texelSize;
|
||||
uniform int framemod8;
|
||||
|
||||
#if DOF_QUALITY == 5
|
||||
uniform int hideGUI;
|
||||
uniform int frameCounter;
|
||||
uniform float aspectRatio;
|
||||
uniform float screenBrightness;
|
||||
uniform float far;
|
||||
#include "/lib/bokeh.glsl"
|
||||
#endif
|
||||
|
||||
|
||||
const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
|
||||
vec2(-1.,3.)/8.,
|
||||
vec2(5.0,1.)/8.,
|
||||
@ -93,4 +103,22 @@ void main() {
|
||||
gl_Position.xy += offsets[framemod8] * gl_Position.w*texelSize;
|
||||
#endif
|
||||
|
||||
#if DOF_QUALITY == 5
|
||||
vec2 jitter = clamp(jitter_offsets[frameCounter % 64], -1.0, 1.0);
|
||||
jitter = rotate(radians(float(frameCounter))) * jitter;
|
||||
jitter.y *= aspectRatio;
|
||||
jitter.x *= DOF_ANAMORPHIC_RATIO;
|
||||
|
||||
#if MANUAL_FOCUS == -2
|
||||
float focusMul = 0;
|
||||
#elif MANUAL_FOCUS == -1
|
||||
float focusMul = gl_Position.z + (far / 3.0) - mix(pow(512.0, screenBrightness), 512.0 * screenBrightness, 0.25);
|
||||
#else
|
||||
float focusMul = gl_Position.z + (far / 3.0) - MANUAL_FOCUS;
|
||||
#endif
|
||||
|
||||
vec2 totalOffset = (jitter * JITTER_STRENGTH) * focusMul * 1e-2;
|
||||
gl_Position.xy += hideGUI >= 1 ? totalOffset : vec2(0);
|
||||
#endif
|
||||
|
||||
}
|
@ -150,4 +150,22 @@ void main() {
|
||||
#ifdef TAA
|
||||
gl_Position.xy += offsets[framemod8] * gl_Position.w*texelSize;
|
||||
#endif
|
||||
|
||||
#if DOF_QUALITY == 5
|
||||
vec2 jitter = clamp(jitter_offsets[frameCounter % 64], -1.0, 1.0);
|
||||
jitter = rotate(radians(float(frameCounter))) * jitter;
|
||||
jitter.y *= aspectRatio;
|
||||
jitter.x *= DOF_ANAMORPHIC_RATIO;
|
||||
|
||||
#if MANUAL_FOCUS == -2
|
||||
float focusMul = 0;
|
||||
#elif MANUAL_FOCUS == -1
|
||||
float focusMul = gl_Position.z - mix(pow(512.0, screenBrightness), 512.0 * screenBrightness, 0.25);
|
||||
#else
|
||||
float focusMul = gl_Position.z - MANUAL_FOCUS;
|
||||
#endif
|
||||
|
||||
vec2 totalOffset = (jitter * JITTER_STRENGTH) * focusMul * 1e-2;
|
||||
gl_Position.xy += hideGUI >= 1 ? totalOffset : vec2(0);
|
||||
#endif
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ uniform float far;
|
||||
uniform float rainStrength;
|
||||
uniform float screenBrightness;
|
||||
uniform vec4 Moon_Weather_properties; // R = cloud coverage G = fog density
|
||||
uniform int hideGUI;
|
||||
|
||||
uniform int framemod8;
|
||||
const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
|
||||
@ -67,6 +68,8 @@ float ld(float depth) {
|
||||
|
||||
// uniform sampler2D depthtex0;
|
||||
uniform sampler2D dhDepthTex;
|
||||
uniform float dhNearPlane;
|
||||
uniform float dhFarPlane;
|
||||
|
||||
// uniform mat4 gbufferProjectionInverse;
|
||||
uniform mat4 dhProjectionInverse;
|
||||
@ -110,6 +113,9 @@ vec3 ACESFilm2(vec3 x){
|
||||
return clamp((x*(a*x+b))/(x*(c*x+d)+e),0.0,1.0);
|
||||
}
|
||||
|
||||
float linearizeDepthFast(const in float depth, const in float near, const in float far) {
|
||||
return (near * far) / (depth * (near - far) + far);
|
||||
}
|
||||
|
||||
#define linear_to_srgb(x) (pow(x, vec3(1.0/2.2)))
|
||||
void main() {
|
||||
@ -117,7 +123,7 @@ void main() {
|
||||
float vignette = (1.5-dot(texcoord-0.5,texcoord-0.5)*2.);
|
||||
vec3 col = texture2D(colortex5,texcoord).rgb;
|
||||
|
||||
#if DOF_QUALITY >= 0 && DOF_QUALITY < 5
|
||||
#if DOF_QUALITY >= 0
|
||||
/*--------------------------------*/
|
||||
float z = ld(texture2D(depthtex0, texcoord.st*RENDER_SCALE).r)*far;
|
||||
#if MANUAL_FOCUS == -2
|
||||
@ -127,6 +133,7 @@ void main() {
|
||||
#elif MANUAL_FOCUS > 0
|
||||
float focus = MANUAL_FOCUS;
|
||||
#endif
|
||||
#if DOF_QUALITY < 5
|
||||
float pcoc = min(abs(aperture * (focal/100.0 * (z - focus)) / (z * (focus - focal/100.0))),texelSize.x*15.0);
|
||||
#ifdef FAR_BLUR_ONLY
|
||||
pcoc *= float(z > focus);
|
||||
@ -145,6 +152,7 @@ void main() {
|
||||
}
|
||||
col = bcolor/BOKEH_SAMPLES;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
vec2 clampedRes = max(vec2(viewWidth,viewHeight),vec2(1920.0,1080.));
|
||||
|
||||
@ -192,4 +200,40 @@ void main() {
|
||||
#endif
|
||||
|
||||
gl_FragData[0].rgb = clamp(int8Dither(col,texcoord),0.0,1.0);
|
||||
|
||||
|
||||
#if DOF_QUALITY == 5
|
||||
#if FOCUS_LASER_COLOR == 0 // Red
|
||||
vec3 laserColor = vec3(25, 0, 0);
|
||||
#elif FOCUS_LASER_COLOR == 1 // Green
|
||||
vec3 laserColor = vec3(0, 25, 0);
|
||||
#elif FOCUS_LASER_COLOR == 2 // Blue
|
||||
vec3 laserColor = vec3(0, 0, 25);
|
||||
#elif FOCUS_LASER_COLOR == 3 // Pink
|
||||
vec3 laserColor = vec3(25, 10, 15);
|
||||
#elif FOCUS_LASER_COLOR == 4 // Yellow
|
||||
vec3 laserColor = vec3(25, 25, 0);
|
||||
#elif FOCUS_LASER_COLOR == 5 // White
|
||||
vec3 laserColor = vec3(25);
|
||||
#endif
|
||||
float depth = texture(depthtex0, texcoord).r;
|
||||
|
||||
#ifdef DISTANT_HORIZONS
|
||||
float _near = near;
|
||||
float _far = far*4.0;
|
||||
|
||||
if (depth >= 1.0) {
|
||||
depth = texture2D(dhDepthTex, texcoord).x;
|
||||
_near = dhNearPlane;
|
||||
_far = dhFarPlane;
|
||||
}
|
||||
|
||||
depth = linearizeDepthFast(depth, _near, _far);
|
||||
#else
|
||||
depth = linearizeDepthFast(depth, near, far);
|
||||
#endif
|
||||
|
||||
// focus = gl_FragCoord.x * 0.1;
|
||||
if( hideGUI < 1) gl_FragData[0].rgb += laserColor * pow( clamp( 1.0-abs(focus-abs(depth)) ,0,1),25) ;
|
||||
#endif
|
||||
}
|
@ -430,6 +430,10 @@ option.DOF_QUALITY=Depth Of Field
|
||||
option.DOF_ANAMORPHIC_RATIO=Anamorphic Ratio
|
||||
value.MANUAL_FOCUS.-2=Autofocus
|
||||
value.MANUAL_FOCUS.-1=Brightness Slider
|
||||
|
||||
screen.JITTER_DOF=Jitter DOF Settings
|
||||
option.JITTER_STRENGTH=Jitter Strength
|
||||
option.FOCUS_LASER_COLOR=Focus
|
||||
value.FOCUS_LASER_COLOR.0=Red
|
||||
value.FOCUS_LASER_COLOR.1=Green
|
||||
value.FOCUS_LASER_COLOR.2=Blue
|
||||
|
@ -270,7 +270,7 @@ BLISS_SHADERS <empty> \
|
||||
screen.TAA_OPTIONS= SCREENSHOT_MODE <empty> TAA BLEND_FACTOR <empty> TAA_UPSCALING SCALE_FACTOR
|
||||
### DOF
|
||||
screen.DepthOfField.columns = 1
|
||||
screen.DepthOfField = [JITTER_DOF] DOF_QUALITY DOF_ANAMORPHIC_RATIO AUTOFOCUS focal aperture MANUAL_FOCUS DoF_Adaptation_Speed FAR_BLUR_ONLY
|
||||
screen.DepthOfField = DOF_QUALITY DOF_ANAMORPHIC_RATIO AUTOFOCUS focal aperture MANUAL_FOCUS DoF_Adaptation_Speed FAR_BLUR_ONLY [JITTER_DOF]
|
||||
screen.JITTER_DOF.columns=1
|
||||
screen.JITTER_DOF = JITTER_STRENGTH FOCUS_LASER_COLOR SCREENSHOT_MODE
|
||||
### EXPOSURE
|
||||
|
Loading…
x
Reference in New Issue
Block a user