diff --git a/shaders/dimensions/all_solid.fsh b/shaders/dimensions/all_solid.fsh index 84e5ed5..4af221a 100644 --- a/shaders/dimensions/all_solid.fsh +++ b/shaders/dimensions/all_solid.fsh @@ -397,7 +397,7 @@ void main() { //////////////////////////////// //////////////////////////////// vec4 Albedo = texture2D_POMSwitch(texture, adjustedTexCoord.xy, vec4(dcdx,dcdy), ifPOM) * color; - + #if defined HAND if (Albedo.a < 0.1) discard; #endif diff --git a/shaders/dimensions/all_solid.vsh b/shaders/dimensions/all_solid.vsh index ff53820..f0d97a3 100644 --- a/shaders/dimensions/all_solid.vsh +++ b/shaders/dimensions/all_solid.vsh @@ -186,9 +186,9 @@ void main() { gl_Position = ftransform(); + vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz; - /////// ----- COLOR STUFF ----- /////// color = gl_Color; @@ -239,6 +239,7 @@ void main() { #endif NameTags = 0; + #ifdef ENTITIES // disallow POM to work on item frames. diff --git a/shaders/dimensions/all_translucent.fsh b/shaders/dimensions/all_translucent.fsh index 673085e..1d76a6b 100644 --- a/shaders/dimensions/all_translucent.fsh +++ b/shaders/dimensions/all_translucent.fsh @@ -15,6 +15,11 @@ varying vec4 color; flat varying vec4 lightCol; #endif +#ifdef ENTITIES + #undef WATER_BACKGROUND_SPECULAR + #undef SCREENSPACE_REFLECTIONS +#endif + flat varying float HELD_ITEM_BRIGHTNESS; const bool colortex4MipmapEnabled = true; @@ -293,6 +298,8 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) //////////////////////////////// gl_FragData[0] = texture2D(texture, lmtexcoord.xy, Texture_MipMap_Bias) * color; + + vec3 Albedo = toLinear(gl_FragData[0].rgb); float UnchangedAlpha = gl_FragData[0].a; @@ -549,7 +556,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) if(isEyeInWater == 1) SkyReflection = vec3(0.0); #endif #else - #ifdef WATER_BACKGROUND_SPECULAR + #ifdef WATER_BACKGROUND_SPECULAR SkyReflection = skyCloudsFromTexLOD2(mat3(gbufferModelViewInverse) * reflectedVector, colortex4, 0).rgb / 30.0; if(isEyeInWater == 1) SkyReflection = vec3(0.0); #endif @@ -571,16 +578,23 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) float visibilityFactor = clamp(exp2((pow(roughness,3.0) / f0) * -4),0,1); - Reflections_Final = mix(SkyReflection*indoors, Reflections.rgb, Reflections.a); - Reflections_Final = mix(FinalColor, Reflections_Final, fresnel); + #ifdef ENTITIES + Reflections_Final = FinalColor; + #else + Reflections_Final = mix(SkyReflection*indoors, Reflections.rgb, Reflections.a); + Reflections_Final = mix(FinalColor, Reflections_Final, fresnel); + #endif + Reflections_Final += SunReflection; gl_FragData[0].rgb = Reflections_Final; - //correct alpha channel with fresnel - gl_FragData[0].a = mix(gl_FragData[0].a, 1.0, fresnel); - + #ifndef ENTITIES + //correct alpha channel with fresnel + gl_FragData[0].a = mix(gl_FragData[0].a, 1.0, fresnel); + #endif + if (gl_FragData[0].r > 65000.) gl_FragData[0].rgba = vec4(0.); } else { diff --git a/shaders/dimensions/all_translucent.vsh b/shaders/dimensions/all_translucent.vsh index 4d2e25d..dabed44 100644 --- a/shaders/dimensions/all_translucent.vsh +++ b/shaders/dimensions/all_translucent.vsh @@ -105,7 +105,7 @@ void main() { if (mc_Entity.x == 72) mat = 0.5; #ifdef ENTITIES - mat = 0.2; + mat = 0.1; #endif diff --git a/shaders/dimensions/composite1.fsh b/shaders/dimensions/composite1.fsh index df71995..c34f82d 100644 --- a/shaders/dimensions/composite1.fsh +++ b/shaders/dimensions/composite1.fsh @@ -1059,7 +1059,5 @@ void main() { } #endif - // gl_FragData[0].rgb = skyCloudsFromTexLOD2(feetPlayerPos_normalized, colortex12, 6).rgb/30; - /* DRAWBUFFERS:3 */ } \ No newline at end of file diff --git a/shaders/dimensions/composite2.fsh b/shaders/dimensions/composite2.fsh index 9d0bf80..ee3ad06 100644 --- a/shaders/dimensions/composite2.fsh +++ b/shaders/dimensions/composite2.fsh @@ -20,9 +20,9 @@ uniform float sunElevation; uniform int frameCounter; uniform float frameTimeCounter; -varying vec2 texcoord; +// varying vec2 texcoord; uniform vec2 texelSize; -flat varying vec2 TAA_Offset; +// flat varying vec2 TAA_Offset; uniform int isEyeInWater; uniform float rainStrength; @@ -284,7 +284,7 @@ void main() { 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(texcoord - TAA_Offset*texelSize*0.5,z)); + 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); diff --git a/shaders/dimensions/composite3.fsh b/shaders/dimensions/composite3.fsh index 0f142b7..a53509d 100644 --- a/shaders/dimensions/composite3.fsh +++ b/shaders/dimensions/composite3.fsh @@ -179,12 +179,13 @@ 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){ +void ApplyDistortion(inout vec2 Texcoord, vec2 TangentNormals, vec2 depths, 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 ); + Texcoord = abs(Texcoord + (TangentNormals * clamp((ld(depths.x) - ld(depths.y)) * 0.5,0.0,0.15)) * RENDER_SCALE * refractionStrength ); float DistortedAlpha = decodeVec2(texture2D(colortex11,Texcoord).b).g; @@ -222,7 +223,7 @@ void main() { vec4 albedo = vec4(unpack0.ba,unpack1.rg); vec2 tangentNormals = unpack0.xy*2.0-1.0; - if(albedo.a <= 0.0) tangentNormals = vec2(0.0); + if(albedo.a < 0.01) tangentNormals = vec2(0.0); vec4 TranslucentShader = texture2D(colortex2, texcoord); ////// --------------- UNPACK MISC --------------- ////// @@ -230,6 +231,7 @@ void main() { ////// --------------- MASKS/BOOLEANS --------------- ////// bool iswater = trpData > 0.99; + bool isTranslucentEntity = abs(trpData-0.1) < 0.01; float translucentAlpha = trpData; ////// --------------- get volumetrics @@ -239,7 +241,7 @@ void main() { ////// --------------- distort texcoords as a refraction effect vec2 refractedCoord = texcoord; #ifdef Refraction - ApplyDistortion(refractedCoord, tangentNormals, vec2(z2,z)); + ApplyDistortion(refractedCoord, tangentNormals, vec2(z2,z), isTranslucentEntity); #endif ////// --------------- MAIN COLOR BUFFER @@ -367,4 +369,8 @@ void main() { gl_FragData[0].r = vl.a * 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 = clamp(vec3(tangentNormals.xy,0), 0.0,68000.0); } \ No newline at end of file diff --git a/shaders/lib/volumetricClouds.glsl b/shaders/lib/volumetricClouds.glsl index 6a7442c..ad22e97 100644 --- a/shaders/lib/volumetricClouds.glsl +++ b/shaders/lib/volumetricClouds.glsl @@ -184,16 +184,25 @@ float GetCumulusDensity(int layer, in vec3 pos, in int LoD, float minHeight, flo float GetAltostratusDensity(vec3 pos){ - float large = texture2D(noisetex, (pos.xz + cloud_movement)/100000. ).b; - float small = texture2D(noisetex, (pos.xz - cloud_movement)/10000. - vec2(-large,1-large)/5).b; - - float shape = (small + pow((1.0-large),2.0))/2.0; - float Coverage; float Density; DailyWeather_Alto(Coverage, Density); - shape = pow(max(shape + Coverage - 0.5,0.0),2.0); - shape *= Density; + float large = texture2D(noisetex, (pos.xz + cloud_movement)/100000. ).b; + float small = texture2D(noisetex, (pos.xz - cloud_movement)/10000. - vec2(-large,1-large)/5).b; + large = max(large + Coverage - 0.5, 0.0); + // float shape = (small + pow((1.0-large),2.0))/2.0; + float weight = 0.7; + float shape = max( large*weight - small*(1.0-weight) ,0.0); + shape *= shape; + + + + // infinite vertical height will mess with lighting, so get rid of it. + // shape = max(shape - pow(abs(LAYER2_HEIGHT - pos.y)/20,1.5), 0.0); + shape = min(min(shape , clamp((LAYER2_HEIGHT + 15) - pos.y,0,1)), 1.0 - clamp(LAYER2_HEIGHT - pos.y,0,1)); + + + // shape *= Density; return shape; } @@ -295,13 +304,14 @@ if(layer == 2){ float altostratus = GetAltostratusDensity(rayProgress); if(altostratus > 1e-5){ - float muE = altostratus; + float muE = altostratus * cloudDensity; float directLight = 0.0; for (int j = 0; j < 2; j++){ - vec3 shadowSamplePos_high = rayProgress + dV_Sun * (0.1 + j + dither); - float shadow = GetAltostratusDensity(shadowSamplePos_high); - directLight += shadow; /// (1+j); + vec3 shadowSamplePos_high = rayProgress + dV_Sun * (0.1 + j * (0.5 + dither*0.05)) ; + // vec3 shadowSamplePos_high = rayProgress + dV_Sun * (j * (0.5 + dither*0.05)) ; + float shadow = GetAltostratusDensity(shadowSamplePos_high) * cloudDensity; + directLight += shadow; } float skyscatter_alto = sqrt(altostratus*0.05); @@ -343,7 +353,7 @@ if(layer == 2){ #ifdef CloudLayer2 // cast a shadow from higher clouds onto lower clouds vec3 HighAlt_shadowPos = rayProgress + dV_Sun/abs(dV_Sun.y) * max(LAYER2_HEIGHT - rayProgress.y,0.0); - float HighAlt_shadow = GetAltostratusDensity(HighAlt_shadowPos) ; + float HighAlt_shadow = GetAltostratusDensity(HighAlt_shadowPos) * CloudLayer2_density; directLight += HighAlt_shadow; #endif @@ -573,8 +583,8 @@ float GetCloudShadow(vec3 feetPlayerPos){ shadow += GetCumulusDensity(1, higherShadowStart, 0, CloudLayer1_height, CloudLayer1_height+100)*CloudLayer1_density; #endif #ifdef CloudLayer2 - vec3 highShadowStart = playerPos + (WsunVec / max(abs(WsunVec.y),0.2)) * max(CloudLayer1_height - playerPos.y,0.0); - shadow += GetAltostratusDensity(highShadowStart) * 0.5; + vec3 highShadowStart = playerPos + (WsunVec / max(abs(WsunVec.y),0.2)) * max(CloudLayer2_height - playerPos.y,0.0); + shadow += GetAltostratusDensity(highShadowStart) * CloudLayer2_density; #endif shadow = clamp(shadow,0.0,1.0); @@ -604,7 +614,7 @@ float GetCloudShadow_VLFOG(vec3 WorldPos, vec3 WorldSpace_sunVec){ #endif #ifdef CloudLayer2 vec3 highShadowStart = WorldPos + (WorldSpace_sunVec / max(abs(WorldSpace_sunVec.y),0.2)) * max(CloudLayer2_height - WorldPos.y,0.0); - shadow += GetAltostratusDensity(highShadowStart)*0.5; + shadow += GetAltostratusDensity(highShadowStart)*CloudLayer2_density; #endif shadow = clamp(shadow,0.0,1.0); diff --git a/shaders/shaders.properties b/shaders/shaders.properties index 652c3b1..cb5a473 100644 --- a/shaders/shaders.properties +++ b/shaders/shaders.properties @@ -33,6 +33,12 @@ program.composite4.enabled = TAA_UPSCALING # SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE #Get the correct alpha value : S_A*(1-DST_A)+DST_A +program.gbuffers_entities_translucent.enabled = IS_IRIS + +#ifdef IS_IRIS + separateEntityDraws=true + blend.gbuffers_entities_translucent = off +#endif blend.gbuffers_water = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE blend.gbuffers_hand_water = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE @@ -50,7 +56,6 @@ blend.gbuffers_hand = off blend.gbuffers_block = off blend.gbuffers_entities = off blend.gbuffers_beaconbeam = off - blend.gbuffers_water.colortex11 = off blend.composite.colortex12 = off diff --git a/shaders/world-1/gbuffers_entities_translucent.fsh b/shaders/world-1/gbuffers_entities_translucent.fsh new file mode 100644 index 0000000..78b1b61 --- /dev/null +++ b/shaders/world-1/gbuffers_entities_translucent.fsh @@ -0,0 +1,6 @@ +#version 120 + +#define ENTITIES +#define OVERWORLD_SHADER + +#include "/dimensions/all_translucent.fsh" \ No newline at end of file diff --git a/shaders/world-1/gbuffers_entities_translucent.vsh b/shaders/world-1/gbuffers_entities_translucent.vsh new file mode 100644 index 0000000..3e0489a --- /dev/null +++ b/shaders/world-1/gbuffers_entities_translucent.vsh @@ -0,0 +1,6 @@ +#version 120 + +#define ENTITIES +#define OVERWORLD_SHADER + +#include "/dimensions/all_translucent.vsh" \ No newline at end of file diff --git a/shaders/world0/gbuffers_entities_translucent.fsh b/shaders/world0/gbuffers_entities_translucent.fsh new file mode 100644 index 0000000..78b1b61 --- /dev/null +++ b/shaders/world0/gbuffers_entities_translucent.fsh @@ -0,0 +1,6 @@ +#version 120 + +#define ENTITIES +#define OVERWORLD_SHADER + +#include "/dimensions/all_translucent.fsh" \ No newline at end of file diff --git a/shaders/world0/gbuffers_entities_translucent.vsh b/shaders/world0/gbuffers_entities_translucent.vsh new file mode 100644 index 0000000..3e0489a --- /dev/null +++ b/shaders/world0/gbuffers_entities_translucent.vsh @@ -0,0 +1,6 @@ +#version 120 + +#define ENTITIES +#define OVERWORLD_SHADER + +#include "/dimensions/all_translucent.vsh" \ No newline at end of file diff --git a/shaders/world1/gbuffers_entities_translucent.fsh b/shaders/world1/gbuffers_entities_translucent.fsh new file mode 100644 index 0000000..78b1b61 --- /dev/null +++ b/shaders/world1/gbuffers_entities_translucent.fsh @@ -0,0 +1,6 @@ +#version 120 + +#define ENTITIES +#define OVERWORLD_SHADER + +#include "/dimensions/all_translucent.fsh" \ No newline at end of file diff --git a/shaders/world1/gbuffers_entities_translucent.vsh b/shaders/world1/gbuffers_entities_translucent.vsh new file mode 100644 index 0000000..3e0489a --- /dev/null +++ b/shaders/world1/gbuffers_entities_translucent.vsh @@ -0,0 +1,6 @@ +#version 120 + +#define ENTITIES +#define OVERWORLD_SHADER + +#include "/dimensions/all_translucent.vsh" \ No newline at end of file