diff --git a/shaders/lib/common.glsl b/shaders/lib/common.glsl index 154190fb..d9c1f7e3 100644 --- a/shaders/lib/common.glsl +++ b/shaders/lib/common.glsl @@ -60,12 +60,12 @@ const bool colortex12Clear = false; #define WATER_FANCY #define WATER_REFRACTION 1 // [0 1 2] #define WATER_WAVE_TYPE 2 // [0 1 2] -#define WATER_SCALE 16.0 +#define WATER_SCALE 18.0 #define WATER_RADIUS 50 -#define WATER_OCTAVES_NEAR 64 -#define WATER_OCTAVES_FAR 16 +#define WATER_OCTAVES_NEAR 48 +#define WATER_OCTAVES_FAR 24 #define WATER_OCTAVES_VERTEX 8 -#define WATER_PARALLAX_DEPTH 0.03 +#define WATER_PARALLAX_DEPTH 0.02 #define WATER_PARALLAX_SAMPLES 64 #define WATER_WAVE_DEPTH 1.0 #define WATER_RESOLUTION 2048 diff --git a/shaders/lib/lighting/pbr.glsl b/shaders/lib/lighting/pbr.glsl index 88832f8f..da06c9d5 100644 --- a/shaders/lib/lighting/pbr.glsl +++ b/shaders/lib/lighting/pbr.glsl @@ -9,7 +9,7 @@ viewTangent = normalize(gl_NormalMatrix * at_tangent.xyz); tangentW = at_tangent.w; - #ifdef PARALLAX_ENABLED + #if defined PARALLAX_ENABLED || (WATER_WAVE_TYPE == WATER_WAVE_PARALLAX && (defined RENDER_WATER || defined RENDER_HAND_WATER)) vec3 viewBinormal = normalize(cross(viewTangent, viewNormal) * at_tangent.w); mat3 matTBN = mat3(viewTangent, viewBinormal, viewNormal); @@ -215,10 +215,20 @@ // float opaqueShadowDepth = SampleDepth(lightData.shadowPos, vec2(0.0)); // #endif - if ( - lightData.shadowPos.x > 0.0 && lightData.shadowPos.x < 1.0 && - lightData.shadowPos.y > 0.0 && lightData.shadowPos.y < 1.0 - ) { + #if SHADOW_TYPE == SHADOW_TYPE_CASCADED + bool isInBounds = false; + for (int i = 0; i < 4 && !isInBounds; i++) { + isInBounds = + lightData.shadowPos[i].x > 0.0 && lightData.shadowPos[i].x < 1.0 && + lightData.shadowPos[i].y > 0.0 && lightData.shadowPos[i].y < 1.0; + } + #else + bool isInBounds = + lightData.shadowPos.x > 0.0 && lightData.shadowPos.x < 1.0 && + lightData.shadowPos.y > 0.0 && lightData.shadowPos.y < 1.0; + #endif + + if (isInBounds) { if (shadow > EPSILON) shadow *= GetShadowing(lightData); diff --git a/shaders/lib/lighting/pbr_forward.glsl b/shaders/lib/lighting/pbr_forward.glsl index b50909e3..4b8a6be4 100644 --- a/shaders/lib/lighting/pbr_forward.glsl +++ b/shaders/lib/lighting/pbr_forward.glsl @@ -46,7 +46,7 @@ lightData.sunTransmittanceEye = GetSunTransmittance(colortex9, eyeAltitude, skyLightLevels.x);// * sunColor; #endif - #ifdef PARALLAX_ENABLED + #if defined PARALLAX_ENABLED || WATER_WAVE_TYPE == WATER_WAVE_PARALLAX vec3 tanViewDir = normalize(tanViewPos); #endif @@ -124,8 +124,8 @@ float waterScale = WATER_SCALE * rcp(2.0*WATER_RADIUS); vec2 waterWorldPos = waterScale * (localPos.xz + cameraPosition.xz); - vec2 waterWorldPosX = waterWorldPos + vec2(1.0, 0.0)*waterPixelSize; - vec2 waterWorldPosY = waterWorldPos + vec2(0.0, 1.0)*waterPixelSize; + vec2 waterWorldPosX = waterWorldPos + vec2(1.0, 0.0)*0.01; + vec2 waterWorldPosY = waterWorldPos + vec2(0.0, 1.0)*0.01; float skyLight = saturate((lmcoord.y - (0.5/16.0)) / (15.0/16.0)); @@ -134,7 +134,7 @@ depth = GetWaves(waterWorldPos, waveSpeed, octaves); depthX = GetWaves(waterWorldPosX, waveSpeed, octaves); depthY = GetWaves(waterWorldPosY, waveSpeed, octaves); - zScale *= 0.2*WATER_SCALE; + zScale *= 0.04*WATER_SCALE; #if WATER_WAVE_TYPE == WATER_WAVE_PARALLAX } diff --git a/shaders/lib/world/water.glsl b/shaders/lib/world/water.glsl index f37c208b..c4d00fbe 100644 --- a/shaders/lib/world/water.glsl +++ b/shaders/lib/world/water.glsl @@ -31,9 +31,9 @@ float GetWaves(inout vec2 position, const in float waveSpeed, const in int itera accumWeight += waveDX.x * weight; maxWeight += weight; - weight = mix(weight, 0.0, 0.2); + weight = mix(weight, 0.0, 0.18); - iter += 0.9*i;//12.0; + iter += 12.0; phase *= 1.18; speed *= 1.07; } diff --git a/shaders/program/final.fsh b/shaders/program/final.fsh index 2fac1381..bfc7e551 100644 --- a/shaders/program/final.fsh +++ b/shaders/program/final.fsh @@ -154,7 +154,7 @@ out vec3 outColor0; vec2 tileTex = texcoord * (tileMax - tileMin) + tileMin; tileTex = clamp(tileTex, tileMin, tileMax); - bloom += textureLod(BUFFER_BLOOM, tileTex, 0).rgb;// * exp2(i); + bloom += textureLod(BUFFER_BLOOM, tileTex, 0).rgb; } bloom *= (0.01 * BLOOM_STRENGTH); diff --git a/shaders/program/gbuffers_hand_water.fsh b/shaders/program/gbuffers_hand_water.fsh index 8c7db27b..509df984 100644 --- a/shaders/program/gbuffers_hand_water.fsh +++ b/shaders/program/gbuffers_hand_water.fsh @@ -26,7 +26,7 @@ flat in mat2 atlasBounds; flat in float matEmissive; #endif -#ifdef PARALLAX_ENABLED +#if defined PARALLAX_ENABLED || WATER_WAVE_TYPE == WATER_WAVE_PARALLAX in vec2 localCoord; in vec3 tanViewPos; diff --git a/shaders/program/gbuffers_hand_water.vsh b/shaders/program/gbuffers_hand_water.vsh index 70e192cc..e3687511 100644 --- a/shaders/program/gbuffers_hand_water.vsh +++ b/shaders/program/gbuffers_hand_water.vsh @@ -26,7 +26,7 @@ flat out mat2 atlasBounds; flat out float matEmissive; #endif -#ifdef PARALLAX_ENABLED +#if defined PARALLAX_ENABLED || WATER_WAVE_TYPE == WATER_WAVE_PARALLAX out vec2 localCoord; out vec3 tanViewPos; @@ -90,7 +90,7 @@ in vec3 vaPosition; in vec4 at_tangent; in vec3 at_midBlock; -#if defined PARALLAX_ENABLED || defined AF_ENABLED +#if defined PARALLAX_ENABLED || WATER_WAVE_TYPE == WATER_WAVE_PARALLAX || defined AF_ENABLED in vec4 mc_midTexCoord; #endif diff --git a/shaders/program/gbuffers_water.fsh b/shaders/program/gbuffers_water.fsh index ac5abf7f..ad1a4779 100644 --- a/shaders/program/gbuffers_water.fsh +++ b/shaders/program/gbuffers_water.fsh @@ -26,7 +26,7 @@ flat in mat2 atlasBounds; flat in float matEmissive; #endif -#ifdef PARALLAX_ENABLED +#if defined PARALLAX_ENABLED || WATER_WAVE_TYPE == WATER_WAVE_PARALLAX in vec2 localCoord; in vec3 tanViewPos; diff --git a/shaders/program/gbuffers_water.vsh b/shaders/program/gbuffers_water.vsh index 35e5e0e4..ff922ee4 100644 --- a/shaders/program/gbuffers_water.vsh +++ b/shaders/program/gbuffers_water.vsh @@ -26,7 +26,7 @@ flat out mat2 atlasBounds; flat out float matEmissive; #endif -#ifdef PARALLAX_ENABLED +#if defined PARALLAX_ENABLED || WATER_WAVE_TYPE == WATER_WAVE_PARALLAX out vec2 localCoord; out vec3 tanViewPos; @@ -90,7 +90,7 @@ in vec3 vaPosition; in vec4 at_tangent; in vec3 at_midBlock; -#if defined PARALLAX_ENABLED || defined AF_ENABLED +#if defined PARALLAX_ENABLED || WATER_WAVE_TYPE == WATER_WAVE_PARALLAX || defined AF_ENABLED in vec4 mc_midTexCoord; #endif