From 26c35b59b0c40c2d59cf4e7e9708b5020d6e80c5 Mon Sep 17 00:00:00 2001 From: Sasha Date: Thu, 20 Apr 2023 22:13:02 +0100 Subject: [PATCH] fixed focus laser, improved F1 TAA behaviour --- shaders/composite1.fsh | 26 ++++++++++++++++++++++++++ shaders/composite2.fsh | 26 -------------------------- shaders/composite5.fsh | 9 +++++++-- shaders/shaders.properties | 2 +- 4 files changed, 34 insertions(+), 29 deletions(-) diff --git a/shaders/composite1.fsh b/shaders/composite1.fsh index 384aec5..87f25ce 100644 --- a/shaders/composite1.fsh +++ b/shaders/composite1.fsh @@ -65,6 +65,7 @@ uniform mat4 shadowProjection; uniform mat4 gbufferModelView; // uniform float viewWidth; // uniform float viewHeight; +uniform int hideGUI; uniform float aspectRatio; uniform vec2 texelSize; uniform vec3 cameraPosition; @@ -1176,6 +1177,31 @@ void main() { // gl_FragData[0].rgb = vec3(1.0); // if(z < 1) gl_FragData[0].rgb = Custom_GGX(normal, -np3, WsunVec, SpecularTex.r, SpecularTex.g) * vec3(1.0); + #ifdef DOF_JITTER + vec3 laserColor; + #if FOCUS_LASER_COLOR == 0 // Red + laserColor = vec3(25, 0, 0); + #elif FOCUS_LASER_COLOR == 1 // Green + laserColor = vec3(0, 25, 0); + #elif FOCUS_LASER_COLOR == 2 // Blue + laserColor = vec3(0, 0, 25); + #elif FOCUS_LASER_COLOR == 3 // Pink + laserColor = vec3(25, 10, 15); + #elif FOCUS_LASER_COLOR == 4 // Yellow + laserColor = vec3(25, 25, 0); + #elif FOCUS_LASER_COLOR == 5 // White + laserColor = vec3(25); + #endif + + #if DOF_JITTER_FOCUS < 0 + float focusDist = mix(pow(512.0, screenBrightness), 512.0 * screenBrightness, 0.25); + #else + float focusDist = DOF_JITTER_FOCUS; + #endif + + if( hideGUI < 1.0) gl_FragData[0].rgb += laserColor * pow( clamp( 1.0-abs(focusDist-abs(fragpos.z)) ,0,1),25) ; + #endif + /* DRAWBUFFERS:3 */ } \ No newline at end of file diff --git a/shaders/composite2.fsh b/shaders/composite2.fsh index e259cef..59e7a25 100644 --- a/shaders/composite2.fsh +++ b/shaders/composite2.fsh @@ -40,7 +40,6 @@ uniform float near; uniform int frameCounter; uniform float aspectRatio; uniform float screenBrightness; -uniform float hideGUI; uniform float rainStrength; uniform float sunElevation; uniform ivec2 eyeBrightnessSmooth; @@ -234,31 +233,6 @@ void main() { waterVolumetrics(vl, vec3(0.0), fragpos, estEyeDepth, estEyeDepth, length(fragpos), noise, totEpsilon, scatterCoef, (ambientUp*8./150./3.*0.5) , lightCol.rgb*8./150./3.0*(1.0-pow(1.0-sunElevation*lightCol.a,5.0)), dot(normalize(fragpos), normalize(sunVec) )); - // #ifdef DOF_JITTER - // vec3 laserColor; - // #if FOCUS_LASER_COLOR == 0 // Red - // laserColor = vec3(25, 0, 0); - // #elif FOCUS_LASER_COLOR == 1 // Green - // laserColor = vec3(0, 25, 0); - // #elif FOCUS_LASER_COLOR == 2 // Blue - // laserColor = vec3(0, 0, 25); - // #elif FOCUS_LASER_COLOR == 3 // Pink - // laserColor = vec3(25, 10, 15); - // #elif FOCUS_LASER_COLOR == 4 // Yellow - // laserColor = vec3(25, 25, 0); - // #elif FOCUS_LASER_COLOR == 5 // White - // laserColor = vec3(25); - // #endif - - // #if DOF_JITTER_FOCUS < 0 - // float focusDist = mix(pow(512.0, screenBrightness), 512.0 * screenBrightness, 0.25); - // #else - // float focusDist = DOF_JITTER_FOCUS; - // #endif - - // if( hideGUI < 1.0) gl_FragData[0].rgb += laserColor * pow( clamp( 1.0-abs(focusDist-abs(fragpos.z)) ,0,1),25) ; - // #endif - gl_FragData[0] = clamp(vec4(vl,1.0),0.000001,65000.); } } diff --git a/shaders/composite5.fsh b/shaders/composite5.fsh index d8acfb8..f8aa1d3 100644 --- a/shaders/composite5.fsh +++ b/shaders/composite5.fsh @@ -76,6 +76,7 @@ uniform vec2 texelSize; uniform float frameTimeCounter; uniform float viewHeight; uniform float viewWidth; +uniform int hideGUI; uniform int frameCounter; uniform int framemod8; uniform vec3 previousCameraPosition; @@ -454,8 +455,12 @@ void main() { #ifndef SPLIT_RENDER #ifdef SCREENSHOT_MODE - - vec4 color = TAA_hq_render(); + vec4 color; + if(hideGUI >= 1) { + color = TAA_hq_render(); + } else { + color = vec4(clamp(fp10Dither(texture2D(colortex3,texcoord).rgb,triangularize(interleaved_gradientNoise())),0.,65000.), 0.0); + } gl_FragData[0] = color; diff --git a/shaders/shaders.properties b/shaders/shaders.properties index 06b0c68..43a9d13 100644 --- a/shaders/shaders.properties +++ b/shaders/shaders.properties @@ -57,7 +57,7 @@ screen = \ screen.JITTER_DOF = \ DOF_JITTER DOF_JITTER_SHADOW \ DOF_JITTER_FOCUS JITTER_STRENGTH \ -DOF_CAMERA_WIDTH aperture_stops +DOF_CAMERA_WIDTH FOCUS_LASER_COLOR \ ######## LIGHTING ### DIRECT LIGHT