From 69b0be256e19defd824773c679c2641813f0e9cf Mon Sep 17 00:00:00 2001 From: Sasha Date: Fri, 7 Jul 2023 22:58:36 +0100 Subject: [PATCH] jitter dof (: shadow jitter still not working --- shaders/composite1.fsh | 27 ++++++++++ shaders/composite2.fsh | 12 +++++ shaders/gbuffers_all_particles.vsh | 24 +++++++++ shaders/gbuffers_all_solid.vsh | 25 ++++++++++ shaders/gbuffers_all_translucent.vsh | 25 +++++++++- shaders/lang/en_us.lang | 7 +++ shaders/lib/bokeh.glsl | 74 +++++++++++++++++++++++++++- shaders/lib/settings.glsl | 7 ++- shaders/shaders.properties | 13 +++-- shaders/shadow.vsh | 40 +++++++++++++++ 10 files changed, 247 insertions(+), 7 deletions(-) diff --git a/shaders/composite1.fsh b/shaders/composite1.fsh index a87f509..2dfc73a 100644 --- a/shaders/composite1.fsh +++ b/shaders/composite1.fsh @@ -44,6 +44,7 @@ uniform sampler2DShadow shadow; varying vec4 normalMat; uniform int heldBlockLightValue; uniform int frameCounter; +uniform float screenBrightness; uniform int isEyeInWater; uniform float far; uniform float near; @@ -60,6 +61,7 @@ uniform mat4 shadowProjection; uniform mat4 gbufferModelView; // uniform float viewWidth; // uniform float viewHeight; +uniform int hideGUI; uniform float aspectRatio; uniform vec2 texelSize; uniform vec3 cameraPosition; @@ -1170,5 +1172,30 @@ void main() { if (isEyeInWater == 0) waterVolumetrics(gl_FragData[0].rgb, fragpos0, fragpos, estimatedDepth , estimatedSunDepth, Vdiff, noise, totEpsilon, scatterCoef, ambientColVol, lightColVol, dot(np3, WsunVec)); } + #ifdef DOF_JITTER + vec3 laserColor; + #if FOCUS_LASER_COLOR == 0 // Red + laserColor = vec3(25, 0, 0); + #elif FOCUS_LASER_COLOR == 1 // Green + laserColor = vec3(0, 25, 0); + #elif FOCUS_LASER_COLOR == 2 // Blue + laserColor = vec3(0, 0, 25); + #elif FOCUS_LASER_COLOR == 3 // Pink + laserColor = vec3(25, 10, 15); + #elif FOCUS_LASER_COLOR == 4 // Yellow + laserColor = vec3(25, 25, 0); + #elif FOCUS_LASER_COLOR == 5 // White + laserColor = vec3(25); + #endif + + #if DOF_JITTER_FOCUS < 0 + float focusDist = mix(pow(512.0, screenBrightness), 512.0 * screenBrightness, 0.25); + #else + float focusDist = DOF_JITTER_FOCUS; + #endif + + if( hideGUI < 1.0) gl_FragData[0].rgb += laserColor * pow( clamp( 1.0-abs(focusDist-abs(fragpos.z)) ,0,1),25) ; + #endif + /* DRAWBUFFERS:3 */ } \ No newline at end of file diff --git a/shaders/composite2.fsh b/shaders/composite2.fsh index 9d07dec..9155d63 100644 --- a/shaders/composite2.fsh +++ b/shaders/composite2.fsh @@ -30,6 +30,7 @@ uniform vec3 sunVec; uniform float far; uniform float near; uniform int frameCounter; +uniform float aspectRatio; uniform float rainStrength; uniform float sunElevation; uniform ivec2 eyeBrightnessSmooth; @@ -51,6 +52,7 @@ uniform vec2 texelSize; #define TIMEOFDAYFOG #include "/lib/volumetricClouds.glsl" +#include "/lib/bokeh.glsl" float blueNoise(){ @@ -259,6 +261,16 @@ void main() { vec2 tc = floor(gl_FragCoord.xy)/VL_RENDER_RESOLUTION*texelSize+0.5*texelSize; float z = texture2D(depthtex0,tc).x; + + #ifdef DOF_JITTER + vec2 jitter = clamp(jitter_offsets[frameCounter % 64], -1.0, 1.0); + jitter = rotate(radians(float(frameCounter))) * jitter; + jitter.y *= aspectRatio; + jitter.x *= DOF_ANAMORPHIC_RATIO; + jitter.xy *= 0.004 * JITTER_STRENGTH; + + vec3 fragpos_DOF = toScreenSpace(vec3((tc + jitter)/RENDER_SCALE,z)); + #endif if (isEyeInWater == 0){ diff --git a/shaders/gbuffers_all_particles.vsh b/shaders/gbuffers_all_particles.vsh index ffed47d..7cf019d 100644 --- a/shaders/gbuffers_all_particles.vsh +++ b/shaders/gbuffers_all_particles.vsh @@ -2,6 +2,7 @@ //#extension GL_EXT_gpu_shader4 : disable #include "/lib/settings.glsl" #include "/lib/res_params.glsl" +#include "/lib/bokeh.glsl" /* !! DO NOT REMOVE !! @@ -31,6 +32,13 @@ uniform vec3 sunPosition; uniform float sunElevation; uniform sampler2D colortex4; +uniform int frameCounter; +uniform float far; +uniform float aspectRatio; +uniform float viewHeight; +uniform float viewWidth; +uniform int hideGUI; +uniform float screenBrightness; uniform vec2 texelSize; uniform int framemod8; @@ -81,4 +89,20 @@ void main() { #ifdef TAA gl_Position.xy += offsets[framemod8] * gl_Position.w*texelSize; #endif + + #ifdef DOF_JITTER + vec2 jitter = clamp(jitter_offsets[frameCounter % 64], -1.0, 1.0); + jitter = rotate(radians(float(frameCounter))) * jitter; + jitter.y *= aspectRatio; + jitter.x *= DOF_ANAMORPHIC_RATIO; + + #if DOF_JITTER_FOCUS < 0 + float focusMul = gl_Position.z - mix(pow(512.0, screenBrightness), 512.0 * screenBrightness, 0.25); + #else + float focusMul = gl_Position.z - DOF_JITTER_FOCUS; + #endif + + vec2 totalOffset = (jitter * JITTER_STRENGTH) * focusMul * 1e-2; + gl_Position.xy += hideGUI >= 1 ? totalOffset : vec2(0); + #endif } diff --git a/shaders/gbuffers_all_solid.vsh b/shaders/gbuffers_all_solid.vsh index d2af865..6457eb3 100644 --- a/shaders/gbuffers_all_solid.vsh +++ b/shaders/gbuffers_all_solid.vsh @@ -1,6 +1,7 @@ //#extension GL_EXT_gpu_shader4 : disable #include "/lib/settings.glsl" #include "/lib/res_params.glsl" +#include "/lib/bokeh.glsl" /* !! DO NOT REMOVE !! @@ -60,6 +61,14 @@ flat varying float HELD_ITEM_BRIGHTNESS; flat varying int PHYSICSMOD_SNOW; flat varying int NameTags; +uniform int frameCounter; +uniform float far; +uniform float aspectRatio; +uniform float viewHeight; +uniform float viewWidth; +uniform int hideGUI; +uniform float screenBrightness; + flat varying float SSSAMOUNT; flat varying float EMISSIVE; flat varying int LIGHTNING; @@ -369,4 +378,20 @@ void main() { gl_Position.xy += offsets[framemod8] * gl_Position.w * texelSize; #endif + +#ifdef DOF_JITTER + vec2 jitter = clamp(jitter_offsets[frameCounter % 64], -1.0, 1.0); + jitter = rotate(radians(float(frameCounter))) * jitter; + jitter.y *= aspectRatio; + jitter.x *= DOF_ANAMORPHIC_RATIO; + + #if DOF_JITTER_FOCUS < 0 + float focusMul = gl_Position.z - mix(pow(512.0, screenBrightness), 512.0 * screenBrightness, 0.25); + #else + float focusMul = gl_Position.z - DOF_JITTER_FOCUS; + #endif + + vec2 totalOffset = (jitter * JITTER_STRENGTH) * focusMul * 1e-2; + gl_Position.xy += hideGUI >= 1 ? totalOffset : vec2(0); +#endif } diff --git a/shaders/gbuffers_all_translucent.vsh b/shaders/gbuffers_all_translucent.vsh index e55f986..664d0ec 100644 --- a/shaders/gbuffers_all_translucent.vsh +++ b/shaders/gbuffers_all_translucent.vsh @@ -2,7 +2,7 @@ //#extension GL_EXT_gpu_shader4 : disable #include "/lib/settings.glsl" #include "/lib/res_params.glsl" - +#include "/lib/bokeh.glsl" /* !! DO NOT REMOVE !! @@ -39,6 +39,13 @@ uniform float sunElevation; varying vec4 tangent_other; +uniform int frameCounter; +uniform float far; +uniform float aspectRatio; +uniform float viewHeight; +uniform float viewWidth; +uniform int hideGUI; +uniform float screenBrightness; uniform vec2 texelSize; uniform int framemod8; @@ -151,6 +158,22 @@ void main() { lightCol.rgb = sc; WsunVec = lightCol.a*normalize(mat3(gbufferModelViewInverse) *sunPosition); + + #ifdef DOF_JITTER + vec2 jitter = clamp(jitter_offsets[frameCounter % 64], -1.0, 1.0); + jitter = rotate(radians(float(frameCounter))) * jitter; + jitter.y *= aspectRatio; + jitter.x *= DOF_ANAMORPHIC_RATIO; + + #if DOF_JITTER_FOCUS < 0 + float focusMul = gl_Position.z - mix(pow(512.0, screenBrightness), 512.0 * screenBrightness, 0.25); + #else + float focusMul = gl_Position.z - DOF_JITTER_FOCUS; + #endif + + vec2 totalOffset = (jitter * JITTER_STRENGTH) * focusMul * 1e-2; + gl_Position.xy += hideGUI >= 1 ? totalOffset : vec2(0); + #endif averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(0,37),0).rgb; // averageSkyCol = texelFetch2D(colortex4,ivec2(1,37),0).rgb; diff --git a/shaders/lang/en_us.lang b/shaders/lang/en_us.lang index 74449bb..c459a1e 100644 --- a/shaders/lang/en_us.lang +++ b/shaders/lang/en_us.lang @@ -236,6 +236,13 @@ option.DOF_QUALITY=Depth Of Field value.DOF_QUALITY.3=High value.DOF_QUALITY.4=Ultra option.DOF_ANAMORPHIC_RATIO=Anamorphic Ratio + value.DOF_JITTER_FOCUS.-1=Brightness Slider + value.FOCUS_LASER_COLOR.0=Red + value.FOCUS_LASER_COLOR.1=Green + value.FOCUS_LASER_COLOR.2=Blue + value.FOCUS_LASER_COLOR.3=Pink + value.FOCUS_LASER_COLOR.4=Yellow + value.FOCUS_LASER_COLOR.5=White option.AEROCHROME_MODE=Aerochrome Mode option.AEROCHROME_PINKNESS=Aerochrome Red:Pink Ratio diff --git a/shaders/lib/bokeh.glsl b/shaders/lib/bokeh.glsl index 0f51029..29b6a32 100644 --- a/shaders/lib/bokeh.glsl +++ b/shaders/lib/bokeh.glsl @@ -399,4 +399,76 @@ vec2(0.694719000547024, 0.7134671125059463), vec2(-0.992326501717018, -0.062069798758671524) ); -#endif \ No newline at end of file +#endif +#if defined(DOF_JITTER) || defined(DOF_JITTER_SHADOW) // DOF_QUALITY == 5 && defined(SCREENSHOT_MODE) + const vec2 jitter_offsets[64] = vec2[]( + vec2(0.08838834764831845, 0), + vec2(-0.1846432401149469, -0.8598513673187094), + vec2(0.017279026012279545, -0.19688558926459543), + vec2(-0.3024918972101173, 0.9324356021314415), + vec2(-0.9396490219009803, -0.21621104421497742), + vec2(0.24734769576390825, -0.1573423572986152), + vec2(-0.41009709429808805, -0.8991011473957005), + vec2(0.5744249772651445, 0.07728806825078578), + vec2(0.3423210807918538, 0.12501510966878018), + vec2(-0.44015653024869994, 0.751049085532647), + vec2(0.17167724937276072, -0.36686431013087517), + vec2(0.12686512045562875, 0.4044659951241622), + vec2(-0.42888394095723925, -0.6815394817536159), + vec2(0.4485669917863205, -0.09861619481490404), + vec2(-0.27375345242708055, 0.3893861159366807), + vec2(-0.06324338646074763, -0.4880448484196678), + vec2(0.3882523628219502, 0.32721950241874764), + vec2(-0.14238056851320097, 0.782649521631399), + vec2(0.3810988237928309, -0.37924423067954616), + vec2(-0.025496987788449936, 0.5513958683321046), + vec2(-0.3626167543233098, -0.4345360623515941), + vec2(0.9169758677396763, 0.3890279655539787), + vec2(-0.48670912146566037, 0.3386395297098746), + vec2(0.13299692659673018, -0.591184672937166), + vec2(-0.2530651743438579, 0.6046862967972011), + vec2(-0.6013578380024912, -0.19184955218339567), + vec2(0.9300141309321251, 0.047552247755117134), + vec2(-0.35612804311487684, 0.1470044792078405), + vec2(-0.2258550920331724, -0.6279346919884959), + vec2(0.6257873078318013, -0.47495025566539767), + vec2(-0.6675333000242891, 0.17595963559487854), + vec2(0.3794305347699942, -0.5901016601265889), + vec2(0.12069909342891681, 0.7023134833145649), + vec2(-0.5720078077939695, -0.44299499751434795), + vec2(0.731701930078265, -0.06062000923574415), + vec2(-0.5057602714083884, 0.5467120337663267), + vec2(0.2898616761608319, -0.7818521015468547), + vec2(0.514304945229712, 0.5669461379286951), + vec2(-0.7722948658519765, -0.07157611458215449), + vec2(0.6009761594775107, 0.31585622637469357), + vec2(-0.5224659775357187, 0.02160560847664148), + vec2(-0.3823729459844533, -0.2215929380173709), + vec2(0.785920133036245, 0.21538812522581444), + vec2(-0.7334855212372673, 0.3764126593717251), + vec2(0.1309753226146144, -0.9387667254786982), + vec2(0.31791146893355565, 0.7809416098022366), + vec2(0.3076149721436936, 0.5368291431293896), + vec2(0.8232633014643855, -0.2538208747561163), + vec2(-0.77026392317357, -0.3650424477471912), + vec2(-0.112886093968774, 0.10341290919644958), + vec2(0.7241773560320561, 0.5144216723762915), + vec2(-0.8901573611276761, 0.11093859756735677), + vec2(0.5870542621401351, -0.6896954351763548), + vec2(0.033319899649036984, 0.913688833404118), + vec2(-0.6477269570369681, -0.6572764175958464), + vec2(0.5841426097907643, -0.2698887019251361), + vec2(-0.7243231135792285, 0.5984718265172488), + vec2(0.003684027952365215, -0.7551813874414849), + vec2(0.5422048902753999, 0.7874492726274129), + vec2(-0.15778073396756462, -0.3037972020750958), + vec2(0.8459367503175589, -0.47927394511090204), + vec2(0.14228560991136777, 0.18558638207624523), + vec2(-0.08273296353158632, 0.30776250055080007), + vec2(-0.26111159362214226, -0.046186964352566244) + ); +#endif + +mat2 rotate(float angle){ + return mat2(cos(angle), -sin(angle), sin(angle), cos(angle)); +} \ No newline at end of file diff --git a/shaders/lib/settings.glsl b/shaders/lib/settings.glsl index 2784518..1589861 100644 --- a/shaders/lib/settings.glsl +++ b/shaders/lib/settings.glsl @@ -328,8 +328,11 @@ uniform int moonPhase; #define aperture 0.8 // [0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 0.95 1.0 1.05 1.1 1.15 1.2 1.25 1.3 1.35 1.4 1.45 1.5 1.55 1.6 1.65 1.7 1.75 1.8 1.85 1.9 1.95 2.0 2.05 2.1 2.15 2.2 2.25 2.3 2.35 2.4 2.45 2.5 2.55 2.6 2.65 2.7 2.75 2.8 2.85 2.9 2.95 3.0 3.05 3.1 3.15 3.2 3.25 3.3 3.35 3.4 3.45 3.5 3.55 3.6 3.65 3.7 3.75 3.8 3.85 3.9 3.95 4.0 4.05 4.1 4.15 4.2 4.25 4.3 4.35 4.4 4.45 4.5 4.55 4.6 4.65 4.7 4.75 4.8 4.85 4.9 4.95 5.0 5.05 5.1 5.15 5.2 5.25 5.3 5.35 5.4 5.45 5.5 5.55 5.6 5.65 5.7 5.75 5.8 5.85 5.9 5.95 6.0 6.05 6.1 6.15 6.2 6.25 6.3 6.35 6.4 6.45 6.5 6.55 6.6 6.65 6.7 6.75 6.8 6.85 6.9 6.95 7.0 7.05 7.1 7.15 7.2 7.25 7.3 7.35 7.4 7.45 7.5 7.55 7.6 7.65 7.7 7.75 7.8 7.85 7.9 7.95 8.0 8.05 8.1 8.15 8.2 8.25 8.3 8.35 8.4 8.45 8.5 8.55 8.6 8.65 8.7 8.75 8.8 8.85 8.9 8.95 9.0 9.05 9.1 9.15 9.2 9.25 9.3 9.35 9.4 9.45 9.5 9.55 9.6 9.65 9.7 9.75 9.8 9.85 9.9 9.95 ] #define MANUAL_FOCUS 48.0 // [0.06948345122280154 0.07243975703425146 0.07552184450877376 0.07873506526686186 0.0820849986238988 0.08557746127787037 0.08921851740926011 0.09301448921066349 0.09697196786440505 0.10109782498721881 0.10539922456186433 0.10988363537639657 0.11455884399268773 0.11943296826671962 0.12451447144412296 0.129812176855438 0.1353352832366127 0.1410933807013415 0.1470964673929768 0.15335496684492847 0.1598797460796939 0.16668213447794653 0.17377394345044514 0.18116748694692214 0.18887560283756183 0.19691167520419406 0.20528965757990927 0.21402409717744744 0.22313016014842982 0.2326236579172927 0.2425210746356487 0.25283959580474646 0.26359713811572677 0.27481238055948964 0.2865047968601901 0.29869468928867837 0.3114032239145977 0.32465246735834974 0.3384654251067422 0.3528660814588489 0.36787944117144233 0.3835315728763107 0.39984965434484737 0.4168620196785084 0.4345982085070782 0.453089017280169 0.4723665527410147 0.49246428767540973 0.513417119032592 0.5352614285189903 0.5580351457700471 0.5817778142098083 0.6065306597126334 0.6323366621862497 0.6592406302004438 0.6872892787909722 0.7165313105737893 0.7470175003104326 0.7788007830714049 0.8119363461506349 0.8464817248906141 0.8824969025845955 0.9200444146293233 0.9591894571091382 1.0 1.0425469051899914 1.086904049521229 1.1331484530668263 1.1813604128656459 1.2316236423470497 1.2840254166877414 1.338656724353094 1.3956124250860895 1.4549914146182013 1.5168967963882134 1.5814360605671443 1.6487212707001282 1.7188692582893286 1.7920018256557555 1.8682459574322223 1.9477340410546757 2.030604096634748 2.117000016612675 2.2070718156067044 2.300975890892825 2.398875293967098 2.5009400136621287 2.6073472713092674 2.718281828459045 2.833936307694169 2.9545115270921065 3.080216848918031 3.211270543153561 3.347900166492527 3.4903429574618414 3.638846248353525 3.7936678946831774 3.955076722920577 4.123352997269821 4.298788906309526 4.4816890703380645 4.672371070304759 4.871165999245474 5.0784190371800815 5.29449005047003 5.51975421667673 5.754602676005731 5.999443210467818 6.254700951936329 6.5208191203301125 6.798259793203881 7.087504708082256 7.38905609893065 7.703437568215379 8.031194996067258 8.372897488127265 8.72913836372013 9.10053618607165 9.487735836358526 9.891409633455755 10.312258501325767 10.751013186076355 11.208435524800691 11.685319768402522 12.182493960703473 12.700821376227164 13.241202019156521 13.804574186067095 14.391916095149892 15.00424758475255 15.642631884188171 16.30817745988666 17.00203994009402 17.725424121461643 18.479586061009854 19.265835257097933 20.085536923187668 20.940114358348602 21.831051418620845 22.75989509352673 23.728258192205157 24.737822143832553 25.790339917193062 26.88763906446752 28.03162489452614 29.22428378123494 30.46768661252054 31.763992386181833 33.11545195869231 34.52441195350251 35.99331883562839 37.524723159600995 39.12128399815321 40.78577355933337 42.52108200006278 44.3302224444953 46.21633621589248 48.182698291098816 50.23272298708815 52.36996988945491 54.598150033144236 56.92113234615337 59.34295036739207 61.867809250367884 64.50009306485578 67.24437240923179 70.10541234668786 73.08818067910767 76.19785657297057 79.43983955226133 82.81975887399955 86.3434833026695 90.01713130052181 93.84708165144015 97.83998453682129 102.00277308269969 106.34267539816554 110.86722712598126 115.58428452718766 120.50203812241894 125.62902691361414 130.9741532108186 136.54669808981876 142.35633750745257 148.4131591025766 154.72767971186107 161.3108636308289 168.17414165184545 175.32943091211476 182.78915558614753 190.56626845863 198.67427341514983 ] #define DoF_Adaptation_Speed 1.00 // [0.20 0.21 0.23 0.24 0.25 0.27 0.29 0.30 0.32 0.34 0.36 0.39 0.41 0.43 0.46 0.49 0.52 0.55 0.59 0.62 0.66 0.70 0.74 0.79 0.84 0.89 0.94 1.00 1.06 1.13 1.20 1.27 1.35 1.43 1.52 1.61 1.71 1.82 1.93 2.05 2.18 2.31 2.45 2.60 2.76 2.93 3.11 3.30 3.51 3.72 3.95 4.19 4.45 4.73 5.02 5.33 5.65 6.00] - - +// #define DOF_JITTER +// #define DOF_JITTER_SHADOW +#define DOF_JITTER_FOCUS 32 // [-1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 19 20 21 22 24 25 26 28 29 30 32 33 35 36 38 40 41 43 45 47 48 50 52 54 56 58 60 63 65 67 70 72 75 77 80 83 85 88 91 94 98 101 104 108 111 115 119 123 127 132 136 141 146 151 156 161 167 173 179 186 193 200 207 215 224 232 242 251 262 273 284 297 310 324 339 355 372 391 411 433 457 483 512] +#define JITTER_STRENGTH 1.0 // sorry [0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 2.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] +#define FOCUS_LASER_COLOR 1 // Red, Green, Blue, Pink, Yellow, White [0 1 2 3 4 5] //////////////////////////////////////////////////////// // ----- COLOR/POST PROCESSING RELATED SETTINGS ----- // diff --git a/shaders/shaders.properties b/shaders/shaders.properties index aac84a0..4be6ee0 100644 --- a/shaders/shaders.properties +++ b/shaders/shaders.properties @@ -47,10 +47,15 @@ alphaTest.gbuffers_skytextured=false alphaTest.gbuffers_hand=true -sliders = UPPER_CURVE LOWER_CURVE CONTRAST EMISSIVE_TYPE Lightning_R Lightning_G Lightning_B SCALE_FACTOR CompSky_R CompSky_G CompSky_B ambientsss_brightness SSS_TYPE Cloud_Speed Cumulus_height Cumulus_coverage Cumulus_density Alto_coverage Alto_density ORB_ColMult ORB_X ORB_Y ORB_Z ORB_R ORB_G ORB_B TOD_Fog_mult Morning_Uniform_Fog Noon_Uniform_Fog Evening_Uniform_Fog Night_Uniform_Fog Morning_Cloudy_Fog Noon_Cloudy_Fog Evening_Cloudy_Fog Night_Cloudy_Fog NetherFog_brightness Summer_Leaf_R Summer_Leaf_G Summer_Leaf_B Fall_Leaf_R Fall_Leaf_G Fall_Leaf_B Winter_Leaf_R Winter_Leaf_G Winter_Leaf_B Spring_Leaf_R Spring_Leaf_G Spring_Leaf_B Summer_R Summer_G Summer_B Fall_R Fall_G Fall_B Winter_R Winter_G Winter_B Spring_R Spring_G Spring_B Season_Length CaveFogFallOff CaveFogColor_R CaveFogColor_G CaveFogColor_B indirect_effect GI_Strength ambient_brightness AmbientLight_R AmbientLight_G AmbientLight_B Rain_coverage Moon_temp Haze_amount RainFog_amount ambient_temp Sun_temp Puddle_Size LabSSS_Curve Emissive_Curve Emissive_Brightness AO_Strength BLOOMY_FOG WAVY_SPEED WAVY_STRENGTH BLOOM_STRENGTH shadowDistance shadowDistanceRenderMul FinalR FinalG FinalB Sky_Brightness fog_coefficientMieR fog_coefficientMieG fog_coefficientMieB sun_illuminance sunColorG sunColorB sunColorR sky_mieg sky_coefficientMieB sky_coefficientMieG sky_coefficientMieR sky_coefficientRayleighB sky_coefficientRayleighG sky_coefficientRayleighR CLOUDS_QUALITY EXPOSURE_MULTIPLIER MIN_LIGHT_AMOUNT TORCH_R TORCH_G TORCH_B TORCH_AMOUNT shadowMapResolution sunPathRotation BLEND_FACTOR VL_SAMPLES Exposure_Speed POM_DEPTH MAX_ITERATIONS MAX_DIST SSR_STEPS ambientOcclusionLevel SEA_LEVEL moon_illuminance moonColorR moonColorG moonColorB fog_coefficientRayleighR fog_coefficientRayleighG SATURATION Manual_exposure_value focal aperture MANUAL_FOCUS SHADOW_FILTER_SAMPLE_COUNT Max_Filter_Depth VPS_Search_Samples Min_Shadow_Filter_Radius Max_Shadow_Filter_Radius Water_Top_Layer fog_coefficientRayleighB SHARPENING rayMarchSampleCount Dirt_Amount Dirt_Scatter_R Dirt_Scatter_G Dirt_Scatter_B Dirt_Absorb_R Dirt_Absorb_G Dirt_Absorb_B Water_Absorb_R Water_Absorb_G Water_Absorb_B Purkinje_strength Purkinje_strength Purkinje_R Purkinje_G Purkinje_B Texture_MipMap_Bias DoF_Adaptation_Speed Purkinje_Multiplier CROSSTALK VL_RENDER_RESOLUTION BLOOM_QUALITY VL_RENDER_RESOLUTION RAY_COUNT STEPS STEP_LENGTH cloud_LevelOfDetail cloud_ShadowLevelOfDetail cloud_LevelOfDetailLQ cloud_ShadowLevelOfDetailLQ minRayMarchSteps maxRayMarchSteps minRayMarchStepsLQ maxRayMarchStepsLQ fbmAmount fbmPower1 fbmPower2 Roughness_Threshold Sun_specular_Strength reflection_quality DOF_QUALITY DOF_ANAMORPHIC_RATIO AEROCHROME_PINKNESS +sliders = UPPER_CURVE LOWER_CURVE CONTRAST EMISSIVE_TYPE Lightning_R Lightning_G Lightning_B SCALE_FACTOR CompSky_R CompSky_G CompSky_B ambientsss_brightness SSS_TYPE Cloud_Speed Cumulus_height Cumulus_coverage Cumulus_density Alto_coverage Alto_density ORB_ColMult ORB_X ORB_Y ORB_Z ORB_R ORB_G ORB_B TOD_Fog_mult Morning_Uniform_Fog Noon_Uniform_Fog Evening_Uniform_Fog Night_Uniform_Fog Morning_Cloudy_Fog Noon_Cloudy_Fog Evening_Cloudy_Fog Night_Cloudy_Fog NetherFog_brightness Summer_Leaf_R Summer_Leaf_G Summer_Leaf_B Fall_Leaf_R Fall_Leaf_G Fall_Leaf_B Winter_Leaf_R Winter_Leaf_G Winter_Leaf_B Spring_Leaf_R Spring_Leaf_G Spring_Leaf_B Summer_R Summer_G Summer_B Fall_R Fall_G Fall_B Winter_R Winter_G Winter_B Spring_R Spring_G Spring_B Season_Length CaveFogFallOff CaveFogColor_R CaveFogColor_G CaveFogColor_B indirect_effect GI_Strength ambient_brightness AmbientLight_R AmbientLight_G AmbientLight_B Rain_coverage Moon_temp Haze_amount RainFog_amount ambient_temp Sun_temp Puddle_Size LabSSS_Curve Emissive_Curve Emissive_Brightness AO_Strength BLOOMY_FOG WAVY_SPEED WAVY_STRENGTH BLOOM_STRENGTH shadowDistance shadowDistanceRenderMul FinalR FinalG FinalB Sky_Brightness fog_coefficientMieR fog_coefficientMieG fog_coefficientMieB sun_illuminance sunColorG sunColorB sunColorR sky_mieg sky_coefficientMieB sky_coefficientMieG sky_coefficientMieR sky_coefficientRayleighB sky_coefficientRayleighG sky_coefficientRayleighR CLOUDS_QUALITY EXPOSURE_MULTIPLIER MIN_LIGHT_AMOUNT TORCH_R TORCH_G TORCH_B TORCH_AMOUNT shadowMapResolution sunPathRotation BLEND_FACTOR VL_SAMPLES Exposure_Speed POM_DEPTH MAX_ITERATIONS MAX_DIST SSR_STEPS ambientOcclusionLevel SEA_LEVEL moon_illuminance moonColorR moonColorG moonColorB fog_coefficientRayleighR fog_coefficientRayleighG SATURATION Manual_exposure_value focal aperture MANUAL_FOCUS SHADOW_FILTER_SAMPLE_COUNT Max_Filter_Depth VPS_Search_Samples Min_Shadow_Filter_Radius Max_Shadow_Filter_Radius Water_Top_Layer fog_coefficientRayleighB SHARPENING rayMarchSampleCount Dirt_Amount Dirt_Scatter_R Dirt_Scatter_G Dirt_Scatter_B Dirt_Absorb_R Dirt_Absorb_G Dirt_Absorb_B Water_Absorb_R Water_Absorb_G Water_Absorb_B Purkinje_strength Purkinje_strength Purkinje_R Purkinje_G Purkinje_B Texture_MipMap_Bias DoF_Adaptation_Speed Purkinje_Multiplier CROSSTALK VL_RENDER_RESOLUTION BLOOM_QUALITY VL_RENDER_RESOLUTION RAY_COUNT STEPS STEP_LENGTH cloud_LevelOfDetail cloud_ShadowLevelOfDetail cloud_LevelOfDetailLQ cloud_ShadowLevelOfDetailLQ minRayMarchSteps maxRayMarchSteps minRayMarchStepsLQ maxRayMarchStepsLQ fbmAmount fbmPower1 fbmPower2 Roughness_Threshold Sun_specular_Strength reflection_quality DOF_QUALITY DOF_ANAMORPHIC_RATIO AEROCHROME_PINKNESS DOF_JITTER_FOCUS JITTER_STRENGTH screen.columns=2 -screen = [Direct_Light] [World] [Ambient_light] [Fog] [Post_Processing] [Clouds] [Misc_Settings] [Climate] PhysicsMod_support [LabPBR] +screen = [Direct_Light] [World] \ +[Ambient_light] [Fog] \ +[Post_Processing] [Clouds] \ +[Misc_Settings] [Climate] \ + \ +PhysicsMod_support [LabPBR] # screen = [Direct_Light] [World] # [Ambient_light] [Fog] @@ -169,7 +174,9 @@ screen = [Direct_Light] [World] [Ambient_light] [Fog] [Post_Processing] [Clouds] screen.TAA_OPTIONS= SCREENSHOT_MODE TAA BLEND_FACTOR TAA_UPSCALING SCALE_FACTOR ### DOF screen.DepthOfField.columns = 1 - screen.DepthOfField = DOF_QUALITY DOF_ANAMORPHIC_RATIO AUTOFOCUS focal aperture MANUAL_FOCUS DoF_Adaptation_Speed FAR_BLUR_ONLY + screen.DepthOfField = [JITTER_DOF] DOF_QUALITY DOF_ANAMORPHIC_RATIO AUTOFOCUS focal aperture MANUAL_FOCUS DoF_Adaptation_Speed FAR_BLUR_ONLY + screen.JITTER_DOF.columns=1 + screen.JITTER_DOF = DOF_JITTER DOF_JITTER_SHADOW DOF_JITTER_FOCUS JITTER_STRENGTH DOF_CAMERA_WIDTH FOCUS_LASER_COLOR SCREENSHOT_MODE ### EXPOSURE screen.Exposure.columns = 1 screen.Exposure = AUTO_EXPOSURE EXPOSURE_MULTIPLIER Exposure_Speed Manual_exposure_value diff --git a/shaders/shadow.vsh b/shaders/shadow.vsh index d1bdc17..72e7a62 100644 --- a/shaders/shadow.vsh +++ b/shaders/shadow.vsh @@ -10,6 +10,7 @@ Read the terms of modification and sharing before changing something below pleas */ #include "/lib/settings.glsl" #include "/lib/Shadow_Params.glsl" +#include "/lib/bokeh.glsl" #define SHADOW_MAP_BIAS 0.5 const float PI = 3.1415927; @@ -21,8 +22,12 @@ uniform mat4 shadowModelView; uniform mat4 gbufferModelView; uniform mat4 gbufferModelViewInverse; uniform mat4 gbufferProjection; +uniform mat4 gbufferProjectionInverse; +uniform int hideGUI; uniform vec3 cameraPosition; uniform float frameTimeCounter; +uniform int frameCounter; +uniform float screenBrightness; uniform vec3 sunVec; uniform float aspectRatio; uniform float sunElevation; @@ -94,6 +99,41 @@ void main() { vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz; + // HHHHHHHHH ITS THE JITTER DOF HERE TO SAY HELLO + // It turns out 'position' above is just viewPos lmao + // #ifdef DOF_JITTER_SHADOW + // // CLIP SPACE + // vec2 jitter = clamp(jitter_offsets[frameCounter % 64], -1.0, 1.0); + // jitter = rotate(radians(float(frameCounter))) * jitter; + // jitter.y *= aspectRatio; + // jitter.x *= DOF_ANAMORPHIC_RATIO; + + // vec4 clipPos = gbufferProjection * vec4(position, 1.0); + + // // CLIP SPACE -> VIEW SPACE + // vec3 viewPos = (gbufferProjectionInverse * clipPos).xyz; + + // // Focus distance + // #if DOF_JITTER_FOCUS < 0 + // float focusMul = clipPos.z - mix(pow(512.0, screenBrightness), 512.0 * screenBrightness, 0.25); + // #else + // float focusMul = clipPos.z - DOF_JITTER_FOCUS; + // #endif + + // // CLIP SPACE -> SHADOW CLIP SPACE + // vec3 jitterViewPos = (gbufferProjectionInverse * vec4(jitter, 1.0, 1.0)).xyz; + // // vec3 jitterFeetPos = (gbufferModelViewInverse * vec4(jitterViewPos, 1.0)).xyz; + // // vec3 jitterShadowViewPos = (shadowModelView * vec4(jitterFeetPos, 1.0)).xyz; + // // vec4 jitterShadowClipPos = gl_ProjectionMatrix * vec4(jitterShadowViewPos, 1.0); + + // // vec4 totalOffset = jitterShadowClipPos * JITTER_STRENGTH * focusMul * 1e-2; + + // position += jitterViewPos * focusMul * 1e-2; + // if(focusMul < 10.0) { + // gl_Position = vec4(-1.0); + // return; + // } + // #endif //Check if the vertice is going to cast shadows // #ifdef SHADOW_FRUSTRUM_CULLING