added a contrast setting. make beacon beams and enchantment glint work in the end and nether. tweak lighting in the end and nether.

This commit is contained in:
Xonk 2023-07-06 20:47:26 -04:00
parent 4ec1a86639
commit b62cb8aa4b
36 changed files with 262 additions and 616 deletions

Binary file not shown.

View File

@ -166,6 +166,10 @@ vec3 viewToWorld(vec3 viewPosition) {
return pos.xyz;
}
/// thanks stackoverflow https://stackoverflow.com/questions/944713/help-with-pixel-shader-effect-for-brightness-and-contrast#3027595
void applyContrast(inout vec3 color, float contrast){
color = ((color - 0.5) * max(contrast, 0.0)) + 0.5;
}
void main() {
/* DRAWBUFFERS:73 */
@ -328,6 +332,9 @@ void main() {
#endif
gl_FragData[0].r = vl.a; // pass fog alpha so bloom can do bloomy fog
// applyContrast(color.rgb,CONTRAST);
gl_FragData[1].rgb = clamp(color.rgb,0.0,68000.0);
// gl_FragData[1].rgb = vec3(tangentNormals,0.0);

View File

@ -304,7 +304,7 @@ vec3 projectAndDivide(mat4 projectionMatrix, vec3 position){
vec4 homogeneousPos = projectionMatrix * vec4(position, 1.0);
return homogeneousPos.xyz / homogeneousPos.w;
}
;
vec3 TAA_hq(bool hand, bool istranslucent, vec3 EntityVelocity, inout vec3 DEBUG){
#ifdef TAA_UPSCALING
vec2 adjTC = clamp(texcoord*RENDER_SCALE, vec2(0.0),RENDER_SCALE-texelSize*2.);
@ -386,7 +386,7 @@ vec3 TAA_hq(bool hand, bool istranslucent, vec3 EntityVelocity, inout vec3 DEBUG
vec3 albedoPrev = texture2D(colortex5, previousPosition.xy).xyz;
vec3 supersampled = mix(albedoPrev,albedoCurrent0,clamp(0.05,0.,1.));
#endif
//De-tonemap
return supersampled;
}
@ -409,6 +409,7 @@ vec2 R2_samples(int n){
vec2 alpha = vec2(0.75487765, 0.56984026);
return fract(alpha * n)*2.-1.0;
}
vec4 TAA_hq_render(){
#ifdef TAA_UPSCALING
vec2 adjTC = clamp(texcoord*RENDER_SCALE, vec2(0.0),RENDER_SCALE-texelSize*2.);
@ -470,8 +471,9 @@ void main() {
vec3 DEBUG = vec3(0.0);
color += TAA_hq(hand, translucentCol, vec3(0.0), DEBUG);
gl_FragData[0].rgb = clamp(fp10Dither(color ,triangularize(R2_dither())),6.11*1e-5,65000.0);
#else
vec3 color = clamp(fp10Dither(texture2D(colortex3,texcoord).rgb,triangularize(interleaved_gradientNoise())),0.,65000.);
gl_FragData[0].rgb = color;

View File

@ -67,6 +67,10 @@ vec4 SampleTextureCatmullRom(sampler2D tex, vec2 uv, vec2 texSize )
return result;
}
/// thanks stackoverflow https://stackoverflow.com/questions/944713/help-with-pixel-shader-effect-for-brightness-and-contrast#3027595
void applyContrast(inout vec3 color, float contrast){
color = (color - 0.5) * contrast + 0.5;
}
void main() {
#ifdef BICUBIC_UPSCALING
@ -75,6 +79,7 @@ void main() {
vec3 col = texture2D(colortex7,texcoord).rgb;
#endif
#ifdef CONTRAST_ADAPTATIVE_SHARPENING
//Weights : 1 in the center, 0.5 middle, 0.25 corners
vec3 albedoCurrent1 = texture2D(colortex7, texcoord + vec2(texelSize.x,texelSize.y)/MC_RENDER_QUALITY*0.5).rgb;
@ -95,5 +100,8 @@ void main() {
vec3 diff = col-lum;
col = col + diff*(-lum*CROSSTALK + SATURATION);
applyContrast(col, CONTRAST);
gl_FragColor.rgb = clamp(int8Dither(col,texcoord),0.0,1.0);
}

View File

@ -1,25 +1,10 @@
#version 120
//#extension GL_EXT_gpu_shader4 : disable
#include "lib/settings.glsl"
#include "/lib/settings.glsl"
varying vec4 lmtexcoord;
varying vec4 color;
varying vec4 normalMat;
uniform sampler2D texture;
uniform sampler2D gaux1;
uniform vec4 lightCol;
uniform vec3 sunVec;
uniform vec2 texelSize;
uniform float skyIntensityNight;
uniform float skyIntensity;
uniform float sunElevation;
uniform mat4 gbufferProjectionInverse;
uniform mat4 gbufferModelViewInverse;
uniform mat4 shadowModelView;
uniform mat4 shadowProjection;
//faster and actually more precise than pow 2.2
vec3 toLinear(vec3 sRGB){
@ -32,17 +17,9 @@ vec3 toLinear(vec3 sRGB){
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
/* DRAWBUFFERS:2 */
void main() {
gl_FragData[0] = vec4(toLinear( texture2D(texture, lmtexcoord.xy).rgb * color.rgb), 0.1);
gl_FragData[0] = texture2D(texture, lmtexcoord.xy);
vec3 albedo = toLinear(gl_FragData[0].rgb*color.rgb);
float exposure = texelFetch2D(gaux1,ivec2(10,37),0).r;
vec3 col = albedo*exp(-exposure*4.) * 255.0;
gl_FragData[0].rgb = col*color.a;
gl_FragData[0].a = gl_FragData[0].a*0.1;
}

View File

@ -1,6 +1,6 @@
#version 120
//#extension GL_EXT_gpu_shader4 : disable
#include "lib/settings.glsl"
#include "/lib/settings.glsl"
#include "/lib/res_params.glsl"
/*
@ -12,26 +12,17 @@ Read the terms of modification and sharing before changing something below pleas
varying vec4 lmtexcoord;
varying vec4 color;
varying vec4 normalMat;
#ifdef MC_NORMAL_MAP
varying vec4 tangent;
attribute vec4 at_tangent;
#endif
uniform vec2 texelSize;
uniform int framemod8;
const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
vec2(-1.,3.)/8.,
vec2(5.0,1.)/8.,
vec2(-3,-5.)/8.,
vec2(-5.,5.)/8.,
vec2(-7.,-1.)/8.,
vec2(3,7.)/8.,
vec2(7.,-7.)/8.);
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
vec4 toClipSpace3(vec3 viewSpacePosition) {
return vec4(projMAD(gl_ProjectionMatrix, viewSpacePosition),-viewSpacePosition.z);
}
const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
vec2(-1.,3.)/8.,
vec2(5.0,1.)/8.,
vec2(-3,-5.)/8.,
vec2(-5.,5.)/8.,
vec2(-7.,-1.)/8.,
vec2(3,7.)/8.,
vec2(7.,-7.)/8.);
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
@ -40,25 +31,17 @@ vec4 toClipSpace3(vec3 viewSpacePosition) {
//////////////////////////////VOID MAIN//////////////////////////////
void main() {
gl_Position = ftransform();
lmtexcoord.xy = (gl_TextureMatrix[0] * gl_MultiTexCoord0).st;
vec2 lmcoord = gl_MultiTexCoord1.xy/255.;
lmtexcoord.zw = lmcoord*lmcoord;
vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
color = gl_Color;
gl_Position = toClipSpace3(position);
color = gl_Color;
#ifdef MC_NORMAL_MAP
tangent = vec4(normalize(gl_NormalMatrix *at_tangent.rgb),at_tangent.w);
#endif
normalMat = vec4(normalize(gl_NormalMatrix *gl_Normal),1.0);
#ifdef TAA_UPSCALING
gl_Position.xy = gl_Position.xy * RENDER_SCALE + RENDER_SCALE * gl_Position.w - gl_Position.w;
#endif
#ifdef TAA
gl_Position.xy += offsets[framemod8] * gl_Position.w*texelSize;
gl_Position.xy += offsets[framemod8] * gl_Position.w*texelSize;
#endif
}

View File

@ -40,17 +40,22 @@ vec3 DoDirectLighting(vec3 SunColor, float Shadow, float NdotL, float Subsurface
#ifdef NETHER
//// NETHER ////
vec3 DoAmbientLighting_Nether(vec3 FogColor, vec3 TorchColor, float Lightmap, vec3 Normal, vec3 np3, vec3 WorldPos){
vec3 TorchLight = TorchColor * clamp(pow(Lightmap,3.0),0.0,1.0);
float TorchLM = 10.0 - ( 1.0 / (pow(exp(-0.5*inversesqrt(Lightmap)),5.0)+0.1));
TorchLM = pow(TorchLM/4,10) + pow(Lightmap,1.5)*0.5; //pow(TorchLM/4.5,10)*2.5 + pow(Lightmap.x,1.5)*0.5;
vec3 TorchLight = TorchColor * TorchLM * 0.75;
TorchLight *= TORCH_AMOUNT;
vec3 LavaGlow = vec3(TORCH_R,TORCH_G,TORCH_B);
LavaGlow *= pow(clamp(1.0-max(Normal.y,0.0) + dot(Normal,np3),0.0,1.0),3.0);
LavaGlow *= clamp(exp2(-max((WorldPos.y - 50.0) / 5,0.0)),0.0,1.0);
LavaGlow *= pow(Lightmap,0.2);
vec3 AmbientLight = vec3(0.1) + FogColor*clamp(1.1 + dot(Normal,np3),0.0,1.0);
vec3 FogTint = FogColor*clamp(1.1 + dot(Normal,np3),0.0,1.0) * 0.05;
return AmbientLight + TorchLight + LavaGlow;
vec3 AmbientLight = max(vec3(0.05), (MIN_LIGHT_AMOUNT*0.01 + nightVision*0.5) );
return AmbientLight + FogTint + TorchLight + LavaGlow;
}
#endif
@ -59,15 +64,25 @@ vec3 DoAmbientLighting_Nether(vec3 FogColor, vec3 TorchColor, float Lightmap, ve
vec3 DoAmbientLighting_End(vec3 FogColor, vec3 TorchColor, float Lightmap, vec3 Normal, vec3 np3){
// vec3 TorchLight = TorchColor * clamp(pow(Lightmap,3.0),0.0,1.0);
vec3 TorchLight = TorchColor * pow(1.0-pow(1.0-clamp(Lightmap,0.0,1.0) ,0.1),2);
TorchLight = exp(TorchLight * 30) - 1.0;
// vec3 TorchLight = TorchColor * pow(1.0-pow(1.0-clamp(Lightmap,0.0,1.0) ,0.1),2);
// TorchLight = exp(TorchLight * 30) - 1.0;
float TorchLM = 10.0 - ( 1.0 / (pow(exp(-0.5*inversesqrt(Lightmap)),5.0)+0.1));
TorchLM = pow(TorchLM/4,10) + pow(Lightmap,1.5)*0.5; //pow(TorchLM/4.5,10)*2.5 + pow(Lightmap.x,1.5)*0.5;
vec3 TorchLight = TorchColor * TorchLM * 0.75;
TorchLight *= TORCH_AMOUNT;
FogColor = (FogColor / pow(0.00001 + dot(FogColor,vec3(0.3333)),1.0) ) * 0.1;
// vec3 AmbientLight = sqrt( clamp(1.25 + dot(Normal,np3),0.0,1.0)) * (vec3(0.5,0.75,1.0) * 0.05);
// vec3 AmbientLight = sqrt( clamp(1.25 + dot(Normal,np3),0.0,1.0)*0.5) * FogColor;
vec3 AmbientLight = vec3(0.5,0.75,1.0) * 0.05 + FogColor*clamp(1.1 + dot(Normal,np3),0.0,1.0)*0.5;
// vec3 AmbientLight = vec3(0.5,0.75,1.0) * 0.05 + FogColor*clamp(1.1 + dot(Normal,np3),0.0,1.0)*0.5;
return TorchLight + AmbientLight;
vec3 FogTint = FogColor*clamp(1.1 + dot(Normal,np3),0.0,1.0) * 0.05;
vec3 AmbientLight = max(vec3(0.5,0.75,1.0) * 0.05, (MIN_LIGHT_AMOUNT*0.01 + nightVision*0.5) );
return TorchLight + AmbientLight + FogTint;
}
#endif

View File

@ -253,7 +253,7 @@ mat2x3 getVolumetricRays(float dither,vec3 fragpos,float dither2) {
vec3 absorbance = vec3(1.0);
float expFactor = 11.0;
vec3 fogColor = (gl_Fog.color.rgb / pow(dot(gl_Fog.color.rgb,vec3(0.3333)),1.1) ) ;
vec3 fogColor = (gl_Fog.color.rgb / max(pow(dot(gl_Fog.color.rgb,vec3(0.3333)),1.1),0.01) ) ;
for (int i=0;i<SAMPLES;i++) {

View File

@ -339,11 +339,13 @@ uniform int moonPhase;
//#define USE_ACES_COLORSPACE_APPROXIMATION
#define CONTRAST_ADAPTATIVE_SHARPENING
#define SHARPENING 0.35 // [0.0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.2 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.3 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.4 0.41 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.5 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.59 0.6 0.61 0.62 0.63 0.64 0.65 0.66 0.67 0.68 0.69 0.7 0.71 0.72 0.73 0.74 0.75 0.76 0.77 0.78 0.79 0.8 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.88 0.89 0.9 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.99 1.0 ]
#define SHARPENING 0.35 // [0.0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.2 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.3 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.4 0.41 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.5 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.59 0.6 0.61 0.62 0.63 0.64 0.65 0.66 0.67 0.68 0.69 0.7 0.71 0.72 0.73 0.74 0.75 0.76 0.77 0.78 0.79 0.8 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.88 0.89 0.9 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.99 1.0 ]
#define SATURATION 0.00 // [-1.0 -0.98 -0.96 -0.94 -0.92 -0.9 -0.88 -0.86 -0.84 -0.82 -0.8 -0.78 -0.76 -0.74 -0.72 -0.7 -0.68 -0.66 -0.64 -0.62 -0.6 -0.58 -0.56 -0.54 -0.52 -0.5 -0.48 -0.46 -0.44 -0.42 -0.4 -0.38 -0.36 -0.34 -0.32 -0.3 -0.28 -0.26 -0.24 -0.22 -0.2 -0.18 -0.16 -0.14 -0.12 -0.1 -0.08 -0.06 -0.04 -0.02 0.0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2 0.22 0.24 0.26 0.28 0.3 0.32 0.34 0.36 0.38 0.4 0.42 0.44 0.46 0.48 0.5 0.52 0.54 0.56 0.58 0.6 0.62 0.64 0.66 0.68 0.7 0.72 0.74 0.76 0.78 0.8 0.82 0.84 0.86 0.88 0.9 0.92 0.94 0.96 0.98 1.0 ]
#define CROSSTALK 0.0 // [-1.0 -0.98 -0.96 -0.94 -0.92 -0.9 -0.88 -0.86 -0.84 -0.82 -0.8 -0.78 -0.76 -0.74 -0.72 -0.7 -0.68 -0.66 -0.64 -0.62 -0.6 -0.58 -0.56 -0.54 -0.52 -0.5 -0.48 -0.46 -0.44 -0.42 -0.4 -0.38 -0.36 -0.34 -0.32 -0.3 -0.28 -0.26 -0.24 -0.22 -0.2 -0.18 -0.16 -0.14 -0.12 -0.1 -0.08 -0.06 -0.04 -0.02 0.0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2 0.22 0.24 0.26 0.28 0.3 0.32 0.34 0.36 0.38 0.4 0.42 0.44 0.46 0.48 0.5 0.52 0.54 0.56 0.58 0.6 0.62 0.64 0.66 0.68 0.7 0.72 0.74 0.76 0.78 0.8 0.82 0.84 0.86 0.88 0.9 0.92 0.94 0.96 0.98 1.0 ]
#define CONTRAST 1.0 // [0.0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.2 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.3 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.4 0.41 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.5 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.59 0.6 0.61 0.62 0.63 0.64 0.65 0.66 0.67 0.68 0.69 0.7 0.71 0.72 0.73 0.74 0.75 0.76 0.77 0.78 0.79 0.8 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.88 0.89 0.9 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.99 1.0 1.0 1.01 1.02 1.03 1.04 1.05 1.06 1.07 1.08 1.09 1.1 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.18 1.19 1.2 1.21 1.22 1.23 1.24 1.25 1.26 1.27 1.28 1.29 1.3 1.31 1.32 1.33 1.34 1.35 1.36 1.37 1.38 1.39 1.4 1.41 1.42 1.43 1.44 1.45 1.46 1.47 1.48 1.49 1.5 1.51 1.52 1.53 1.54 1.55 1.56 1.57 1.58 1.59 1.6 1.61 1.62 1.63 1.64 1.65 1.66 1.67 1.68 1.69 1.7 1.71 1.72 1.73 1.74 1.75 1.76 1.77 1.78 1.79 1.8 1.81 1.82 1.83 1.84 1.85 1.86 1.87 1.88 1.89 1.9 1.91 1.92 1.93 1.94 1.95 1.96 1.97 1.98 1.99 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0 ]
#define EXPOSURE_MULTIPLIER 1.0 // [0.25 0.4 0.5 0.6 0.7 0.75 0.8 0.85 0.9 0.95 1.0 1.1 1.2 1.3 1.4 1.5 2.0 3.0 4.0]
#define AUTO_EXPOSURE
#define Manual_exposure_value 1.0 // [0.000553 0.000581 0.000611 0.000642 0.000675 0.000710 0.000746 0.000784 0.000825 0.000867 0.000911 0.000958 0.001007 0.001059 0.001113 0.001170 0.001230 0.001294 0.001360 0.001430 0.001503 0.001580 0.001661 0.001746 0.001836 0.001930 0.002029 0.002133 0.002242 0.002357 0.002478 0.002605 0.002739 0.002879 0.003027 0.003182 0.003345 0.003517 0.003697 0.003887 0.004086 0.004296 0.004516 0.004748 0.004991 0.005247 0.005516 0.005799 0.006096 0.006409 0.006737 0.007083 0.007446 0.007828 0.008229 0.008651 0.009095 0.009561 0.010051 0.010567 0.011108 0.011678 0.012277 0.012906 0.013568 0.014264 0.014995 0.015764 0.016572 0.017422 0.018315 0.019254 0.020241 0.021279 0.022370 0.023517 0.024723 0.025991 0.027323 0.028724 0.030197 0.031745 0.033373 0.035084 0.036883 0.038774 0.040762 0.042852 0.045049 0.047358 0.049787 0.052339 0.055023 0.057844 0.060810 0.063927 0.067205 0.070651 0.074273 0.078081 0.082084 0.086293 0.090717 0.095369 0.100258 0.105399 0.110803 0.116484 0.122456 0.128734 0.135335 0.142274 0.149568 0.157237 0.165298 0.173773 0.182683 0.192049 0.201896 0.212247 0.223130 0.234570 0.246596 0.259240 0.272531 0.286504 0.301194 0.316636 0.332871 0.349937 0.367879 0.386741 0.406569 0.427414 0.449328 0.472366 0.496585 0.522045 0.548811 0.576949 0.606530 0.637628 0.670320 0.704688 0.740818 0.778800 0.818730 0.860707 0.904837 0.951229 1.0 1.051271 1.105170 1.161834 1.221402 1.284025 1.349858 1.419067 1.491824 1.568312 1.648721 1.733253 1.822118 1.915540 2.013752 2.117000 2.225540 2.339646 2.459603 2.585709 2.718281 2.857651 3.004166 3.158192 3.320116 3.490342 3.669296 3.857425 4.055199 4.263114 4.481689 4.711470 4.953032 5.206979 5.473947 5.754602 6.049647 6.359819 6.685894 7.028687 7.389056 7.767901 8.166169 8.584858 9.025013 9.487735 9.974182 10.48556 11.02317 11.58834 12.18249 ]

View File

@ -75,6 +75,8 @@ flat varying float EMISSIVE;
flat varying int LIGHTNING;
flat varying int SIGN;
flat varying float HELD_ITEM_BRIGHTNESS;
float blueNoise(){
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter);
}
@ -225,9 +227,9 @@ void main() {
float torchlightmap = lmtexcoord.z;
// #ifdef Hand_Held_lights
// if(HELD_ITEM_BRIGHTNESS > 0.0) torchlightmap = max(torchlightmap, HELD_ITEM_BRIGHTNESS * clamp( pow(max(1.0-length(fragpos)/10,0.0),1.5),0.0,1.0));
// #endif
#ifdef Hand_Held_lights
if(HELD_ITEM_BRIGHTNESS > 0.0) torchlightmap = max(torchlightmap, HELD_ITEM_BRIGHTNESS * clamp( pow(max(1.0-length(fragpos)/10,0.0),1.5),0.0,1.0));
#endif
float lightmap = clamp( (lmtexcoord.w-0.8) * 10.0,0.,1.);

View File

@ -47,7 +47,7 @@ alphaTest.gbuffers_skytextured=false
alphaTest.gbuffers_hand=true
sliders = EMISSIVE_TYPE Lightning_R Lightning_G Lightning_B SCALE_FACTOR CompSky_R CompSky_G CompSky_B ambientsss_brightness SSS_TYPE Cloud_Speed Cumulus_height Cumulus_coverage Cumulus_density Alto_coverage Alto_density ORB_ColMult ORB_X ORB_Y ORB_Z ORB_R ORB_G ORB_B TOD_Fog_mult Morning_Uniform_Fog Noon_Uniform_Fog Evening_Uniform_Fog Night_Uniform_Fog Morning_Cloudy_Fog Noon_Cloudy_Fog Evening_Cloudy_Fog Night_Cloudy_Fog NetherFog_brightness Summer_Leaf_R Summer_Leaf_G Summer_Leaf_B Fall_Leaf_R Fall_Leaf_G Fall_Leaf_B Winter_Leaf_R Winter_Leaf_G Winter_Leaf_B Spring_Leaf_R Spring_Leaf_G Spring_Leaf_B Summer_R Summer_G Summer_B Fall_R Fall_G Fall_B Winter_R Winter_G Winter_B Spring_R Spring_G Spring_B Season_Length CaveFogFallOff CaveFogColor_R CaveFogColor_G CaveFogColor_B indirect_effect GI_Strength ambient_brightness AmbientLight_R AmbientLight_G AmbientLight_B Rain_coverage Moon_temp Haze_amount RainFog_amount ambient_temp Sun_temp Puddle_Size LabSSS_Curve Emissive_Curve Emissive_Brightness AO_Strength BLOOMY_FOG WAVY_SPEED WAVY_STRENGTH BLOOM_STRENGTH shadowDistance shadowDistanceRenderMul FinalR FinalG FinalB Sky_Brightness fog_coefficientMieR fog_coefficientMieG fog_coefficientMieB sun_illuminance sunColorG sunColorB sunColorR sky_mieg sky_coefficientMieB sky_coefficientMieG sky_coefficientMieR sky_coefficientRayleighB sky_coefficientRayleighG sky_coefficientRayleighR CLOUDS_QUALITY EXPOSURE_MULTIPLIER MIN_LIGHT_AMOUNT TORCH_R TORCH_G TORCH_B TORCH_AMOUNT shadowMapResolution sunPathRotation BLEND_FACTOR VL_SAMPLES Exposure_Speed POM_DEPTH MAX_ITERATIONS MAX_DIST SSR_STEPS ambientOcclusionLevel SEA_LEVEL moon_illuminance moonColorR moonColorG moonColorB fog_coefficientRayleighR fog_coefficientRayleighG SATURATION Manual_exposure_value focal aperture MANUAL_FOCUS SHADOW_FILTER_SAMPLE_COUNT Max_Filter_Depth VPS_Search_Samples Min_Shadow_Filter_Radius Max_Shadow_Filter_Radius Water_Top_Layer fog_coefficientRayleighB SHARPENING rayMarchSampleCount Dirt_Amount Dirt_Scatter_R Dirt_Scatter_G Dirt_Scatter_B Dirt_Absorb_R Dirt_Absorb_G Dirt_Absorb_B Water_Absorb_R Water_Absorb_G Water_Absorb_B Purkinje_strength Purkinje_strength Purkinje_R Purkinje_G Purkinje_B Texture_MipMap_Bias DoF_Adaptation_Speed Purkinje_Multiplier CROSSTALK VL_RENDER_RESOLUTION BLOOM_QUALITY VL_RENDER_RESOLUTION RAY_COUNT STEPS STEP_LENGTH cloud_LevelOfDetail cloud_ShadowLevelOfDetail cloud_LevelOfDetailLQ cloud_ShadowLevelOfDetailLQ minRayMarchSteps maxRayMarchSteps minRayMarchStepsLQ maxRayMarchStepsLQ fbmAmount fbmPower1 fbmPower2 Roughness_Threshold Sun_specular_Strength reflection_quality DOF_QUALITY DOF_ANAMORPHIC_RATIO AEROCHROME_PINKNESS
sliders = CONTRAST EMISSIVE_TYPE Lightning_R Lightning_G Lightning_B SCALE_FACTOR CompSky_R CompSky_G CompSky_B ambientsss_brightness SSS_TYPE Cloud_Speed Cumulus_height Cumulus_coverage Cumulus_density Alto_coverage Alto_density ORB_ColMult ORB_X ORB_Y ORB_Z ORB_R ORB_G ORB_B TOD_Fog_mult Morning_Uniform_Fog Noon_Uniform_Fog Evening_Uniform_Fog Night_Uniform_Fog Morning_Cloudy_Fog Noon_Cloudy_Fog Evening_Cloudy_Fog Night_Cloudy_Fog NetherFog_brightness Summer_Leaf_R Summer_Leaf_G Summer_Leaf_B Fall_Leaf_R Fall_Leaf_G Fall_Leaf_B Winter_Leaf_R Winter_Leaf_G Winter_Leaf_B Spring_Leaf_R Spring_Leaf_G Spring_Leaf_B Summer_R Summer_G Summer_B Fall_R Fall_G Fall_B Winter_R Winter_G Winter_B Spring_R Spring_G Spring_B Season_Length CaveFogFallOff CaveFogColor_R CaveFogColor_G CaveFogColor_B indirect_effect GI_Strength ambient_brightness AmbientLight_R AmbientLight_G AmbientLight_B Rain_coverage Moon_temp Haze_amount RainFog_amount ambient_temp Sun_temp Puddle_Size LabSSS_Curve Emissive_Curve Emissive_Brightness AO_Strength BLOOMY_FOG WAVY_SPEED WAVY_STRENGTH BLOOM_STRENGTH shadowDistance shadowDistanceRenderMul FinalR FinalG FinalB Sky_Brightness fog_coefficientMieR fog_coefficientMieG fog_coefficientMieB sun_illuminance sunColorG sunColorB sunColorR sky_mieg sky_coefficientMieB sky_coefficientMieG sky_coefficientMieR sky_coefficientRayleighB sky_coefficientRayleighG sky_coefficientRayleighR CLOUDS_QUALITY EXPOSURE_MULTIPLIER MIN_LIGHT_AMOUNT TORCH_R TORCH_G TORCH_B TORCH_AMOUNT shadowMapResolution sunPathRotation BLEND_FACTOR VL_SAMPLES Exposure_Speed POM_DEPTH MAX_ITERATIONS MAX_DIST SSR_STEPS ambientOcclusionLevel SEA_LEVEL moon_illuminance moonColorR moonColorG moonColorB fog_coefficientRayleighR fog_coefficientRayleighG SATURATION Manual_exposure_value focal aperture MANUAL_FOCUS SHADOW_FILTER_SAMPLE_COUNT Max_Filter_Depth VPS_Search_Samples Min_Shadow_Filter_Radius Max_Shadow_Filter_Radius Water_Top_Layer fog_coefficientRayleighB SHARPENING rayMarchSampleCount Dirt_Amount Dirt_Scatter_R Dirt_Scatter_G Dirt_Scatter_B Dirt_Absorb_R Dirt_Absorb_G Dirt_Absorb_B Water_Absorb_R Water_Absorb_G Water_Absorb_B Purkinje_strength Purkinje_strength Purkinje_R Purkinje_G Purkinje_B Texture_MipMap_Bias DoF_Adaptation_Speed Purkinje_Multiplier CROSSTALK VL_RENDER_RESOLUTION BLOOM_QUALITY VL_RENDER_RESOLUTION RAY_COUNT STEPS STEP_LENGTH cloud_LevelOfDetail cloud_ShadowLevelOfDetail cloud_LevelOfDetailLQ cloud_ShadowLevelOfDetailLQ minRayMarchSteps maxRayMarchSteps minRayMarchStepsLQ maxRayMarchStepsLQ fbmAmount fbmPower1 fbmPower2 Roughness_Threshold Sun_specular_Strength reflection_quality DOF_QUALITY DOF_ANAMORPHIC_RATIO AEROCHROME_PINKNESS
screen.columns=2
screen = [Direct_Light] [World] [Ambient_light] [Fog] [Post_Processing] [Clouds] [Misc_Settings] [Climate] <empty> <empty> PhysicsMod_support [LabPBR]
@ -175,7 +175,7 @@ screen = [Direct_Light] [World] [Ambient_light] [Fog] [Post_Processing] [Clouds]
screen.Exposure = AUTO_EXPOSURE EXPOSURE_MULTIPLIER Exposure_Speed Manual_exposure_value
### TONEMAPS
screen.Tonemapping.columns = 1
screen.Tonemapping = TONEMAP USE_ACES_COLORSPACE_APPROXIMATION SATURATION CROSSTALK <empty> FinalR FinalG FinalB
screen.Tonemapping = TONEMAP USE_ACES_COLORSPACE_APPROXIMATION SATURATION CROSSTALK CONTRAST <empty> FinalR FinalG FinalB
### PURKINJE
screen.Purkinje_effect.columns = 1
screen.Purkinje_effect = Purkinje_strength Purkinje_R Purkinje_G Purkinje_B Purkinje_Multiplier

View File

@ -448,7 +448,9 @@ void main() {
p3 += gbufferModelViewInverse[3].xyz + cameraPosition;
vec3 FogColor = (gl_Fog.color.rgb / pow(0.00001 + dot(gl_Fog.color.rgb,vec3(0.3333)),1.0) ) * 0.2;
// vec3 FogColor = (gl_Fog.color.rgb / pow(0.00001 + dot(gl_Fog.color.rgb,vec3(0.3333)),1.0) ) * 0.2;
// vec3 fogColor = (gl_Fog.color.rgb / max(pow(dot(gl_Fog.color.rgb,vec3(0.3333)),1.1),0.01) ) ;
vec3 FogColor = (gl_Fog.color.rgb / max(dot(gl_Fog.color.rgb,vec3(0.3333)),0.01) );
// do all ambient lighting stuff
vec3 Indirect_lighting = DoAmbientLighting_Nether(FogColor, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.x, normal, np3, p3 );
@ -457,31 +459,9 @@ void main() {
if(!hand) Indirect_lighting *= ssao(fragpos,noise,FlatNormals) * AO;
// ScreenSpace_SSS(Indirect_SSS, fragpos, vec2(R2_dither()), FlatNormals);
// Indirect_lighting *= 1 + SubsurfaceScattering_sky(albedo, Indirect_SSS, LabSSS) * 5;
vec3 LightColor = LightSourceColor();
float SdotV = dot(normalize(viewspace_sunvec), normalize(fragpos));
float OrbMie = max(exp((p3.y - 60) / -30.),0);
// 0.5 added because lightsources are always high radius.
float NdotL = clamp( dot(normal,normalize(WsunVec)) + 0.25,0.0,1.0);
vec3 LightSource = LightColor * NdotL * OrbMie ;
// LightSource *= rayTraceShadow(worldToView(normalize(-LightPos)), fragpos, interleaved_gradientNoise());
// LightSource *= GetCloudShadow(p3, WsunVec, blueNoise());
// finalize
gl_FragData[0].rgb = Indirect_lighting * albedo;
// gl_FragData[0].rgb = LightSource * albedo;
#ifdef Specular_Reflections
MaterialReflections_N(gl_FragData[0].rgb, SpecularTex.r, SpecularTex.ggg, albedo, normal, np3, fragpos, vec3(blueNoise(gl_FragCoord.xy).rg,noise), hand);

View File

@ -5,12 +5,12 @@
#include "/lib/settings.glsl"
flat varying vec4 lightCol;
flat varying vec3 ambientUp;
flat varying vec3 ambientLeft;
flat varying vec3 ambientRight;
flat varying vec3 ambientB;
flat varying vec3 ambientF;
flat varying vec3 ambientDown;
// flat varying vec3 ambientUp;
// flat varying vec3 ambientLeft;
// flat varying vec3 ambientRight;
// flat varying vec3 ambientB;
// flat varying vec3 ambientF;
// flat varying vec3 ambientDown;
flat varying float tempOffsets;
flat varying float fogAmount;
flat varying float VFAmount;

View File

@ -5,12 +5,12 @@
#include "/lib/settings.glsl"
flat varying vec3 ambientUp;
flat varying vec3 ambientLeft;
flat varying vec3 ambientRight;
flat varying vec3 ambientB;
flat varying vec3 ambientF;
flat varying vec3 ambientDown;
// flat varying vec3 ambientUp;
// flat varying vec3 ambientLeft;
// flat varying vec3 ambientRight;
// flat varying vec3 ambientB;
// flat varying vec3 ambientF;
// flat varying vec3 ambientDown;
flat varying vec3 lightSourceColor;
flat varying vec3 sunColor;
flat varying vec3 sunColorCloud;

View File

@ -3,12 +3,12 @@
#include "/lib/settings.glsl"
flat varying vec3 ambientUp;
flat varying vec3 ambientLeft;
flat varying vec3 ambientRight;
flat varying vec3 ambientB;
flat varying vec3 ambientF;
flat varying vec3 ambientDown;
// flat varying vec3 ambientUp;
// flat varying vec3 ambientLeft;
// flat varying vec3 ambientRight;
// flat varying vec3 ambientB;
// flat varying vec3 ambientF;
// flat varying vec3 ambientDown;
flat varying vec3 zenithColor;
flat varying vec3 sunColor;
flat varying vec3 sunColorCloud;

View File

@ -69,6 +69,11 @@ vec4 SampleTextureCatmullRom(sampler2D tex, vec2 uv, vec2 texSize )
return result;
}
/// thanks stackoverflow https://stackoverflow.com/questions/944713/help-with-pixel-shader-effect-for-brightness-and-contrast#3027595
void applyContrast(inout vec3 color, float contrast){
color = (color - 0.5) * contrast + 0.5;
}
void main() {
#ifdef BICUBIC_UPSCALING
vec3 col = SampleTextureCatmullRom(colortex7,texcoord,1.0/texelSize).rgb;
@ -96,6 +101,9 @@ void main() {
vec3 diff = col-lum;
col = col + diff*(-lum*CROSSTALK + SATURATION);
//col = -vec3(-lum*CROSSFADING + SATURATION);
applyContrast(col, CONTRAST);
gl_FragColor.rgb = clamp(int8Dither(col,texcoord),0.0,1.0);
//gl_FragColor.rgb = vec3(contrast);
}

View File

@ -1,81 +1,25 @@
#version 120
//#extension GL_EXT_gpu_shader4 : disable
#include "/lib/settings.glsl"
varying vec4 lmtexcoord;
varying vec4 color;
varying vec4 normalMat;
uniform sampler2D texture;
uniform sampler2D gaux1;
uniform vec4 lightCol;
uniform vec3 sunVec;
uniform vec2 texelSize;
uniform float skyIntensityNight;
uniform float skyIntensity;
uniform float sunElevation;
uniform mat4 gbufferProjectionInverse;
uniform mat4 gbufferModelViewInverse;
uniform mat4 shadowModelView;
uniform mat4 shadowProjection;
//faster and actually more precise than pow 2.2
vec3 toLinear(vec3 sRGB){
return sRGB * (sRGB * (sRGB * 0.305306011 + 0.682171111) + 0.012522878);
}
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
vec3 toScreenSpace(vec3 p) {
vec4 iProjDiag = vec4(gbufferProjectionInverse[0].x, gbufferProjectionInverse[1].y, gbufferProjectionInverse[2].zw);
vec3 p3 = p * 2. - 1.;
vec4 fragposition = iProjDiag * p3.xyzz + gbufferProjectionInverse[3];
return fragposition.xyz / fragposition.w;
}
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 facos(float sx){
float x = clamp(abs( sx ),0.,1.);
float a = sqrt( 1. - x ) * ( -0.16882 * x + 1.56734 );
return sx > 0. ? a : 3.14159265359 - a;
}
#define SHADOW_MAP_BIAS 0.8
float calcDistort(vec2 worlpos){
vec2 pos = worlpos * 1.165;
vec2 posSQ = pos*pos;
float distb = pow(posSQ.x*posSQ.x*posSQ.x + posSQ.y*posSQ.y*posSQ.y, 1.0 / 6.0);
return 1.08695652/((1.0 - SHADOW_MAP_BIAS) + distb * SHADOW_MAP_BIAS);
}
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
/* DRAWBUFFERS:2 */
void main() {
gl_FragData[0] = texture2D(texture, lmtexcoord.xy);
vec3 albedo = toLinear(gl_FragData[0].rgb*color.rgb);
float exposure = texelFetch2D(gaux1,ivec2(10,37),0).r;
vec3 col = albedo*exp(-exposure*3.);
gl_FragData[0].rgb = col*color.a;
gl_FragData[0].a = gl_FragData[0].a*0.1;
gl_FragData[0] = vec4(toLinear( texture2D(texture, lmtexcoord.xy).rgb * color.rgb), 0.1);
}

View File

@ -1,5 +1,6 @@
#version 120
//#extension GL_EXT_gpu_shader4 : disable
#include "/lib/settings.glsl"
#include "/lib/res_params.glsl"
/*
@ -11,26 +12,17 @@ Read the terms of modification and sharing before changing something below pleas
varying vec4 lmtexcoord;
varying vec4 color;
varying vec4 normalMat;
#ifdef MC_NORMAL_MAP
varying vec4 tangent;
attribute vec4 at_tangent;
#endif
uniform vec2 texelSize;
uniform int framemod8;
const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
vec2(-1.,3.)/8.,
vec2(5.0,1.)/8.,
vec2(-3,-5.)/8.,
vec2(-5.,5.)/8.,
vec2(-7.,-1.)/8.,
vec2(3,7.)/8.,
vec2(7.,-7.)/8.);
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
vec4 toClipSpace3(vec3 viewSpacePosition) {
return vec4(projMAD(gl_ProjectionMatrix, viewSpacePosition),-viewSpacePosition.z);
}
const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
vec2(-1.,3.)/8.,
vec2(5.0,1.)/8.,
vec2(-3,-5.)/8.,
vec2(-5.,5.)/8.,
vec2(-7.,-1.)/8.,
vec2(3,7.)/8.,
vec2(7.,-7.)/8.);
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
@ -39,27 +31,17 @@ vec4 toClipSpace3(vec3 viewSpacePosition) {
//////////////////////////////VOID MAIN//////////////////////////////
void main() {
gl_Position = ftransform();
lmtexcoord.xy = (gl_TextureMatrix[0] * gl_MultiTexCoord0).st;
vec2 lmcoord = gl_MultiTexCoord1.xy/255.;
lmtexcoord.zw = lmcoord*lmcoord;
vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
color = gl_Color;
gl_Position = toClipSpace3(position);
#ifdef MC_NORMAL_MAP
tangent = vec4(normalize(gl_NormalMatrix *at_tangent.rgb),at_tangent.w);
#endif
normalMat = vec4(normalize(gl_NormalMatrix *gl_Normal),1.0);
// #ifdef TAA_UPSCALING
// gl_Position.xy = gl_Position.xy * RENDER_SCALE + RENDER_SCALE * gl_Position.w - gl_Position.w;
// #endif
color = gl_Color;
#ifdef TAA
gl_Position.xy += offsets[framemod8] * gl_Position.w*texelSize;
gl_Position.xy += offsets[framemod8] * gl_Position.w*texelSize;
#endif
}

View File

@ -1,64 +1,32 @@
#version 120
//#extension GL_EXT_gpu_shader4 : disable
varying vec4 lmtexcoord;
varying vec4 color;
varying vec4 normalMat;
#define SHADOW_MAP_BIAS 0.8
varying vec2 texcoord;
uniform sampler2D texture;
uniform vec4 lightCol;
uniform vec3 sunVec;
uniform vec3 upVec;
uniform vec2 texelSize;
uniform float skyIntensityNight;
uniform float skyIntensity;
uniform float sunElevation;
uniform float rainStrength;
uniform mat4 gbufferProjectionInverse;
uniform mat4 gbufferModelViewInverse;
uniform mat4 shadowModelView;
uniform mat4 shadowProjection;
//faster and actually more precise than pow 2.2
vec3 toLinear(vec3 sRGB){
return sRGB * (sRGB * (sRGB * 0.305306011 + 0.682171111) + 0.012522878);
}
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
vec3 toScreenSpace(vec3 p) {
vec4 iProjDiag = vec4(gbufferProjectionInverse[0].x, gbufferProjectionInverse[1].y, gbufferProjectionInverse[2].zw);
vec3 p3 = p * 2. - 1.;
vec4 fragposition = iProjDiag * p3.xyzz + gbufferProjectionInverse[3];
return fragposition.xyz / fragposition.w;
}
float interleaved_gradientNoise(){
vec2 coord = gl_FragCoord.xy;
float noise = fract(52.9829189*fract(0.06711056*coord.x + 0.00583715*coord.y));
return noise;
vec4 encode (vec3 n, vec2 lightmaps){
n.xy = n.xy / dot(abs(n), vec3(1.0));
n.xy = n.z <= 0.0 ? (1.0 - abs(n.yx)) * sign(n.xy) : n.xy;
vec2 encn = clamp(n.xy * 0.5 + 0.5,-1.0,1.0);
return vec4(encn,vec2(lightmaps.x,lightmaps.y));
}
float facos(float sx){
float x = clamp(abs( sx ),0.,1.);
float a = sqrt( 1. - x ) * ( -0.16882 * x + 1.56734 );
return sx > 0. ? a : 3.14159265359 - a;
//encoding by jodie
float encodeVec2(vec2 a){
const vec2 constant1 = vec2( 1., 256.) / 65535.;
vec2 temp = floor( a * 255. );
return temp.x*constant1.x+temp.y*constant1.y;
}
#define SHADOW_MAP_BIAS 0.8
float calcDistort(vec2 worlpos){
vec2 pos = worlpos * 1.165;
vec2 posSQ = pos*pos;
float distb = pow(posSQ.x*posSQ.x*posSQ.x + posSQ.y*posSQ.y*posSQ.y, 1.0 / 6.0);
return 1.08695652/((1.0 - SHADOW_MAP_BIAS) + distb * SHADOW_MAP_BIAS);
float encodeVec2(float x,float y){
return encodeVec2(vec2(x,y));
}
//////////////////////////////VOID MAIN//////////////////////////////
@ -66,25 +34,14 @@ float calcDistort(vec2 worlpos){
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
/* DRAWBUFFERS:2 */
/* DRAWBUFFERS:28 */
void main() {
vec4 Albedo = vec4(texture2D(texture, texcoord).rgb*5.0,1.0);
Albedo *= color;
Albedo.rgb = toLinear(Albedo.rgb);
gl_FragData[0] = texture2D(texture, lmtexcoord.xy)*color;
gl_FragData[0].a = 1.0;
vec3 albedo = toLinear(gl_FragData[0].rgb);
float torch_lightmap = lmtexcoord.z;
vec3 diffuseLight = torch_lightmap*vec3(20.,30.,50.)*2./10. ;
vec3 color = diffuseLight*albedo;
gl_FragData[0].rgb = color*0.01;
}
gl_FragData[0] = Albedo;
gl_FragData[1] = vec4(0.0,0.0,0.0,0.9);
}

View File

@ -1,6 +1,8 @@
#version 120
//#extension GL_EXT_gpu_shader4 : disable
#define TAA
#include "lib/settings.glsl"
#include "/lib/res_params.glsl"
/*
!! DO NOT REMOVE !!
@ -9,24 +11,19 @@ Read the terms of modification and sharing before changing something below pleas
!! DO NOT REMOVE !!
*/
varying vec4 lmtexcoord;
varying vec4 color;
varying vec4 normalMat;
#ifdef MC_NORMAL_MAP
varying vec4 tangent;
attribute vec4 at_tangent;
#endif
varying vec2 texcoord;
uniform vec2 texelSize;
uniform int framemod8;
const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
vec2(-1.,3.)/8.,
vec2(5.0,1.)/8.,
vec2(-3,-5.)/8.,
vec2(-5.,5.)/8.,
vec2(-7.,-1.)/8.,
vec2(3,7.)/8.,
vec2(7.,-7.)/8.);
const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
vec2(-1.,3.)/8.,
vec2(5.0,1.)/8.,
vec2(-3,-5.)/8.,
vec2(-5.,5.)/8.,
vec2(-7.,-1.)/8.,
vec2(3,7.)/8.,
vec2(7.,-7.)/8.);
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
@ -34,21 +31,18 @@ uniform int framemod8;
//////////////////////////////VOID MAIN//////////////////////////////
void main() {
lmtexcoord.xy = (gl_MultiTexCoord0).xy;
vec2 lmcoord = gl_MultiTexCoord1.xy/255.;
lmtexcoord.zw = lmcoord;
gl_Position = ftransform();
color = gl_Color;
#ifdef MC_NORMAL_MAP
tangent = vec4(normalize(gl_NormalMatrix *at_tangent.rgb),at_tangent.w);
#endif
normalMat = vec4(normalize(gl_NormalMatrix *gl_Normal),1.0);
#ifdef TAA
gl_Position.xy += offsets[framemod8] * gl_Position.w*texelSize;
if(gl_Color.a < 1.0 ) gl_Position = vec4(10,10,10,1);
texcoord = (gl_MultiTexCoord0).xy;
color = gl_Color;
#ifdef TAA_UPSCALING
gl_Position.xy = gl_Position.xy * RENDER_SCALE + RENDER_SCALE * gl_Position.w - gl_Position.w;
#endif
}
#ifdef TAA
gl_Position.xy += offsets[framemod8] * gl_Position.w*texelSize;
#endif
}

View File

@ -40,12 +40,6 @@ void main() {
vec4 Albedo = texture2D(texture, texcoord);
// if (Albedo.a > 0.1) Albedo.a = 1.0;
// else Albedo.a = 0.0;
// vec4 data1 = vec4(1);
// gl_FragData[0] = vec4(encodeVec2(Albedo.x,data1.x), encodeVec2(Albedo.y,data1.y), encodeVec2(Albedo.z,data1.z), encodeVec2(data1.w,Albedo.w));
Albedo *= color;
Albedo.rgb = toLinear(Albedo.rgb);

View File

@ -1,7 +1,7 @@
#version 120
//#extension GL_EXT_gpu_shader4 : disable
#include "/lib/settings.glsl"
#include "lib/settings.glsl"
#include "/lib/res_params.glsl"
/*
@ -34,9 +34,14 @@ void main() {
gl_Position = ftransform();
// if(gl_Color.a < 0.1 ) gl_Position = vec4(10,10,10,1);
texcoord = (gl_MultiTexCoord0).xy;
color = gl_Color;
#ifdef TAA_UPSCALING
gl_Position.xy = gl_Position.xy * RENDER_SCALE + RENDER_SCALE * gl_Position.w - gl_Position.w;
#endif
#ifdef TAA
gl_Position.xy += offsets[framemod8] * gl_Position.w*texelSize;
#endif

View File

@ -384,7 +384,7 @@ void main() {
#endif
#endif
float vanilla_AO = normalAndAO.a;
float vanilla_AO = clamp(normalAndAO.a,0,1);
normalAndAO.a = clamp(pow(normalAndAO.a*5,4),0,1);
@ -406,7 +406,7 @@ void main() {
p3 += gbufferModelViewInverse[3].xyz;
// do all ambient lighting stuff
vec3 AO = vec3( exp( (vanilla_AO*vanilla_AO) * -5) ) ;
vec3 Indirect_lighting = DoAmbientLighting_End(gl_Fog.color.rgb, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.x, normal, np3) ;
// Indirect_lighting = vec3(TORCH_R,TORCH_G,TORCH_B) * curveinvert(clamp(lightmap.x,0.0,1.0),2);
@ -459,9 +459,9 @@ void main() {
if(!hand) gl_FragData[0].rgb *= ssao(fragpos,noise,FlatNormals) * AO;
// if(lightningBolt) albedo.rgb += vec3(Lightning_R,Lightning_G,Lightning_B) ;
LabEmission(gl_FragData[0].rgb, albedo, SpecularTex.a);
if(lightningBolt) gl_FragData[0].rgb = LightColor * 10 ;

View File

@ -5,12 +5,12 @@
#include "/lib/settings.glsl"
flat varying vec4 lightCol;
flat varying vec3 ambientUp;
flat varying vec3 ambientLeft;
flat varying vec3 ambientRight;
flat varying vec3 ambientB;
flat varying vec3 ambientF;
flat varying vec3 ambientDown;
// flat varying vec3 ambientUp;
// flat varying vec3 ambientLeft;
// flat varying vec3 ambientRight;
// flat varying vec3 ambientB;
// flat varying vec3 ambientF;
// flat varying vec3 ambientDown;
flat varying float tempOffsets;
flat varying float fogAmount;
flat varying float VFAmount;

View File

@ -1,6 +1,6 @@
#version 120
//Horizontal bilateral blur for volumetric fog + Forward rendered objects + Draw volumetric fog
//#extension GL_EXT_gpu_shader4 : disable
#extension GL_EXT_gpu_shader4 : disable
#include "/lib/settings.glsl"

View File

@ -5,12 +5,13 @@
#include "/lib/settings.glsl"
flat varying vec3 ambientUp;
flat varying vec3 ambientLeft;
flat varying vec3 ambientRight;
flat varying vec3 ambientB;
flat varying vec3 ambientF;
flat varying vec3 ambientDown;
// flat varying vec3 ambientUp;
// flat varying vec3 ambientLeft;
// flat varying vec3 ambientRight;
// flat varying vec3 ambientB;
// flat varying vec3 ambientF;
// flat varying vec3 ambientDown;
flat varying vec3 lightSourceColor;
flat varying vec3 sunColor;
flat varying vec3 sunColorCloud;

View File

@ -19,6 +19,11 @@ uniform int isEyeInWater;
#include "/lib/color_dither.glsl"
#include "/lib/res_params.glsl"
/// thanks stackoverflow https://stackoverflow.com/questions/944713/help-with-pixel-shader-effect-for-brightness-and-contrast#3027595
void applyContrast(inout vec3 color, float contrast){
color = (color - 0.5) * contrast + 0.5;
}
vec4 SampleTextureCatmullRom(sampler2D tex, vec2 uv, vec2 texSize )
{
// We're going to sample a a 4x4 grid of texels surrounding the target UV coordinate. We'll do this by rounding
@ -69,6 +74,11 @@ vec4 SampleTextureCatmullRom(sampler2D tex, vec2 uv, vec2 texSize )
return result;
}
/// thanks stackoverflow https://stackoverflow.com/questions/944713/help-with-pixel-shader-effect-for-brightness-and-contrast#3027595
void applyContrast(inout vec3 color, float contrast){
color = (color - 0.5) * contrast + 0.5;
}
void main() {
#ifdef BICUBIC_UPSCALING
vec3 col = SampleTextureCatmullRom(colortex7,texcoord,1.0/texelSize).rgb;
@ -96,6 +106,9 @@ void main() {
vec3 diff = col-lum;
col = col + diff*(-lum*CROSSTALK + SATURATION);
//col = -vec3(-lum*CROSSFADING + SATURATION);
applyContrast(col, CONTRAST);
gl_FragColor.rgb = clamp(int8Dither(col,texcoord),0.0,1.0);
//gl_FragColor.rgb = vec3(contrast);
}

View File

@ -1,81 +1,25 @@
#version 120
//#extension GL_EXT_gpu_shader4 : disable
#include "/lib/settings.glsl"
varying vec4 lmtexcoord;
varying vec4 color;
varying vec4 normalMat;
uniform sampler2D texture;
uniform sampler2D gaux1;
uniform vec4 lightCol;
uniform vec3 sunVec;
uniform vec2 texelSize;
uniform float skyIntensityNight;
uniform float skyIntensity;
uniform float sunElevation;
uniform mat4 gbufferProjectionInverse;
uniform mat4 gbufferModelViewInverse;
uniform mat4 shadowModelView;
uniform mat4 shadowProjection;
//faster and actually more precise than pow 2.2
vec3 toLinear(vec3 sRGB){
return sRGB * (sRGB * (sRGB * 0.305306011 + 0.682171111) + 0.012522878);
}
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
vec3 toScreenSpace(vec3 p) {
vec4 iProjDiag = vec4(gbufferProjectionInverse[0].x, gbufferProjectionInverse[1].y, gbufferProjectionInverse[2].zw);
vec3 p3 = p * 2. - 1.;
vec4 fragposition = iProjDiag * p3.xyzz + gbufferProjectionInverse[3];
return fragposition.xyz / fragposition.w;
}
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 facos(float sx){
float x = clamp(abs( sx ),0.,1.);
float a = sqrt( 1. - x ) * ( -0.16882 * x + 1.56734 );
return sx > 0. ? a : 3.14159265359 - a;
}
#define SHADOW_MAP_BIAS 0.8
float calcDistort(vec2 worlpos){
vec2 pos = worlpos * 1.165;
vec2 posSQ = pos*pos;
float distb = pow(posSQ.x*posSQ.x*posSQ.x + posSQ.y*posSQ.y*posSQ.y, 1.0 / 6.0);
return 1.08695652/((1.0 - SHADOW_MAP_BIAS) + distb * SHADOW_MAP_BIAS);
}
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
/* DRAWBUFFERS:2 */
void main() {
gl_FragData[0] = texture2D(texture, lmtexcoord.xy);
vec3 albedo = toLinear(gl_FragData[0].rgb*color.rgb);
float exposure = texelFetch2D(gaux1,ivec2(10,37),0).r;
vec3 col = albedo*exp(-exposure*3.);
gl_FragData[0].rgb = col*color.a;
gl_FragData[0].a = gl_FragData[0].a*0.1;
gl_FragData[0] = vec4(toLinear( texture2D(texture, lmtexcoord.xy).rgb * color.rgb), 0.1);
}

View File

@ -1,5 +1,6 @@
#version 120
//#extension GL_EXT_gpu_shader4 : disable
#include "/lib/settings.glsl"
#include "/lib/res_params.glsl"
/*
@ -11,26 +12,17 @@ Read the terms of modification and sharing before changing something below pleas
varying vec4 lmtexcoord;
varying vec4 color;
varying vec4 normalMat;
#ifdef MC_NORMAL_MAP
varying vec4 tangent;
attribute vec4 at_tangent;
#endif
uniform vec2 texelSize;
uniform int framemod8;
const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
vec2(-1.,3.)/8.,
vec2(5.0,1.)/8.,
vec2(-3,-5.)/8.,
vec2(-5.,5.)/8.,
vec2(-7.,-1.)/8.,
vec2(3,7.)/8.,
vec2(7.,-7.)/8.);
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
vec4 toClipSpace3(vec3 viewSpacePosition) {
return vec4(projMAD(gl_ProjectionMatrix, viewSpacePosition),-viewSpacePosition.z);
}
const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
vec2(-1.,3.)/8.,
vec2(5.0,1.)/8.,
vec2(-3,-5.)/8.,
vec2(-5.,5.)/8.,
vec2(-7.,-1.)/8.,
vec2(3,7.)/8.,
vec2(7.,-7.)/8.);
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
@ -39,25 +31,17 @@ vec4 toClipSpace3(vec3 viewSpacePosition) {
//////////////////////////////VOID MAIN//////////////////////////////
void main() {
gl_Position = ftransform();
lmtexcoord.xy = (gl_TextureMatrix[0] * gl_MultiTexCoord0).st;
vec2 lmcoord = gl_MultiTexCoord1.xy/255.;
lmtexcoord.zw = lmcoord*lmcoord;
vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
color = gl_Color;
gl_Position = toClipSpace3(position);
color = gl_Color;
#ifdef MC_NORMAL_MAP
tangent = vec4(normalize(gl_NormalMatrix *at_tangent.rgb),at_tangent.w);
#endif
normalMat = vec4(normalize(gl_NormalMatrix *gl_Normal),1.0);
// #ifdef TAA_UPSCALING
// gl_Position.xy = gl_Position.xy * RENDER_SCALE + RENDER_SCALE * gl_Position.w - gl_Position.w;
// #endif
#ifdef TAA
gl_Position.xy += offsets[framemod8] * gl_Position.w*texelSize;
gl_Position.xy += offsets[framemod8] * gl_Position.w*texelSize;
#endif
}

View File

@ -1,90 +1,29 @@
#version 120
//#extension GL_EXT_gpu_shader4 : disable
#include "/lib/settings.glsl"
varying vec4 lmtexcoord;
varying vec2 texcoord;
varying vec4 color;
varying vec4 normalMat;
#define SHADOW_MAP_BIAS 0.8
uniform sampler2D texture;
uniform vec4 lightCol;
uniform vec3 sunVec;
uniform vec3 upVec;
uniform vec2 texelSize;
uniform float skyIntensityNight;
uniform float skyIntensity;
uniform float sunElevation;
uniform float rainStrength;
uniform mat4 gbufferProjectionInverse;
uniform mat4 gbufferModelViewInverse;
uniform mat4 shadowModelView;
uniform mat4 shadowProjection;
//faster and actually more precise than pow 2.2
vec3 toLinear(vec3 sRGB){
return sRGB * (sRGB * (sRGB * 0.305306011 + 0.682171111) + 0.012522878);
}
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
vec3 toScreenSpace(vec3 p) {
vec4 iProjDiag = vec4(gbufferProjectionInverse[0].x, gbufferProjectionInverse[1].y, gbufferProjectionInverse[2].zw);
vec3 p3 = p * 2. - 1.;
vec4 fragposition = iProjDiag * p3.xyzz + gbufferProjectionInverse[3];
return fragposition.xyz / fragposition.w;
}
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 facos(float sx){
float x = clamp(abs( sx ),0.,1.);
float a = sqrt( 1. - x ) * ( -0.16882 * x + 1.56734 );
return sx > 0. ? a : 3.14159265359 - a;
}
#define SHADOW_MAP_BIAS 0.8
float calcDistort(vec2 worlpos){
vec2 pos = worlpos * 1.165;
vec2 posSQ = pos*pos;
float distb = pow(posSQ.x*posSQ.x*posSQ.x + posSQ.y*posSQ.y*posSQ.y, 1.0 / 6.0);
return 1.08695652/((1.0 - SHADOW_MAP_BIAS) + distb * SHADOW_MAP_BIAS);
}
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
/* DRAWBUFFERS:2 */
/* DRAWBUFFERS:28 */
void main() {
gl_FragData[0] = texture2D(texture, lmtexcoord.xy)*color;
gl_FragData[0].a = 1.0;
vec3 albedo = toLinear(gl_FragData[0].rgb);
float torch_lightmap = lmtexcoord.z;
vec3 diffuseLight = torch_lightmap*vec3(20.,30.,50.)*2./10. ;
vec3 color = diffuseLight*albedo;
gl_FragData[0].rgb = color*0.01;
vec4 Albedo = texture2D(texture, texcoord.xy) * color * 1.5;
gl_FragData[0] = vec4(toLinear(Albedo.rgb), 1.0);
gl_FragData[1] = vec4(0.0, 0.0, 0.0, 0.5);
}

View File

@ -1,6 +1,8 @@
#version 120
//#extension GL_EXT_gpu_shader4 : disable
#define TAA
#include "/lib/settings.glsl"
#include "/lib/res_params.glsl"
/*
!! DO NOT REMOVE !!
@ -9,24 +11,19 @@ Read the terms of modification and sharing before changing something below pleas
!! DO NOT REMOVE !!
*/
varying vec4 lmtexcoord;
varying vec4 color;
varying vec4 normalMat;
#ifdef MC_NORMAL_MAP
varying vec4 tangent;
attribute vec4 at_tangent;
#endif
varying vec2 texcoord;
uniform vec2 texelSize;
uniform int framemod8;
const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
vec2(-1.,3.)/8.,
vec2(5.0,1.)/8.,
vec2(-3,-5.)/8.,
vec2(-5.,5.)/8.,
vec2(-7.,-1.)/8.,
vec2(3,7.)/8.,
vec2(7.,-7.)/8.);
const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
vec2(-1.,3.)/8.,
vec2(5.0,1.)/8.,
vec2(-3,-5.)/8.,
vec2(-5.,5.)/8.,
vec2(-7.,-1.)/8.,
vec2(3,7.)/8.,
vec2(7.,-7.)/8.);
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
@ -34,21 +31,14 @@ uniform int framemod8;
//////////////////////////////VOID MAIN//////////////////////////////
void main() {
lmtexcoord.xy = (gl_MultiTexCoord0).xy;
vec2 lmcoord = gl_MultiTexCoord1.xy/255.;
lmtexcoord.zw = lmcoord;
gl_Position = ftransform();
color = gl_Color;
#ifdef MC_NORMAL_MAP
tangent = vec4(normalize(gl_NormalMatrix *at_tangent.rgb),at_tangent.w);
#endif
if(gl_Color.a < 1.0 ) gl_Position = vec4(10,10,10,1);
texcoord = (gl_MultiTexCoord0).xy;
color = gl_Color;
normalMat = vec4(normalize(gl_NormalMatrix *gl_Normal),1.0);
#ifdef TAA
gl_Position.xy += offsets[framemod8] * gl_Position.w*texelSize;
gl_Position.xy += offsets[framemod8] * gl_Position.w*texelSize;
#endif
}
}

View File

@ -1,9 +1,7 @@
#version 120
/* DRAWBUFFERS:3 */
/* RENDERTARGETS:0 */
void main() {
discard;
}

View File

@ -1,14 +1,5 @@
#version 120
//#extension GL_EXT_gpu_shader4 : disable
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
void main() {
gl_Position.w = -1.0;
gl_Position = ftransform();
}

View File

@ -1,24 +1,7 @@
#version 120
/*
!! DO NOT REMOVE !!
This code is from Chocapic13' shaders
Read the terms of modification and sharing before changing something below please !
!! DO NOT REMOVE !!
*/
/* RENDERTARGETS:0 */
/* DRAWBUFFERS:1 */
varying vec4 color;
varying vec2 texcoord;
//faster and actually more precise than pow 2.2
vec3 toLinear(vec3 sRGB){
return sRGB * (sRGB * (sRGB * 0.305306011 + 0.682171111) + 0.012522878);
}
uniform sampler2D texture;
void main() {
gl_FragData[0] = texture2D(texture,texcoord.xy)*color;
gl_FragData[0].rgb = gl_FragData[0].rgb*gl_FragData[0].a;
discard;
}

View File

@ -1,36 +1,5 @@
#version 120
#define TAA
/*
!! DO NOT REMOVE !!
This code is from Chocapic13' shaders
Read the terms of modification and sharing before changing something below please !
!! DO NOT REMOVE !!
*/
varying vec4 color;
varying vec2 texcoord;
uniform vec2 texelSize;
uniform int framemod8;
const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
vec2(-1.,3.)/8.,
vec2(5.0,1.)/8.,
vec2(-3,-5.)/8.,
vec2(-5.,5.)/8.,
vec2(-7.,-1.)/8.,
vec2(3,7.)/8.,
vec2(7.,-7.)/8.);
void main() {
texcoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).st;
color = gl_Color;
gl_Position = ftransform();
#ifdef TAA
gl_Position.xy += offsets[framemod8] * gl_Position.w*texelSize;
#endif
}

