diff --git a/funnyhaha.zip b/funnyhaha.zip deleted file mode 100644 index 3755746..0000000 Binary files a/funnyhaha.zip and /dev/null differ diff --git a/shaders/composite3.fsh b/shaders/composite3.fsh index 8313c1d..43cece3 100644 --- a/shaders/composite3.fsh +++ b/shaders/composite3.fsh @@ -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); diff --git a/shaders/composite5.fsh b/shaders/composite5.fsh index 506d4b8..2c1599e 100644 --- a/shaders/composite5.fsh +++ b/shaders/composite5.fsh @@ -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; diff --git a/shaders/final.fsh b/shaders/final.fsh index e08140d..05a28ae 100644 --- a/shaders/final.fsh +++ b/shaders/final.fsh @@ -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); } diff --git a/shaders/gbuffers_armor_glint.fsh b/shaders/gbuffers_armor_glint.fsh index be6fa5a..430bda4 100644 --- a/shaders/gbuffers_armor_glint.fsh +++ b/shaders/gbuffers_armor_glint.fsh @@ -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; } diff --git a/shaders/gbuffers_armor_glint.vsh b/shaders/gbuffers_armor_glint.vsh index a8082d3..acb4c70 100644 --- a/shaders/gbuffers_armor_glint.vsh +++ b/shaders/gbuffers_armor_glint.vsh @@ -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 } diff --git a/shaders/lib/diffuse_lighting.glsl b/shaders/lib/diffuse_lighting.glsl index aee90fd..1c9d648 100644 --- a/shaders/lib/diffuse_lighting.glsl +++ b/shaders/lib/diffuse_lighting.glsl @@ -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 \ No newline at end of file diff --git a/shaders/lib/end_fog.glsl b/shaders/lib/end_fog.glsl index 6fb0375..8fda10b 100644 --- a/shaders/lib/end_fog.glsl +++ b/shaders/lib/end_fog.glsl @@ -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 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.); diff --git a/shaders/shaders.properties b/shaders/shaders.properties index 57b30c0..309a9c0 100644 --- a/shaders/shaders.properties +++ b/shaders/shaders.properties @@ -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] 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 FinalR FinalG FinalB + screen.Tonemapping = TONEMAP USE_ACES_COLORSPACE_APPROXIMATION SATURATION CROSSTALK CONTRAST FinalR FinalG FinalB ### PURKINJE screen.Purkinje_effect.columns = 1 screen.Purkinje_effect = Purkinje_strength Purkinje_R Purkinje_G Purkinje_B Purkinje_Multiplier diff --git a/shaders/world-1/composite2.fsh b/shaders/world-1/composite2.fsh index e29c083..b702613 100644 --- a/shaders/world-1/composite2.fsh +++ b/shaders/world-1/composite2.fsh @@ -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); diff --git a/shaders/world-1/composite3.fsh b/shaders/world-1/composite3.fsh index d307c56..6e8a9c6 100644 --- a/shaders/world-1/composite3.fsh +++ b/shaders/world-1/composite3.fsh @@ -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; diff --git a/shaders/world-1/deferred.fsh b/shaders/world-1/deferred.fsh index 5101bbb..175e16c 100644 --- a/shaders/world-1/deferred.fsh +++ b/shaders/world-1/deferred.fsh @@ -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; diff --git a/shaders/world-1/deferred.vsh b/shaders/world-1/deferred.vsh index dc314c3..7110679 100644 --- a/shaders/world-1/deferred.vsh +++ b/shaders/world-1/deferred.vsh @@ -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; diff --git a/shaders/world-1/final.fsh b/shaders/world-1/final.fsh index f63e40d..55c84a7 100644 --- a/shaders/world-1/final.fsh +++ b/shaders/world-1/final.fsh @@ -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); } diff --git a/shaders/world-1/gbuffers_armor_glint.fsh b/shaders/world-1/gbuffers_armor_glint.fsh index 5339fa8..430bda4 100644 --- a/shaders/world-1/gbuffers_armor_glint.fsh +++ b/shaders/world-1/gbuffers_armor_glint.fsh @@ -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); } diff --git a/shaders/world-1/gbuffers_armor_glint.vsh b/shaders/world-1/gbuffers_armor_glint.vsh index 9353bb7..acb4c70 100644 --- a/shaders/world-1/gbuffers_armor_glint.vsh +++ b/shaders/world-1/gbuffers_armor_glint.vsh @@ -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 } diff --git a/shaders/world-1/gbuffers_beaconbeam.fsh b/shaders/world-1/gbuffers_beaconbeam.fsh index 9006e58..4ddf770 100644 --- a/shaders/world-1/gbuffers_beaconbeam.fsh +++ b/shaders/world-1/gbuffers_beaconbeam.fsh @@ -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); +} \ No newline at end of file diff --git a/shaders/world-1/gbuffers_beaconbeam.vsh b/shaders/world-1/gbuffers_beaconbeam.vsh index d43a22a..8fcca72 100644 --- a/shaders/world-1/gbuffers_beaconbeam.vsh +++ b/shaders/world-1/gbuffers_beaconbeam.vsh @@ -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 -} \ No newline at end of file + #ifdef TAA + gl_Position.xy += offsets[framemod8] * gl_Position.w*texelSize; + #endif +} diff --git a/shaders/world-1/gbuffers_spidereyes.fsh b/shaders/world-1/gbuffers_spidereyes.fsh index 07f3e98..ece8cad 100644 --- a/shaders/world-1/gbuffers_spidereyes.fsh +++ b/shaders/world-1/gbuffers_spidereyes.fsh @@ -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); diff --git a/shaders/world-1/gbuffers_spidereyes.vsh b/shaders/world-1/gbuffers_spidereyes.vsh index 70f53ae..ebab698 100644 --- a/shaders/world-1/gbuffers_spidereyes.vsh +++ b/shaders/world-1/gbuffers_spidereyes.vsh @@ -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 diff --git a/shaders/world1/composite.fsh b/shaders/world1/composite.fsh index b9f1f58..297c570 100644 --- a/shaders/world1/composite.fsh +++ b/shaders/world1/composite.fsh @@ -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 ; diff --git a/shaders/world1/composite2.fsh b/shaders/world1/composite2.fsh index 05a5dfd..a9d8404 100644 --- a/shaders/world1/composite2.fsh +++ b/shaders/world1/composite2.fsh @@ -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; diff --git a/shaders/world1/composite3.fsh b/shaders/world1/composite3.fsh index 96e2d81..3500f83 100644 --- a/shaders/world1/composite3.fsh +++ b/shaders/world1/composite3.fsh @@ -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" diff --git a/shaders/world1/deferred.fsh b/shaders/world1/deferred.fsh index c87db6e..0f1055b 100644 --- a/shaders/world1/deferred.fsh +++ b/shaders/world1/deferred.fsh @@ -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; diff --git a/shaders/world1/final.fsh b/shaders/world1/final.fsh index f63e40d..d5d1df8 100644 --- a/shaders/world1/final.fsh +++ b/shaders/world1/final.fsh @@ -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); } diff --git a/shaders/world1/gbuffers_armor_glint.fsh b/shaders/world1/gbuffers_armor_glint.fsh index 5339fa8..430bda4 100644 --- a/shaders/world1/gbuffers_armor_glint.fsh +++ b/shaders/world1/gbuffers_armor_glint.fsh @@ -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); } diff --git a/shaders/world1/gbuffers_armor_glint.vsh b/shaders/world1/gbuffers_armor_glint.vsh index c636189..acb4c70 100644 --- a/shaders/world1/gbuffers_armor_glint.vsh +++ b/shaders/world1/gbuffers_armor_glint.vsh @@ -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 } diff --git a/shaders/world1/gbuffers_beaconbeam.fsh b/shaders/world1/gbuffers_beaconbeam.fsh index 9006e58..6c6a7bf 100644 --- a/shaders/world1/gbuffers_beaconbeam.fsh +++ b/shaders/world1/gbuffers_beaconbeam.fsh @@ -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); } diff --git a/shaders/world1/gbuffers_beaconbeam.vsh b/shaders/world1/gbuffers_beaconbeam.vsh index d43a22a..32726c5 100644 --- a/shaders/world1/gbuffers_beaconbeam.vsh +++ b/shaders/world1/gbuffers_beaconbeam.vsh @@ -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 -} \ No newline at end of file +} diff --git a/shaders/world1/gbuffers_skybasic.fsh b/shaders/world1/gbuffers_skybasic.fsh index 563a191..21db346 100644 --- a/shaders/world1/gbuffers_skybasic.fsh +++ b/shaders/world1/gbuffers_skybasic.fsh @@ -1,9 +1,7 @@ #version 120 -/* DRAWBUFFERS:3 */ - - +/* RENDERTARGETS:0 */ void main() { - + discard; } diff --git a/shaders/world1/gbuffers_skybasic.vsh b/shaders/world1/gbuffers_skybasic.vsh index b76e386..0a2f94b 100644 --- a/shaders/world1/gbuffers_skybasic.vsh +++ b/shaders/world1/gbuffers_skybasic.vsh @@ -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(); } diff --git a/shaders/world1/gbuffers_skytextured.fsh b/shaders/world1/gbuffers_skytextured.fsh index 8ad1592..21db346 100644 --- a/shaders/world1/gbuffers_skytextured.fsh +++ b/shaders/world1/gbuffers_skytextured.fsh @@ -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; } diff --git a/shaders/world1/gbuffers_skytextured.vsh b/shaders/world1/gbuffers_skytextured.vsh index 2c401c5..0a2f94b 100644 --- a/shaders/world1/gbuffers_skytextured.vsh +++ b/shaders/world1/gbuffers_skytextured.vsh @@ -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 } - diff --git a/shaders/world1/gbuffers_spidereyes.fsh b/shaders/world1/gbuffers_spidereyes.fsh index 07f3e98..8255274 100644 --- a/shaders/world1/gbuffers_spidereyes.fsh +++ b/shaders/world1/gbuffers_spidereyes.fsh @@ -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); -} \ No newline at end of file +}