mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2025-06-26 18:22:33 +08:00
Revert "intial changes for commit #495"
This reverts commit 4869877f77
.
This commit is contained in:
@ -1,18 +1,14 @@
|
||||
#include "/lib/settings.glsl"
|
||||
|
||||
uniform sampler2D colortex7;
|
||||
uniform sampler2D colortex5;
|
||||
uniform sampler2D colortex6;
|
||||
uniform sampler2D colortex14;
|
||||
uniform sampler2D depthtex0;
|
||||
uniform sampler2D depthtex1;
|
||||
uniform sampler2D depthtex2;
|
||||
uniform sampler2D noisetex;
|
||||
|
||||
varying vec2 texcoord;
|
||||
uniform vec2 texelSize;
|
||||
uniform float frameTimeCounter;
|
||||
uniform int frameCounter;
|
||||
uniform float viewHeight;
|
||||
uniform float viewWidth;
|
||||
uniform float aspectRatio;
|
||||
@ -23,19 +19,12 @@ uniform int hideGUI;
|
||||
#include "/lib/color_dither.glsl"
|
||||
#include "/lib/res_params.glsl"
|
||||
|
||||
uniform float near;
|
||||
uniform float far;
|
||||
float ld(float dist) {
|
||||
return (2.0 * near) / (far + near - dist * (far - near));
|
||||
}
|
||||
|
||||
float interleaved_gradientNoise(){
|
||||
vec2 coord = gl_FragCoord.xy;
|
||||
float noise = fract(52.9829189*fract(0.06711056*coord.x + 0.00583715*coord.y));
|
||||
return noise;
|
||||
}
|
||||
float blueNoise(){
|
||||
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter);
|
||||
}
|
||||
|
||||
#include "/lib/gameplay_effects.glsl"
|
||||
|
||||
@ -64,20 +53,14 @@ uniform mat4 gbufferPreviousModelView;
|
||||
|
||||
#include "/lib/util.glsl"
|
||||
#include "/lib/projections.glsl"
|
||||
vec3 tonemap(vec3 col){
|
||||
return col/(1+luma(col));
|
||||
}
|
||||
vec3 invTonemap(vec3 col){
|
||||
return col/(1-luma(col));
|
||||
}
|
||||
|
||||
vec3 doMotionBlur(vec2 texcoord, float depth, float noise, bool hand){
|
||||
vec3 doMotionBlur(vec2 texcoord, float depth, float noise){
|
||||
|
||||
float samples = 4.0;
|
||||
vec3 color = vec3(0.0);
|
||||
|
||||
float blurMult = 1.0;
|
||||
if(hand) blurMult = 0.0;
|
||||
if(depth < 0.56) blurMult = 0.0;
|
||||
|
||||
vec3 viewPos = toScreenSpace(vec3(texcoord, depth));
|
||||
viewPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz + (cameraPosition - previousCameraPosition);
|
||||
@ -88,9 +71,8 @@ vec3 doMotionBlur(vec2 texcoord, float depth, float noise, bool hand){
|
||||
vec2 velocity = texcoord - previousPosition.xy;
|
||||
|
||||
// thank you Capt Tatsu for letting me use these
|
||||
velocity = (velocity / (1.0 + length(velocity)) ) * 0.05 * blurMult * MOTION_BLUR_STRENGTH;
|
||||
velocity = (velocity / (1.0 + length(velocity))) * 0.05 * blurMult * MOTION_BLUR_STRENGTH;
|
||||
texcoord = texcoord - velocity*(samples*0.5 + noise);
|
||||
|
||||
vec2 screenEdges = 2.0/vec2(viewWidth, viewHeight);
|
||||
|
||||
for (int i = 0; i < int(samples); i++) {
|
||||
@ -99,53 +81,23 @@ vec3 doMotionBlur(vec2 texcoord, float depth, float noise, bool hand){
|
||||
color += texture2D(colortex7, clamp(texcoord, screenEdges, 1.0-screenEdges)).rgb;
|
||||
|
||||
}
|
||||
|
||||
// return vec3(texcoord,0.0);
|
||||
return color / samples;
|
||||
}
|
||||
|
||||
float convertHandDepth_2(in float depth, bool hand) {
|
||||
if(!hand) return depth;
|
||||
|
||||
float ndcDepth = depth * 2.0 - 1.0;
|
||||
ndcDepth /= MC_HAND_DEPTH;
|
||||
return ndcDepth * 0.5 + 0.5;
|
||||
}
|
||||
|
||||
uniform sampler2D shadowcolor1;
|
||||
|
||||
float doVignette( in vec2 texcoord, in float noise){
|
||||
|
||||
float vignette = 1.0-clamp(1.0-length(texcoord-0.5),0.0,1.0);
|
||||
|
||||
// vignette = pow(1.0-pow(1.0-vignette,3),5);
|
||||
vignette *= vignette*vignette;
|
||||
vignette = 1.0-vignette;
|
||||
vignette *= vignette*vignette*vignette*vignette;
|
||||
|
||||
// stop banding
|
||||
vignette = vignette + vignette*(noise-0.5)*0.01;
|
||||
|
||||
return mix(1.0, vignette, VIGNETTE_STRENGTH);
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
float noise = blueNoise();
|
||||
float depth = texture2D(depthtex0,texcoord*RENDER_SCALE).r;
|
||||
float noise = interleaved_gradientNoise();
|
||||
|
||||
#ifdef MOTION_BLUR
|
||||
float depth = texture2D(depthtex0, texcoord*RENDER_SCALE).r;
|
||||
bool hand = depth < 0.56;
|
||||
float depth2 = convertHandDepth_2(depth, hand);
|
||||
|
||||
vec3 COLOR = doMotionBlur(texcoord, depth2, noise, hand);
|
||||
vec3 COLOR = doMotionBlur(texcoord, depth, noise);
|
||||
#else
|
||||
vec3 COLOR = texture2D(colortex7,texcoord).rgb;
|
||||
#endif
|
||||
|
||||
#ifdef VIGNETTE
|
||||
COLOR *= doVignette(texcoord, noise);
|
||||
#endif
|
||||
|
||||
|
||||
#if defined LOW_HEALTH_EFFECT || defined DAMAGE_TAKEN_EFFECT || defined WATER_ON_CAMERA_EFFECT
|
||||
// for making the fun, more fun
|
||||
applyGameplayEffects(COLOR, texcoord, noise);
|
||||
@ -156,19 +108,10 @@ void main() {
|
||||
#endif
|
||||
|
||||
#if DEBUG_VIEW == debug_SHADOWMAP
|
||||
vec2 shadowUV = texcoord * vec2(2.0, 1.0) ;
|
||||
|
||||
// shadowUV -= vec2(0.5,0.0);
|
||||
// float zoom = 0.1;
|
||||
// shadowUV = ((shadowUV-0.5) - (shadowUV-0.5)*zoom) + 0.5;
|
||||
vec2 shadowUV = texcoord * vec2(2.0, 1.0);
|
||||
|
||||
if(shadowUV.x < 1.0 && shadowUV.y < 1.0 && hideGUI == 1) COLOR = texture2D(shadowcolor1,shadowUV).rgb;
|
||||
#endif
|
||||
#if DEBUG_VIEW == debug_DEPTHTEX0
|
||||
COLOR = vec3(ld(texture2D(depthtex0, texcoord*RENDER_SCALE).r));
|
||||
#endif
|
||||
#if DEBUG_VIEW == debug_DEPTHTEX1
|
||||
COLOR = vec3(ld(texture2D(depthtex1, texcoord*RENDER_SCALE).r));
|
||||
if(shadowUV.x < 1.0 && shadowUV.y < 1.0 && hideGUI == 1)COLOR = texture2D(shadowcolor1,shadowUV).rgb;
|
||||
#endif
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user