View File

@ -1,9 +1,10 @@
#version 120
#include "/lib/settings.glsl"
varying vec4 color;
varying vec4 lmtexcoord;
varying vec2 texcoord;
varying vec4 color;
uniform sampler2D texture;
//faster and actually more precise than pow 2.2
@ -11,24 +12,6 @@ vec3 toLinear(vec3 sRGB){
return sRGB * (sRGB * (sRGB * 0.305306011 + 0.682171111) + 0.012522878);
}
vec4 encode (vec3 n, vec2 lightmaps){
n.xy = n.xy / dot(abs(n), vec3(1.0));
n.xy = n.z <= 0.0 ? (1.0 - abs(n.yx)) * sign(n.xy) : n.xy;
vec2 encn = clamp(n.xy * 0.5 + 0.5,-1.0,1.0);
return vec4(encn,vec2(lightmaps.x,lightmaps.y));
}
//encoding by jodie
float encodeVec2(vec2 a){
const vec2 constant1 = vec2( 1., 256.) / 65535.;
vec2 temp = floor( a * 255. );
return temp.x*constant1.x+temp.y*constant1.y;
}
float encodeVec2(float x,float y){
return encodeVec2(vec2(x,y));
}
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
@ -38,18 +21,9 @@ float encodeVec2(float x,float y){
void main() {
vec4 Albedo = texture2D(texture, texcoord);
// if (Albedo.a > 0.1) Albedo.a = 1.0;
// else Albedo.a = 0.0;
// vec4 data1 = vec4(1);
// gl_FragData[0] = vec4(encodeVec2(Albedo.x,data1.x), encodeVec2(Albedo.y,data1.y), encodeVec2(Albedo.z,data1.z), encodeVec2(data1.w,Albedo.w));
vec4 Albedo = texture2D(texture, texcoord.xy) * color;
Albedo *= color;
Albedo.rgb = toLinear(Albedo.rgb);
gl_FragData[0] = vec4(toLinear(Albedo.rgb), Albedo.a);
gl_FragData[1] = vec4(0.0, 0.0, 0.0, 0.5);
gl_FragData[0] = Albedo;
gl_FragData[1] = vec4(0.0,0.0,0.0,0.5);
}
}