From 1ea16b150a084a6f71aa1651f3c75dd058e30c40 Mon Sep 17 00:00:00 2001 From: Xonk Date: Fri, 1 Mar 2024 22:48:09 -0500 Subject: [PATCH] improve fog upsampler and filtered effects upsampler. improve metals in specular reflections. fix end and nether not compiling, and fix SSAO making them black. redo water shader. added water caustics strength misc setting. add 2 new post process types "xonk tonemapp" and "full reinhard". create overdraw prevention for DH shadowmap. fix SSS with dh shadowmap. tweak screenspace shadow SSS to be better in the distance. add fog behind glass. move water fog to be done in the fog behind glass pass. --- shaders/block.properties | 4 +- shaders/dimensions/DH_solid.fsh | 9 +- shaders/dimensions/DH_translucent.fsh | 22 +- shaders/dimensions/all_particles.fsh | 10 +- shaders/dimensions/all_solid.fsh | 4 +- shaders/dimensions/all_translucent.fsh | 80 ++- shaders/dimensions/composite.fsh | 43 +- shaders/dimensions/composite.vsh | 6 +- shaders/dimensions/composite1.fsh | 615 +++++++++--------- shaders/dimensions/composite1.vsh | 13 +- shaders/dimensions/composite11.fsh | 16 + shaders/dimensions/composite2.fsh | 288 +++++--- shaders/dimensions/composite2.vsh | 33 +- shaders/dimensions/composite3.fsh | 169 ++--- shaders/dimensions/composite3.vsh | 14 +- shaders/dimensions/composite5.fsh | 2 +- shaders/dimensions/deferred.fsh | 5 +- shaders/dimensions/deferred2.fsh | 17 +- shaders/dimensions/deferred3.fsh | 392 +++++++++++ shaders/dimensions/deferred3.vsh | 48 ++ shaders/dimensions/final.fsh | 18 +- .../dimensions/fogBehindTranslucent_pass.fsh | 436 +++++++++++++ .../dimensions/fogBehindTranslucent_pass.vsh | 71 ++ shaders/lang/en_us.lang | 2 +- shaders/lib/color_transforms.glsl | 17 + shaders/lib/diffuse_lighting.glsl | 9 +- shaders/lib/end_fog.glsl | 4 +- shaders/lib/indirect_lighting_effects.glsl | 40 +- shaders/lib/nether_fog.glsl | 5 + shaders/lib/overworld_fog.glsl | 2 +- shaders/lib/settings.glsl | 18 +- shaders/lib/specular.glsl | 6 +- shaders/lib/stars.glsl | 3 +- shaders/lib/volumetricClouds.glsl | 5 +- shaders/lib/waterBump.glsl | 115 ++-- shaders/shaders.properties | 11 +- shaders/world-1/composite.fsh | 5 + shaders/world-1/composite.vsh | 5 + shaders/world-1/composite1.fsh | 2 +- shaders/world-1/composite1.vsh | 2 +- shaders/world-1/composite10.fsh | 2 +- shaders/world-1/composite10.vsh | 2 +- shaders/world-1/composite11.fsh | 2 +- shaders/world-1/composite11.vsh | 2 +- shaders/world-1/composite12.fsh | 5 + shaders/world-1/composite12.vsh | 5 + shaders/world-1/composite2.fsh | 2 +- shaders/world-1/composite2.vsh | 2 +- shaders/world-1/composite3.fsh | 2 +- shaders/world-1/composite3.vsh | 2 +- shaders/world-1/composite4.fsh | 2 +- shaders/world-1/composite4.vsh | 2 +- shaders/world-1/composite5.fsh | 2 +- shaders/world-1/composite5.vsh | 2 +- shaders/world-1/composite6.fsh | 2 +- shaders/world-1/composite6.vsh | 2 +- shaders/world-1/composite7.fsh | 2 +- shaders/world-1/composite7.vsh | 2 +- shaders/world-1/composite8.fsh | 2 +- shaders/world-1/composite8.vsh | 2 +- shaders/world-1/composite9.fsh | 2 +- shaders/world-1/composite9.vsh | 2 +- shaders/world0/composite.fsh | 2 +- shaders/world0/composite.vsh | 2 +- shaders/world0/composite1.fsh | 2 +- shaders/world0/composite1.vsh | 2 +- shaders/world0/composite10.fsh | 2 +- shaders/world0/composite10.vsh | 2 +- shaders/world0/composite11.fsh | 2 +- shaders/world0/composite11.vsh | 2 +- shaders/world0/composite12.fsh | 5 + shaders/world0/composite12.vsh | 5 + shaders/world0/composite2.fsh | 2 +- shaders/world0/dh_shadow.fsh | 14 +- shaders/world0/dh_shadow.vsh | 9 +- shaders/world0/shadow.vsh | 4 +- shaders/world1/composite.fsh | 5 + shaders/world1/composite.vsh | 5 + shaders/world1/composite1.fsh | 2 +- shaders/world1/composite1.vsh | 2 +- shaders/world1/composite10.fsh | 2 +- shaders/world1/composite10.vsh | 2 +- shaders/world1/composite11.fsh | 2 +- shaders/world1/composite11.vsh | 2 +- shaders/world1/composite12.fsh | 5 + shaders/world1/composite12.vsh | 5 + shaders/world1/composite2.fsh | 2 +- shaders/world1/composite2.vsh | 2 +- shaders/world1/composite3.fsh | 2 +- shaders/world1/composite3.vsh | 2 +- shaders/world1/composite4.fsh | 2 +- shaders/world1/composite4.vsh | 2 +- shaders/world1/composite5.fsh | 2 +- shaders/world1/composite5.vsh | 2 +- shaders/world1/composite6.fsh | 2 +- shaders/world1/composite6.vsh | 2 +- shaders/world1/composite7.fsh | 2 +- shaders/world1/composite7.vsh | 2 +- shaders/world1/composite8.fsh | 2 +- shaders/world1/composite8.vsh | 2 +- shaders/world1/composite9.fsh | 2 +- shaders/world1/composite9.vsh | 2 +- 102 files changed, 1982 insertions(+), 753 deletions(-) create mode 100644 shaders/dimensions/deferred3.fsh create mode 100644 shaders/dimensions/deferred3.vsh create mode 100644 shaders/dimensions/fogBehindTranslucent_pass.fsh create mode 100644 shaders/dimensions/fogBehindTranslucent_pass.vsh create mode 100644 shaders/world-1/composite.fsh create mode 100644 shaders/world-1/composite.vsh create mode 100644 shaders/world-1/composite12.fsh create mode 100644 shaders/world-1/composite12.vsh create mode 100644 shaders/world0/composite12.fsh create mode 100644 shaders/world0/composite12.vsh create mode 100644 shaders/world1/composite.fsh create mode 100644 shaders/world1/composite.vsh create mode 100644 shaders/world1/composite12.fsh create mode 100644 shaders/world1/composite12.vsh diff --git a/shaders/block.properties b/shaders/block.properties index 42bb42b..e6c64df 100644 --- a/shaders/block.properties +++ b/shaders/block.properties @@ -18,12 +18,12 @@ ####### ----- blocks with SSS ----- ####### ## strong sss - block.10004 = minecraft:tall_seagrass minecraft:seagrass minecraft:kelp minecraft:large_fern:half=lower minecraft:tall_grass minecraft:tall_seagrass minecraft:kelp_plant minecraft:peony minecraft:rose_bush minecraft:lilac minecraft:sunflower:half=lower minecraft:packed_ice minecraft:blue_ice minecraft:melon_stem minecraft:pumpkin_stem minecraft:attached_melon_stem minecraft:attached_pumpkin_stem minecraft:lily_pad \ + block.10004 = minecraft:flowering_azalea minecraft:tall_seagrass minecraft:seagrass minecraft:kelp minecraft:large_fern:half=lower minecraft:tall_grass minecraft:tall_seagrass minecraft:kelp_plant minecraft:peony minecraft:rose_bush minecraft:lilac minecraft:sunflower:half=lower minecraft:packed_ice minecraft:blue_ice minecraft:melon_stem minecraft:pumpkin_stem minecraft:attached_melon_stem minecraft:attached_pumpkin_stem minecraft:lily_pad \ \ westerosblocks:blackberry_bush westerosblocks:blueberry_bush westerosblocks:raspberry_bush westerosblocks:juniper_bush westerosblocks:red_rose_bush westerosblocks:pink_rose_bush westerosblocks:white_rose_bush westerosblocks:yellow_rose_bush westerosblocks:yellow_wildflowers westerosblocks:green_spiny_herb westerosblocks:green_leafy_herb westerosblocks:orange_marigolds westerosblocks:orange_trollius westerosblocks:blue_forgetmenots westerosblocks:pink_wildflowers westerosblocks:yellow_tansy westerosblocks:blue_flax westerosblocks:white_daisies westerosblocks:yellow_daisies westerosblocks:green_scrub_grass westerosblocks:dead_scrub_grass westerosblocks:yellow_bedstraw westerosblocks:orange_bells westerosblocks:blue_bells westerosblocks:blue_swamp_bells westerosblocks:yellow_buttercups westerosblocks:orange_bog_asphodel westerosblocks:yellow_lupine westerosblocks:blue_hyacinth westerosblocks:pink_thistle westerosblocks:yellow_dandelions westerosblocks:yellow_daffodils westerosblocks:yellow_roses westerosblocks:strawberry_bush westerosblocks:white_lilyofthevalley westerosblocks:yellow_bells westerosblocks:yellow_sunflower westerosblocks:white_roses westerosblocks:red_dark_roses westerosblocks:yellow_hellebore westerosblocks:meadow_fescue westerosblocks:red_poppies westerosblocks:red_roses westerosblocks:purple_pansies westerosblocks:purple_roses westerosblocks:orange_sun_star westerosblocks:pink_primrose westerosblocks:red_aster westerosblocks:blue_chicory westerosblocks:red_flowering_spiny_herb westerosblocks:purple_foxglove westerosblocks:pink_allium westerosblocks:purple_violets westerosblocks:white_chamomile westerosblocks:red_tulips westerosblocks:white_peony westerosblocks:purple_alpine_sowthistle westerosblocks:red_carnations westerosblocks:magenta_roses westerosblocks:red_chrysanthemum westerosblocks:blue_orchid westerosblocks:yellow_rudbeckia westerosblocks:pink_tulips westerosblocks:cranberry_bush westerosblocks:purple_lavender westerosblocks:red_sourleaf_bush westerosblocks:pink_sweet_peas westerosblocks:red_sorrel westerosblocks:pink_roses westerosblocks:unshaded_grass westerosblocks:cow_parsely westerosblocks:bracken westerosblocks:lady_fern westerosblocks:nettle westerosblocks:dead_bracken westerosblocks:fireweed westerosblocks:heather westerosblocks:red_fern westerosblocks:dock_leaf westerosblocks:jasmine_vines westerosblocks:dappled_moss westerosblocks:cushion_moss_wall westerosblocks:hemp_short westerosblocks:hemp_tall westerosblocks:hemp_dense westerosblocks:crop_carrots westerosblocks:crop_wheat westerosblocks:crop_turnips westerosblocks:crop_peas westerosblocks:cattails westerosblocks:jungle_tall_fern westerosblocks:jungle_tall_grass westerosblocks:savanna_tall_grass \ ## weak sss - block.10006 = minecraft:grass_block:snowy=true minecraft:snow_block minecraft:snow powder_snow cobweb red_mushroom_block brown_mushroom_block weeping_vines weeping_vines_plant twisting_vines twisting_vines_plant vine tube_coral tube_coral_block tube_coral_fan tube_coral_wall_fan horn_coral horn_coral_block horn_coral_fan horn_coral_wall_fan fire_coral fire_coral_block fire_coral_fan fire_coral_wall_fan dead_brain_coral dead_brain_coral_block dead_brain_coral_fan dead_brain_coral_wall_fan dead_bubble_coral dead_bubble_coral_block dead_bubble_coral_fan dead_bubble_coral_wall_fan dead_bush dead_fire_coral dead_fire_coral_block dead_fire_coral_fan dead_fire_coral_wall_fan dead_horn_coral dead_horn_coral_block dead_horn_coral_fan dead_horn_coral_wall_fan dead_tube_coral dead_tube_coral_block dead_tube_coral_fan dead_tube_coral_wall_fan bubble_coral bubble_coral_block bubble_coral_fan bubble_coral_wall_fan brain_coral brain_coral_block brain_coral_fan brain_coral_wall_fan bamboo bamboo_sapling minecraft:spore_blossom minecraft:cave_vines minecraft:cave_vines_plant minecraft:glow_lichen minecraft:melon minecraft:pumpkin minecraft:big_dripleaf minecraft:big_dripleaf_stem minecraft:cactus minecraft:hay_block minecraft:brown_mushroom minecraft:mushroom_stem minecraft:sugar_cane minecraft:crimson_fungus minecraft:warped_fungus minecraft:sea_pickle minecraft:honeycomb_block + block.10006 = minecraft:amethyst_block minecraft:budding_amethyst minecraft:small_amethyst_bud minecraft:medium_amethyst_bud minecraft:large_amethyst_bud minecraft:amethyst_cluster minecraft:pitcher_plant minecraft:small_dripleaf minecraft:grass_block:snowy=true minecraft:snow_block minecraft:snow powder_snow cobweb red_mushroom_block brown_mushroom_block weeping_vines weeping_vines_plant twisting_vines twisting_vines_plant vine tube_coral tube_coral_block tube_coral_fan tube_coral_wall_fan horn_coral horn_coral_block horn_coral_fan horn_coral_wall_fan fire_coral fire_coral_block fire_coral_fan fire_coral_wall_fan dead_brain_coral dead_brain_coral_block dead_brain_coral_fan dead_brain_coral_wall_fan dead_bubble_coral dead_bubble_coral_block dead_bubble_coral_fan dead_bubble_coral_wall_fan dead_bush dead_fire_coral dead_fire_coral_block dead_fire_coral_fan dead_fire_coral_wall_fan dead_horn_coral dead_horn_coral_block dead_horn_coral_fan dead_horn_coral_wall_fan dead_tube_coral dead_tube_coral_block dead_tube_coral_fan dead_tube_coral_wall_fan bubble_coral bubble_coral_block bubble_coral_fan bubble_coral_wall_fan brain_coral brain_coral_block brain_coral_fan brain_coral_wall_fan bamboo bamboo_sapling minecraft:spore_blossom minecraft:cave_vines minecraft:cave_vines_plant minecraft:glow_lichen minecraft:melon minecraft:pumpkin minecraft:big_dripleaf minecraft:big_dripleaf_stem minecraft:cactus minecraft:hay_block minecraft:brown_mushroom minecraft:mushroom_stem minecraft:sugar_cane minecraft:crimson_fungus minecraft:warped_fungus minecraft:sea_pickle minecraft:honeycomb_block ## weak sss block.200 = minecraft:white_wool minecraft:orange_wool minecraft:magenta_wool minecraft:light_blue_wool minecraft:yellow_wool minecraft:lime_wool minecraft:pink_wool minecraft:gray_wool minecraft:light_gray_wool minecraft:cyan_wool minecraft:purple_wool minecraft:blue_wool minecraft:brown_wool minecraft:green_wool minecraft:red_wool minecraft:black_wool minecraft:orange_carpet minecraft:magenta_carpet minecraft:light_blue_carpet minecraft:yellow_carpet minecraft:lime_carpet minecraft:pink_carpet minecraft:gray_carpet minecraft:light_gray_carpet minecraft:cyan_carpet minecraft:purple_carpet minecraft:blue_carpet minecraft:brown_carpet minecraft:green_carpet minecraft:red_carpet minecraft:black_carpet \ diff --git a/shaders/dimensions/DH_solid.fsh b/shaders/dimensions/DH_solid.fsh index 012a192..9a74593 100644 --- a/shaders/dimensions/DH_solid.fsh +++ b/shaders/dimensions/DH_solid.fsh @@ -66,9 +66,14 @@ uniform float frameTimeCounter; float blueNoise(){ return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter); } -float interleaved_gradientNoise(){ +float interleaved_gradientNoise_temporal(){ return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y)+frameTimeCounter*51.9521); } +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 R2_dither(){ vec2 coord = gl_FragCoord.xy + (frameCounter%40000) * 2.0; vec2 alpha = vec2(0.75487765, 0.56984026); @@ -96,7 +101,7 @@ void main() { #ifdef DH_OVERDRAW_PREVENTION // overdraw prevention - if(clamp(1.0-length(pos.xyz)/max(far - 16.0,0.0),0.0,1.0) > 0.0 ){ + if(clamp(1.0-length(pos.xyz)/max(far - 32.0 * sqrt(interleaved_gradientNoise_temporal()),0.0),0.0,1.0) > 0.0 ){ discard; return; } diff --git a/shaders/dimensions/DH_translucent.fsh b/shaders/dimensions/DH_translucent.fsh index 673df58..35b0ff5 100644 --- a/shaders/dimensions/DH_translucent.fsh +++ b/shaders/dimensions/DH_translucent.fsh @@ -158,25 +158,24 @@ vec3 rayTrace(vec3 dir, vec3 position,float dither, float fresnel, bool inwater) vec3 stepv = direction * mult / quality * vec3(RENDER_SCALE,1.0); - vec3 spos = clipPosition*vec3(RENDER_SCALE,1.0) + stepv; + vec3 spos = clipPosition*vec3(RENDER_SCALE,1.0) + stepv*dither; float minZ = clipPosition.z; float maxZ = spos.z+stepv.z*0.5; spos.xy += offsets[framemod8]*texelSize*0.5/RENDER_SCALE; - float dist = 1.0 + clamp(position.z*position.z/50.0,0,2); // shrink sample size as distance increases for (int i = 0; i <= int(quality); i++) { - float sp = sqrt(texelFetch2D(colortex12,ivec2(spos.xy/texelSize/4),0).a/65000.0); sp = DH_inv_ld(sp); if(sp <= max(maxZ,minZ) && sp >= min(maxZ,minZ)) return vec3(spos.xy/RENDER_SCALE,sp); - spos += stepv; + //small bias - minZ = maxZ-0.00035/DH_ld(spos.z); + minZ = maxZ-0.0000035/DH_ld(spos.z); + maxZ += stepv.z; } @@ -243,16 +242,14 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) if(iswater){ vec3 posxz = playerPos+cameraPosition; - posxz.xz -= posxz.y; - vec3 waterHeightmap = normalize(getWaveHeight(posxz.xz,1.0)); + vec3 waterHeightmap = normalize(getWaveNormal(posxz, true)); float bumpmult = WATER_WAVE_STRENGTH; waterHeightmap = waterHeightmap * vec3(bumpmult, bumpmult, bumpmult) + vec3(0.0f, 0.0f, 1.0f - bumpmult); waterHeightmap = normalize(waterHeightmap); - vec2 TangentNormal = waterHeightmap.xy*0.5+0.5; - + // vec2 TangentNormal = waterHeightmap.xy*0.5+0.5; // gl_FragData[2] = vec4(encodeVec2(TangentNormal), encodeVec2(vec2(1.0)), encodeVec2(vec2(1.0)), 1.0); if(normals.y > 0.0) normals = vec3(waterHeightmap.x,normals.y,waterHeightmap.y); @@ -320,10 +317,11 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) float normalDotEye = dot(normals, normalize(pos.xyz)); float fresnel = pow(clamp(1.0 + normalDotEye, 0.0, 1.0),5.0); - fresnel = mix(0.02, 1.0, fresnel); + + fresnel = mix(0.1, 1.0, fresnel); + #ifdef SNELLS_WINDOW - // snells window looking thing - if(isEyeInWater == 1 ) fresnel = pow(clamp(1.66 + normalDotEye,0.0,1.0), 25.0); + if(isEyeInWater == 1) fresnel = pow(clamp(1.5 + normalDotEye,0.0,1.0), 25.0); #endif #ifdef WATER_REFLECTIONS diff --git a/shaders/dimensions/all_particles.fsh b/shaders/dimensions/all_particles.fsh index 962ec87..3628c99 100644 --- a/shaders/dimensions/all_particles.fsh +++ b/shaders/dimensions/all_particles.fsh @@ -18,6 +18,8 @@ varying vec4 color; flat varying vec4 lightCol; #endif +uniform int isEyeInWater; + uniform sampler2D texture; uniform sampler2D noisetex; uniform sampler2D colortex4; @@ -135,6 +137,10 @@ void main() { vec3 Direct_lighting = vec3(0.0); vec3 Indirect_lighting = vec3(0.0); + + vec3 MinimumLightColor = vec3(0.2,0.4,1.0); + if(isEyeInWater == 1) MinimumLightColor = vec3(10.0); + vec3 Torch_Color = vec3(TORCH_R,TORCH_G,TORCH_B); @@ -172,7 +178,7 @@ void main() { Direct_lighting *= phaseg(clamp(dot(feetPlayerPos_normalized, WsunVec),0.0,1.0), 0.65)*2 + 0.5; #endif - vec3 AmbientLightColor = averageSkyCol_Clouds * 3.0; + vec3 AmbientLightColor = (averageSkyCol_Clouds / 30.0) * 3.0; #endif @@ -184,7 +190,7 @@ void main() { vec3 AmbientLightColor = vec3(1.0); #endif - Indirect_lighting = DoAmbientLightColor(AmbientLightColor, Torch_Color, clamp(lightmap.xy,0,1)); + Indirect_lighting = DoAmbientLightColor(AmbientLightColor,MinimumLightColor, Torch_Color, clamp(lightmap.xy,0,1)); #ifdef LINES gl_FragData[0].rgb = (Indirect_lighting + Direct_lighting) * toLinear(color.rgb); diff --git a/shaders/dimensions/all_solid.fsh b/shaders/dimensions/all_solid.fsh index 25747ff..1fb1956 100644 --- a/shaders/dimensions/all_solid.fsh +++ b/shaders/dimensions/all_solid.fsh @@ -311,9 +311,9 @@ void main() { vec3 fragpos = toScreenSpace(gl_FragCoord.xyz*vec3(texelSize/RENDER_SCALE,1.0)-vec3(vec2(tempOffset)*texelSize*0.5,0.0)); vec3 worldpos = mat3(gbufferModelViewInverse) * fragpos + gbufferModelViewInverse[3].xyz + cameraPosition; - // #ifdef DH_OVERDRAW_PREVENTION + // #if defined DH_OVERDRAW_PREVENTION && defined DISTANT_HORIZONS // // overdraw prevention - // if(clamp(1.0-length(pos.xyz)/max(far,0.0),0.0,1.0) <= 0.0 ){ + // if(clamp(1.0-length(pos.xyz)/max(far - 16.0 * sqrt(interleaved_gradientNoise_temporal()),0.0),0.0,1.0) <= 0.0 ){ // discard; // return; // } diff --git a/shaders/dimensions/all_translucent.fsh b/shaders/dimensions/all_translucent.fsh index d4dd888..37e08a5 100644 --- a/shaders/dimensions/all_translucent.fsh +++ b/shaders/dimensions/all_translucent.fsh @@ -44,7 +44,6 @@ varying vec4 normalMat; varying vec3 binormal; varying vec3 flatnormal; -varying vec3 viewVector; @@ -77,7 +76,6 @@ uniform vec3 nsunColor; #include "/lib/projections.glsl" #include "/lib/sky_gradient.glsl" #include "/lib/waterBump.glsl" -#include "/lib/stars.glsl" #ifdef OVERWORLD_SHADER flat varying float Flashing; @@ -132,20 +130,29 @@ const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.), #define PW_DEPTH 1.0 //[0.5 1.0 1.5 2.0 2.5 3.0] #define PW_POINTS 1 //[2 4 6 8 16 32] -vec3 getParallaxDisplacement(vec3 posxz, float iswater,float bumpmult,vec3 viewVec) { - float waveZ = mix(20.0,0.25,iswater); - float waveM = mix(0.0,4.0,iswater); +varying vec3 viewVector; +vec3 getParallaxDisplacement(vec3 posxz) { vec3 parallaxPos = posxz; - vec2 vec = viewVector.xy * (1.0 / float(PW_POINTS)) * 22.0 * PW_DEPTH; - float waterHeight = getWaterHeightmap(posxz.xz, waveM, waveZ, iswater) ; - + vec2 vec = viewVector.xy * (1.0 / float(PW_POINTS)) * 22.0; + float waterHeight = getWaterHeightmap(posxz.xz); parallaxPos.xz += waterHeight * vec; return parallaxPos; - } +// vec3 getParallaxDisplacement(vec3 posxz,float bumpmult,vec3 viewVec) { + +// vec3 parallaxPos = posxz; +// vec2 vec = viewVector.xy * (1.0 / float(PW_POINTS)) * 22.0 * PW_DEPTH; +// float waterHeight = getWaterHeightmap(posxz.xz) ; + +// parallaxPos.xz += waterHeight * vec; + +// return parallaxPos; + +// } + vec3 applyBump(mat3 tbnMatrix, vec3 bump, float puddle_values){ float bumpmult = 1; bump = bump * vec3(bumpmult, bumpmult, bumpmult) + vec3(0.0f, 0.0f, 1.0f - bumpmult); @@ -258,8 +265,11 @@ vec3 rayTrace(vec3 dir, vec3 position,float dither, float fresnel, bool inwater) spos += stepv; //small bias - minZ = maxZ-(0.0001/dist)/ld(spos.z); - if(inwater) minZ = maxZ-0.0004/ld(spos.z); + if(inwater) { + minZ = maxZ-0.000035/ld(spos.z); + }else{ + minZ = maxZ-(0.0001/dist)/ld(spos.z); + } maxZ += stepv.z; } @@ -268,7 +278,6 @@ vec3 rayTrace(vec3 dir, vec3 position,float dither, float fresnel, bool inwater) vec3 GGX (vec3 n, vec3 v, vec3 l, float r, vec3 F0) { r = pow(r,2.5); -// r*=r; vec3 h = l + v; float hn = inversesqrt(dot(h, h)); @@ -278,7 +287,7 @@ vec3 GGX (vec3 n, vec3 v, vec3 l, float r, vec3 F0) { float dotNL = clamp(dot(n,l),0.,1.); float dotNHsq = dotNH*dotNH; - float denom = dotNHsq * r - dotNHsq + 1.; + float denom = dotNHsq * r - dotNHsq + 1.0; float D = r / (3.141592653589793 * denom * denom); vec3 F = 0.2 + (1. - F0) * exp2((-5.55473*dotLH-6.98316)*dotLH); float k2 = .25 * r; @@ -286,6 +295,7 @@ vec3 GGX (vec3 n, vec3 v, vec3 l, float r, vec3 F0) { return dotNL * D * F / (dotLH*dotLH*(1.0-k2)+k2); } + uniform float dhFarPlane; #include "/lib/DistantHorizons_projections.glsl" @@ -368,14 +378,13 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) #ifndef HAND if (iswater > 0.95){ + vec3 posxz = feetPlayerPos + cameraPosition; + float bumpmult = WATER_WAVE_STRENGTH; - vec3 bump = vec3(0); - vec3 posxz = feetPlayerPos+cameraPosition; - posxz.xz -= posxz.y; - posxz.xyz = getParallaxDisplacement(posxz,iswater,bumpmult,normalize(tbnMatrix*viewPos)) ; + posxz.xyz = getParallaxDisplacement(posxz) ; - bump = normalize(getWaveHeight(posxz.xz,iswater)); + vec3 bump = normalize(getWaveNormal(posxz, false)); TangentNormal = bump.xy*0.5+0.5; // tangent space normals for refraction @@ -402,6 +411,8 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) #endif vec3 Indirect_lighting = vec3(0.0); + vec3 MinimumLightColor = vec3(0.2,0.4,1.0); + if(isEyeInWater == 1) MinimumLightColor = vec3(10.0); vec3 Direct_lighting = vec3(0.0); #ifdef OVERWORLD_SHADER @@ -464,25 +475,19 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) inShadowmapBounds = true; } - // if(!inShadowmapBounds && !iswater) Shadows = min(max(lightmap.y-0.8, 0.0) * 25,1.0); if(!inShadowmapBounds) Shadows = 1.0; Shadows *= GetCloudShadow(feetPlayerPos); Direct_lighting = (lightCol.rgb/80.0) * NdotL * Shadows; - vec3 AmbientLightColor = averageSkyCol_Clouds; + vec3 AmbientLightColor = averageSkyCol_Clouds/30.0; vec3 ambientcoefs = WS_normal / dot(abs(WS_normal), vec3(1)); float SkylightDir = ambientcoefs.y*1.5; float skylight = max(pow(viewToWorld(flatnormal).y*0.5+0.5,0.1) + SkylightDir, 0.25); AmbientLightColor *= skylight; - - // float skylight = max(pow(viewToWorld(flatnormal).y*0.5+0.5,0.1) + viewToWorld(normal).y, 0.25) * 1.35; - // Indirect_lighting = DoAmbientLighting(averageSkyCol_Clouds, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.xy, skylight); - - #endif #ifdef NETHER_SHADER @@ -515,9 +520,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) AmbientLightColor *= clamp(1.5 + dot(WS_normal, normalize(feetPlayerPos))*0.5,0,2); #endif - - Indirect_lighting = DoAmbientLightColor(AmbientLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.xy); - // Albedo = Albedo * exp2( (clamp(-dot(normal, normalize(viewPos)),0.0,1.0)) * -10.0);//pow(clamp(1.0 + dot(normal, normalize(viewPos)), 0.0, 1.0),5.0); + Indirect_lighting = DoAmbientLightColor(AmbientLightColor, MinimumLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.xy); vec3 FinalColor = (Indirect_lighting + Direct_lighting) * Albedo; @@ -535,7 +538,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) #ifdef WATER_REFLECTIONS vec2 SpecularTex = texture2D(specular, lmtexcoord.xy, Texture_MipMap_Bias).rg; - SpecularTex = (iswater > 0.0 && iswater < 0.9) && SpecularTex.r > 0.0 && SpecularTex.g < 0.9 ? SpecularTex : vec2(1.0,0.02); + SpecularTex = (iswater > 0.0 && iswater < 0.9) && SpecularTex.r > 0.0 && SpecularTex.g < 0.9 ? SpecularTex : vec2(1.0,0.1); float roughness = max(pow(1.0-SpecularTex.r,2.0),0.05); float f0 = SpecularTex.g; @@ -558,10 +561,12 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) #ifdef SNELLS_WINDOW // snells window looking thing - if(isEyeInWater == 1 ) fresnel = pow(clamp(1.66 + normalDotEye,0.0,1.0), 25.0); + if(isEyeInWater == 1) fresnel = pow(clamp(1.5 + normalDotEye,0.0,1.0), 25.0); #endif fresnel = mix(f0, 1.0, fresnel); + + // vec3 Metals = f0 > 229.5/255.0 ? max(Albedo, fresnel) : vec3(1.0); // Sun, Sky, and screen-space reflections @@ -570,13 +575,11 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) SunReflection = Direct_lighting * GGX(normal, -normalize(viewPos), WsunVec*mat3(gbufferModelViewInverse), roughness, vec3(f0)); #endif #ifdef WATER_BACKGROUND_SPECULAR - SkyReflection = skyCloudsFromTex(mat3(gbufferModelViewInverse) * reflectedVector, colortex4).rgb / 30.0; - if(isEyeInWater == 1) SkyReflection = vec3(0.0); + if(isEyeInWater == 0) SkyReflection = skyCloudsFromTex(mat3(gbufferModelViewInverse) * reflectedVector, colortex4).rgb / 30.0; #endif #else #ifdef WATER_BACKGROUND_SPECULAR - SkyReflection = skyCloudsFromTexLOD2(mat3(gbufferModelViewInverse) * reflectedVector, colortex4, 0).rgb / 30.0; - if(isEyeInWater == 1) SkyReflection = vec3(0.0); + if(isEyeInWater == 0) SkyReflection = skyCloudsFromTexLOD2(mat3(gbufferModelViewInverse) * reflectedVector, colortex4, 0).rgb / 30.0; #endif #endif #ifdef SCREENSPACE_REFLECTIONS @@ -594,6 +597,11 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) } #endif + #ifdef OVERWORLD_SHADER + if(isEyeInWater == 1 && iswater > 0.9){ + SkyReflection.rgb = exp(-8.0 * vec3(Water_Absorb_R, Water_Absorb_G, Water_Absorb_B)) * clamp(WsunVec.y*lightCol.a,0,1) ; + } + #endif float visibilityFactor = clamp(exp2((pow(roughness,3.0) / f0) * -4),0,1); #ifdef ENTITIES @@ -606,7 +614,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) Reflections_Final += SunReflection; - gl_FragData[0].rgb = Reflections_Final; + gl_FragData[0].rgb = Reflections_Final ; #ifndef ENTITIES //correct alpha channel with fresnel @@ -638,6 +646,6 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) if(gl_FragCoord.x*texelSize.x < 0.47) gl_FragData[0] = vec4(0.0); #endif - gl_FragData[3].a = max(lmtexcoord.w*blueNoise()*0.05 + lmtexcoord.w,0.0); + gl_FragData[3].a = lmtexcoord.w; } } \ No newline at end of file diff --git a/shaders/dimensions/composite.fsh b/shaders/dimensions/composite.fsh index 5e3a19e..6385ea0 100644 --- a/shaders/dimensions/composite.fsh +++ b/shaders/dimensions/composite.fsh @@ -78,14 +78,7 @@ vec2 tapLocation2(int sampleNumber, int nb, float jitter){ return vec2(cos_v, sin_v)*sqrt(alpha); } -float interleaved_gradientNoise_temporal(){ - return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y)+frameTimeCounter*51.9521); -} -float interleaved_gradientNoise(){ - vec2 coord = gl_FragCoord.xy; - float noise = fract(52.9829189*fract(0.06711056*coord.x + 0.00583715*coord.y)); - return noise; -} + vec3 decode (vec2 encn){ vec3 n = vec3(0.0); encn = encn * 2.0 - 1.0; @@ -99,8 +92,27 @@ vec2 decodeVec2(float a){ const float constant2 = 256. / 255.; return fract( a * constant1 ) * constant2 ; } + + + +float interleaved_gradientNoise_temporal(){ + return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y)+frameTimeCounter*51.9521); +} +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 interleaved_gradientNoise(){ +// return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y)+ 1.0/1.6180339887 * frameCounter); +// } float R2_dither(){ - vec2 coord = gl_FragCoord.xy + (frameCounter%40000) * 2.0; + #ifdef TAA + vec2 coord = gl_FragCoord.xy + (frameCounter%40000) * 2.0; + #else + vec2 coord = gl_FragCoord.xy; + #endif vec2 alpha = vec2(0.75487765, 0.56984026); return fract(alpha.x * coord.x + alpha.y * coord.y ) ; } @@ -339,7 +351,7 @@ void main() { #endif - +#ifdef OVERWORLD_SHADER float SpecularTex = texture2D(colortex8,texcoord).z; float LabSSS = clamp((-64.0 + SpecularTex * 255.0) / 191.0 ,0.0,1.0); @@ -368,7 +380,7 @@ void main() { #ifdef Variable_Penumbra_Shadows - if (LabSSS > 0.0 || NdotL > 0.0001) { + if (LabSSS > -1) { vec3 feetPlayerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz; @@ -393,7 +405,7 @@ void main() { float mult = maxshadowfilt; float avgBlockerDepth = 0.0; - vec2 scales = vec2(0.0, 120.0 - Max_Filter_Depth); + vec2 scales = vec2(0.0, Max_Filter_Depth); float blockerCount = 0.0; float rdMul = distortFactor*(1.0+mult)*d0*k/shadowMapResolution; float diffthreshM = diffthresh*mult*d0*k/20.; @@ -412,7 +424,11 @@ void main() { float b = smoothstep(weight*diffthresh/2.0, weight*diffthresh, projectedShadowPosition.z - d); blockerCount += b; - avgDepth += max(projectedShadowPosition.z - d, 0.0)*1000.; + #ifdef DISTANT_HORIZONS_SHADOWMAP + avgDepth += max(projectedShadowPosition.z - d, 0.0)*10000.0; + #else + avgDepth += max(projectedShadowPosition.z - d, 0.0)*1000.0; + #endif avgBlockerDepth += d * b; } @@ -428,4 +444,5 @@ void main() { } #endif } +#endif } \ No newline at end of file diff --git a/shaders/dimensions/composite.vsh b/shaders/dimensions/composite.vsh index 78dc5df..1555ac9 100644 --- a/shaders/dimensions/composite.vsh +++ b/shaders/dimensions/composite.vsh @@ -27,7 +27,11 @@ void main() { WsunVec = (float(sunElevation > 1e-5)*2-1.)*normalize(mat3(gbufferModelViewInverse) * sunPosition); - TAA_Offset = offsets[framemod8]; + #ifdef TAA + TAA_Offset = offsets[framemod8]; + #else + TAA_Offset = vec2(0.0); + #endif #ifdef TAA_UPSCALING gl_Position.xy = (gl_Position.xy*0.5+0.5)*RENDER_SCALE*2.0-1.0; diff --git a/shaders/dimensions/composite1.fsh b/shaders/dimensions/composite1.fsh index 0d733e8..bfc380d 100644 --- a/shaders/dimensions/composite1.fsh +++ b/shaders/dimensions/composite1.fsh @@ -13,7 +13,6 @@ const bool colortex5MipmapEnabled = true; flat varying vec3 averageSkyCol_Clouds; flat varying vec4 lightCol; - uniform sampler2D colortex14; #if Sun_specular_Strength != 0 #define LIGHTSOURCE_REFLECTION @@ -62,6 +61,8 @@ uniform sampler2D colortex9; //Specular uniform sampler2D colortex10; uniform sampler2D colortex11; uniform sampler2D colortex12; +uniform sampler2D colortex13; +uniform sampler2D colortex14; uniform sampler2D colortex15; // flat normals(rgb), vanillaAO(alpha) @@ -86,6 +87,9 @@ uniform float farPlane; uniform float dhFarPlane; uniform float dhNearPlane; +flat varying vec3 zMults; +flat varying vec3 zMults_DH; + uniform vec2 texelSize; uniform float viewWidth; uniform float viewHeight; @@ -298,7 +302,6 @@ void waterVolumetrics_notoverworld(inout vec3 inColor, vec3 rayStart, vec3 rayEn dV *= maxZ; vec3 dVWorld = -mat3(gbufferModelViewInverse) * (rayEnd - rayStart) * maxZ; rayLength *= maxZ; - float dY = normalize(mat3(gbufferModelViewInverse) * rayEnd).y * rayLength; estEndDepth *= maxZ; estSunDepth *= maxZ; vec3 absorbance = vec3(1.0); @@ -325,42 +328,7 @@ void waterVolumetrics_notoverworld(inout vec3 inColor, vec3 rayStart, vec3 rayEn #ifdef OVERWORLD_SHADER -float waterCaustics(vec3 wPos, vec3 lightSource) { // water waves - vec2 pos = wPos.xz + (lightSource.xz/lightSource.y*wPos.y); - if(isEyeInWater==1) pos = wPos.xz - (lightSource.xz/lightSource.y*wPos.y); // fix the fucky - vec2 movement = vec2(-0.035*frameTimeCounter); - float caustic = 0.0; - float weightSum = 0.0; - float radiance = 2.39996; - mat2 rotationMatrix = mat2(vec2(cos(radiance), -sin(radiance)), vec2(sin(radiance), cos(radiance))); - - const vec2 wave_size[4] = vec2[]( - vec2(64.), - vec2(32.,16.), - vec2(16.,32.), - vec2(48.) - ); - - for (int i = 0; i < 4; i++){ - pos = rotationMatrix * pos; - - vec2 speed = movement; - float waveStrength = 1.0; - - if( i == 0) { - speed *= 0.15; - waveStrength = 2.0; - } - - float small_wave = texture2D(noisetex, pos / wave_size[i] + speed ).b * waveStrength; - - caustic += max( 1.0-sin( 1.0-pow( 0.5+sin( small_wave*3.0 )*0.5, 25.0) ), 0); - - weightSum -= exp2(caustic*0.1); - } - return caustic / weightSum; -} float fogPhase(float lightPoint){ float linear = 1.0 - clamp(lightPoint*0.5+0.5,0.0,1.0); float linear2 = 1.0 - clamp(lightPoint,0.0,1.0); @@ -370,72 +338,70 @@ float fogPhase(float lightPoint){ return exponential; } + void waterVolumetrics(inout vec3 inColor, vec3 rayStart, vec3 rayEnd, float estEndDepth, float estSunDepth, float rayLength, float dither, vec3 waterCoefs, vec3 scatterCoef, vec3 ambient, vec3 lightSource, float VdotL){ - inColor *= exp(-rayLength * waterCoefs); //No need to take the integrated value - int spCount = rayMarchSampleCount; - vec3 start = toShadowSpaceProjected(rayStart); - vec3 end = toShadowSpaceProjected(rayEnd); - vec3 dV = (end-start); - //limit ray length at 32 blocks for performance and reducing integration error - //you can't see above this anyway - float maxZ = min(rayLength,12.0)/(1e-8+rayLength); - dV *= maxZ; + int spCount = rayMarchSampleCount; + vec3 start = toShadowSpaceProjected(rayStart); + vec3 end = toShadowSpaceProjected(rayEnd); + vec3 dV = (end-start); - rayLength *= maxZ; - - float dY = normalize(mat3(gbufferModelViewInverse) * rayEnd).y * rayLength; - estEndDepth *= maxZ; - estSunDepth *= maxZ; + //limit ray length at 32 blocks for performance and reducing integration error + //you can't see above this anyway + float maxZ = min(rayLength,12.0)/(1e-8+rayLength); + dV *= maxZ; + rayLength *= maxZ; + estEndDepth *= maxZ; + estSunDepth *= maxZ; + + vec3 wpos = mat3(gbufferModelViewInverse) * rayStart + gbufferModelViewInverse[3].xyz; + vec3 dVWorld = (wpos - gbufferModelViewInverse[3].xyz); - vec3 wpos = mat3(gbufferModelViewInverse) * rayStart + gbufferModelViewInverse[3].xyz; - vec3 dVWorld = (wpos-gbufferModelViewInverse[3].xyz); + inColor *= exp(-rayLength * waterCoefs); // No need to take the integrated value + float phase = fogPhase(VdotL) * 5.0; + vec3 absorbance = vec3(1.0); + vec3 vL = vec3(0.0); - // float phase = (phaseg(VdotL,0.6) + phaseg(VdotL,0.8)) * 0.5; - float phase = fogPhase(VdotL) ; - - vec3 absorbance = vec3(1.0); - vec3 vL = vec3(0.0); + float expFactor = 11.0; + for (int i=0;i 0.0) return vec4(0,0,0,1); +// float startFlip = mix(max(cameraPosition.y - planeHeight,0.0), max(planeHeight - cameraPosition.y,0), clamp(dV_view.y,0,1)); +// float signFlip = mix(-1.0, 1.0, clamp(cameraPosition.y - planeHeight,0.0,1.0)); +// if(max(signFlip * normalize(dV_view).y,0.0) > 0.0) return vec4(0,0,0,1); - vec3 progress_view = vec3(0,cameraPosition.y,0) + dV_view/abs(dV_view.y) * startFlip; +// vec3 progress_view = vec3(0,cameraPosition.y,0) + dV_view/abs(dV_view.y) * startFlip; - oceanNormals = normalize(getWaveHeight((progress_view+cameraPosition).xz,1)); +// oceanNormals = normalize(getWaveHeight((progress_view+cameraPosition).xz,1)); - vec3 Lighting = vec3(1); - float object = 1; +// vec3 Lighting = vec3(1); +// float object = 1; - color += max(Lighting - Lighting*exp(-mult*object),0.0) * total_extinction; - total_extinction *= max(exp(-mult*object),0.0); +// color += max(Lighting - Lighting*exp(-mult*object),0.0) * total_extinction; +// total_extinction *= max(exp(-mult*object),0.0); - return vec4(color, total_extinction); -} +// return vec4(color, total_extinction); +// } // uniform float viewWidth; @@ -606,27 +573,22 @@ vec3 getViewPos() { return viewPos.xyz; } +vec4 BilateralUpscale(sampler2D tex, sampler2D depth, vec2 coord, float referenceDepth){ + + const ivec2 scaling = ivec2(1.0/VL_RENDER_RESOLUTION); + ivec2 posDepth = ivec2(coord*VL_RENDER_RESOLUTION) * scaling; + ivec2 posColor = ivec2(coord*VL_RENDER_RESOLUTION); -vec4 BilateralUpscale_DH(sampler2D tex, sampler2D depth, vec2 coord, float referenceDepth, bool depthCheck){ - - const ivec2 scaling = ivec2(1.0); - ivec2 posDepth = ivec2(coord)*scaling; - ivec2 posColor = ivec2(coord); - - // vec2 pos = mod(coord,2)*2 - 1; - ivec2 pos = ivec2(coord*texelSize) + 1; - // ivec2 pos = (ivec2(gl_FragCoord.xy) % 2 )*2; + ivec2 pos = ivec2(gl_FragCoord.xy*texelSize + 1); ivec2 getRadius[4] = ivec2[]( - ivec2(-2,-2), - ivec2(-2, 0), + ivec2(-2,-2), + ivec2(-2, 0), ivec2( 0, 0), ivec2( 0,-2) ); - - // float diffThreshold = referenceDepth; - - float diffThreshold = 0.0002; + + float diffThreshold = zMults.x; vec4 RESULT = vec4(0.0); float SUM = 0.0; @@ -635,18 +597,107 @@ vec4 BilateralUpscale_DH(sampler2D tex, sampler2D depth, vec2 coord, float refer ivec2 radius = getRadius[i]; - float offsetDepth = sqrt(texelFetch2D(depth, (posDepth + radius * scaling + pos * scaling),0).a/65000.0); + float offsetDepth = ld(texelFetch2D(depth, posDepth + radius * scaling + pos * scaling, 0).r); float EDGES = abs(offsetDepth - referenceDepth) < diffThreshold ? 1.0 : 1e-5; - RESULT += texelFetch2D(tex, (posColor + radius + pos),0) * EDGES; + RESULT += texelFetch2D(tex, posColor + radius + pos, 0) * EDGES; SUM += EDGES; } - + // return vec4(0,0,0,1) * SUM; return RESULT / SUM; } +vec4 BilateralUpscale_DH(sampler2D tex, sampler2D depth, vec2 coord, float referenceDepth){ + ivec2 scaling = ivec2(1.0/VL_RENDER_RESOLUTION); + ivec2 posDepth = ivec2(coord*VL_RENDER_RESOLUTION) * scaling; + ivec2 posColor = ivec2(coord*VL_RENDER_RESOLUTION); + ivec2 pos = ivec2(gl_FragCoord.xy*texelSize + 1); + + ivec2 getRadius[4] = ivec2[]( + ivec2(-2,-2), + ivec2(-2, 0), + ivec2( 0, 0), + ivec2( 0,-2) + ); + + #ifdef DISTANT_HORIZONS + float diffThreshold = 0.01; + #else + float diffThreshold = zMults.x; + #endif + + vec4 RESULT = vec4(0.0); + float SUM = 0.0; + + for (int i = 0; i < 4; i++) { + + ivec2 radius = getRadius[i]; + + #ifdef DISTANT_HORIZONS + float offsetDepth = sqrt(texelFetch2D(depth, posDepth + radius * scaling + pos * scaling,0).a/65000.0); + #else + float offsetDepth = ld(texelFetch2D(depth, posDepth + radius * scaling + pos * scaling, 0).r); + #endif + + float EDGES = abs(offsetDepth - referenceDepth) < diffThreshold ? 1.0 : 1e-5; + + RESULT += texelFetch2D(tex, posColor + radius + pos, 0) * EDGES; + + SUM += EDGES; + } + // return vec4(1) * SUM; + return RESULT / SUM; + +} + +void BilateralUpscale_REUSE_Z(sampler2D tex1, sampler2D tex2, sampler2D depth, vec2 coord, float referenceDepth, inout vec2 ambientEffects, inout vec3 filteredShadow){ + ivec2 scaling = ivec2(1.0); + ivec2 posDepth = ivec2(coord) * scaling; + ivec2 posColor = ivec2(coord); + ivec2 pos = ivec2(gl_FragCoord.xy*texelSize + 1); + + ivec2 getRadius[4] = ivec2[]( + ivec2(-2,-2), + ivec2(-2, 0), + ivec2( 0, 0), + ivec2( 0,-2) + ); + + #ifdef DISTANT_HORIZONS + float diffThreshold = 0.0005; + #else + float diffThreshold = 0.005; + #endif + + vec3 shadow_RESULT = vec3(0.0); + vec2 ssao_RESULT = vec2(0.0); + vec4 fog_RESULT = vec4(0.0); + float SUM = 0.0; + + for (int i = 0; i < 4; i++) { + + ivec2 radius = getRadius[i]; + + #ifdef DISTANT_HORIZONS + float offsetDepth = sqrt(texelFetch2D(depth, posDepth + radius * scaling + pos * scaling,0).a/65000.0); + #else + float offsetDepth = ld(texelFetch2D(depth, posDepth + radius * scaling + pos * scaling, 0).r); + #endif + + float EDGES = abs(offsetDepth - referenceDepth) < diffThreshold ? 1.0 : 1e-5; + + shadow_RESULT += texelFetch2D(tex1, posColor + radius + pos, 0).rgb * EDGES; + ssao_RESULT += texelFetch2D(tex2, posColor + radius + pos, 0).rg * EDGES; + + SUM += EDGES; + } + + filteredShadow = shadow_RESULT/SUM; + ambientEffects = ssao_RESULT/SUM; +} + void main() { vec3 DEBUG = vec3(1.0); @@ -666,6 +717,7 @@ void main() { bool isDHrange = z >= 1.0; #ifdef DISTANT_HORIZONS + float DH_mixedLinearZ = sqrt(texture2D(colortex12,texcoord).a/65000.0); float DH_depth0 = texture2D(dhDepthTex,texcoord).x; float DH_depth1 = texture2D(dhDepthTex1,texcoord).x; @@ -716,6 +768,7 @@ void main() { lightmap.y = 1.0; #endif + // if(isEyeInWater == 1) lightmap.y = max(lightmap.y, 0.75); ////// --------------- UNPACK MISC --------------- ////// @@ -770,13 +823,14 @@ void main() { scatterCoef = dirtAmount * wateralbedo / 3.14; } #endif - - vec3 Indirect_lighting = vec3(1.0); + vec3 Absorbtion = vec3(1.0); vec3 AmbientLightColor = vec3(0.0); + vec3 MinimumLightColor = vec3(0.2,0.4,1.0); + vec3 Indirect_lighting = vec3(0.0); vec3 Indirect_SSS = vec3(0.0); - vec3 Direct_lighting = vec3(0.0); vec3 DirectLightColor = vec3(0.0); + vec3 Direct_lighting = vec3(0.0); vec3 Direct_SSS = vec3(0.0); float cloudShadow = 1.0; float Shadows = 1.0; @@ -793,8 +847,8 @@ void main() { float LM_shadowMapFallback = min(max(lightmap.y-0.8, 0.0) * 25,1.0); #ifdef OVERWORLD_SHADER - DirectLightColor = lightCol.rgb/80.0; - AmbientLightColor = averageSkyCol_Clouds; + DirectLightColor = lightCol.rgb / 80.0; + AmbientLightColor = averageSkyCol_Clouds / 30.0; #ifdef PER_BIOME_ENVIRONMENT // BiomeSunlightColor(DirectLightColor); @@ -806,20 +860,6 @@ void main() { DirectLightColor = mix(DirectLightColor, biomeDirect, maxDistance); #endif - - vec3 filteredShadow = vec3(1.412,1.0,0.0); - - #ifdef DENOISE_SSS_AND_SSAO - if (!hand) filteredShadow = BilateralUpscale_SSAO(colortex3, depthtex0, gl_FragCoord.xy, ld(z0)).rgb; - #else - if (!hand) filteredShadow = texture2D(colortex3,texcoord).rgb; - #endif - - float ShadowBlockerDepth = filteredShadow.y; - - - Shadows = clamp(1.0 - filteredShadow.b,0.0,1.0); - shadowMap = Shadows; bool inShadowmapBounds = false; #endif @@ -827,8 +867,28 @@ void main() { float heightRelativeToClouds = clamp(cameraPosition.y - LAYER0_minHEIGHT,0.0,1.0); vec4 Clouds = texture2D_bicubic_offset(colortex0, texcoord*CLOUDS_QUALITY, noise, RENDER_SCALE.x); #endif + + //////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////// FILTER STUFF ////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////// + + vec3 filteredShadow = vec3(1.412,1.0,0.0); + vec2 SSAO_SSS = vec2(1.0); + + #ifdef DISTANT_HORIZONS + BilateralUpscale_REUSE_Z(colortex3, colortex14, colortex12, gl_FragCoord.xy, DH_mixedLinearZ, SSAO_SSS, filteredShadow); + #else + BilateralUpscale_REUSE_Z(colortex3, colortex14, depthtex0, gl_FragCoord.xy, ld(z0), SSAO_SSS, filteredShadow); + #endif - ///////////////////////////// start drawin :D + float ShadowBlockerDepth = filteredShadow.y; + Shadows = clamp(1.0 - filteredShadow.b,0.0,1.0); + shadowMap = Shadows; + + + //////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////// START DRAW //////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////// if (swappedDepth >= 1.0) { #ifdef OVERWORLD_SHADER vec3 Background = vec3(0.0); @@ -875,7 +935,38 @@ void main() { } else { feetPlayerPos += gbufferModelViewInverse[3].xyz; - + + //////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////// UNDER WATER SHADING //////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////// + if ((isEyeInWater == 0 && iswater) || (isEyeInWater == 1 && !iswater)){ + #ifdef DISTANT_HORIZONS + vec3 viewPos0 = toScreenSpace_DH(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5, z0, DH_depth0); + #else + vec3 viewPos0 = toScreenSpace(vec3(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5,z0)); + #endif + + float Vdiff = distance(viewPos, viewPos0)*2.0; + float estimatedDepth = Vdiff * abs(feetPlayerPos_normalized.y); //assuming water plane + + // make it such that the estimated depth flips to be correct when entering water. + if (isEyeInWater == 1){ + estimatedDepth = 40.0 * pow(max(1.0-lightmap.y,0.0),2.0); + MinimumLightColor = vec3(10.0); + } + + float depthfalloff = 1.0 - clamp(exp(-0.1*estimatedDepth),0.0,1.0); + + + float estimatedSunDepth = Vdiff; //assuming water plane + Absorbtion = mix(exp(-2.0 * totEpsilon * estimatedDepth), exp(-8.0 * totEpsilon), depthfalloff); + + // DirectLightColor *= Absorbtion; + // AmbientLightColor *= Absorbtion; + + // apply caustics to the lighting, and make sure they dont look weird + // DirectLightColor *= mix(1.0, waterCaustics(feetPlayerPos + cameraPosition, WsunVec)*WATER_CAUSTICS_BRIGHTNESS + 0.25, clamp(estimatedDepth,0,1)); + } //////////////////////////////////////////////////////////////////////////////////// ///////////////////////////// MAJOR LIGHTSOURCE STUFF //////////////////////// //////////////////////////////////////////////////////////////////////////////////// @@ -937,7 +1028,7 @@ void main() { Shadows = shadowMap; } - Shadows = mix(LM_shadowMapFallback, Shadows, shadowMapFalloff); + if(!iswater) Shadows = mix(LM_shadowMapFallback, Shadows, shadowMapFalloff); #ifdef OLD_LIGHTLEAK_FIX if (isEyeInWater == 0) Shadows *= clamp(pow(eyeBrightnessSmooth.y/240. + lightmap.y,2.0) ,0.0,1.0); // light leak fix @@ -949,9 +1040,12 @@ void main() { //////////////////////////////////////////////////////////////////////////////// #if SSS_TYPE != 0 + #ifdef DISTANT_HORIZONS + shadowMapFalloff = pow(1.0-pow(1.0-min(max(1.0 - length(vec3(feetPlayerPos.x,feetPlayerPos.y/1.5,feetPlayerPos.z)) / min(shadowDistance, max(far-32,0.0)),0.0)*5.0,1.0),2.0),2.0); + #endif + #if defined DISTANT_HORIZONS_SHADOWMAP && defined Variable_Penumbra_Shadows - float DH_SSS_DISTANCE = pow(1.0-pow(1.0-min(max(1.0 - length(vec3(feetPlayerPos.x,feetPlayerPos.y/1.5,feetPlayerPos.z)) / min(shadowDistance, far),0.0)*5.0,1.0),2.0),2.0); - ShadowBlockerDepth = mix(pow(1.0 - Shadows,2.0), ShadowBlockerDepth, DH_SSS_DISTANCE); + ShadowBlockerDepth = mix(pow(1.0 - Shadows,2.0), ShadowBlockerDepth, shadowMapFalloff); #endif #if !defined Variable_Penumbra_Shadows @@ -976,13 +1070,11 @@ void main() { ShadowBlockerDepth = mix(1.0, ShadowBlockerDepth, shadowMapFalloff); #endif - Direct_SSS = SubsurfaceScattering_sun(albedo, ShadowBlockerDepth, sunSSS_density, clamp(dot(feetPlayerPos_normalized, WsunVec),0.0,1.0), inShadowmapBounds); - - Direct_SSS *= mix(LM_shadowMapFallback, 1.0, shadowMapFalloff); - if (isEyeInWater == 0) Direct_SSS *= clamp(pow(eyeBrightnessSmooth.y/240. + lightmap.y,2.0) ,0.0,1.0); // light leak fix - } - + Direct_SSS = SubsurfaceScattering_sun(albedo, ShadowBlockerDepth, sunSSS_density, clamp(dot(feetPlayerPos_normalized, WsunVec),0.0,1.0)); + // Direct_SSS *= mix(LM_shadowMapFallback, 1.0, shadowMapFalloff); + // if (isEyeInWater == 0) Direct_SSS *= clamp(pow(eyeBrightnessSmooth.y/240. + lightmap.y,2.0) ,0.0,1.0); // light leak fix + } #endif #ifdef CLOUDS_SHADOWS @@ -992,8 +1084,6 @@ void main() { #endif #endif - - #ifdef END_SHADER float vortexBounds = clamp(vortexBoundRange - length(feetPlayerPos+cameraPosition), 0.0,1.0); vec3 lightPos = LightSourcePosition(feetPlayerPos+cameraPosition, cameraPosition,vortexBounds); @@ -1009,24 +1099,14 @@ void main() { Direct_lighting += lightColors * endPhase * end_NdotL * fogShadow; AmbientLightColor += lightColors * (endPhase*endPhase) * (1.0-exp(vec3(0.6,2.0,2) * -(endPhase*0.1))) ; + + Direct_lighting *= Absorbtion; #endif ///////////////////////////////////////////////////////////////////////////////// ///////////////////////////// INDIRECT LIGHTING ///////////////////////////// ///////////////////////////////////////////////////////////////////////////////// - #if indirect_effect == 1 - #ifdef DENOISE_SSS_AND_SSAO - #ifdef DISTANT_HORIZONS - vec2 SSAO_SSS = BilateralUpscale_DH(colortex14, colortex12, gl_FragCoord.xy, sqrt(texture2D(colortex12,texcoord).a/65000.0), z >= 1.0).xy; - #else - vec2 SSAO_SSS = BilateralUpscale_SSAO(colortex14, depthtex0, gl_FragCoord.xy, ld(z)).xy; - #endif - #else - vec2 SSAO_SSS = SSAO(viewPos, FlatNormals, hand, isLeaf, noise_2); - #endif - #endif - #if defined OVERWORLD_SHADER && (indirect_effect == 0 || indirect_effect == 1) vec3 ambientcoefs = slopednormal / dot(abs(slopednormal), vec3(1)); @@ -1040,136 +1120,106 @@ void main() { skylight = min(skylight, (SSAO_SSS.x*SSAO_SSS.x*SSAO_SSS.x) * 2.5); #endif - AmbientLightColor *= skylight; + Indirect_lighting = AmbientLightColor * skylight; + #endif #ifdef NETHER_SHADER - AmbientLightColor = skyCloudsFromTexLOD2(normal, colortex4, 6).rgb; + Indirect_lighting = skyCloudsFromTexLOD2(normal, colortex4, 6).rgb; vec3 up = skyCloudsFromTexLOD2(vec3( 0, 1, 0), colortex4, 6).rgb; vec3 down = skyCloudsFromTexLOD2(vec3( 0,-1, 0), colortex4, 6).rgb; up *= pow( max( slopednormal.y, 0), 2); down *= pow( max(-slopednormal.y, 0), 2); - AmbientLightColor += up + down; + Indirect_lighting += up + down; + + Indirect_lighting *= Absorbtion; #endif #ifdef END_SHADER - AmbientLightColor += vec3(0.5,0.75,1.0) * 0.9 + 0.1; + Indirect_lighting += (vec3(0.5,0.75,1.0) * 0.9 + 0.1) * 0.1; - AmbientLightColor *= clamp(1.5 + dot(normal, feetPlayerPos_normalized)*0.5,0,2); + Indirect_lighting *= clamp(1.5 + dot(normal, feetPlayerPos_normalized)*0.5,0,2); + + Indirect_lighting *= Absorbtion; #endif - - Indirect_lighting = DoAmbientLightColor(AmbientLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.xy); + + Indirect_lighting = DoAmbientLightColor(Indirect_lighting, MinimumLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.xy); #ifdef OVERWORLD_SHADER Indirect_lighting += LightningFlashLighting; #endif - //////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////// UNDER WATER SHADING //////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////// - #ifdef OVERWORLD_SHADER - if ((isEyeInWater == 0 && iswater) || (isEyeInWater == 1 && !iswater)){ - #ifdef DISTANT_HORIZONS - vec3 viewPos0 = toScreenSpace_DH(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5, z0, DH_depth0); - #else - vec3 viewPos0 = toScreenSpace(vec3(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5,z0)); - #endif - float Vdiff = distance(viewPos, viewPos0); - float VdotU = feetPlayerPos_normalized.y; - float estimatedDepth = Vdiff * abs(VdotU); //assuming water plane - - // make it such that the estimated depth flips to be correct when entering water. - if (isEyeInWater == 1) estimatedDepth = (1.0-lightmap.y)*16.0; - - float estimatedSunDepth = Vdiff; //assuming water plane - vec3 Absorbtion = exp2(-totEpsilon*estimatedDepth); - - DirectLightColor *= Absorbtion; - if(isEyeInWater == 1 ) Indirect_lighting = (Indirect_lighting/exp2(-estimatedDepth*0.5)) * Absorbtion; - - // apply caustics to the lighting - float Direct_caustics = waterCaustics(feetPlayerPos + cameraPosition, WsunVec); - DirectLightColor *= 1.0 + max(pow(Direct_caustics * 3.0, 2.0),0.0); - - // if(isEyeInWater == 0) DirectLightColor *= max(eyeBrightnessSmooth.y/240., 0.0); - } - #endif + #ifdef SSS_view + Indirect_lighting = vec3(3.0); + #endif ///////////////////////////////////////////////////////////////////////////////////// ///////////////////////////// EFFECTS FOR INDIRECT ///////////////////////////// ///////////////////////////////////////////////////////////////////////////////////// - float SkySSS = 0.0; + float SkySSS = 1.0; + vec3 AO = vec3(1.0); + #if indirect_effect == 0 - vec3 AO = vec3( exp( (vanilla_AO*vanilla_AO) * -5) ) ; + AO = vec3( exp( (vanilla_AO*vanilla_AO) * -5) ) ; Indirect_lighting *= AO; - Direct_lighting *= AO; + // Direct_lighting *= AO; #endif #if indirect_effect == 1 - vec3 AO = vec3( exp( (vanilla_AO*vanilla_AO) * -3) ); + AO = vec3( exp( (vanilla_AO*vanilla_AO) * -3) ); - AO *= SSAO_SSS.x*SSAO_SSS.x*SSAO_SSS.x; + AO *= SSAO_SSS.x*SSAO_SSS.x*SSAO_SSS.x;//*SSAO_SSS.x*SSAO_SSS.x*SSAO_SSS.x; + // AO *= exp((1-SSAO_SSS.x) * -10); + SkySSS = SSAO_SSS.y; Indirect_lighting *= AO; - Direct_lighting *= AO; #endif // GTAO #if indirect_effect == 2 - vec3 AO = vec3( exp( (vanilla_AO*vanilla_AO) * -3) ); + AO = vec3( exp( (vanilla_AO*vanilla_AO) * -3) ); vec2 r2 = fract(R2_samples((frameCounter%40000) + frameCounter*2) + bnoise); if (!hand) AO = ambient_occlusion(vec3(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5,z), viewPos, worldToView(slopednormal), r2) * vec3(1.0); Indirect_lighting *= AO; - Direct_lighting *= AO; #endif // RTAO and/or SSGI #if indirect_effect == 3 || indirect_effect == 4 if (!hand) ApplySSRT(Indirect_lighting, viewPos, normal, vec3(bnoise, noise_2), lightmap.xy, AmbientLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), isGrass); #endif - - #ifdef SSS_view - // albedo = vec3(1); - Indirect_lighting = vec3(0.5); + + #if defined END_SHADER + Direct_lighting *= AO; #endif - //////////////////////////////// SKY SSS //////////////////////////////// - #if defined Ambient_SSS && defined OVERWORLD_SHADER + + ///////////////////////////// SKY SSS ///////////////////////////// + + #if defined Ambient_SSS && defined OVERWORLD_SHADER && indirect_effect == 1 if (!hand){ - - #if indirect_effect != 1 - SkySSS = ScreenSpace_SSS(viewPos, FlatNormals, hand, isLeaf, noise); - #endif - - vec3 ambientColor = (averageSkyCol_Clouds / 12.0) * ambient_brightness; // divide by 12 to match the brightest part of ambient light facing up - float skylightmap = pow(lightmap.y,3); + vec3 ambientColor = AmbientLightColor * 2.5 * ambient_brightness; // x2.5 to match the brightness of upfacing skylight + float skylightmap = pow(lightmap.y, 3.0); Indirect_SSS = SubsurfaceScattering_sky(albedo, SkySSS, LabSSS); Indirect_SSS *= ambientColor; Indirect_SSS *= skylightmap; - - vec3 SSS_forSky = vec3((1.0 - SkySSS) * LabSSS); - SSS_forSky *= ambientColor; - SSS_forSky *= skylightmap; - - //light up dark parts so its more visible - Indirect_lighting = max(Indirect_lighting, SSS_forSky * ambientsss_brightness); + Indirect_SSS *= AO; // apply to ambient light. - Indirect_lighting = max(Indirect_lighting, Indirect_SSS * ambientsss_brightness); - + Indirect_lighting = max(Indirect_lighting, Indirect_SSS * ambientsss_brightness ); + #ifdef OVERWORLD_SHADER if(LabSSS > 0.0) Indirect_lighting += (1.0-SkySSS) * LightningPhase * lightningEffect * pow(lightmap.y,10); #endif - } #endif + ///////////////////////////////////////////////////////////////////////// ///////////////////////////// FINALIZE ///////////////////////////// @@ -1180,7 +1230,6 @@ void main() { #ifdef OVERWORLD_SHADER // do these here so it gets underwater absorbtion. - // Direct_lighting = max(DirectLightColor * NdotL * Shadows, DirectLightColor * LabSSS*0); Direct_lighting = max(DirectLightColor * NdotL * Shadows, DirectLightColor * Direct_SSS); #endif @@ -1197,52 +1246,15 @@ void main() { } + #ifdef DISTANT_HORIZONS + vec4 vlBehingTranslucents = BilateralUpscale_DH(colortex13, colortex12, gl_FragCoord.xy, sqrt(texture2D(colortex12,texcoord).a/65000.0)); + #else + vec4 vlBehingTranslucents = BilateralUpscale(colortex13, depthtex1, gl_FragCoord.xy, ld(z)); + #endif + + gl_FragData[0].rgb = gl_FragData[0].rgb * vlBehingTranslucents.a + vlBehingTranslucents.rgb; - - - #ifdef OVERWORLD_SHADER - if (iswater && isEyeInWater == 0){ - - #ifdef DISTANT_HORIZONS - vec3 viewPos0 = toScreenSpace_DH(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5, z0, DH_depth0); - #else - vec3 viewPos0 = toScreenSpace(vec3(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5,z0)); - #endif - - float Vdiff = distance(viewPos, viewPos0); - float VdotU = feetPlayerPos_normalized.y; - float estimatedDepth = Vdiff * abs(VdotU) ; //assuming water plane - float estimatedSunDepth = estimatedDepth/abs(WsunVec.y); //assuming water plane - - float custom_lightmap_T = clamp(pow(texture2D(colortex14, texcoord).a,3.0),0.0,1.0); - - #ifdef DISTANT_HORIZONS - if(isDHrange) custom_lightmap_T = 0.85; - #endif - - vec3 lightColVol = lightCol.rgb / 80.; - - - vec3 lightningColor = (lightningEffect / 3) * (max(eyeBrightnessSmooth.y,0)/240.); - vec3 ambientColVol = max((averageSkyCol_Clouds / 30.0) * custom_lightmap_T , vec3(0.2,0.4,1.0) * (MIN_LIGHT_AMOUNT*0.01 + nightVision)) ; - - waterVolumetrics(gl_FragData[0].rgb, viewPos0, viewPos, estimatedDepth, estimatedSunDepth, Vdiff, noise_2, totEpsilon, scatterCoef, ambientColVol, lightColVol, dot(feetPlayerPos_normalized, WsunVec)); - } - #else - if (iswater && isEyeInWater == 0){ - vec3 viewPos0 = toScreenSpace(vec3(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5,z0)); - float Vdiff = distance(viewPos,viewPos0); - float VdotU = feetPlayerPos_normalized.y; - float estimatedDepth = Vdiff * abs(VdotU) ; //assuming water plane - - vec3 ambientColVol = max(vec3(1.0,0.5,1.0) * 0.3, vec3(0.2,0.4,1.0) * (MIN_LIGHT_AMOUNT*0.01 + nightVision)); - - waterVolumetrics_notoverworld(gl_FragData[0].rgb, viewPos0, viewPos, estimatedDepth , estimatedDepth, Vdiff, noise_2, totEpsilon, scatterCoef, ambientColVol); - } - #endif - - // gl_FragData[0].rgb = vec3(1) * (abs(ld(texture2D(depthtex0,texcoord + vec2(0.001,0)).r) - ld(z0)) < (1.0/(far * near))*0.1 ? 1.0 : 1e-5 ); //////// DEBUG VIEW STUFF #if DEBUG_VIEW == debug_SHADOWMAP @@ -1251,7 +1263,7 @@ void main() { gl_FragData[0].rgb = mix(vec3(0.1) * (normal.y * 0.1 +0.9), Normal_Shadowmap, shadowMap); #endif #if DEBUG_VIEW == debug_NORMALS - gl_FragData[0].rgb = normal; + gl_FragData[0].rgb = FlatNormals; #endif #if DEBUG_VIEW == debug_SPECULAR gl_FragData[0].rgb = SpecularTex.rgb; @@ -1266,6 +1278,13 @@ void main() { gl_FragData[0].rgb = viewPos * 0.001; #endif + // #if DEBUG_VIEW == debug_FILTERED_STUFF + // vec3 FilteredDebug = vec3(15.0) * exp(-1.0 * vec3(1.0,0.5,1.0) * filteredShadow.y); + // FilteredDebug += vec3(15.0) * exp(-7.0 * vec3(1.0,1.0,0.5) * pow(SSAO_SSS.x,2)); + // FilteredDebug += vec3(15.0) * exp(-7.0 * vec3(0.5,1.0,1.0) * pow(SSAO_SSS.y,2)); + // gl_FragData[0].rgb = FilteredDebug; + // #endif + #ifdef CLOUDS_INFRONT_OF_WORLD gl_FragData[1] = texture2D(colortex2, texcoord); if(heightRelativeToClouds > 0.0 && !hand){ diff --git a/shaders/dimensions/composite1.vsh b/shaders/dimensions/composite1.vsh index 3ce3f02..e6593dd 100644 --- a/shaders/dimensions/composite1.vsh +++ b/shaders/dimensions/composite1.vsh @@ -9,10 +9,14 @@ flat varying vec4 lightCol; flat varying vec2 TAA_Offset; flat varying vec3 zMults; +flat varying vec3 zMults_DH; uniform sampler2D colortex4; // uniform float far; uniform float near; +uniform float dhFarPlane; +uniform float dhNearPlane; + uniform mat4 gbufferModelViewInverse; uniform vec3 sunPosition; uniform float rainStrength; @@ -39,7 +43,8 @@ void main() { Flashing = texelFetch2D(colortex4,ivec2(1,1),0).x/150.0; - zMults = vec3((far * near)*2.0,far+near,far-near); + zMults = vec3(1.0/(far * near),far+near,far-near); + zMults_DH = vec3(1.0/(dhFarPlane * dhNearPlane),dhFarPlane+dhNearPlane,dhFarPlane-dhNearPlane); lightCol.rgb = texelFetch2D(colortex4,ivec2(6,37),0).rgb; lightCol.a = float(sunElevation > 1e-5)*2.0 - 1.0; @@ -50,7 +55,11 @@ void main() { // WsunVec = normalize(LightDir); - TAA_Offset = offsets[framemod8]; + #ifdef TAA + TAA_Offset = offsets[framemod8]; + #else + TAA_Offset = vec2(0.0); + #endif #ifdef TAA_UPSCALING gl_Position.xy = (gl_Position.xy*0.5+0.5)*RENDER_SCALE*2.0-1.0; diff --git a/shaders/dimensions/composite11.fsh b/shaders/dimensions/composite11.fsh index 0d40844..1cbfa93 100644 --- a/shaders/dimensions/composite11.fsh +++ b/shaders/dimensions/composite11.fsh @@ -95,6 +95,22 @@ vec3 getViewPos() { return viewPos.xyz; } +vec3 ACESFilm2(vec3 x){ +// float a = 2.51f; +// float b = 0.03f; +// float c = 2.43f; +// float d = 0.59f; +// float e = 0.14f; + + float a = 2.51f; // brightests + float b = 0.53f; // lower midtones + float c = 2.43f; // upper midtones + float d = 0.59f; // upper midtones + float e = 0.54f; // lowest tones + return clamp((x*(a*x+b))/(x*(c*x+d)+e),0.0,1.0); +} + + #define linear_to_srgb(x) (pow(x, vec3(1.0/2.2))) void main() { /* DRAWBUFFERS:7 */ diff --git a/shaders/dimensions/composite2.fsh b/shaders/dimensions/composite2.fsh index ed45737..656e161 100644 --- a/shaders/dimensions/composite2.fsh +++ b/shaders/dimensions/composite2.fsh @@ -2,16 +2,19 @@ flat varying vec4 lightCol; flat varying vec3 averageSkyCol; -// flat varying vec3 averageSkyCol_Clouds; +flat varying vec3 averageSkyCol_Clouds; uniform sampler2D noisetex; uniform sampler2D depthtex0; +uniform sampler2D depthtex1; uniform sampler2D dhDepthTex; +uniform sampler2D dhDepthTex1; uniform sampler2D colortex2; uniform sampler2D colortex3; // uniform sampler2D colortex4; uniform sampler2D colortex6; +uniform sampler2D colortex7; flat varying vec3 WsunVec; uniform vec3 sunVec; @@ -43,6 +46,7 @@ uniform float eyeAltitude; #include "/lib/res_params.glsl" #include "/lib/sky_gradient.glsl" #include "/lib/Shadow_Params.glsl" +#include "/lib/waterBump.glsl" #include "/lib/DistantHorizons_projections.glsl" @@ -80,17 +84,31 @@ float linearizeDepthFast(const in float depth, const in float near, const in flo #define fsign(a) (clamp((a)*1e35,0.,1.)*2.-1.) -float interleaved_gradientNoise(){ - return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y)+ 1.0/1.6180339887 * frameCounter); +float interleaved_gradientNoise_temporal(){ + return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y)+frameTimeCounter*51.9521); } +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 interleaved_gradientNoise(){ +// return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y)+ 1.0/1.6180339887 * frameCounter); +// } float blueNoise(){ return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a+ 1.0/1.6180339887 * frameCounter ); } float R2_dither(){ - vec2 coord = gl_FragCoord.xy + (frameCounter%40000) * 2.0; + #ifdef TAA + vec2 coord = gl_FragCoord.xy + (frameCounter%40000) * 2.0; + #else + vec2 coord = gl_FragCoord.xy; + #endif vec2 alpha = vec2(0.75487765, 0.56984026); return fract(alpha.x * coord.x + alpha.y * coord.y ) ; } + void waterVolumetrics_notoverworld(inout vec3 inColor, vec3 rayStart, vec3 rayEnd, float estEndDepth, float estSunDepth, float rayLength, float dither, vec3 waterCoefs, vec3 scatterCoef, vec3 ambient){ inColor *= exp(-rayLength * waterCoefs); //No need to take the integrated value @@ -136,44 +154,73 @@ void waterVolumetrics_notoverworld(inout vec3 inColor, vec3 rayStart, vec3 rayEn } -#ifdef OVERWORLD_SHADER -float waterCaustics(vec3 wPos, vec3 lightSource) { // water waves +// #ifdef OVERWORLD_SHADER +// vec4 waterVolumetrics_test( vec3 rayStart, vec3 rayEnd, float estEndDepth, float estSunDepth, float rayLength, float dither, vec3 waterCoefs, vec3 scatterCoef, vec3 ambient, vec3 lightSource, float VdotL){ +// int spCount = rayMarchSampleCount; - vec2 pos = wPos.xz + (lightSource.xz/lightSource.y*wPos.y); - if(isEyeInWater==1) pos = wPos.xz - (lightSource.xz/lightSource.y*wPos.y); // fix the fucky - vec2 movement = vec2(-0.035*frameTimeCounter); - float caustic = 0.0; - float weightSum = 0.0; - float radiance = 2.39996; - mat2 rotationMatrix = mat2(vec2(cos(radiance), -sin(radiance)), vec2(sin(radiance), cos(radiance))); +// vec3 start = toShadowSpaceProjected(rayStart); +// vec3 end = toShadowSpaceProjected(rayEnd); +// vec3 dV = (end-start); - const vec2 wave_size[4] = vec2[]( - vec2(64.), - vec2(32.,16.), - vec2(16.,32.), - vec2(48.) - ); +// //limit ray length at 32 blocks for performance and reducing integration error +// //you can't see above this anyway +// float maxZ = min(rayLength,12.0)/(1e-8+rayLength); +// dV *= maxZ; +// rayLength *= maxZ; +// estEndDepth *= maxZ; +// estSunDepth *= maxZ; + +// vec3 wpos = mat3(gbufferModelViewInverse) * rayStart + gbufferModelViewInverse[3].xyz; +// vec3 dVWorld = (wpos - gbufferModelViewInverse[3].xyz); - for (int i = 0; i < 4; i++){ - pos = rotationMatrix * pos; +// vec3 newabsorbance = exp(-rayLength * waterCoefs); // No need to take the integrated value + +// float phase = fogPhase(VdotL) * 5.0; +// vec3 absorbance = vec3(1.0); +// vec3 vL = vec3(0.0); - vec2 speed = movement; - float waveStrength = 1.0; - - if( i == 0) { - speed *= 0.15; - waveStrength = 2.0; - } - float small_wave = texture2D(noisetex, pos / wave_size[i] + speed ).b * waveStrength; +// float expFactor = 11.0; +// for (int i=0;i 0.99; + + float z0 = texture2D(depthtex0,tc).x; #ifdef DISTANT_HORIZONS - float DH_z = texture2D(dhDepthTex,tc).x; + float DH_z0 = texture2D(dhDepthTex,tc).x; #else - float DH_z = 0.0; + float DH_z0 = 0.0; #endif - vec3 viewPos = toScreenSpace_DH(tc/RENDER_SCALE, z, DH_z); + float z = texture2D(depthtex1,tc).x; + float DH_z = texture2D(dhDepthTex1,tc).x; + + vec3 viewPos1 = toScreenSpace_DH(tc/RENDER_SCALE, z, DH_z); + vec3 viewPos0 = toScreenSpace_DH(tc/RENDER_SCALE, z0, DH_z0); + + vec3 playerPos = normalize(mat3(gbufferModelViewInverse) * viewPos1); + // vec3 lightningColor = (lightningEffect / 3) * (max(eyeBrightnessSmooth.y,0)/240.); + + + + float dirtAmount = Dirt_Amount; + vec3 waterEpsilon = vec3(Water_Absorb_R, Water_Absorb_G, Water_Absorb_B); + vec3 dirtEpsilon = vec3(Dirt_Absorb_R, Dirt_Absorb_G, Dirt_Absorb_B); + vec3 totEpsilon = dirtEpsilon*dirtAmount + waterEpsilon; + vec3 scatterCoef = dirtAmount * vec3(Dirt_Scatter_R, Dirt_Scatter_G, Dirt_Scatter_B) / 3.14; + + vec3 directLightColor = lightCol.rgb/80.0; + vec3 indirectLightColor = averageSkyCol/30.0; + vec3 indirectLightColor_dynamic = averageSkyCol_Clouds/30.0; + + //////////////////////////////////////////////////////////// + ///////////////// IN FRONT OF TRANSLUCENTS ///////////////// + //////////////////////////////////////////////////////////// - if (isEyeInWater == 0){ - #ifdef OVERWORLD_SHADER - vec4 VolumetricFog = GetVolumetricFog(viewPos, vec2(noise_1,noise_2), lightCol.rgb/80.0, averageSkyCol/30.0); + vec4 VolumetricFog = GetVolumetricFog(viewPos0, vec2(noise_1,noise_2), directLightColor, indirectLightColor); #endif #if defined NETHER_SHADER || defined END_SHADER - vec4 VolumetricFog = GetVolumetricFog(viewPos, noise_1, noise_2); + vec4 VolumetricFog = GetVolumetricFog(viewPos0, noise_1, noise_2); #endif gl_FragData[0] = clamp(VolumetricFog, 0.0, 65000.0); - } - + + ////////////////////////////////////////////////////////// + ///////////////// BEHIND OF TRANSLUCENTS ///////////////// + ////////////////////////////////////////////////////////// + if (isEyeInWater == 1){ - float dirtAmount = Dirt_Amount; - vec3 waterEpsilon = vec3(Water_Absorb_R, Water_Absorb_G, Water_Absorb_B); - vec3 dirtEpsilon = vec3(Dirt_Absorb_R, Dirt_Absorb_G, Dirt_Absorb_B); - vec3 totEpsilon = dirtEpsilon*dirtAmount + waterEpsilon; - vec3 scatterCoef = dirtAmount * vec3(Dirt_Scatter_R, Dirt_Scatter_G, Dirt_Scatter_B) / 3.14; + float estEyeDepth = clamp(eyeBrightnessSmooth.y/240.0,0.,1.0); + // estEyeDepth = pow(estEyeDepth,3.0) * 32.0; + estEyeDepth = 0.0; - #ifdef OVERWORLD_SHADER + // vec3 lightningColor = (lightningEffect / 3) * (max(eyeBrightnessSmooth.y,0)/240.); - float estEyeDepth = 1.0-clamp(eyeBrightnessSmooth.y/240.0,0.,1.0); - estEyeDepth = pow(estEyeDepth,3.0) * 32.0; + vec3 vl = vec3(0.0); + waterVolumetrics(vl, vec3(0.0), viewPos0, estEyeDepth, estEyeDepth, length(viewPos0), noise_1, totEpsilon, scatterCoef, indirectLightColor_dynamic, directLightColor , dot(normalize(viewPos0), normalize(sunVec* lightCol.a ) )); + + gl_FragData[0] = clamp(vec4(vl,1.0),0.000001,65000.); - vec3 lightColVol = lightCol.rgb / 80.; - - vec3 lightningColor = (lightningEffect / 3) * (max(eyeBrightnessSmooth.y,0)/240.); - vec3 ambientColVol = (averageSkyCol/30.0); - - vec3 vl = vec3(0.0); - waterVolumetrics(vl, vec3(0.0), viewPos, estEyeDepth, estEyeDepth, length(viewPos), noise_1, totEpsilon, scatterCoef, ambientColVol, lightColVol*(1.0-pow(1.0-sunElevation*lightCol.a,5.0)) , dot(normalize(viewPos), normalize(sunVec* lightCol.a ) )); - - gl_FragData[0] = clamp(vec4(vl,1.0),0.000001,65000.); - #else - vec3 fragpos0 = toScreenSpace(vec3(tc,z)); - vec3 ambientColVol = max(vec3(1.0,0.5,1.0) * 0.6, vec3(0.2,0.4,1.0) * MIN_LIGHT_AMOUNT*0.01); - gl_FragData[0].a = 1; - waterVolumetrics_notoverworld(gl_FragData[0].rgb, fragpos0, viewPos, 1.0, 1.0, 1.0, blueNoise(), totEpsilon, scatterCoef, ambientColVol); - #endif - } } \ No newline at end of file diff --git a/shaders/dimensions/composite2.vsh b/shaders/dimensions/composite2.vsh index 557601d..e142803 100644 --- a/shaders/dimensions/composite2.vsh +++ b/shaders/dimensions/composite2.vsh @@ -4,11 +4,13 @@ flat varying vec4 lightCol; flat varying vec3 averageSkyCol; +flat varying vec3 averageSkyCol_Clouds; flat varying vec3 WsunVec; flat varying vec3 refractedSunVec; flat varying float tempOffsets; +uniform vec2 texelSize; uniform sampler2D colortex4; @@ -28,21 +30,40 @@ uniform int frameCounter; uniform float frameTimeCounter; #include "/lib/Shadow_Params.glsl" +#include "/lib/sky_gradient.glsl" void main() { gl_Position = ftransform(); // gl_Position.xy = (gl_Position.xy*0.5+0.5)*0.51*2.0-1.0; gl_Position.xy = (gl_Position.xy*0.5+0.5)*(0.01+VL_RENDER_RESOLUTION)*2.0-1.0; + #ifdef TAA tempOffsets = HaltonSeq2(frameCounter%10000); + #else + tempOffsets = 0.0; + #endif + + #ifdef OVERWORLD_SHADER + lightCol.rgb = texelFetch2D(colortex4,ivec2(6,37),0).rgb; + averageSkyCol = texelFetch2D(colortex4,ivec2(1,37),0).rgb; + averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(0,37),0).rgb; + #endif + + #ifdef NETHER_SHADER + lightCol.rgb = vec3(0.0); + averageSkyCol = vec3(0.0); + averageSkyCol_Clouds = vec3(2.0, 1.0, 0.5) * 30.0; + #endif + + #ifdef END_SHADER + lightCol.rgb = vec3(0.0); + averageSkyCol = vec3(0.0); + averageSkyCol_Clouds = vec3(5.0); + #endif - averageSkyCol = texelFetch2D(colortex4,ivec2(1,37),0).rgb; - lightCol.a = float(sunElevation > 1e-5)*2.0 - 1.0; - lightCol.rgb = texelFetch2D(colortex4,ivec2(6,37),0).rgb; - WsunVec = lightCol.a * normalize(mat3(gbufferModelViewInverse) * sunPosition); - // WsunVec = normalize(LightDir); - + + refractedSunVec = refract(WsunVec, -vec3(0.0,1.0,0.0), 1.0/1.33333); } diff --git a/shaders/dimensions/composite3.fsh b/shaders/dimensions/composite3.fsh index 4515a9c..7cc6e63 100644 --- a/shaders/dimensions/composite3.fsh +++ b/shaders/dimensions/composite3.fsh @@ -107,28 +107,25 @@ float linearizeDepthFast(const in float depth, const in float near, const in flo return (near * far) / (depth * (near - far) + far); } - - - - vec4 BilateralUpscale(sampler2D tex, sampler2D depth, vec2 coord, float referenceDepth){ - - const ivec2 scaling = ivec2(1.0/VL_RENDER_RESOLUTION); - ivec2 posDepth = ivec2(coord*VL_RENDER_RESOLUTION)*scaling; + ivec2 scaling = ivec2(1.0/VL_RENDER_RESOLUTION); + ivec2 posDepth = ivec2(coord*VL_RENDER_RESOLUTION) * scaling; ivec2 posColor = ivec2(coord*VL_RENDER_RESOLUTION); - - // vec2 pos = mod(coord,2)*2 - 1; - ivec2 pos = ivec2((coord*texelSize) + 1.0); - // ivec2 pos = (ivec2(gl_FragCoord.xy) % 2 )*2; + ivec2 pos = ivec2(gl_FragCoord.xy*texelSize + 1); ivec2 getRadius[4] = ivec2[]( - ivec2(-2,-2), - ivec2(-2, 0), + ivec2(-2,-2), + ivec2(-2, 0), ivec2( 0, 0), ivec2( 0,-2) ); - float diffThreshold = zMults.x; + #ifdef DISTANT_HORIZONS + float diffThreshold = 0.01; + #else + float diffThreshold = zMults.x; + #endif + vec4 RESULT = vec4(0.0); float SUM = 0.0; @@ -136,96 +133,24 @@ vec4 BilateralUpscale(sampler2D tex, sampler2D depth, vec2 coord, float referenc for (int i = 0; i < 4; i++) { ivec2 radius = getRadius[i]; - - float offsetDepth = ld(texelFetch2D(depth, (posDepth + radius * scaling + pos * scaling),0).r); - + + #ifdef DISTANT_HORIZONS + float offsetDepth = sqrt(texelFetch2D(depth, posDepth + radius * scaling + pos * scaling,0).a/65000.0); + #else + float offsetDepth = ld(texelFetch2D(depth, posDepth + radius * scaling + pos * scaling, 0).r); + #endif + float EDGES = abs(offsetDepth - referenceDepth) < diffThreshold ? 1.0 : 1e-5; - RESULT += texelFetch2D(tex, (posColor + radius + pos),0) * EDGES; - + RESULT += texelFetch2D(tex, posColor + radius + pos, 0) * EDGES; + SUM += EDGES; } - + // return vec4(1) * SUM; return RESULT / SUM; - - - // coord = coord; - // vec4 vl = vec4(0.0); - // float sum = 0.0; - // mat3x3 weights; - // const ivec2 scaling = ivec2(1.0/VL_RENDER_RESOLUTION); - // ivec2 posD = ivec2(coord*VL_RENDER_RESOLUTION)*scaling; - // ivec2 posVl = ivec2(coord*VL_RENDER_RESOLUTION); - // float dz = zMults.x; - // ivec2 pos = (ivec2(gl_FragCoord.xy) % 2 )*2; - // //pos = ivec2(1,-1); - // ivec2 tcDepth = posD + ivec2(-2,-2) * scaling + pos * scaling; - // float dsample = ld(texelFetch2D(depth,tcDepth,0).r); - // float w = abs(dsample-frDepth) < dz ? 1.0 : 1e-5; - // vl += texelFetch2D(tex,posVl+ivec2(-2)+pos,0)*w; - // sum += w; - - // tcDepth = posD + ivec2(-2,0) * scaling + pos * scaling; - // dsample = ld(texelFetch2D(depth,tcDepth,0).r); - // w = abs(dsample-frDepth) < dz ? 1.0 : 1e-5; - // vl += texelFetch2D(tex,posVl+ivec2(-2,0)+pos,0)*w; - // sum += w; - - // tcDepth = posD + ivec2(0) + pos * scaling; - // dsample = ld(texelFetch2D(depth,tcDepth,0).r); - // w = abs(dsample-frDepth) < dz ? 1.0 : 1e-5; - // vl += texelFetch2D(tex,posVl+ivec2(0)+pos,0)*w; - // sum += w; - - // tcDepth = posD + ivec2(0,-2) * scaling + pos * scaling; - // dsample = ld(texelFetch2D(depth,tcDepth,0).r); - // w = abs(dsample-frDepth) < dz ? 1.0 : 1e-5; - // vl += texelFetch2D(tex,posVl+ivec2(0,-2)+pos,0)*w; - // sum += w; - - // return vl/sum; } -vec4 BilateralUpscale_DH(sampler2D tex, sampler2D depth, vec2 coord, float referenceDepth, bool depthCheck){ - - const ivec2 scaling = ivec2(1.0/VL_RENDER_RESOLUTION); - ivec2 posDepth = ivec2(coord*VL_RENDER_RESOLUTION)*scaling; - ivec2 posColor = ivec2(coord*VL_RENDER_RESOLUTION); - - // vec2 pos = mod(coord,2)*2 - 1; - ivec2 pos = ivec2(coord*texelSize) + 1; - // ivec2 pos = (ivec2(gl_FragCoord.xy) % 2 )*2; - - ivec2 getRadius[4] = ivec2[]( - ivec2(-2,-2), - ivec2(-2, 0), - ivec2( 0, 0), - ivec2( 0,-2) - ); - - // float diffThreshold = referenceDepth; - - float diffThreshold = zMults_DH.x; - - vec4 RESULT = vec4(0.0); - float SUM = 0.0; - - for (int i = 0; i < 4; i++) { - - ivec2 radius = getRadius[i]; - - float offsetDepth = sqrt(texelFetch2D(depth, (posDepth + radius * scaling + pos * scaling),0).a/65000.0); - - float EDGES = abs(offsetDepth - referenceDepth) < diffThreshold ? 1.0 : 1e-5; - - RESULT += texelFetch2D(tex, (posColor + radius + pos),0) * EDGES; - - SUM += EDGES; - } - - return RESULT / SUM; -} vec3 decode (vec2 encn){ vec3 n = vec3(0.0); encn = encn * 2.0 - 1.0; @@ -273,17 +198,18 @@ void applyContrast(inout vec3 color, float contrast){ color = ((color - 0.5) * max(contrast, 0.0)) + 0.5; } -void ApplyDistortion(inout vec2 Texcoord, vec2 TangentNormals, vec2 depths, bool isEntity){ +void ApplyDistortion(inout vec2 Texcoord, vec2 TangentNormals, float lineardistance, bool isEntity){ vec2 UnalteredTexcoord = Texcoord; float refractionStrength = isEntity ? 0.5 : 1.0; - Texcoord = abs(Texcoord + (TangentNormals * clamp((ld(depths.x) - ld(depths.y)) * 0.5,0.0,0.15)) * RENDER_SCALE * refractionStrength ); + // Texcoord = abs(Texcoord + (TangentNormals * clamp((ld(depths.x) - ld(depths.y)) * 0.5,0.0,0.15)) * RENDER_SCALE * refractionStrength ); + Texcoord = abs(Texcoord + (TangentNormals * mix(0.01, 0.1, pow(clamp(1.0-lineardistance/(32*4),0.0,1.0),2))) * RENDER_SCALE * refractionStrength ); float DistortedAlpha = decodeVec2(texture2D(colortex11,Texcoord).b).g; - if(DistortedAlpha <= 0.001) Texcoord = UnalteredTexcoord; // remove distortion on non-translucents + if(DistortedAlpha < 0.1) Texcoord = UnalteredTexcoord; // remove distortion on non-translucents } uniform float dhRenderDistance; @@ -297,7 +223,7 @@ void main() { float z = texture2D(depthtex0,texcoord).x; float z2 = texture2D(depthtex1,texcoord).x; - float frDepth = ld(z2); + float frDepth = ld(z); float swappedDepth = z; @@ -351,11 +277,17 @@ void main() { bool isTranslucentEntity = abs(trpData-0.1) < 0.01; float translucentAlpha = trpData; + + ////// --------------- get volumetrics - #ifdef DISTANT_HORIZONS - vec4 vl = BilateralUpscale_DH(colortex0, colortex12, gl_FragCoord.xy, sqrt(texture2D(colortex12,texcoord).a/65000.0), z >= 1.0); + #ifdef TOGGLE_VL_FOG + #ifdef DISTANT_HORIZONS + vec4 vl = BilateralUpscale(colortex0, colortex12, gl_FragCoord.xy, sqrt(texture2D(colortex12,texcoord).a/65000.0)); + #else + vec4 vl = BilateralUpscale(colortex0, depthtex0, gl_FragCoord.xy, frDepth); + #endif #else - vec4 vl = BilateralUpscale(colortex0, depthtex0, gl_FragCoord.xy, frDepth); + vec4 vl = vec4(0,0,0,1); #endif float bloomyFogMult = 1.0; @@ -363,7 +295,7 @@ void main() { ////// --------------- distort texcoords as a refraction effect vec2 refractedCoord = texcoord; #ifdef Refraction - ApplyDistortion(refractedCoord, tangentNormals, vec2(z2,z), isTranslucentEntity); + ApplyDistortion(refractedCoord, tangentNormals, linearDistance, isTranslucentEntity); #endif ////// --------------- MAIN COLOR BUFFER @@ -405,7 +337,7 @@ void main() { #ifdef BorderFog color.rgb = mix(color.rgb, borderFogColor, fog); #endif - } + } ////// --------------- VARIOUS FOG EFFECTS (behind volumetric fog) //////////// blindness, nightvision, liquid fogs and misc fogs @@ -446,17 +378,30 @@ void main() { vec3 dirtEpsilon = vec3(Dirt_Absorb_R, Dirt_Absorb_G, Dirt_Absorb_B); vec3 totEpsilon = dirtEpsilon*dirtAmount + waterEpsilon; - vec3 fogfade = clamp( exp( (linearDistance / -4) * totEpsilon ) ,0.0,1.0); - fogfade *= 1.0 - clamp( linearDistance / far,0.0,1.0); + vec3 absorbColor = exp(-totEpsilon*linearDistance); + vec3 maxAbsorb = exp(-8.0 * totEpsilon); - color.rgb *= fogfade; - bloomyFogMult *= 0.3; + #ifdef OVERWORLD_SHADER + + linearDistance = length(vec3(p3.x,max(-p3.y,0.0),p3.z)); + float fogfade = exp(-0.001*(linearDistance*linearDistance)); + vec3 thresholdAbsorbedColor = mix(maxAbsorb, absorbColor, clamp(dot(absorbColor,vec3(0.33333)),0.0,1.0)); + color.rgb = mix(vec3(1.0) * clamp(WsunVec.y,0,1) * pow(normalize(np3).y*0.3+0.7,1.5) * maxAbsorb, color.rgb * thresholdAbsorbedColor, clamp(fogfade,0.0,1.0)); + + #else + + color.rgb *= absorbColor; + + #endif + + bloomyFogMult *= 0.4; } ////// --------------- BLEND FOG INTO SCENE //////////// apply VL fog over opaque and translucents color *= vl.a; color += vl.rgb; + bloomyFogMult *= vl.a; ////// --------------- VARIOUS FOG EFFECTS (in front of volumetric fog) //////////// blindness, nightvision, liquid fogs and misc fogs @@ -495,10 +440,10 @@ void main() { #endif // color.rgb = vec3(1) * sqrt(texture2D(colortex12,texcoord).a/65000.0); - gl_FragData[0].r = vl.a * bloomyFogMult; // pass fog alpha so bloom can do bloomy fog + gl_FragData[0].r = bloomyFogMult; // pass fog alpha so bloom can do bloomy fog gl_FragData[1].rgb = clamp(color.rgb, 0.0,68000.0); -// if(isTranslucentEntity) gl_FragData[1].rgb = vec3(255); + // gl_FragData[1].rgb = vec3(1) * sqrt(texelFetch2D(colortex12,ivec2(gl_FragCoord.xy),0).a/65000.0); - // gl_FragData[1].rgb = clamp(vec3(tangentNormals.xy,0), 0.0,68000.0); + // gl_FragData[1].rgb = vl.rgb; } \ No newline at end of file diff --git a/shaders/dimensions/composite3.vsh b/shaders/dimensions/composite3.vsh index 5fa2045..ccf349a 100644 --- a/shaders/dimensions/composite3.vsh +++ b/shaders/dimensions/composite3.vsh @@ -3,11 +3,16 @@ varying vec2 texcoord; flat varying vec3 zMults; flat varying vec3 zMults_DH; +flat varying vec3 WsunVec; + uniform float far; uniform float near; uniform float dhFarPlane; uniform float dhNearPlane; +uniform mat4 gbufferModelViewInverse; +uniform vec3 sunPosition; +uniform float sunElevation; flat varying vec2 TAA_Offset; uniform int framemod8; const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.), @@ -37,7 +42,14 @@ void main() { skyGroundColor = texelFetch2D(colortex4,ivec2(1,37),0).rgb / 30.0; #endif - TAA_Offset = offsets[framemod8]; + #ifdef TAA + TAA_Offset = offsets[framemod8]; + #else + TAA_Offset = vec2(0.0); + #endif + + float lightCola = float(sunElevation > 1e-5)*2.0 - 1.0; + WsunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition); zMults = vec3(1.0/(far * near),far+near,far-near); zMults_DH = vec3(1.0/(dhFarPlane * dhNearPlane),dhFarPlane+dhNearPlane,dhFarPlane-dhNearPlane); diff --git a/shaders/dimensions/composite5.fsh b/shaders/dimensions/composite5.fsh index 134bc56..eb795f9 100644 --- a/shaders/dimensions/composite5.fsh +++ b/shaders/dimensions/composite5.fsh @@ -13,9 +13,9 @@ const int colortex8Format = RGBA8; // Specular Texture const int colortex9Format = RGBA8; // rain in alpha const int colortex10Format = RGBA16; // resourcepack Skies const int colortex11Format = RGBA16; // unchanged translucents albedo, alpha and tangent normals - const int colortex12Format = RGBA16F; // DISTANT HORIZONS + VANILLA MIXED DEPTHs +const int colortex13Format = RGBA16F; // low res VL (composite5->composite15) const int colortex14Format = RGBA8; // rg = SSAO and SS-SSS. a = skylightmap for translucents. const int colortex15Format = RGBA8; // flat normals and vanilla AO */ diff --git a/shaders/dimensions/deferred.fsh b/shaders/dimensions/deferred.fsh index 22fbeae..87e316d 100644 --- a/shaders/dimensions/deferred.fsh +++ b/shaders/dimensions/deferred.fsh @@ -126,6 +126,8 @@ float linearizeDepthFast(const in float depth, const in float near, const in flo // uniform sampler2D colortex12; // const bool shadowHardwareFiltering = true; uniform sampler2DShadow shadow; + uniform sampler2DShadow shadowtex0; + uniform sampler2DShadow shadowtex1; #define TEST #define TIMEOFDAYFOG #include "/lib/lightning_stuff.glsl" @@ -281,9 +283,10 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+ suncol = vec3(0.0); #endif - vec4 clouds = renderClouds(mat3(gbufferModelView)*viewVector*1024., vec2(fract(frameCounter/1.6180339887),1-fract(frameCounter/1.6180339887)), suncol*1.75, skyGroundCol/30.0); + vec4 clouds = renderClouds(mat3(gbufferModelView)*viewVector*1024., vec2(fract(frameCounter/1.6180339887),1-fract(frameCounter/1.6180339887)), suncol*2.0, skyGroundCol/30.0); sky = sky*clouds.a + clouds.rgb / 5.0; + sky = mix(dot(sky,vec3(0.333)) * vec3(0.5), sky, pow(clamp(viewVector.y+1.0,0.0,1.0),5)); vec4 VL_Fog = GetVolumetricFog(mat3(gbufferModelView)*viewVector*1024., vec2(fract(frameCounter/1.6180339887),1-fract(frameCounter/1.6180339887)), lightSourceColor*1.75, skyGroundCol/30.0); sky = sky * VL_Fog.a + VL_Fog.rgb / 5.0; diff --git a/shaders/dimensions/deferred2.fsh b/shaders/dimensions/deferred2.fsh index 5eeac80..486bb76 100644 --- a/shaders/dimensions/deferred2.fsh +++ b/shaders/dimensions/deferred2.fsh @@ -45,7 +45,12 @@ vec3 toScreenSpace(vec3 p) { } float R2_dither(){ + #ifdef TAA vec2 coord = gl_FragCoord.xy + (frameCounter%40000) * 2.0; + #else + + vec2 coord = gl_FragCoord.xy; + #endif vec2 alpha = vec2(0.75487765, 0.56984026); return fract(alpha.x * coord.x + alpha.y * coord.y ) ; } @@ -67,12 +72,14 @@ const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.), vec2(3,7.)/8., vec2(7.,-7.)/8.); float blueNoise(){ - return fract(texelFetch2D(noisetex, ivec2(1.0-gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter); -} -float blueNoise2(){ - return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter); + #ifdef TAA + return fract(texelFetch2D(noisetex, ivec2(1.0-gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter); + #else + return fract(texelFetch2D(noisetex, ivec2(1.0-gl_FragCoord.xy)%512, 0).a); + #endif } + vec3 normVec (vec3 vec){ return vec*inversesqrt(dot(vec,vec)); } @@ -100,7 +107,7 @@ void main() { vec3 viewPos = toScreenSpace(vec3(halfResTC*texelSize,1.0)); - vec4 VolumetricClouds = renderClouds(viewPos, vec2(R2_dither(),blueNoise2()), sunColor/80.0, averageSkyCol/30.0); + vec4 VolumetricClouds = renderClouds(viewPos, vec2(R2_dither(), blueNoise()), sunColor/80.0, averageSkyCol/30.0); // gl_FragData[0] = vec4(0.0,0.0,0.0,1.0); gl_FragData[0] = VolumetricClouds; diff --git a/shaders/dimensions/deferred3.fsh b/shaders/dimensions/deferred3.fsh new file mode 100644 index 0000000..eb7b08a --- /dev/null +++ b/shaders/dimensions/deferred3.fsh @@ -0,0 +1,392 @@ +#include "/lib/settings.glsl" + +flat varying vec4 lightCol; +flat varying vec3 averageSkyCol; +// flat varying vec3 averageSkyCol_Clouds; + +uniform sampler2D noisetex; +uniform sampler2D depthtex0; +uniform sampler2D depthtex1; +uniform sampler2D dhDepthTex; +uniform sampler2D dhDepthTex1; + +uniform sampler2D colortex2; +uniform sampler2D colortex3; +// uniform sampler2D colortex4; +uniform sampler2D colortex6; + +flat varying vec3 WsunVec; +uniform vec3 sunVec; +uniform float sunElevation; + +// uniform float far; +uniform float dhFarPlane; +uniform float dhNearPlane; + +uniform int frameCounter; +uniform float frameTimeCounter; + +// varying vec2 texcoord; +uniform vec2 texelSize; +// flat varying vec2 TAA_Offset; + +uniform int isEyeInWater; +uniform float rainStrength; +uniform ivec2 eyeBrightnessSmooth; +uniform float eyeAltitude; + +#define DHVLFOG +#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z) +#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz) + +#include "/lib/color_transforms.glsl" +#include "/lib/color_dither.glsl" +#include "/lib/projections.glsl" +#include "/lib/res_params.glsl" +#include "/lib/sky_gradient.glsl" +#include "/lib/Shadow_Params.glsl" + +#include "/lib/DistantHorizons_projections.glsl" + +float DH_ld(float dist) { + return (2.0 * dhNearPlane) / (dhFarPlane + dhNearPlane - dist * (dhFarPlane - dhNearPlane)); +} +float DH_inv_ld (float lindepth){ + return -((2.0*dhNearPlane/lindepth)-dhFarPlane-dhNearPlane)/(dhFarPlane-dhNearPlane); +} + +float linearizeDepthFast(const in float depth, const in float near, const in float far) { + return (near * far) / (depth * (near - far) + far); +} + + +#ifdef OVERWORLD_SHADER + const bool shadowHardwareFiltering = true; + uniform sampler2DShadow shadow; + + flat varying vec3 refractedSunVec; + + #define TIMEOFDAYFOG + #include "/lib/lightning_stuff.glsl" + #include "/lib/volumetricClouds.glsl" + #include "/lib/overworld_fog.glsl" +#endif +#ifdef NETHER_SHADER + uniform sampler2D colortex4; + #include "/lib/nether_fog.glsl" +#endif +#ifdef END_SHADER + uniform sampler2D colortex4; + #include "/lib/end_fog.glsl" +#endif + +#define fsign(a) (clamp((a)*1e35,0.,1.)*2.-1.) + +float interleaved_gradientNoise(){ + return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y)+ 1.0/1.6180339887 * frameCounter); +} +float blueNoise(){ + return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a+ 1.0/1.6180339887 * frameCounter ); +} +float R2_dither(){ + vec2 coord = gl_FragCoord.xy + (frameCounter%40000) * 2.0; + vec2 alpha = vec2(0.75487765, 0.56984026); + return fract(alpha.x * coord.x + alpha.y * coord.y ) ; +} +void waterVolumetrics_notoverworld(inout vec3 inColor, vec3 rayStart, vec3 rayEnd, float estEndDepth, float estSunDepth, float rayLength, float dither, vec3 waterCoefs, vec3 scatterCoef, vec3 ambient){ + inColor *= exp(-rayLength * waterCoefs); //No need to take the integrated value + + int spCount = rayMarchSampleCount; + vec3 start = toShadowSpaceProjected(rayStart); + vec3 end = toShadowSpaceProjected(rayEnd); + vec3 dV = (end-start); + //limit ray length at 32 blocks for performance and reducing integration error + //you can't see above this anyway + float maxZ = min(rayLength,12.0)/(1e-8+rayLength); + dV *= maxZ; + + + rayLength *= maxZ; + + float dY = normalize(mat3(gbufferModelViewInverse) * rayEnd).y * rayLength; + estEndDepth *= maxZ; + estSunDepth *= maxZ; + + vec3 wpos = mat3(gbufferModelViewInverse) * rayStart + gbufferModelViewInverse[3].xyz; + vec3 dVWorld = (wpos-gbufferModelViewInverse[3].xyz); + + vec3 absorbance = vec3(1.0); + vec3 vL = vec3(0.0); + + float expFactor = 11.0; + for (int i=0;i 1e-5)*2.0 - 1.0; + lightCol.rgb = texelFetch2D(colortex4,ivec2(6,37),0).rgb; + + WsunVec = lightCol.a * normalize(mat3(gbufferModelViewInverse) * sunPosition); + // WsunVec = normalize(LightDir); + + refractedSunVec = refract(WsunVec, -vec3(0.0,1.0,0.0), 1.0/1.33333); +} diff --git a/shaders/dimensions/final.fsh b/shaders/dimensions/final.fsh index 4a35ce7..ef09be6 100644 --- a/shaders/dimensions/final.fsh +++ b/shaders/dimensions/final.fsh @@ -6,6 +6,7 @@ uniform sampler2D colortex7; uniform vec2 texelSize; uniform float frameTimeCounter; +uniform sampler2D shadow; uniform sampler2D shadowcolor0; uniform sampler2D shadowcolor1; uniform sampler2D shadowtex0; @@ -121,6 +122,20 @@ void applyColorCurve(inout vec3 color, vec4 darks, vec4 brights){ } #endif +//float3 crosstalk_and_saturation(float3 color){ +// +// float crosstalk = 0.0; +// float saturation = 0.0 +// +// float luminance = dot(COLOR, vec3(0.21, 0.72, 0.07)); +// +// float3 difference = color - luminance; +// +// color = color + difference*(-luminance*crosstalk + saturation); +// +// return color; +//} + uniform int hideGUI; void main() { #ifdef BICUBIC_UPSCALING @@ -165,7 +180,6 @@ void main() { gl_FragColor.rgb = FINAL_COLOR; - // vec2 texrood = texcoord * vec2(2.0, 1.0) - vec2(1.0, 0.0); - // if(texcoord.x > 0.5) gl_FragColor.rgb = texture2D(shadowcolor0, texrood).rgb; + // if(texcoord.x > 0.5) gl_FragColor.rgb = texture2D(shadowcolor0, texcoord * vec2(2.0, 1.0) - vec2(1.0, 0.0)).rgb * vec3(1.0); } diff --git a/shaders/dimensions/fogBehindTranslucent_pass.fsh b/shaders/dimensions/fogBehindTranslucent_pass.fsh new file mode 100644 index 0000000..21020fc --- /dev/null +++ b/shaders/dimensions/fogBehindTranslucent_pass.fsh @@ -0,0 +1,436 @@ +#include "/lib/settings.glsl" + +flat varying vec4 lightCol; +flat varying vec3 averageSkyCol; +flat varying vec3 averageSkyCol_Clouds; + +uniform sampler2D noisetex; +uniform sampler2D depthtex0; +uniform sampler2D depthtex1; +uniform sampler2D dhDepthTex; +uniform sampler2D dhDepthTex1; + +uniform sampler2D colortex2; +uniform sampler2D colortex3; +// uniform sampler2D colortex4; +uniform sampler2D colortex6; +uniform sampler2D colortex7; +uniform sampler2D colortex14; + +flat varying vec3 WsunVec; +uniform vec3 sunVec; +uniform float sunElevation; + +// uniform float far; +uniform float dhFarPlane; +uniform float dhNearPlane; + +uniform int frameCounter; +uniform float frameTimeCounter; + +// varying vec2 texcoord; +uniform vec2 texelSize; +// flat varying vec2 TAA_Offset; + +uniform int isEyeInWater; +uniform float rainStrength; +uniform ivec2 eyeBrightnessSmooth; +uniform float eyeAltitude; + +#define DHVLFOG +#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z) +#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz) + +#include "/lib/color_transforms.glsl" +#include "/lib/color_dither.glsl" +#include "/lib/projections.glsl" +#include "/lib/res_params.glsl" +#include "/lib/sky_gradient.glsl" +#include "/lib/Shadow_Params.glsl" +#include "/lib/waterBump.glsl" + +#include "/lib/DistantHorizons_projections.glsl" + +float DH_ld(float dist) { + return (2.0 * dhNearPlane) / (dhFarPlane + dhNearPlane - dist * (dhFarPlane - dhNearPlane)); +} +float DH_inv_ld (float lindepth){ + return -((2.0*dhNearPlane/lindepth)-dhFarPlane-dhNearPlane)/(dhFarPlane-dhNearPlane); +} + +float linearizeDepthFast(const in float depth, const in float near, const in float far) { + return (near * far) / (depth * (near - far) + far); +} + + +#ifdef OVERWORLD_SHADER + const bool shadowHardwareFiltering = true; + uniform sampler2DShadow shadow; + + flat varying vec3 refractedSunVec; + + #define TIMEOFDAYFOG + #include "/lib/lightning_stuff.glsl" + #include "/lib/volumetricClouds.glsl" + #include "/lib/overworld_fog.glsl" +#endif +#ifdef NETHER_SHADER + uniform sampler2D colortex4; + #include "/lib/nether_fog.glsl" +#endif +#ifdef END_SHADER + uniform sampler2D colortex4; + #include "/lib/end_fog.glsl" +#endif + +#define fsign(a) (clamp((a)*1e35,0.,1.)*2.-1.) + +float interleaved_gradientNoise(){ + return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y)+ 1.0/1.6180339887 * frameCounter); +} +float blueNoise(){ + return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a+ 1.0/1.6180339887 * frameCounter ); +} +float R2_dither(){ + #ifdef TAA + vec2 coord = gl_FragCoord.xy + (frameCounter%40000) * 2.0; + #else + vec2 coord = gl_FragCoord.xy; + #endif + vec2 alpha = vec2(0.75487765, 0.56984026); + return fract(alpha.x * coord.x + alpha.y * coord.y ) ; +} + +void waterVolumetrics_notoverworld(inout vec3 inColor, vec3 rayStart, vec3 rayEnd, float estEndDepth, float estSunDepth, float rayLength, float dither, vec3 waterCoefs, vec3 scatterCoef, vec3 ambient){ + inColor *= exp(-rayLength * waterCoefs); //No need to take the integrated value + + int spCount = rayMarchSampleCount; + vec3 start = toShadowSpaceProjected(rayStart); + vec3 end = toShadowSpaceProjected(rayEnd); + vec3 dV = (end-start); + //limit ray length at 32 blocks for performance and reducing integration error + //you can't see above this anyway + float maxZ = min(rayLength,12.0)/(1e-8+rayLength); + dV *= maxZ; + + + rayLength *= maxZ; + + float dY = normalize(mat3(gbufferModelViewInverse) * rayEnd).y * rayLength; + estEndDepth *= maxZ; + estSunDepth *= maxZ; + + vec3 wpos = mat3(gbufferModelViewInverse) * rayStart + gbufferModelViewInverse[3].xyz; + vec3 dVWorld = (wpos-gbufferModelViewInverse[3].xyz); + + vec3 absorbance = vec3(1.0); + vec3 vL = vec3(0.0); + + float expFactor = 11.0; + for (int i=0;i 0.99; + + float z0 = texture2D(depthtex0,tc).x; + + #ifdef DISTANT_HORIZONS + float DH_z0 = texture2D(dhDepthTex,tc).x; + #else + float DH_z0 = 0.0; + #endif + + float z = texture2D(depthtex1,tc).x; + float DH_z = texture2D(dhDepthTex1,tc).x; + + + vec3 viewPos1 = toScreenSpace_DH(tc/RENDER_SCALE, z, DH_z); + vec3 viewPos0 = toScreenSpace_DH(tc/RENDER_SCALE, z0, DH_z0); + + vec3 playerPos = normalize(mat3(gbufferModelViewInverse) * viewPos1); + // vec3 lightningColor = (lightningEffect / 3) * (max(eyeBrightnessSmooth.y,0)/240.); + + float dirtAmount = Dirt_Amount + 0.1; + vec3 waterEpsilon = vec3(Water_Absorb_R, Water_Absorb_G, Water_Absorb_B); + vec3 dirtEpsilon = vec3(Dirt_Absorb_R, Dirt_Absorb_G, Dirt_Absorb_B); + vec3 totEpsilon = dirtEpsilon*dirtAmount + waterEpsilon; + vec3 scatterCoef = dirtAmount * vec3(Dirt_Scatter_R, Dirt_Scatter_G, Dirt_Scatter_B) / 3.14; + + vec3 directLightColor = lightCol.rgb/80.0; + vec3 indirectLightColor = averageSkyCol/30.0; + vec3 indirectLightColor_dynamic = averageSkyCol_Clouds/30.0; + + ////////////////////////////////////////////////////////// + ///////////////// BEHIND OF TRANSLUCENTS ///////////////// + ////////////////////////////////////////////////////////// + + // gl_FragData[0] = vec4(0,0,0,1); + + if(texture2D(colortex2, tc).a > 0.0 || iswater){ + + #ifdef OVERWORLD_SHADER + float lightmap = texture2D(colortex14,tc).a; + if(z >= 1.0 ) lightmap = 1.0; + #else + float lightmap = 1.0; + #endif + float Vdiff = distance(viewPos1, viewPos0); + float VdotU = playerPos.y; + float estimatedDepth = Vdiff * abs(VdotU) ; //assuming water plane + float estimatedSunDepth = estimatedDepth/abs(WsunVec.y); //assuming water plane + + vec4 VolumetricFog2 = vec4(0,0,0,1); + #ifdef OVERWORLD_SHADER + if(!iswater) VolumetricFog2 = GetVolumetricFog(viewPos1, vec2(noise_1, noise_2), directLightColor, indirectLightColor); + #endif + + vec4 underwaterVlFog = vec4(0,0,0,1); + underwaterVlFog = waterVolumetrics_test(viewPos0, viewPos1, estimatedDepth, estimatedSunDepth, Vdiff, noise_1, totEpsilon, scatterCoef, indirectLightColor_dynamic * max(lightmap,0.0), directLightColor, dot(normalize(viewPos1), normalize(sunVec*lightCol.a)) ); + + vec4 fogFinal = vec4(underwaterVlFog.rgb * VolumetricFog2.a + VolumetricFog2.rgb, VolumetricFog2.a * underwaterVlFog.a); + + gl_FragData[0] = clamp(fogFinal, 0.0, 65000.0); + + }else{ + gl_FragData[0] = vec4(0,0,0,1); + } +} \ No newline at end of file diff --git a/shaders/dimensions/fogBehindTranslucent_pass.vsh b/shaders/dimensions/fogBehindTranslucent_pass.vsh new file mode 100644 index 0000000..56355f4 --- /dev/null +++ b/shaders/dimensions/fogBehindTranslucent_pass.vsh @@ -0,0 +1,71 @@ +#include "/lib/settings.glsl" +#include "/lib/util.glsl" +#include "/lib/res_params.glsl" + +flat varying vec4 lightCol; +flat varying vec3 averageSkyCol; +flat varying vec3 averageSkyCol_Clouds; + +flat varying vec3 WsunVec; +flat varying vec3 refractedSunVec; + +flat varying float tempOffsets; + +uniform sampler2D colortex4; + +uniform float sunElevation; +uniform vec2 texelSize; +uniform vec3 sunPosition; +uniform mat4 gbufferModelViewInverse; +uniform int frameCounter; + + + +//////////////////////////////VOID MAIN////////////////////////////// +//////////////////////////////VOID MAIN////////////////////////////// +//////////////////////////////VOID MAIN////////////////////////////// +//////////////////////////////VOID MAIN////////////////////////////// +//////////////////////////////VOID MAIN////////////////////////////// + + +uniform float frameTimeCounter; +#include "/lib/Shadow_Params.glsl" +#include "/lib/sky_gradient.glsl" + +void main() { + gl_Position = ftransform(); + + // gl_Position.xy = (gl_Position.xy*0.5+0.5)*0.51*2.0-1.0; + gl_Position.xy = (gl_Position.xy*0.5+0.5)*(0.01+VL_RENDER_RESOLUTION)*2.0-1.0; + + #ifdef TAA + tempOffsets = HaltonSeq2(frameCounter%10000); + #else + tempOffsets = 0.0; + #endif + + #ifdef OVERWORLD_SHADER + lightCol.rgb = texelFetch2D(colortex4,ivec2(6,37),0).rgb; + averageSkyCol = texelFetch2D(colortex4,ivec2(1,37),0).rgb; + averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(0,37),0).rgb; + #endif + + #ifdef NETHER_SHADER + lightCol.rgb = vec3(0.0); + averageSkyCol = vec3(0.0); + averageSkyCol_Clouds = vec3(2.0, 1.0, 0.5) * 30.0; + #endif + + #ifdef END_SHADER + lightCol.rgb = vec3(0.0); + averageSkyCol = vec3(0.0); + averageSkyCol_Clouds = vec3(5.0); + #endif + + + lightCol.a = float(sunElevation > 1e-5)*2.0 - 1.0; + WsunVec = lightCol.a * normalize(mat3(gbufferModelViewInverse) * sunPosition); + // WsunVec = normalize(LightDir); + + refractedSunVec = refract(WsunVec, -vec3(0.0,1.0,0.0), 1.0/1.33333); +} diff --git a/shaders/lang/en_us.lang b/shaders/lang/en_us.lang index 6d73653..a21845c 100644 --- a/shaders/lang/en_us.lang +++ b/shaders/lang/en_us.lang @@ -597,7 +597,7 @@ screen.Post_Processing.comment = Configure settings for all post processing effe screen.TAA_OPTIONS.comment = Configure settings related to anti-aliasing. option.SCREENSHOT_MODE.comment = Toggle frame accumulation to get a low noise and high quality image. §bWhat is this?§r It stacks frames that happend onto the next frame that is generated, so it is like a long exposure photo. option.TAA.comment = Toggle temporal anti-aliasing. This removes all jagged edges on things, softens the image, and helps remove noise for many effects. This will cause ghosting or trailing because it uses past frames for extra information on the world. §aPERFORMANCE COST:§r low - option.BLEND_FACTOR.comment = Configure how much of frame history is used. high number means it relies less on frame history, so it may look flickery and noisy. low numbers rely more on frame history, so it may look smudged and cause trailing. + option.BLEND_FACTOR.comment = Configure how much of frame history is used. high numbers means it relies less on frame history, so it may look flickery and noisy. low numbers rely more on frame history, so it may look less moisy, but more smudged with more trailing. option.TAA_UPSCALING.comment = Toggle temporal upscaling. This retains a good amount of quality from a lower resolution image when it upscales. so you can still have a high looking resolution compared to typical upsanpling and still have better performance. option.SCALE_FACTOR.comment = Configure from what fraction of your resolution to upscale from. Below 0.5 is not recommended at all i only have it as an option because it's funny :P diff --git a/shaders/lib/color_transforms.glsl b/shaders/lib/color_transforms.glsl index cb0aade..1f23a30 100644 --- a/shaders/lib/color_transforms.glsl +++ b/shaders/lib/color_transforms.glsl @@ -155,3 +155,20 @@ vec3 Tonemap_Uchimura(vec3 x) { const float b = 0.0; // pedestal 0.0 return Tonemap_Uchimura_Modified(x, P, a, m, l, c, b); } + + +vec3 Tonemap_Xonk(vec3 Color){ + + Color = pow(Color,vec3(1.3)); + + return Color / (0.333 + Color); + // return pow(Color / (0.333 + Color), vec3(1.1)); +} + +vec3 Tonemap_Full_Reinhard(vec3 C){ + + float whitepoint = 10.0; + float lighten = 0.5; + + return (C * (1.0 + C / (whitepoint*whitepoint))) / (lighten + C); +} \ No newline at end of file diff --git a/shaders/lib/diffuse_lighting.glsl b/shaders/lib/diffuse_lighting.glsl index e78686c..52e83fb 100644 --- a/shaders/lib/diffuse_lighting.glsl +++ b/shaders/lib/diffuse_lighting.glsl @@ -1,15 +1,16 @@ vec3 DoAmbientLightColor( - vec3 SkyColor, + vec3 SkyColor, + vec3 MinimumColor, vec3 TorchColor, vec2 Lightmap ){ // do sky lighting. float skyLM = (pow(Lightmap.y,15.0)*2.0 + pow(Lightmap.y,2.5))*0.5; - SkyColor = (SkyColor / 30.0) * ambient_brightness * skyLM; - vec3 MinimumLight = vec3(0.2,0.4,1.0) * (MIN_LIGHT_AMOUNT*0.01 + nightVision); + SkyColor = SkyColor * ambient_brightness * skyLM; + vec3 MinimumLight = MinimumColor * (MIN_LIGHT_AMOUNT*0.01 + nightVision); vec3 IndirectLight = max(SkyColor, MinimumLight); - + // vec3(0.2,0.4,1.0) // do torch lighting. float TorchLM = 10.0 - ( 1.0 / (pow(exp(-0.5*inversesqrt(Lightmap.x)),5.0)+0.1)); TorchLM = pow(TorchLM/4,10) + pow(Lightmap.x,1.5)*0.5; diff --git a/shaders/lib/end_fog.glsl b/shaders/lib/end_fog.glsl index 5012a15..f909583 100644 --- a/shaders/lib/end_fog.glsl +++ b/shaders/lib/end_fog.glsl @@ -213,7 +213,9 @@ vec4 GetVolumetricFog( float dither, float dither2 ){ - + #ifndef TOGGLE_VL_FOG + return vec4(0.0,0.0,0.0,1.0); + #endif /// ------------- RAYMARCHING STUFF ------------- \\\ int SAMPLES = 16; diff --git a/shaders/lib/indirect_lighting_effects.glsl b/shaders/lib/indirect_lighting_effects.glsl index 20ec75c..363a9ed 100644 --- a/shaders/lib/indirect_lighting_effects.glsl +++ b/shaders/lib/indirect_lighting_effects.glsl @@ -41,20 +41,32 @@ vec2 SpiralSample( //////////////////////////////////////////////////////////////// vec4 BilateralUpscale_SSAO(sampler2D tex, sampler2D depth, vec2 coord, float referenceDepth){ - const ivec2 scaling = ivec2(1.0); - ivec2 posDepth = ivec2(coord)*scaling; + ivec2 scaling = ivec2(1.0); + ivec2 posDepth = ivec2(coord) * scaling; ivec2 posColor = ivec2(coord); - - ivec2 pos = ivec2(coord*texelSize); + ivec2 pos = ivec2(gl_FragCoord.xy*texelSize + 1); ivec2 getRadius[4] = ivec2[]( - ivec2(-2,-2), + ivec2(-2,-2), ivec2(-2, 0), ivec2( 0, 0), ivec2( 0,-2) ); - - float diffThreshold = 0.005; + // ivec2 getRadius3x3[8] = ivec2[]( + // ivec2(-2,-2), + // ivec2(-2, 0), + // ivec2( 0, 0), + // ivec2( 0,-2), + // ivec2(-2,-1), + // ivec2(-1,-2), + // ivec2(0,-1), + // ivec2(-1,0) + // ); + #ifdef DISTANT_HORIZONS + float diffThreshold = 0.0005 ; + #else + float diffThreshold = 0.005; + #endif vec4 RESULT = vec4(0.0); float SUM = 0.0; @@ -62,18 +74,22 @@ vec4 BilateralUpscale_SSAO(sampler2D tex, sampler2D depth, vec2 coord, float ref for (int i = 0; i < 4; i++) { ivec2 radius = getRadius[i]; - - float offsetDepth = ld(texelFetch2D(depth, (posDepth + radius * scaling + pos * scaling),0).r); - + #ifdef DISTANT_HORIZONS + float offsetDepth = sqrt(texelFetch2D(depth, posDepth + radius * scaling + pos * scaling,0).a/65000.0); + #else + float offsetDepth = ld(texelFetch2D(depth, posDepth + radius * scaling + pos * scaling, 0).r); + #endif + float EDGES = abs(offsetDepth - referenceDepth) < diffThreshold ? 1.0 : 1e-5; - RESULT += texelFetch2D(tex, (posColor + radius + pos),0) * EDGES; + RESULT += texelFetch2D(tex, posColor + radius + pos, 0) * EDGES; SUM += EDGES; } - return RESULT / SUM; + // return vec4(1,1,1,1) * SUM/4; + return RESULT / SUM; } vec2 SSAO( diff --git a/shaders/lib/nether_fog.glsl b/shaders/lib/nether_fog.glsl index 1911518..89bd7fd 100644 --- a/shaders/lib/nether_fog.glsl +++ b/shaders/lib/nether_fog.glsl @@ -41,6 +41,11 @@ vec4 GetVolumetricFog( float dither, float dither2 ){ + + #ifndef TOGGLE_VL_FOG + return vec4(0.0,0.0,0.0,1.0); + #endif + int SAMPLES = 16; vec3 vL = vec3(0.0); float absorbance = 1.0; diff --git a/shaders/lib/overworld_fog.glsl b/shaders/lib/overworld_fog.glsl index 185b086..4ff8e50 100644 --- a/shaders/lib/overworld_fog.glsl +++ b/shaders/lib/overworld_fog.glsl @@ -174,7 +174,7 @@ vec4 GetVolumetricFog( #ifdef DISTANT_HORIZONS float atmosphereMult = 1.0; #else - float atmosphereMult = 2.0; + float atmosphereMult = 1.5; #endif float expFactor = 11.0; diff --git a/shaders/lib/settings.glsl b/shaders/lib/settings.glsl index cb19077..817db55 100644 --- a/shaders/lib/settings.glsl +++ b/shaders/lib/settings.glsl @@ -9,15 +9,17 @@ // #define Vanilla_like_water #define WATER_WAVE_STRENGTH 1.0 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0] #define Dirt_Amount 0.14 // [0.0 0.04 0.08 0.12 0.16 0.2 0.24 0.28 0.32 0.36 0.4 0.44 0.48 0.52 0.56 0.6 0.64 0.68 0.72 0.76 0.8 0.84 0.88 0.92 0.96 1.0 1.04 1.08 1.12 1.16 1.2 1.24 1.28 1.32 1.36 1.4 1.44 1.48 1.52 1.56 1.6 1.64 1.68 1.72 1.76 1.8 1.84 1.88 1.92 1.96 2.0 ] + #define Dirt_Scatter_R 0.7 // [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 ] #define Dirt_Scatter_G 0.7 // [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 ] #define Dirt_Scatter_B 0.7 // [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 ] -#define Dirt_Absorb_R 1.65 // [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 1.02 1.04 1.06 1.08 1.1 1.12 1.14 1.16 1.18 1.2 1.22 1.24 1.26 1.28 1.3 1.32 1.34 1.36 1.38 1.4 1.42 1.44 1.46 1.48 1.5 1.52 1.54 1.56 1.58 1.6 1.62 1.64 1.66 1.68 1.7 1.72 1.74 1.76 1.78 1.8 1.82 1.84 1.86 1.88 1.9 1.92 1.94 1.96 1.98 2.0 ] -#define Dirt_Absorb_G 1.85 // [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 1.02 1.04 1.06 1.08 1.1 1.12 1.14 1.16 1.18 1.2 1.22 1.24 1.26 1.28 1.3 1.32 1.34 1.36 1.38 1.4 1.42 1.44 1.46 1.48 1.5 1.52 1.54 1.56 1.58 1.6 1.62 1.64 1.66 1.68 1.7 1.72 1.74 1.76 1.78 1.8 1.82 1.84 1.86 1.88 1.9 1.92 1.94 1.96 1.98 2.0 ] -#define Dirt_Absorb_B 2.05 // [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 1.02 1.04 1.06 1.08 1.1 1.12 1.14 1.16 1.18 1.2 1.22 1.24 1.26 1.28 1.3 1.32 1.34 1.36 1.38 1.4 1.42 1.44 1.46 1.48 1.5 1.52 1.54 1.56 1.58 1.6 1.62 1.64 1.66 1.68 1.7 1.72 1.74 1.76 1.78 1.8 1.82 1.84 1.86 1.88 1.9 1.92 1.94 1.96 1.98 2.0 ] +#define Dirt_Absorb_R 0.65 // [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 1.02 1.04 1.06 1.08 1.1 1.12 1.14 1.16 1.18 1.2 1.22 1.24 1.26 1.28 1.3 1.32 1.34 1.36 1.38 1.4 1.42 1.44 1.46 1.48 1.5 1.52 1.54 1.56 1.58 1.6 1.62 1.64 1.66 1.68 1.7 1.72 1.74 1.76 1.78 1.8 1.82 1.84 1.86 1.88 1.9 1.92 1.94 1.96 1.98 2.0 ] +#define Dirt_Absorb_G 0.85 // [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 1.02 1.04 1.06 1.08 1.1 1.12 1.14 1.16 1.18 1.2 1.22 1.24 1.26 1.28 1.3 1.32 1.34 1.36 1.38 1.4 1.42 1.44 1.46 1.48 1.5 1.52 1.54 1.56 1.58 1.6 1.62 1.64 1.66 1.68 1.7 1.72 1.74 1.76 1.78 1.8 1.82 1.84 1.86 1.88 1.9 1.92 1.94 1.96 1.98 2.0 ] +#define Dirt_Absorb_B 1.05 // [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 1.02 1.04 1.06 1.08 1.1 1.12 1.14 1.16 1.18 1.2 1.22 1.24 1.26 1.28 1.3 1.32 1.34 1.36 1.38 1.4 1.42 1.44 1.46 1.48 1.5 1.52 1.54 1.56 1.58 1.6 1.62 1.64 1.66 1.68 1.7 1.72 1.74 1.76 1.78 1.8 1.82 1.84 1.86 1.88 1.9 1.92 1.94 1.96 1.98 2.0 ] #define Water_Absorb_R 0.2629 // [0.0 0.0025 0.005 0.0075 0.01 0.0125 0.015 0.0175 0.02 0.0225 0.025 0.0275 0.03 0.0325 0.035 0.0375 0.04 0.0425 0.045 0.0475 0.05 0.0525 0.055 0.0575 0.06 0.0625 0.065 0.0675 0.07 0.0725 0.075 0.0775 0.08 0.0825 0.085 0.0875 0.09 0.0925 0.095 0.0975 0.1 0.1025 0.105 0.1075 0.11 0.1125 0.115 0.1175 0.12 0.1225 0.125 0.1275 0.13 0.1325 0.135 0.1375 0.14 0.1425 0.145 0.1475 0.15 0.1525 0.155 0.1575 0.16 0.1625 0.165 0.1675 0.17 0.1725 0.175 0.1775 0.18 0.1825 0.185 0.1875 0.19 0.1925 0.195 0.1975 0.2 0.2025 0.205 0.2075 0.21 0.2125 0.215 0.2175 0.22 0.2225 0.225 0.2275 0.23 0.2325 0.235 0.2375 0.24 0.2425 0.245 0.2475 0.25 ] #define Water_Absorb_G 0.0565 // [0.0 0.0025 0.005 0.0075 0.01 0.0125 0.015 0.0175 0.02 0.0225 0.025 0.0275 0.03 0.0325 0.035 0.0375 0.04 0.0425 0.045 0.0475 0.05 0.0525 0.055 0.0575 0.06 0.0625 0.065 0.0675 0.07 0.0725 0.075 0.0775 0.08 0.0825 0.085 0.0875 0.09 0.0925 0.095 0.0975 0.1 0.1025 0.105 0.1075 0.11 0.1125 0.115 0.1175 0.12 0.1225 0.125 0.1275 0.13 0.1325 0.135 0.1375 0.14 0.1425 0.145 0.1475 0.15 0.1525 0.155 0.1575 0.16 0.1625 0.165 0.1675 0.17 0.1725 0.175 0.1775 0.18 0.1825 0.185 0.1875 0.19 0.1925 0.195 0.1975 0.2 0.2025 0.205 0.2075 0.21 0.2125 0.215 0.2175 0.22 0.2225 0.225 0.2275 0.23 0.2325 0.235 0.2375 0.24 0.2425 0.245 0.2475 0.25 ] #define Water_Absorb_B 0.01011 // [0.0 0.0025 0.005 0.0075 0.01 0.0125 0.015 0.0175 0.02 0.0225 0.025 0.0275 0.03 0.0325 0.035 0.0375 0.04 0.0425 0.045 0.0475 0.05 0.0525 0.055 0.0575 0.06 0.0625 0.065 0.0675 0.07 0.0725 0.075 0.0775 0.08 0.0825 0.085 0.0875 0.09 0.0925 0.095 0.0975 0.1 0.1025 0.105 0.1075 0.11 0.1125 0.115 0.1175 0.12 0.1225 0.125 0.1275 0.13 0.1325 0.135 0.1375 0.14 0.1425 0.145 0.1475 0.15 0.1525 0.155 0.1575 0.16 0.1625 0.165 0.1675 0.17 0.1725 0.175 0.1775 0.18 0.1825 0.185 0.1875 0.19 0.1925 0.195 0.1975 0.2 0.2025 0.205 0.2075 0.21 0.2125 0.215 0.2175 0.22 0.2225 0.225 0.2275 0.23 0.2325 0.235 0.2375 0.24 0.2425 0.245 0.2475 0.25 ] + #define rayMarchSampleCount 2 // [1 2 3 4 6 8 12 16 32 64] #define Water_Top_Layer 62.90 // [0.90 1.90 2.90 3.90 4.90 5.90 6.90 7.90 8.90 9.90 10.90 11.90 12.90 13.90 14.90 15.90 16.90 17.90 18.90 19.90 20.90 21.90 22.90 23.90 24.90 25.90 26.90 27.90 28.90 29.90 30.90 31.90 32.90 33.90 34.90 35.90 36.90 37.90 38.90 39.90 40.90 41.90 42.90 43.90 44.90 45.90 46.90 47.90 48.90 49.90 50.90 51.90 52.90 53.90 54.90 55.90 56.90 57.90 58.90 59.90 60.90 61.90 62.90 63.90 64.90 65.90 66.90 67.90 68.90 69.90 70.90 71.90 72.90 73.90 74.90 75.90 76.90 77.90 78.90 79.90 80.90 81.90 82.90 83.90 84.90 85.90 86.90 87.90 88.90 89.90 90.90 91.90 92.90 93.90 94.90 95.90 96.90 97.90 98.90 99.90 100.90 101.90 102.90 103.90 104.90 105.90 106.90 107.90 108.90 109.90 110.90 111.90 112.90 113.90 114.90 115.90 116.90 117.90 118.90 119.90 120.90 121.90 122.90 123.90 124.90 125.90 126.90 127.90 128.90 129.90 130.90 131.90 132.90 133.90 134.90 135.90 136.90 137.90 138.90 139.90 140.90 141.90 142.90 143.90 144.90 145.90 146.90 147.90 148.90 149.90 150.90 151.90 152.90 153.90 154.90 155.90 156.90 157.90 158.90 159.90 160.90 161.90 162.90 163.90 164.90 165.90 166.90 167.90 168.90 169.90 170.90 171.90 172.90 173.90 174.90 175.90 176.90 177.90 178.90 179.90 180.90 181.90 182.90 183.90 184.90 185.90 186.90 187.90 188.90 189.90 190.90 191.90 192.90 193.90 194.90 195.90 196.90 197.90 198.90 199.90] @@ -132,7 +134,7 @@ const float entityShadowDistanceMul = 1.0; // [0.05 0.10 1.50 0.20 0.25 0.30 0.3 #define VPS_Search_Samples 4 // [4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32] #define Min_Shadow_Filter_Radius 5.0 // [0.0 1.0 2.0 3.0 4.0 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 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0 42.0 43.0 44.0 45.0 46.0 47.0 48.0 49.0 50.0 51.0 52.0 53.0 54.0 55.0 56.0 57.0 58.0 59.0 60.0 61.0 62.0 63.0 64.0 65.0 66.0 67.0 68.0 69.0 70.0 71.0 72.0 73.0 74.0 75.0 76.0 77.0 78.0 79.0 80.0 81.0 82.0 83.0 84.0 85.0 86.0 87.0 88.0 89.0 90.0 91.0 92.0 93.0 94.0 95.0 96.0 97.0 98.0 99.0 100.0 101.0 102.0 103.0 104.0 105.0 106.0 107.0 108.0 109.0 110.0 111.0 112.0 113.0 114.0 115.0 116.0 117.0 118.0 119.0 ] #define Max_Shadow_Filter_Radius 30.0 // [0.0 1.0 2.0 3.0 4.0 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 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0 42.0 43.0 44.0 45.0 46.0 47.0 48.0 49.0 50.0 51.0 52.0 53.0 54.0 55.0 56.0 57.0 58.0 59.0 60.0 61.0 62.0 63.0 64.0 65.0 66.0 67.0 68.0 69.0 70.0 71.0 72.0 73.0 74.0 75.0 76.0 77.0 78.0 79.0 80.0 81.0 82.0 83.0 84.0 85.0 86.0 87.0 88.0 89.0 90.0 91.0 92.0 93.0 94.0 95.0 96.0 97.0 98.0 99.0 100.0 101.0 102.0 103.0 104.0 105.0 106.0 107.0 108.0 109.0 110.0 111.0 112.0 113.0 114.0 115.0 116.0 117.0 118.0 119.0 ] -#define Max_Filter_Depth 99.0 // [0.1 1.0 2.0 3.0 4.0 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 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0 42.0 43.0 44.0 45.0 46.0 47.0 48.0 49.0 50.0 51.0 52.0 53.0 54.0 55.0 56.0 57.0 58.0 59.0 60.0 61.0 62.0 63.0 64.0 65.0 66.0 67.0 68.0 69.0 70.0 71.0 72.0 73.0 74.0 75.0 76.0 77.0 78.0 79.0 80.0 81.0 82.0 83.0 84.0 85.0 86.0 87.0 88.0 89.0 90.0 91.0 92.0 93.0 94.0 95.0 96.0 97.0 98.0 99.0 100.0 101.0 102.0 103.0 104.0 105.0 106.0 107.0 108.0 109.0 110.0 111.0 112.0 113.0 114.0 115.0 116.0 117.0 118.0 119.0 220.0] +#define Max_Filter_Depth 35.0 // [0.1 1.0 2.0 3.0 4.0 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 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0 42.0 43.0 44.0 45.0 46.0 47.0 48.0 49.0 50.0 51.0 52.0 53.0 54.0 55.0 56.0 57.0 58.0 59.0 60.0 61.0 62.0 63.0 64.0 65.0 66.0 67.0 68.0 69.0 70.0 71.0 72.0 73.0 74.0 75.0 76.0 77.0 78.0 79.0 80.0 81.0 82.0 83.0 84.0 85.0 86.0 87.0 88.0 89.0 90.0 91.0 92.0 93.0 94.0 95.0 96.0 97.0 98.0 99.0 100.0 101.0 102.0 103.0 104.0 105.0 106.0 107.0 108.0 109.0 110.0 111.0 112.0 113.0 114.0 115.0 116.0 117.0 118.0 119.0 220.0] #define BASIC_SHADOW_FILTER #define SHADOW_FILTER_SAMPLE_COUNT 13 // [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 ] @@ -492,7 +494,7 @@ uniform int moonPhase; #define TAA // #define SCREENSHOT_MODE // #define TAA_UPSCALING -#define BLEND_FACTOR 0.16 // [0.01 0.02 0.03 0.04 0.05 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.20 0.30 0.40 0.50 0.60 0.70 0.80 0.90 1.00] +#define BLEND_FACTOR 0.12 // [0.01 0.02 0.03 0.04 0.05 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.20 0.30 0.40 0.50 0.60 0.70 0.80 0.90 1.00] #define CLOSEST_VELOCITY //#define NO_CLIP @@ -520,7 +522,7 @@ uniform int moonPhase; // ----- COLOR/POST PROCESSING RELATED SETTINGS ----- // //////////////////////////////////////////////////////// -#define TONEMAP ToneMap_Hejl2015 // [Tonemap_Uchimura HableTonemap reinhard Tonemap_Lottes ACESFilm] +#define TONEMAP ToneMap_Hejl2015 // [ToneMap_Hejl2015 Tonemap_Xonk Tonemap_Uchimura HableTonemap Tonemap_Full_Reinhard reinhard Tonemap_Lottes ACESFilm] //#define USE_ACES_COLORSPACE_APPROXIMATION #define CONTRAST_ADAPTATIVE_SHARPENING @@ -628,6 +630,7 @@ uniform int moonPhase; #define TRANSLUCENT_ENTITIES +#define WATER_CAUSTICS_BRIGHTNESS 1.0 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0] #define DENOISE_SSS_AND_SSAO /////////////////////////////////////////// @@ -664,7 +667,8 @@ uniform int moonPhase; #define debug_DIRECT 5 #define debug_VIEW_POSITION 6 #define debug_DH_WATER_BLENDING 7 -#define DEBUG_VIEW debug_OFF // [debug_OFF debug_SHADOWMAP debug_NORMALS debug_SPECULAR debug_INDIRECT debug_DIRECT debug_VIEW_POSITION debug_DH_WATER_BLENDING] +#define debug_FILTERED_STUFF 8 +#define DEBUG_VIEW debug_OFF // [debug_OFF debug_SHADOWMAP debug_NORMALS debug_SPECULAR debug_INDIRECT debug_DIRECT debug_VIEW_POSITION debug_DH_WATER_BLENDING debug_FILTERED_STUFF] ///////////////////////////////// // ----- RANDOM SETTINGS ----- // diff --git a/shaders/lib/specular.glsl b/shaders/lib/specular.glsl index 4c337ab..1b28526 100644 --- a/shaders/lib/specular.glsl +++ b/shaders/lib/specular.glsl @@ -188,11 +188,10 @@ void DoSpecularReflections( Lightmap = clamp((Lightmap-0.6)*5.0, 0.0,1.0); - // Roughness = unpackRoughness(Roughness); Roughness = 1.0 - Roughness; Roughness *= Roughness; F0 = F0 == 0.0 ? 0.02 : F0; - // Roughness = 0.0; + // Roughness = 0.1; // F0 = 0.9; mat3 Basis = CoordBase(Normal); @@ -221,7 +220,8 @@ void DoSpecularReflections( bool hasReflections = Roughness_Threshold == 1.0 ? true : F0 * (1.0 - Roughness * Roughness_Threshold) > 0.01; // mulitply all reflections by the albedo if it is a metal. - vec3 Metals = F0 > 229.5/255.0 ? max(Albedo, Fresnel) : vec3(1.0); + vec3 Metals = F0 > 229.5/255.0 ? lerp(normalize(Albedo+1e-7) * (dot(Albedo,vec3(0.21, 0.72, 0.07)) * 0.7 + 0.3), vec3(1.0), Fresnel * pow(1.0-Roughness,25.0)) : vec3(1.0); + // vec3 Metals = F0 > 229.5/255.0 ? max(Albedo, Fresnel) : vec3(1.0); // --------------- BACKGROUND REFLECTIONS // apply background reflections to the final color. make sure it does not exist based on the lightmap diff --git a/shaders/lib/stars.glsl b/shaders/lib/stars.glsl index b4309ed..8b96837 100644 --- a/shaders/lib/stars.glsl +++ b/shaders/lib/stars.glsl @@ -44,5 +44,6 @@ float stars(vec3 viewPos){ float elevation = clamp(viewPos.y,0.,1.); vec2 uv = viewPos.xz/(1.5+elevation); - return StableStarField(uv*1000.,0.999)*0.5*0.3; + return exp((1.0-StableStarField(uv*1000.,0.999)) * -10) * 3; + // return StableStarField(uv*1000.,0.999)*0.5*0.3; } diff --git a/shaders/lib/volumetricClouds.glsl b/shaders/lib/volumetricClouds.glsl index b0a5cf6..e61ec01 100644 --- a/shaders/lib/volumetricClouds.glsl +++ b/shaders/lib/volumetricClouds.glsl @@ -259,7 +259,6 @@ float phaseg(float x, float g){ } -// random magic number bullshit go! vec3 DoCloudLighting( float density, float densityFaded, @@ -276,7 +275,7 @@ vec3 DoCloudLighting( float powder = 1.0 - exp(-10.0 * densityFaded); float lesspowder = powder*0.4+0.6; - float indirectScatter = exp2( -15 * sqrt((skyScatter*skyScatter*skyScatter) * densityFaded)) * lesspowder; + float indirectScatter = exp(-15 * sqrt((skyScatter*skyScatter*skyScatter) * densityFaded)) * lesspowder; vec3 indirectLight = skyLightCol * mix(1.0, indirectScatter, distantfog); @@ -406,7 +405,7 @@ if(layer == 2){ directLight += HighAlt_shadow; #endif - float skyScatter = clamp(((maxHeight - 20 - rayProgress.y) / 275.0) * (0.5+cloudDensity),0.0,1.0); + float skyScatter = clamp(((maxHeight - 50 - rayProgress.y) / 275.0) * (0.5+cloudDensity),0.0,1.0); vec3 lighting = DoCloudLighting(muE, cumulus, skyLightCol * skylightOcclusion, skyScatter, directLight, sunScatter, sunMultiScatter, distantfog); diff --git a/shaders/lib/waterBump.glsl b/shaders/lib/waterBump.glsl index d490e5a..01b4351 100644 --- a/shaders/lib/waterBump.glsl +++ b/shaders/lib/waterBump.glsl @@ -1,81 +1,82 @@ -float getWaterHeightmap(vec2 posxz, float waveM, float waveZ, float iswater) { // water waves - vec2 movement = vec2(frameTimeCounter*0.05); - vec2 pos = posxz ; - float caustic = 1.0; - float weightSum = 0.0; +float waterCaustics(vec3 worldPos, vec3 sunVec) { + + vec3 projectedPos = worldPos - (sunVec/sunVec.y*worldPos.y); + vec2 pos = projectedPos.xz; + + float heightSum = 0.0; + float movement = frameTimeCounter*0.02; + // movement = 0.0; float radiance = 2.39996; mat2 rotationMatrix = mat2(vec2(cos(radiance), -sin(radiance)), vec2(sin(radiance), cos(radiance))); - - const vec2 wave_size[3] = vec2[]( + + vec2 wave_size[3] = vec2[]( vec2(48.,12.), vec2(12.,48.), - vec2(32.) + vec2(32.,32.) ); - float WavesLarge = clamp( pow(1.0-pow(1.0-texture2D(noisetex, pos / 600.0 ).b, 5.0),5.0),0.1,1.0); -// float WavesLarge = pow(abs(0.5-texture2D(noisetex, pos / 600.0 ).b),2); + float WavesLarge = max(texture2D(noisetex, pos / 600.0 ).b,0.1); for (int i = 0; i < 3; i++){ - pos = rotationMatrix * pos ; - - float Waves = texture2D(noisetex, pos / wave_size[i] + (1.0-WavesLarge)*0.5 + movement).b; - - - caustic += exp2(pow(Waves,3.0) * -5.0); - weightSum += exp2(-(3.0-caustic*pow(WavesLarge,2))); + pos = rotationMatrix * pos; + heightSum += pow(abs(abs(texture2D(noisetex, pos / wave_size[i] + WavesLarge*0.5 + movement).b * 2.0 - 1.0) * 2.0 - 1.0), 2.0) ; } - return ((3.0-caustic) * weightSum / (30.0 * 3.0)); + + float FinalCaustics = exp((1.0 + 5.0 * pow(WavesLarge,0.5)) * (heightSum / 3.0 - 0.5)); + + return FinalCaustics; } +float getWaterHeightmap(vec2 posxz) { + + vec2 pos = posxz; + float heightSum = 0.0; + float movement = frameTimeCounter*0.02; + // movement = 0.0; + + float radiance = 2.39996; + mat2 rotationMatrix = mat2(vec2(cos(radiance), -sin(radiance)), vec2(sin(radiance), cos(radiance))); -// float getWaterHeightmap(vec2 posxz, float waveM, float waveZ, float iswater) { // water waves -// vec2 movement = vec2(frameTimeCounter*0.025); -// vec2 pos = posxz ; -// float caustic = 1.0; -// float weightSum = 0.0; + vec2 wave_size[3] = vec2[]( + vec2(48.,12.), + vec2(12.,48.), + vec2(32.,32.) + ); -// float radiance = 2.39996; -// mat2 rotationMatrix = mat2(vec2(cos(radiance), -sin(radiance)), vec2(sin(radiance), cos(radiance))); + float WavesLarge = max(texture2D(noisetex, pos / 600.0 ).b,0.1); -// const vec2 wave_size[3] = vec2[]( -// vec2(60.,30.), -// vec2(30.,60.), -// vec2(45.) -// ); + for (int i = 0; i < 3; i++){ + pos = rotationMatrix * pos; + heightSum += texture2D(noisetex, pos / wave_size[i] + WavesLarge*0.5 + movement).b; + } -// float WavesLarge = pow(abs(0.5-texture2D(noisetex, pos / 600.0 ).b),2); + return (heightSum / 60.0) * WavesLarge; +} -// for (int i = 0; i < 3; i++){ -// pos = rotationMatrix * pos ; +vec3 getWaveNormal(vec3 posxz, bool isLOD){ -// float Waves = 1.0-exp(pow(abs(0.5-texture2D(noisetex, pos / (wave_size[i] ) + movement).b),1.3) * -10) ; + // vary the normal's "smooth" factor as distance changes, to avoid noise from too much details. + float range = pow(clamp(1.0 - length(posxz - cameraPosition)/(32*4),0.0,1.0),2.0); + float deltaPos = mix(0.5, 0.1, range); + float normalMult = 10.0; -// caustic += Waves*0.1; -// weightSum += exp2(-caustic*pow(WavesLarge,2)); -// } -// return caustic * weightSum/ 30; -// } + if(isLOD){ + normalMult = mix(5.0, normalMult, range); + deltaPos = mix(0.9, deltaPos, range); + } + + vec2 coord = posxz.xz;// - posxz.y; + + float h0 = getWaterHeightmap(coord); + float h1 = getWaterHeightmap(coord + vec2(deltaPos,0.0)); + float h3 = getWaterHeightmap(coord + vec2(0.0,deltaPos)); -vec3 getWaveHeight(vec2 posxz, float iswater){ + float xDelta = ((h1-h0)/deltaPos)*normalMult; + float yDelta = ((h3-h0)/deltaPos)*normalMult; - vec2 coord = posxz; + vec3 wave = normalize(vec3(xDelta,yDelta,1.0-pow(abs(xDelta+yDelta),2.0))); - float deltaPos = 0.25; - - float waveZ = mix(20.0,0.25,iswater); - float waveM = mix(0.0,4.0,iswater); - - float h0 = getWaterHeightmap(coord, waveM, waveZ, iswater); - float h1 = getWaterHeightmap(coord + vec2(deltaPos,0.0), waveM, waveZ, iswater); - float h3 = getWaterHeightmap(coord + vec2(0.0,deltaPos), waveM, waveZ, iswater); - - - float xDelta = ((h1-h0))/deltaPos*2.; - float yDelta = ((h3-h0))/deltaPos*2.; - - vec3 wave = normalize(vec3(xDelta,yDelta,1.0-pow(abs(xDelta+yDelta),2.0))); - - return wave; + return wave ; } \ No newline at end of file diff --git a/shaders/shaders.properties b/shaders/shaders.properties index 454e25d..ffa3514 100644 --- a/shaders/shaders.properties +++ b/shaders/shaders.properties @@ -54,7 +54,7 @@ beacon.beam.depth = true program.dh_water.enabled = false #endif -program.composite4.enabled = TAA_UPSCALING +program.composite5.enabled = TAA_UPSCALING # SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE ZERO # SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE @@ -78,6 +78,7 @@ blend.gbuffers_entities = off blend.gbuffers_beaconbeam = off blend.gbuffers_water.colortex11 = off blend.composite.colortex12 = off +blend.composite.colortex13 = off # Alpha test @@ -92,7 +93,7 @@ alphaTest.gbuffers_skybasic=false alphaTest.gbuffers_skytextured=false -sliders = DAY3_l0_coverage DAY3_l0_density DAY3_l1_coverage DAY3_l1_density DAY3_l2_coverage DAY3_l2_density DAY3_ufog_density DAY3_cfog_density DAY0_l0_coverage DAY0_l1_coverage DAY0_l2_coverage DAY0_ufog_density DAY0_l0_density DAY0_l1_density DAY0_l2_density DAY0_cfog_density DAY1_l0_coverage DAY1_l1_coverage DAY1_l2_coverage DAY1_ufog_density DAY1_l0_density DAY1_l1_density DAY1_l2_density DAY1_cfog_density DAY2_l0_coverage DAY2_l1_coverage DAY2_l2_coverage DAY2_ufog_density DAY2_l0_density DAY2_l1_density DAY2_l2_density DAY2_cfog_density DEBUG_VIEW entityShadowDistanceMul HANDHELD_LIGHT_RANGE CLOUD_SHADOW_STRENGTH CloudLayer0_coverage CloudLayer0_density CloudLayer0_height CloudLayer1_coverage CloudLayer1_density CloudLayer1_height CloudLayer2_coverage CloudLayer2_density CloudLayer2_height PLANET_GROUND_BRIGHTNESS FOG_START_HEIGHT WATER_WAVE_STRENGTH SWAMP_UNIFORM_DENSITY SWAMP_CLOUDY_DENSITY SWAMP_R SWAMP_G SWAMP_B JUNGLE_UNIFORM_DENSITY JUNGLE_CLOUDY_DENSITY JUNGLE_R JUNGLE_G JUNGLE_B DARKFOREST_UNIFORM_DENSITY DARKFOREST_CLOUDY_DENSITY DARKFOREST_R DARKFOREST_G DARKFOREST_B NETHER_PLUME_DENSITY END_STORM_DENSTIY LIT_PARTICLE_BRIGHTNESS R_UPPER_CURVE R_LOWER_CURVE G_UPPER_CURVE G_LOWER_CURVE B_UPPER_CURVE B_LOWER_CURVE UPPER_CURVE LOWER_CURVE CONTRAST EMISSIVE_TYPE SCALE_FACTOR CompSky_R CompSky_G CompSky_B ambientsss_brightness SSS_TYPE Cloud_Speed 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 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 Sun_temp Puddle_Size LabSSS_Curve Emissive_Curve Emissive_Brightness AO_Strength BLOOMY_FOG WAVY_SPEED WAVY_STRENGTH BLOOM_STRENGTH shadowDistance 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 DOF_JITTER_FOCUS JITTER_STRENGTH +sliders = WATER_CAUSTICS_BRIGHTNESS DAY3_l0_coverage DAY3_l0_density DAY3_l1_coverage DAY3_l1_density DAY3_l2_coverage DAY3_l2_density DAY3_ufog_density DAY3_cfog_density DAY0_l0_coverage DAY0_l1_coverage DAY0_l2_coverage DAY0_ufog_density DAY0_l0_density DAY0_l1_density DAY0_l2_density DAY0_cfog_density DAY1_l0_coverage DAY1_l1_coverage DAY1_l2_coverage DAY1_ufog_density DAY1_l0_density DAY1_l1_density DAY1_l2_density DAY1_cfog_density DAY2_l0_coverage DAY2_l1_coverage DAY2_l2_coverage DAY2_ufog_density DAY2_l0_density DAY2_l1_density DAY2_l2_density DAY2_cfog_density DEBUG_VIEW entityShadowDistanceMul HANDHELD_LIGHT_RANGE CLOUD_SHADOW_STRENGTH CloudLayer0_coverage CloudLayer0_density CloudLayer0_height CloudLayer1_coverage CloudLayer1_density CloudLayer1_height CloudLayer2_coverage CloudLayer2_density CloudLayer2_height PLANET_GROUND_BRIGHTNESS FOG_START_HEIGHT WATER_WAVE_STRENGTH SWAMP_UNIFORM_DENSITY SWAMP_CLOUDY_DENSITY SWAMP_R SWAMP_G SWAMP_B JUNGLE_UNIFORM_DENSITY JUNGLE_CLOUDY_DENSITY JUNGLE_R JUNGLE_G JUNGLE_B DARKFOREST_UNIFORM_DENSITY DARKFOREST_CLOUDY_DENSITY DARKFOREST_R DARKFOREST_G DARKFOREST_B NETHER_PLUME_DENSITY END_STORM_DENSTIY LIT_PARTICLE_BRIGHTNESS R_UPPER_CURVE R_LOWER_CURVE G_UPPER_CURVE G_LOWER_CURVE B_UPPER_CURVE B_LOWER_CURVE UPPER_CURVE LOWER_CURVE CONTRAST EMISSIVE_TYPE SCALE_FACTOR CompSky_R CompSky_G CompSky_B ambientsss_brightness SSS_TYPE Cloud_Speed 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 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 Sun_temp Puddle_Size LabSSS_Curve Emissive_Curve Emissive_Brightness AO_Strength BLOOMY_FOG WAVY_SPEED WAVY_STRENGTH BLOOM_STRENGTH shadowDistance 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 DOF_JITTER_FOCUS JITTER_STRENGTH screen.columns=2 screen = \ @@ -102,13 +103,13 @@ BLISS_SHADERS \ [Ambient_light] [Fog] \ [Post_Processing] [Clouds] \ [LabPBR] [Climate] \ - \ + [DAILY_WEATHER] \ [Misc_Settings] [DISTANT_HORIZONS_SETTINGS] # screen = [Direct_Light] [World] # [Ambient_light] [Fog] # [Post_Processing] [Clouds] -# [Misc_Settings] [Climate] +# [Misc_Settings] [Climate] ######## LIGHTING ### DIRECT LIGHT @@ -289,7 +290,7 @@ BLISS_SHADERS \ ######## MISC SETTINGS - screen.Misc_Settings = DEBUG_VIEW [the_orb] display_LUT WhiteWorld SSS_view ambientLight_only Glass_Tint LIGHTNING_FLASH HURT_AND_DEATH_EFFECT LIT_PARTICLE_BRIGHTNESS PLANET_GROUND_BRIGHTNESS BLOOMY_PARTICLES ORIGINAL_CHOCAPIC_SKY BIOME_TINT_WATER CLOUDS_INFRONT_OF_WORLD SELECT_BOX DENOISE_SSS_AND_SSAO + screen.Misc_Settings = DEBUG_VIEW [the_orb] display_LUT WhiteWorld SSS_view ambientLight_only Glass_Tint LIGHTNING_FLASH HURT_AND_DEATH_EFFECT LIT_PARTICLE_BRIGHTNESS PLANET_GROUND_BRIGHTNESS BLOOMY_PARTICLES ORIGINAL_CHOCAPIC_SKY BIOME_TINT_WATER CLOUDS_INFRONT_OF_WORLD SELECT_BOX DENOISE_SSS_AND_SSAO WATER_CAUSTICS_BRIGHTNESS screen.the_orb.columns = 1 screen.the_orb = THE_ORB ORB_X ORB_Y ORB_Z ORB_ColMult ORB_R ORB_G ORB_B diff --git a/shaders/world-1/composite.fsh b/shaders/world-1/composite.fsh new file mode 100644 index 0000000..fe90016 --- /dev/null +++ b/shaders/world-1/composite.fsh @@ -0,0 +1,5 @@ +#version 120 + +#define NETHER_SHADER + +#include "/dimensions/fogBehindTranslucent_pass.fsh" \ No newline at end of file diff --git a/shaders/world-1/composite.vsh b/shaders/world-1/composite.vsh new file mode 100644 index 0000000..6c420ef --- /dev/null +++ b/shaders/world-1/composite.vsh @@ -0,0 +1,5 @@ +#version 120 + +#define NETHER_SHADER + +#include "/dimensions/fogBehindTranslucent_pass.vsh" \ No newline at end of file diff --git a/shaders/world-1/composite1.fsh b/shaders/world-1/composite1.fsh index 3718942..6f2293a 100644 --- a/shaders/world-1/composite1.fsh +++ b/shaders/world-1/composite1.fsh @@ -2,4 +2,4 @@ #define NETHER_SHADER -#include "/dimensions/composite1.fsh" \ No newline at end of file +#include "/dimensions/composite.fsh" \ No newline at end of file diff --git a/shaders/world-1/composite1.vsh b/shaders/world-1/composite1.vsh index 39aedfd..5d659b9 100644 --- a/shaders/world-1/composite1.vsh +++ b/shaders/world-1/composite1.vsh @@ -2,4 +2,4 @@ #define NETHER_SHADER -#include "/dimensions/composite1.vsh" \ No newline at end of file +#include "/dimensions/composite.vsh" \ No newline at end of file diff --git a/shaders/world-1/composite10.fsh b/shaders/world-1/composite10.fsh index 6fdc6a5..bad4613 100644 --- a/shaders/world-1/composite10.fsh +++ b/shaders/world-1/composite10.fsh @@ -2,4 +2,4 @@ #define NETHER_SHADER -#include "/dimensions/composite10.fsh" \ No newline at end of file +#include "/dimensions/composite9.fsh" \ No newline at end of file diff --git a/shaders/world-1/composite10.vsh b/shaders/world-1/composite10.vsh index 7a5a31a..4260062 100644 --- a/shaders/world-1/composite10.vsh +++ b/shaders/world-1/composite10.vsh @@ -2,4 +2,4 @@ #define NETHER_SHADER -#include "/dimensions/composite10.vsh" \ No newline at end of file +#include "/dimensions/composite9.vsh" \ No newline at end of file diff --git a/shaders/world-1/composite11.fsh b/shaders/world-1/composite11.fsh index c8dd09f..6fdc6a5 100644 --- a/shaders/world-1/composite11.fsh +++ b/shaders/world-1/composite11.fsh @@ -2,4 +2,4 @@ #define NETHER_SHADER -#include "/dimensions/composite11.fsh" \ No newline at end of file +#include "/dimensions/composite10.fsh" \ No newline at end of file diff --git a/shaders/world-1/composite11.vsh b/shaders/world-1/composite11.vsh index ae59f60..7a5a31a 100644 --- a/shaders/world-1/composite11.vsh +++ b/shaders/world-1/composite11.vsh @@ -2,4 +2,4 @@ #define NETHER_SHADER -#include "/dimensions/composite11.vsh" \ No newline at end of file +#include "/dimensions/composite10.vsh" \ No newline at end of file diff --git a/shaders/world-1/composite12.fsh b/shaders/world-1/composite12.fsh new file mode 100644 index 0000000..c8dd09f --- /dev/null +++ b/shaders/world-1/composite12.fsh @@ -0,0 +1,5 @@ +#version 120 + +#define NETHER_SHADER + +#include "/dimensions/composite11.fsh" \ No newline at end of file diff --git a/shaders/world-1/composite12.vsh b/shaders/world-1/composite12.vsh new file mode 100644 index 0000000..ae59f60 --- /dev/null +++ b/shaders/world-1/composite12.vsh @@ -0,0 +1,5 @@ +#version 120 + +#define NETHER_SHADER + +#include "/dimensions/composite11.vsh" \ No newline at end of file diff --git a/shaders/world-1/composite2.fsh b/shaders/world-1/composite2.fsh index 64171b8..3718942 100644 --- a/shaders/world-1/composite2.fsh +++ b/shaders/world-1/composite2.fsh @@ -2,4 +2,4 @@ #define NETHER_SHADER -#include "/dimensions/composite2.fsh" \ No newline at end of file +#include "/dimensions/composite1.fsh" \ No newline at end of file diff --git a/shaders/world-1/composite2.vsh b/shaders/world-1/composite2.vsh index e2bee5e..39aedfd 100644 --- a/shaders/world-1/composite2.vsh +++ b/shaders/world-1/composite2.vsh @@ -2,4 +2,4 @@ #define NETHER_SHADER -#include "/dimensions/composite2.vsh" \ No newline at end of file +#include "/dimensions/composite1.vsh" \ No newline at end of file diff --git a/shaders/world-1/composite3.fsh b/shaders/world-1/composite3.fsh index a08fb95..64171b8 100644 --- a/shaders/world-1/composite3.fsh +++ b/shaders/world-1/composite3.fsh @@ -2,4 +2,4 @@ #define NETHER_SHADER -#include "/dimensions/composite3.fsh" \ No newline at end of file +#include "/dimensions/composite2.fsh" \ No newline at end of file diff --git a/shaders/world-1/composite3.vsh b/shaders/world-1/composite3.vsh index 45ba6c5..e2bee5e 100644 --- a/shaders/world-1/composite3.vsh +++ b/shaders/world-1/composite3.vsh @@ -2,4 +2,4 @@ #define NETHER_SHADER -#include "/dimensions/composite3.vsh" \ No newline at end of file +#include "/dimensions/composite2.vsh" \ No newline at end of file diff --git a/shaders/world-1/composite4.fsh b/shaders/world-1/composite4.fsh index 3acc800..a08fb95 100644 --- a/shaders/world-1/composite4.fsh +++ b/shaders/world-1/composite4.fsh @@ -2,4 +2,4 @@ #define NETHER_SHADER -#include "/dimensions/composite4.fsh" \ No newline at end of file +#include "/dimensions/composite3.fsh" \ No newline at end of file diff --git a/shaders/world-1/composite4.vsh b/shaders/world-1/composite4.vsh index 5e9644d..45ba6c5 100644 --- a/shaders/world-1/composite4.vsh +++ b/shaders/world-1/composite4.vsh @@ -2,4 +2,4 @@ #define NETHER_SHADER -#include "/dimensions/composite4.vsh" \ No newline at end of file +#include "/dimensions/composite3.vsh" \ No newline at end of file diff --git a/shaders/world-1/composite5.fsh b/shaders/world-1/composite5.fsh index 72d13ae..3acc800 100644 --- a/shaders/world-1/composite5.fsh +++ b/shaders/world-1/composite5.fsh @@ -2,4 +2,4 @@ #define NETHER_SHADER -#include "/dimensions/composite5.fsh" \ No newline at end of file +#include "/dimensions/composite4.fsh" \ No newline at end of file diff --git a/shaders/world-1/composite5.vsh b/shaders/world-1/composite5.vsh index 59eb056..5e9644d 100644 --- a/shaders/world-1/composite5.vsh +++ b/shaders/world-1/composite5.vsh @@ -2,4 +2,4 @@ #define NETHER_SHADER -#include "/dimensions/composite5.vsh" \ No newline at end of file +#include "/dimensions/composite4.vsh" \ No newline at end of file diff --git a/shaders/world-1/composite6.fsh b/shaders/world-1/composite6.fsh index c3e1a6b..72d13ae 100644 --- a/shaders/world-1/composite6.fsh +++ b/shaders/world-1/composite6.fsh @@ -2,4 +2,4 @@ #define NETHER_SHADER -#include "/dimensions/composite6.fsh" \ No newline at end of file +#include "/dimensions/composite5.fsh" \ No newline at end of file diff --git a/shaders/world-1/composite6.vsh b/shaders/world-1/composite6.vsh index 1a6f8de..59eb056 100644 --- a/shaders/world-1/composite6.vsh +++ b/shaders/world-1/composite6.vsh @@ -2,4 +2,4 @@ #define NETHER_SHADER -#include "/dimensions/composite6.vsh" \ No newline at end of file +#include "/dimensions/composite5.vsh" \ No newline at end of file diff --git a/shaders/world-1/composite7.fsh b/shaders/world-1/composite7.fsh index 98dd642..c3e1a6b 100644 --- a/shaders/world-1/composite7.fsh +++ b/shaders/world-1/composite7.fsh @@ -2,4 +2,4 @@ #define NETHER_SHADER -#include "/dimensions/composite7.fsh" \ No newline at end of file +#include "/dimensions/composite6.fsh" \ No newline at end of file diff --git a/shaders/world-1/composite7.vsh b/shaders/world-1/composite7.vsh index 226fed4..1a6f8de 100644 --- a/shaders/world-1/composite7.vsh +++ b/shaders/world-1/composite7.vsh @@ -2,4 +2,4 @@ #define NETHER_SHADER -#include "/dimensions/composite7.vsh" \ No newline at end of file +#include "/dimensions/composite6.vsh" \ No newline at end of file diff --git a/shaders/world-1/composite8.fsh b/shaders/world-1/composite8.fsh index f46e843..98dd642 100644 --- a/shaders/world-1/composite8.fsh +++ b/shaders/world-1/composite8.fsh @@ -2,4 +2,4 @@ #define NETHER_SHADER -#include "/dimensions/composite8.fsh" \ No newline at end of file +#include "/dimensions/composite7.fsh" \ No newline at end of file diff --git a/shaders/world-1/composite8.vsh b/shaders/world-1/composite8.vsh index 1424be4..226fed4 100644 --- a/shaders/world-1/composite8.vsh +++ b/shaders/world-1/composite8.vsh @@ -2,4 +2,4 @@ #define NETHER_SHADER -#include "/dimensions/composite8.vsh" \ No newline at end of file +#include "/dimensions/composite7.vsh" \ No newline at end of file diff --git a/shaders/world-1/composite9.fsh b/shaders/world-1/composite9.fsh index bad4613..f46e843 100644 --- a/shaders/world-1/composite9.fsh +++ b/shaders/world-1/composite9.fsh @@ -2,4 +2,4 @@ #define NETHER_SHADER -#include "/dimensions/composite9.fsh" \ No newline at end of file +#include "/dimensions/composite8.fsh" \ No newline at end of file diff --git a/shaders/world-1/composite9.vsh b/shaders/world-1/composite9.vsh index 4260062..1424be4 100644 --- a/shaders/world-1/composite9.vsh +++ b/shaders/world-1/composite9.vsh @@ -2,4 +2,4 @@ #define NETHER_SHADER -#include "/dimensions/composite9.vsh" \ No newline at end of file +#include "/dimensions/composite8.vsh" \ No newline at end of file diff --git a/shaders/world0/composite.fsh b/shaders/world0/composite.fsh index 4392112..8a19213 100644 --- a/shaders/world0/composite.fsh +++ b/shaders/world0/composite.fsh @@ -2,4 +2,4 @@ #define OVERWORLD_SHADER -#include "/dimensions/composite.fsh" \ No newline at end of file +#include "/dimensions/fogBehindTranslucent_pass.fsh" \ No newline at end of file diff --git a/shaders/world0/composite.vsh b/shaders/world0/composite.vsh index 481d1c6..ac025c8 100644 --- a/shaders/world0/composite.vsh +++ b/shaders/world0/composite.vsh @@ -2,4 +2,4 @@ #define OVERWORLD_SHADER -#include "/dimensions/composite.vsh" \ No newline at end of file +#include "/dimensions/fogBehindTranslucent_pass.vsh" \ No newline at end of file diff --git a/shaders/world0/composite1.fsh b/shaders/world0/composite1.fsh index 46e557b..4392112 100644 --- a/shaders/world0/composite1.fsh +++ b/shaders/world0/composite1.fsh @@ -2,4 +2,4 @@ #define OVERWORLD_SHADER -#include "/dimensions/composite1.fsh" \ No newline at end of file +#include "/dimensions/composite.fsh" \ No newline at end of file diff --git a/shaders/world0/composite1.vsh b/shaders/world0/composite1.vsh index 36d76b5..481d1c6 100644 --- a/shaders/world0/composite1.vsh +++ b/shaders/world0/composite1.vsh @@ -2,4 +2,4 @@ #define OVERWORLD_SHADER -#include "/dimensions/composite1.vsh" \ No newline at end of file +#include "/dimensions/composite.vsh" \ No newline at end of file diff --git a/shaders/world0/composite10.fsh b/shaders/world0/composite10.fsh index 684023c..7f12057 100644 --- a/shaders/world0/composite10.fsh +++ b/shaders/world0/composite10.fsh @@ -2,4 +2,4 @@ #define OVERWORLD_SHADER -#include "/dimensions/composite10.fsh" \ No newline at end of file +#include "/dimensions/composite9.fsh" \ No newline at end of file diff --git a/shaders/world0/composite10.vsh b/shaders/world0/composite10.vsh index 497490c..803cf3b 100644 --- a/shaders/world0/composite10.vsh +++ b/shaders/world0/composite10.vsh @@ -2,4 +2,4 @@ #define OVERWORLD_SHADER -#include "/dimensions/composite10.vsh" \ No newline at end of file +#include "/dimensions/composite9.vsh" \ No newline at end of file diff --git a/shaders/world0/composite11.fsh b/shaders/world0/composite11.fsh index 56efeb7..684023c 100644 --- a/shaders/world0/composite11.fsh +++ b/shaders/world0/composite11.fsh @@ -2,4 +2,4 @@ #define OVERWORLD_SHADER -#include "/dimensions/composite11.fsh" \ No newline at end of file +#include "/dimensions/composite10.fsh" \ No newline at end of file diff --git a/shaders/world0/composite11.vsh b/shaders/world0/composite11.vsh index 03e95e7..497490c 100644 --- a/shaders/world0/composite11.vsh +++ b/shaders/world0/composite11.vsh @@ -2,4 +2,4 @@ #define OVERWORLD_SHADER -#include "/dimensions/composite11.vsh" \ No newline at end of file +#include "/dimensions/composite10.vsh" \ No newline at end of file diff --git a/shaders/world0/composite12.fsh b/shaders/world0/composite12.fsh new file mode 100644 index 0000000..56efeb7 --- /dev/null +++ b/shaders/world0/composite12.fsh @@ -0,0 +1,5 @@ +#version 120 + +#define OVERWORLD_SHADER + +#include "/dimensions/composite11.fsh" \ No newline at end of file diff --git a/shaders/world0/composite12.vsh b/shaders/world0/composite12.vsh new file mode 100644 index 0000000..03e95e7 --- /dev/null +++ b/shaders/world0/composite12.vsh @@ -0,0 +1,5 @@ +#version 120 + +#define OVERWORLD_SHADER + +#include "/dimensions/composite11.vsh" \ No newline at end of file diff --git a/shaders/world0/composite2.fsh b/shaders/world0/composite2.fsh index df6c56d..46e557b 100644 --- a/shaders/world0/composite2.fsh +++ b/shaders/world0/composite2.fsh @@ -2,4 +2,4 @@ #define OVERWORLD_SHADER -#include "/dimensions/composite2.fsh" \ No newline at end of file +#include "/dimensions/composite1.fsh" \ No newline at end of file diff --git a/shaders/world0/dh_shadow.fsh b/shaders/world0/dh_shadow.fsh index 1f603e1..62ec7bf 100644 --- a/shaders/world0/dh_shadow.fsh +++ b/shaders/world0/dh_shadow.fsh @@ -5,6 +5,9 @@ flat varying int water; varying vec2 texcoord; + +varying float overdrawCull; + uniform sampler2D tex; //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// @@ -13,7 +16,16 @@ uniform sampler2D tex; //////////////////////////////VOID MAIN////////////////////////////// void main() { - if(water > 0) discard; + + if(water > 0){ + discard; + return; + } + + if(overdrawCull < 1.0){ + discard; + return; + } gl_FragData[0] = texture2D(tex, texcoord.xy); } diff --git a/shaders/world0/dh_shadow.vsh b/shaders/world0/dh_shadow.vsh index 54d3b6f..3dc0bf4 100644 --- a/shaders/world0/dh_shadow.vsh +++ b/shaders/world0/dh_shadow.vsh @@ -42,6 +42,7 @@ vec4 toClipSpace3(vec3 viewSpacePosition) { +varying float overdrawCull; // uniform int renderStage; void main() { @@ -52,7 +53,13 @@ void main() { texcoord.xy = gl_MultiTexCoord0.xy; vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz; - + #ifdef DH_OVERDRAW_PREVENTION + vec3 worldpos = mat3(shadowModelViewInverse) * position + shadowModelViewInverse[3].xyz; + overdrawCull = 1.0 - clamp(1.0 - length(worldpos) / max(far-16,0.0),0,1); + #else + overdrawCull = 1.0; + #endif + #ifdef DISTORT_SHADOWMAP gl_Position = BiasShadowProjection(toClipSpace3(position)); #else diff --git a/shaders/world0/shadow.vsh b/shaders/world0/shadow.vsh index 0871b18..af99686 100644 --- a/shaders/world0/shadow.vsh +++ b/shaders/world0/shadow.vsh @@ -170,13 +170,13 @@ void main() { #ifdef WAVY_PLANTS bool istopv = gl_MultiTexCoord0.t < mc_midTexCoord.t; - if ((mc_Entity.x == 10001&&istopv) && length(position.xy) < 24.0) { + if ((mc_Entity.x == 10001 || mc_Entity.x == 10009 && istopv) && length(position.xy) < 24.0) { vec3 worldpos = mat3(shadowModelViewInverse) * position + shadowModelViewInverse[3].xyz; worldpos.xyz += calcMovePlants(worldpos.xyz + cameraPosition)*gl_MultiTexCoord1.y; position = mat3(shadowModelView) * worldpos + shadowModelView[3].xyz ; } - if ((mc_Entity.x == 10003) && length(position.xy) < 24.0) { + if (mc_Entity.x == 10003 && length(position.xy) < 24.0) { vec3 worldpos = mat3(shadowModelViewInverse) * position + shadowModelViewInverse[3].xyz; worldpos.xyz += calcMoveLeaves(worldpos.xyz + cameraPosition, 0.0040, 0.0064, 0.0043, 0.0035, 0.0037, 0.0041, vec3(1.0,0.2,1.0), vec3(0.5,0.1,0.5))*gl_MultiTexCoord1.y; position = mat3(shadowModelView) * worldpos + shadowModelView[3].xyz ; diff --git a/shaders/world1/composite.fsh b/shaders/world1/composite.fsh new file mode 100644 index 0000000..ca39820 --- /dev/null +++ b/shaders/world1/composite.fsh @@ -0,0 +1,5 @@ +#version 120 + +#define END_SHADER + +#include "/dimensions/fogBehindTranslucent_pass.fsh" \ No newline at end of file diff --git a/shaders/world1/composite.vsh b/shaders/world1/composite.vsh new file mode 100644 index 0000000..677486b --- /dev/null +++ b/shaders/world1/composite.vsh @@ -0,0 +1,5 @@ +#version 120 + +#define END_SHADER + +#include "/dimensions/fogBehindTranslucent_pass.vsh" \ No newline at end of file diff --git a/shaders/world1/composite1.fsh b/shaders/world1/composite1.fsh index 275a6fe..598bc16 100644 --- a/shaders/world1/composite1.fsh +++ b/shaders/world1/composite1.fsh @@ -2,4 +2,4 @@ #define END_SHADER -#include "/dimensions/composite1.fsh" \ No newline at end of file +#include "/dimensions/composite.fsh" \ No newline at end of file diff --git a/shaders/world1/composite1.vsh b/shaders/world1/composite1.vsh index b606182..032f8fa 100644 --- a/shaders/world1/composite1.vsh +++ b/shaders/world1/composite1.vsh @@ -2,4 +2,4 @@ #define END_SHADER -#include "/dimensions/composite1.vsh" \ No newline at end of file +#include "/dimensions/composite.vsh" \ No newline at end of file diff --git a/shaders/world1/composite10.fsh b/shaders/world1/composite10.fsh index ee3281f..c4b6b42 100644 --- a/shaders/world1/composite10.fsh +++ b/shaders/world1/composite10.fsh @@ -2,4 +2,4 @@ #define END_SHADER -#include "/dimensions/composite10.fsh" \ No newline at end of file +#include "/dimensions/composite9.fsh" \ No newline at end of file diff --git a/shaders/world1/composite10.vsh b/shaders/world1/composite10.vsh index f2237a9..b487c6a 100644 --- a/shaders/world1/composite10.vsh +++ b/shaders/world1/composite10.vsh @@ -2,4 +2,4 @@ #define END_SHADER -#include "/dimensions/composite10.vsh" \ No newline at end of file +#include "/dimensions/composite9.vsh" \ No newline at end of file diff --git a/shaders/world1/composite11.fsh b/shaders/world1/composite11.fsh index cd9deae..ee3281f 100644 --- a/shaders/world1/composite11.fsh +++ b/shaders/world1/composite11.fsh @@ -2,4 +2,4 @@ #define END_SHADER -#include "/dimensions/composite11.fsh" \ No newline at end of file +#include "/dimensions/composite10.fsh" \ No newline at end of file diff --git a/shaders/world1/composite11.vsh b/shaders/world1/composite11.vsh index 6d5a44b..f2237a9 100644 --- a/shaders/world1/composite11.vsh +++ b/shaders/world1/composite11.vsh @@ -2,4 +2,4 @@ #define END_SHADER -#include "/dimensions/composite11.vsh" \ No newline at end of file +#include "/dimensions/composite10.vsh" \ No newline at end of file diff --git a/shaders/world1/composite12.fsh b/shaders/world1/composite12.fsh new file mode 100644 index 0000000..cd9deae --- /dev/null +++ b/shaders/world1/composite12.fsh @@ -0,0 +1,5 @@ +#version 120 + +#define END_SHADER + +#include "/dimensions/composite11.fsh" \ No newline at end of file diff --git a/shaders/world1/composite12.vsh b/shaders/world1/composite12.vsh new file mode 100644 index 0000000..6d5a44b --- /dev/null +++ b/shaders/world1/composite12.vsh @@ -0,0 +1,5 @@ +#version 120 + +#define END_SHADER + +#include "/dimensions/composite11.vsh" \ No newline at end of file diff --git a/shaders/world1/composite2.fsh b/shaders/world1/composite2.fsh index dcb6e3c..275a6fe 100644 --- a/shaders/world1/composite2.fsh +++ b/shaders/world1/composite2.fsh @@ -2,4 +2,4 @@ #define END_SHADER -#include "/dimensions/composite2.fsh" \ No newline at end of file +#include "/dimensions/composite1.fsh" \ No newline at end of file diff --git a/shaders/world1/composite2.vsh b/shaders/world1/composite2.vsh index 93493b1..b606182 100644 --- a/shaders/world1/composite2.vsh +++ b/shaders/world1/composite2.vsh @@ -2,4 +2,4 @@ #define END_SHADER -#include "/dimensions/composite2.vsh" \ No newline at end of file +#include "/dimensions/composite1.vsh" \ No newline at end of file diff --git a/shaders/world1/composite3.fsh b/shaders/world1/composite3.fsh index 85b347b..dcb6e3c 100644 --- a/shaders/world1/composite3.fsh +++ b/shaders/world1/composite3.fsh @@ -2,4 +2,4 @@ #define END_SHADER -#include "/dimensions/composite3.fsh" \ No newline at end of file +#include "/dimensions/composite2.fsh" \ No newline at end of file diff --git a/shaders/world1/composite3.vsh b/shaders/world1/composite3.vsh index aa0a507..93493b1 100644 --- a/shaders/world1/composite3.vsh +++ b/shaders/world1/composite3.vsh @@ -2,4 +2,4 @@ #define END_SHADER -#include "/dimensions/composite3.vsh" \ No newline at end of file +#include "/dimensions/composite2.vsh" \ No newline at end of file diff --git a/shaders/world1/composite4.fsh b/shaders/world1/composite4.fsh index ca6df9c..85b347b 100644 --- a/shaders/world1/composite4.fsh +++ b/shaders/world1/composite4.fsh @@ -2,4 +2,4 @@ #define END_SHADER -#include "/dimensions/composite4.fsh" \ No newline at end of file +#include "/dimensions/composite3.fsh" \ No newline at end of file diff --git a/shaders/world1/composite4.vsh b/shaders/world1/composite4.vsh index b439e0e..aa0a507 100644 --- a/shaders/world1/composite4.vsh +++ b/shaders/world1/composite4.vsh @@ -2,4 +2,4 @@ #define END_SHADER -#include "/dimensions/composite4.vsh" \ No newline at end of file +#include "/dimensions/composite3.vsh" \ No newline at end of file diff --git a/shaders/world1/composite5.fsh b/shaders/world1/composite5.fsh index 5d88de6..ca6df9c 100644 --- a/shaders/world1/composite5.fsh +++ b/shaders/world1/composite5.fsh @@ -2,4 +2,4 @@ #define END_SHADER -#include "/dimensions/composite5.fsh" \ No newline at end of file +#include "/dimensions/composite4.fsh" \ No newline at end of file diff --git a/shaders/world1/composite5.vsh b/shaders/world1/composite5.vsh index 0d7fb8a..b439e0e 100644 --- a/shaders/world1/composite5.vsh +++ b/shaders/world1/composite5.vsh @@ -2,4 +2,4 @@ #define END_SHADER -#include "/dimensions/composite5.vsh" \ No newline at end of file +#include "/dimensions/composite4.vsh" \ No newline at end of file diff --git a/shaders/world1/composite6.fsh b/shaders/world1/composite6.fsh index 766e494..5d88de6 100644 --- a/shaders/world1/composite6.fsh +++ b/shaders/world1/composite6.fsh @@ -2,4 +2,4 @@ #define END_SHADER -#include "/dimensions/composite6.fsh" \ No newline at end of file +#include "/dimensions/composite5.fsh" \ No newline at end of file diff --git a/shaders/world1/composite6.vsh b/shaders/world1/composite6.vsh index 50c159b..0d7fb8a 100644 --- a/shaders/world1/composite6.vsh +++ b/shaders/world1/composite6.vsh @@ -2,4 +2,4 @@ #define END_SHADER -#include "/dimensions/composite6.vsh" \ No newline at end of file +#include "/dimensions/composite5.vsh" \ No newline at end of file diff --git a/shaders/world1/composite7.fsh b/shaders/world1/composite7.fsh index 9af2e0e..766e494 100644 --- a/shaders/world1/composite7.fsh +++ b/shaders/world1/composite7.fsh @@ -2,4 +2,4 @@ #define END_SHADER -#include "/dimensions/composite7.fsh" \ No newline at end of file +#include "/dimensions/composite6.fsh" \ No newline at end of file diff --git a/shaders/world1/composite7.vsh b/shaders/world1/composite7.vsh index b1cd0be..50c159b 100644 --- a/shaders/world1/composite7.vsh +++ b/shaders/world1/composite7.vsh @@ -2,4 +2,4 @@ #define END_SHADER -#include "/dimensions/composite7.vsh" \ No newline at end of file +#include "/dimensions/composite6.vsh" \ No newline at end of file diff --git a/shaders/world1/composite8.fsh b/shaders/world1/composite8.fsh index eda3677..9af2e0e 100644 --- a/shaders/world1/composite8.fsh +++ b/shaders/world1/composite8.fsh @@ -2,4 +2,4 @@ #define END_SHADER -#include "/dimensions/composite8.fsh" \ No newline at end of file +#include "/dimensions/composite7.fsh" \ No newline at end of file diff --git a/shaders/world1/composite8.vsh b/shaders/world1/composite8.vsh index db8cb16..b1cd0be 100644 --- a/shaders/world1/composite8.vsh +++ b/shaders/world1/composite8.vsh @@ -2,4 +2,4 @@ #define END_SHADER -#include "/dimensions/composite8.vsh" \ No newline at end of file +#include "/dimensions/composite7.vsh" \ No newline at end of file diff --git a/shaders/world1/composite9.fsh b/shaders/world1/composite9.fsh index c4b6b42..eda3677 100644 --- a/shaders/world1/composite9.fsh +++ b/shaders/world1/composite9.fsh @@ -2,4 +2,4 @@ #define END_SHADER -#include "/dimensions/composite9.fsh" \ No newline at end of file +#include "/dimensions/composite8.fsh" \ No newline at end of file diff --git a/shaders/world1/composite9.vsh b/shaders/world1/composite9.vsh index b487c6a..db8cb16 100644 --- a/shaders/world1/composite9.vsh +++ b/shaders/world1/composite9.vsh @@ -2,4 +2,4 @@ #define END_SHADER -#include "/dimensions/composite9.vsh" \ No newline at end of file +#include "/dimensions/composite8.vsh" \ No newline at end of file