diff --git a/README.md b/README.md index 368034d..97357b5 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,9 @@ Notable changes/additions compared to Bliss unstable: + Better shader-side (hardcoded) emissives + Lightsource with shadows on the main end island + Better lightning strikes with clouds lighting up and shadows - + Voxy, Colorwheel, Caelum (Arda Craft) support - + Emissive Ores + + Colorwheel, Caelum (Arda Craft) support + + 1.21.11 Chunk Fade In and Texture Filtering support + + Emissive Ores and Trims Note: With default settings there is at least one guaranteed eclipse per ingame year. @@ -73,6 +74,6 @@ Note: With default settings there is at least one guaranteed eclipse per ingame - once the zip file finishes downloading, install it like a normal shader. you do NOT need to unzip/extract/decompress. # You want MOAR performance? - Delete the gbuffers_terrain.tcs and gbuffers_terrain.tes files for all world folders in the shaders. + Delete the "gbuffers_terrain.tcs" and "gbuffers_terrain.tes" files for all world folders in the shader. This will make the shader grass setting non functional BUT will increase performance, especially with high vanilla render distances! (If you're wondering why, Iris does NOT allow me to disable these files once they're there. So even when Shader Grass is disabled these execute and harm performance!) diff --git a/shaders/dimensions/DH_generic.fsh b/shaders/dimensions/DH_generic.fsh index cac59ca..4077911 100644 --- a/shaders/dimensions/DH_generic.fsh +++ b/shaders/dimensions/DH_generic.fsh @@ -1,7 +1,9 @@ #include "/lib/settings.glsl" -varying vec4 pos; -varying vec4 gcolor; +in DATA { + vec4 pos; + vec4 gcolor; +}; uniform vec2 texelSize; uniform vec3 cameraPosition; @@ -39,7 +41,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) float maxOverdrawDistance = OVERDRAW_MAX_DISTANCE; #endif - if(length(playerPos) < clamp(far-16*4, 16, maxOverdrawDistance) || texelFetch2D(depthtex1, ivec2(gl_FragCoord.xy), 0).x < 1.0){ discard; return;} + if(length(playerPos) < clamp(far-16*4, 16, maxOverdrawDistance) || texelFetch(depthtex1, ivec2(gl_FragCoord.xy), 0).x < 1.0){ discard; return;} #endif diff --git a/shaders/dimensions/DH_generic.vsh b/shaders/dimensions/DH_generic.vsh index 2303289..86e028d 100644 --- a/shaders/dimensions/DH_generic.vsh +++ b/shaders/dimensions/DH_generic.vsh @@ -1,8 +1,10 @@ #include "/lib/settings.glsl" #include "/lib/res_params.glsl" -varying vec4 pos; -varying vec4 gcolor; +out DATA { + vec4 pos; + vec4 gcolor; +}; uniform vec2 texelSize; uniform int framemod8; diff --git a/shaders/dimensions/DH_solid.fsh b/shaders/dimensions/DH_solid.fsh index 8bc5dc7..327105d 100644 --- a/shaders/dimensions/DH_solid.fsh +++ b/shaders/dimensions/DH_solid.fsh @@ -1,15 +1,15 @@ #include "/lib/settings.glsl" - -varying vec4 pos; -varying vec4 localPos; -varying vec4 vPos; -varying vec4 gcolor; -varying vec2 lightmapCoords; -varying vec4 normals_and_materials; -flat varying float SSSAMOUNT; -flat varying float EMISSIVE; -flat varying int dh_material_id; +in DATA { + vec4 localPos; + vec4 vPos; + vec4 gcolor; + vec2 lightmapCoords; + vec4 normalMat; + flat float SSSAMOUNT; + flat float EMISSIVE; + flat int dh_material_id; +}; uniform float far; uniform float nightVision; @@ -69,7 +69,7 @@ uniform sampler2D noisetex; uniform int frameCounter; uniform float frameTimeCounter; float blueNoise(){ - return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter); + return fract(texelFetch(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 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); @@ -96,7 +96,7 @@ float densityAtPos(in vec3 pos){ vec2 coord = uv / 512.0; //The y channel has an offset to avoid using two textures fetches - vec2 xy = texture2D(noisetex, coord).yx; + vec2 xy = texture(noisetex, coord).yx; return mix(xy.r,xy.g, f.y); } @@ -181,8 +181,8 @@ void main() { } #endif - vec3 normals = (normals_and_materials.xyz); - float materials = normals_and_materials.a; + vec3 normals = (normalMat.xyz); + float materials = normalMat.a; vec2 PackLightmaps = lightmapCoords; // PackLightmaps.y *= 1.05; diff --git a/shaders/dimensions/DH_solid.vsh b/shaders/dimensions/DH_solid.vsh index 03eb47f..6dda51f 100644 --- a/shaders/dimensions/DH_solid.vsh +++ b/shaders/dimensions/DH_solid.vsh @@ -1,15 +1,17 @@ #include "/lib/settings.glsl" #include "/lib/res_params.glsl" -varying vec4 pos; -varying vec4 localPos; -varying vec4 vPos; -varying vec4 gcolor; -varying vec2 lightmapCoords; -varying vec4 normals_and_materials; -flat varying float SSSAMOUNT; -flat varying float EMISSIVE; -flat varying int dh_material_id; +out DATA { + vec4 localPos; + vec4 vPos; + vec4 gcolor; + vec2 lightmapCoords; + vec4 normalMat; + flat float SSSAMOUNT; + flat float EMISSIVE; + flat int dh_material_id; +}; + uniform float nightVision; uniform vec2 texelSize; @@ -109,7 +111,7 @@ void main() { // a mask for DH terrain in general. float MATERIALS = 0.65; - normals_and_materials = vec4(normalize(gl_NormalMatrix * gl_Normal), MATERIALS); + normalMat = vec4(normalize(gl_NormalMatrix * gl_Normal), MATERIALS); dh_material_id = dhMaterialId; #if defined Seasons && defined OVERWORLD_SHADER diff --git a/shaders/dimensions/DH_translucent.fsh b/shaders/dimensions/DH_translucent.fsh index ba7f45b..40e5672 100644 --- a/shaders/dimensions/DH_translucent.fsh +++ b/shaders/dimensions/DH_translucent.fsh @@ -36,14 +36,20 @@ uniform sampler2D colortex5; #include "/lib/waterBump.glsl" #include "/lib/Shadow_Params.glsl" -varying vec4 pos; -varying vec4 gcolor; +in DATA { + vec4 pos; + vec4 gcolor; + + vec4 normalMat; + vec2 lightmapCoords; + flat int isWater; -varying vec4 normals_and_materials; + mat4 normalmatrix; -varying vec2 lightmapCoords; + flat vec3 WsunVec; + flat vec3 WsunVec2; +}; -flat varying int isWater; // uniform float far; uniform float dhVoxyFarPlane; @@ -66,8 +72,6 @@ uniform int frameCounter; // uniform sampler2D colortex4; -flat varying vec3 WsunVec; -flat varying vec3 WsunVec2; @@ -197,10 +201,10 @@ vec3 rayTrace(vec3 dir, vec3 position, float dither, float fresnel) { #endif #ifdef QUARTER_RES_SSR - float sampleDepth = sqrt(texelFetch2D(colortex12, ivec2(spos.xy / (texelSize * 4.0)), 0).a / 65000.0); + float sampleDepth = sqrt(texelFetch(colortex12, ivec2(spos.xy / (texelSize * 4.0)), 0).a / 65000.0); float sp = DH_inv_ld(sampleDepth); #else - float sp = texelFetch2D(dhDepthTex, ivec2(spos.xy /texelSize), 0).r; + float sp = texelFetch(dhDepthTex, ivec2(spos.xy /texelSize), 0).r; #endif if (sp < max(minZ, maxZ) && sp > min(minZ, maxZ)) { @@ -302,7 +306,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) float material = 0.7; if(iswater) material = 1.0; - vec3 normals = normalize(normals_and_materials.xyz); + vec3 normals = normalize(normalMat.xyz); if (!gl_FrontFacing) normals = -normals; vec3 worldSpaceNormals = mat3(gbufferModelViewInverse) * normals; @@ -320,7 +324,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) vec3 waterNormals = worldSpaceNormals; - #ifndef Vanilla_like_water + #ifndef VANILLA_LIKE_WATER if(iswater && abs(worldSpaceNormals.y) > 0.1){ vec3 waterPos = (playerPos+cameraPosition).xzy; @@ -348,7 +352,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) vec3 Albedo = toLinear(gl_FragData[0].rgb); #ifndef WhiteWorld - #ifdef Vanilla_like_water + #ifdef VANILLA_LIKE_WATER if (iswater) Albedo *= sqrt(luma(Albedo)); #else if (iswater){ @@ -393,7 +397,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) Shadows = 0.0; projectedShadowPosition = projectedShadowPosition * vec3(0.5,0.5,0.5/6.0) + vec3(0.5); - Shadows = shadow2D(shadow, projectedShadowPosition + vec3(0.0,0.0, smallbias)).x; + Shadows = texture(shadow, projectedShadowPosition + vec3(0.0,0.0, smallbias)).x; } #endif @@ -449,7 +453,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) previousPosition.xy = projMAD(dhPreviousProjection, previousPosition).xy / -previousPosition.z * 0.5 + 0.5; if (previousPosition.x > 0.0 && previousPosition.y > 0.0 && previousPosition.x < 1.0 && previousPosition.y < 1.0) { Reflections.a = 1.0; - Reflections.rgb = texture2D(colortex5, previousPosition.xy).rgb; + Reflections.rgb = texture(colortex5, previousPosition.xy).rgb; } }else{ if (rtPos.x > 0.0 && rtPos.y > 0.0 && rtPos.x < 1.0 && rtPos.y < 1.0) SSR_HIT_SKY_MASK = 1.0; @@ -479,7 +483,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) #ifdef DH_OVERDRAW_PREVENTION float distancefade = min(max(1.0 - viewDist/clamp(far-16*4, 16, maxOverdrawDistance),0.0)*5,1.0); - if(texelFetch2D(depthtex0, ivec2(gl_FragCoord.xy), 0).x < 1.0 || distancefade > 0.0){ + if(texelFetch(depthtex0, ivec2(gl_FragCoord.xy), 0).x < 1.0 || distancefade > 0.0){ gl_FragData[0].a = 0.0; material = 0.0; } diff --git a/shaders/dimensions/DH_translucent.vsh b/shaders/dimensions/DH_translucent.vsh index 66da9cc..12b8ea7 100644 --- a/shaders/dimensions/DH_translucent.vsh +++ b/shaders/dimensions/DH_translucent.vsh @@ -3,13 +3,19 @@ #include "/lib/SSBOs.glsl" -varying vec4 pos; -varying vec4 gcolor; - -varying vec4 normals_and_materials; -varying vec2 lightmapCoords; -flat varying int isWater; +out DATA { + vec4 pos; + vec4 gcolor; + + vec4 normalMat; + vec2 lightmapCoords; + flat int isWater; + mat4 normalmatrix; + + flat vec3 WsunVec; + flat vec3 WsunVec2; +}; uniform sampler2D colortex4; @@ -17,13 +23,9 @@ uniform sampler2D colortex4; #include "/lib/scene_controller.glsl" #endif -varying mat4 normalmatrix; - uniform mat4 gbufferModelViewInverse; uniform mat4 gbufferModelView; -flat varying vec3 WsunVec; -flat varying vec3 WsunVec2; uniform mat4 dhProjection; uniform vec3 sunPosition; uniform float sunElevation; @@ -90,7 +92,7 @@ void main() { // gl_Position = toClipSpace3(position); - normals_and_materials = vec4(mat3(gbufferModelView) * gl_Normal, 1.0); + normalMat = vec4(mat3(gbufferModelView) * gl_Normal, 1.0); gcolor = gl_Color; lightmapCoords = gl_MultiTexCoord1.xy; diff --git a/shaders/dimensions/all_particles.fsh b/shaders/dimensions/all_particles.fsh index 4ffda73..ba57a21 100644 --- a/shaders/dimensions/all_particles.fsh +++ b/shaders/dimensions/all_particles.fsh @@ -22,12 +22,22 @@ #include "/lib/res_params.glsl" -varying vec4 lmtexcoord; -varying vec4 color; +in DATA { + vec4 lmtexcoord; + vec4 color; -#ifdef LINES - flat varying int SELECTION_BOX; -#endif + #if defined DAMAGE_BLOCK_EFFECT && defined POM + vec4 tangent; + vec3 normalMat; + + vec4 texcoordam; // .st for add, .pq for mul + vec2 texcoord; + #endif + + #ifdef OVERWORLD_SHADER + flat vec3 WsunVec; + #endif +}; #ifdef OVERWORLD_SHADER const bool shadowHardwareFiltering = true; @@ -38,8 +48,6 @@ varying vec4 color; uniform sampler2DShadow shadowtex0; uniform sampler2DShadow shadowtex1; #endif - - flat varying vec3 WsunVec; #endif uniform int renderStage; @@ -96,9 +104,7 @@ uniform vec3 relativeEyePosition; #include "/lib/volumetricClouds.glsl" #endif -#if defined IS_LPV_ENABLED || (defined DISTANT_HORIZONS && DH_CHUNK_FADING > 0) - uniform int frameCounter; -#endif +uniform int frameCounter; uniform int heldItemId; uniform int heldItemId2; @@ -134,6 +140,15 @@ uniform int framemod8; #include "/lib/TAA_jitter.glsl" +#ifdef TAA + float blueNoise() { + return fract(texelFetch(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter); + } +#else + float blueNoise() { + return fract(texelFetch(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887); + } +#endif //Mie phase function float phaseg(float x, float g){ @@ -184,14 +199,14 @@ float ComputeShadowMap(inout vec3 directLightColor, vec3 playerPos, float maxDis #ifdef TRANSLUCENT_COLORED_SHADOWS // determine when opaque shadows are overlapping translucent shadows by getting the difference of opaque depth and translucent depth - float shadowDepthDiff = pow(clamp((shadow2D(shadowtex1, projectedShadowPosition).x - projectedShadowPosition.z) * 2.0,0.0,1.0),2.0); + float shadowDepthDiff = pow(clamp((texture(shadowtex1, projectedShadowPosition).x - projectedShadowPosition.z) * 2.0,0.0,1.0),2.0); // get opaque shadow data to get opaque data from translucent shadows. - float opaqueShadow = shadow2D(shadowtex0, projectedShadowPosition).x; + float opaqueShadow = texture(shadowtex0, projectedShadowPosition).x; shadowmap += max(opaqueShadow, shadowDepthDiff); // get translucent shadow data - vec4 translucentShadow = texture2D(shadowcolor0, projectedShadowPosition.xy); + vec4 translucentShadow = texture(shadowcolor0, projectedShadowPosition.xy); // this curve simply looked the nicest. it has no other meaning. float shadowAlpha = pow(1.0 - pow(translucentShadow.a,5.0),0.2); @@ -204,7 +219,7 @@ float ComputeShadowMap(inout vec3 directLightColor, vec3 playerPos, float maxDis translucentTint += mix(translucentShadow.rgb, vec3(1.0), opaqueShadow*shadowDepthDiff); #else - shadowmap += shadow2D(shadow, projectedShadowPosition).x; + shadowmap += texture(shadow, projectedShadowPosition).x; #endif #ifdef TRANSLUCENT_COLORED_SHADOWS @@ -237,11 +252,8 @@ float ComputeShadowMap(inout vec3 directLightColor, vec3 playerPos, float maxDis const float MIX_OCCLUSION_DISTANCE = MAX_DIST*0.9; const int MAX_OCCLUSION_POINTS = MAX_ITERATIONS; - varying vec4 vtexcoordam; // .st for add, .pq for mul - varying vec2 vtexcoord; - - vec2 dcdx = dFdx(vtexcoord.st*vtexcoordam.pq); - vec2 dcdy = dFdy(vtexcoord.st*vtexcoordam.pq); + vec2 dcdx = dFdx(texcoord.st*texcoordam.pq); + vec2 dcdy = dFdy(texcoord.st*texcoordam.pq); #define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z) #define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz) @@ -250,23 +262,17 @@ float ComputeShadowMap(inout vec3 directLightColor, vec3 playerPos, float maxDis const float maxcoord = 1.0-mincoord; uniform sampler2D normals; - varying vec4 tangent; - varying vec4 normalMat; vec4 readNormal(in vec2 coord) { - return texture2DGradARB(normals,fract(coord)*vtexcoordam.pq+vtexcoordam.st,dcdx,dcdy); + return textureGrad(normals,fract(coord)*texcoordam.pq+texcoordam.st,dcdx,dcdy); } vec4 readTexture(in vec2 coord) { - return texture2DGradARB(gtexture,fract(coord)*vtexcoordam.pq+vtexcoordam.st,dcdx,dcdy); + return textureGrad(gtexture,fract(coord)*texcoordam.pq+texcoordam.st,dcdx,dcdy); } - vec4 texture2D_POMSwitch( - sampler2D sampler, - vec2 lightmapCoord, - vec4 dcdxdcdy - ){ - return texture2DGradARB(sampler, lightmapCoord, dcdxdcdy.xy, dcdxdcdy.zw); + vec4 texture_POMSwitch(sampler2D sampler, vec2 lightmapCoord, vec4 dcdxdcdy){ + return textureGrad(sampler, lightmapCoord, dcdxdcdy.xy, dcdxdcdy.zw); } #endif @@ -316,13 +322,13 @@ void main() { // vec3 worldpos = mat3(gbufferModelViewInverse) * fragpos + gbufferModelViewInverse[3].xyz + cameraPosition; - vec3 normal = normalMat.xyz; + vec3 normal = normalMat; vec3 tangent2 = normalize(cross(tangent.rgb,normal)*tangent.w); mat3 tbnMatrix = mat3(tangent.x, tangent2.x, normal.x, tangent.y, tangent2.y, normal.y, tangent.z, tangent2.z, normal.z); - adjustedTexCoord = fract(vtexcoord.st)*vtexcoordam.pq+vtexcoordam.st; + adjustedTexCoord = fract(texcoord.st)*texcoordam.pq+texcoordam.st; vec3 viewVector = normalize(tbnMatrix*fragpos); float dist = length(fragpos); @@ -330,7 +336,7 @@ void main() { float maxdist = MAX_OCCLUSION_DISTANCE; if (dist < maxdist) { - float depthmap = readNormal(vtexcoord.st).a; + float depthmap = readNormal(texcoord.st).a; float used_POM_DEPTH = 1.0; if ( viewVector.z < 0.0 && depthmap < 0.9999 && depthmap > 0.00001) { @@ -341,12 +347,12 @@ void main() { #else vec3 interval = viewVector.xyz/-viewVector.z/ MAX_OCCLUSION_POINTS*POM_DEPTH; #endif - vec3 coord = vec3(vtexcoord.st, 1.0); + vec3 coord = vec3(texcoord.st, 1.0); coord += interval * used_POM_DEPTH; float sumVec = 0.5; - for (int loopCount = 0; (loopCount < MAX_OCCLUSION_POINTS) && (1.0 - POM_DEPTH + POM_DEPTH * readNormal(coord.st).a ) < coord.p && coord.p >= 0.0; ++loopCount) { + for (int loopCount = 0; (loopCount < MAX_OCCLUSION_POINTS) && (1.0 - POM_DEPTH + POM_DEPTH * readNormal(coord.st).a ) < coord.p && coord.p >= 0.0; ++loopCount) { coord = coord + interval * used_POM_DEPTH; sumVec += used_POM_DEPTH; } @@ -358,13 +364,13 @@ void main() { } } - adjustedTexCoord = mix(fract(coord.st)*vtexcoordam.pq+vtexcoordam.st, adjustedTexCoord, max(dist-MIX_OCCLUSION_DISTANCE,0.0)/(MAX_OCCLUSION_DISTANCE-MIX_OCCLUSION_DISTANCE)); + adjustedTexCoord = mix(fract(coord.st)*texcoordam.pq+texcoordam.st, adjustedTexCoord, max(dist-MIX_OCCLUSION_DISTANCE,0.0)/(MAX_OCCLUSION_DISTANCE-MIX_OCCLUSION_DISTANCE)); } } - vec4 Albedo = texture2D_POMSwitch(gtexture, adjustedTexCoord.xy, vec4(dcdx,dcdy)); + vec4 Albedo = texture_POMSwitch(gtexture, adjustedTexCoord.xy, vec4(dcdx,dcdy)); #else - vec4 Albedo = texture2D(gtexture, adjustedTexCoord.xy); + vec4 Albedo = texture(gtexture, adjustedTexCoord.xy); #endif #ifdef COLORWHEEL @@ -387,12 +393,15 @@ void main() { #endif #if !defined DAMAGE_BLOCK_EFFECT + #ifdef LINES + bool selectionBox = renderStage == MC_RENDER_STAGE_OUTLINE; + #endif gl_FragData[2] = vec4(0.0); #ifdef LINES #ifndef SELECT_BOX - if(SELECTION_BOX > 0) discard; + if(selectionBox) discard; #endif #endif @@ -401,7 +410,7 @@ void main() { vec3 feetPlayerPos = mat3(gbufferModelViewInverse) * viewPos; // vec3 feetPlayerPos_normalized = normalize(feetPlayerPos); - vec4 TEXTURE = texture2D(gtexture, lmtexcoord.xy)*color; + vec4 TEXTURE = texture(gtexture, lmtexcoord.xy)*color; #ifdef WhiteWorld TEXTURE.rgb = vec3(0.5); @@ -556,9 +565,9 @@ void main() { #endif vec3 selectBoxColor = HsvToRgb(vec3(selectBoxHue, 1.0, 1.0)); - if(SELECTION_BOX > 0) gl_FragData[0].rgba = vec4(toLinear(selectBoxColor), 1.0); + if(selectionBox) gl_FragData[0] = vec4(toLinear(selectBoxColor), 1.0); #else - if(SELECTION_BOX > 0) gl_FragData[0].rgba = vec4(toLinear(vec3(SELECT_BOX_COL_R, SELECT_BOX_COL_G, SELECT_BOX_COL_B)), 1.0); + if(selectionBox) gl_FragData[0] = vec4(toLinear(vec3(SELECT_BOX_COL_R, SELECT_BOX_COL_G, SELECT_BOX_COL_B)), 1.0); #endif // float LITEMATICA_SCHEMATIC_THING_MASK = 0.0; @@ -569,16 +578,23 @@ void main() { // gl_FragData[2] = vec4(encodeVec2(vec2(0.0)), encodeVec2(vec2(0.0)), encodeVec2(vec2(0.0)), encodeVec2(0.0, LITEMATICA_SCHEMATIC_THING_MASK)); - if (length(viewPos-normalize(sunPosition)*viewDist) < 0.03*viewDist && SELECTION_BOX > 0) discard; // dirty fix for sun shining through selection box + // if (length(viewPos-normalize(sunPosition)*viewDist) < 0.03*viewDist && selectionBox) discard; // dirty fix for sun shining through selection box #else gl_FragData[0].rgb = (Indirect_lighting + Direct_lighting) * Albedo; #endif - // distance fade targeting the world border... - if(TEXTURE.a < 0.7 && TEXTURE.a > 0.2) gl_FragData[0] *= clamp(1.0 - length(feetPlayerPos) / 100.0 ,0.0,1.0); + #if defined PARTICLES && !defined LIT + if(TEXTURE.a > 0.0 && renderStage == MC_RENDER_STAGE_WORLD_BORDER) { + float BN = blueNoise(); - gl_FragData[0].rgb *= 0.1; - + // distance fade targeting the world border... + float distaneFade = clamp(2.5 - length(feetPlayerPos) / (0.1*min(far, 225.0)),0.0,1.0); + + if(distaneFade < BN) discard; + } + #endif + + gl_FragData[0].rgb *= 0.1; #if defined DISTANT_HORIZONS && DH_CHUNK_FADING > 0 float ditherFade = smoothstep(0.98*far, 1.0*far, viewDist); diff --git a/shaders/dimensions/all_particles.vsh b/shaders/dimensions/all_particles.vsh index 7cd0829..9aba05d 100644 --- a/shaders/dimensions/all_particles.vsh +++ b/shaders/dimensions/all_particles.vsh @@ -9,22 +9,28 @@ Read the terms of modification and sharing before changing something below pleas !! DO NOT REMOVE !! */ -varying vec4 lmtexcoord; -varying vec4 color; +out DATA { + vec4 lmtexcoord; + vec4 color; + + #if defined DAMAGE_BLOCK_EFFECT && defined POM + vec4 tangent; + vec3 normalMat; + + vec4 texcoordam; // .st for add, .pq for mul + vec2 texcoord; + #endif + + #ifdef OVERWORLD_SHADER + flat vec3 WsunVec; + #endif +}; + uniform sampler2D colortex4; -// flat varying float exposure; - -#ifdef LINES - flat varying int SELECTION_BOX; -#endif - #ifdef OVERWORLD_SHADER - flat varying vec3 WsunVec; - #include "/lib/scene_controller.glsl" #endif - uniform vec3 sunPosition; uniform float sunElevation; @@ -46,19 +52,11 @@ uniform int heldItemId2; #define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz) vec4 toClipSpace3(vec3 viewSpacePosition) { return vec4(projMAD(gl_ProjectionMatrix, viewSpacePosition),-viewSpacePosition.z); -} - - - +} #if defined DAMAGE_BLOCK_EFFECT && defined POM - varying vec4 vtexcoordam; // .st for add, .pq for mul - varying vec2 vtexcoord; - - attribute vec4 mc_midTexCoord; - varying vec4 tangent; - attribute vec4 at_tangent; - varying vec4 normalMat; + in vec4 mc_midTexCoord; + in vec4 at_tangent; #endif //////////////////////////////VOID MAIN////////////////////////////// @@ -69,20 +67,22 @@ vec4 toClipSpace3(vec3 viewSpacePosition) { void main() { - lmtexcoord.xy = (gl_MultiTexCoord0).xy; + color = gl_Color; + + lmtexcoord.xy = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; vec2 lmcoord = gl_MultiTexCoord1.xy / 240.0; lmtexcoord.zw = lmcoord; #if defined DAMAGE_BLOCK_EFFECT && defined POM vec2 midcoord = (gl_TextureMatrix[0] * mc_midTexCoord).st; vec2 texcoordminusmid = lmtexcoord.xy-midcoord; - vtexcoordam.pq = abs(texcoordminusmid)*2; - vtexcoordam.st = min(lmtexcoord.xy,midcoord-texcoordminusmid); - vtexcoord.xy = sign(texcoordminusmid)*0.5+0.5; + texcoordam.pq = abs(texcoordminusmid)*2; + texcoordam.st = min(lmtexcoord.xy,midcoord-texcoordminusmid); + texcoord.xy = sign(texcoordminusmid)*0.5+0.5; tangent = vec4(normalize(gl_NormalMatrix * at_tangent.rgb), at_tangent.w); - normalMat = vec4(normalize(gl_NormalMatrix * gl_Normal), 1.0); + normalMat = normalize(gl_NormalMatrix * gl_Normal); #endif @@ -109,17 +109,6 @@ void main() { #else gl_Position = ftransform(); #endif - - - color = gl_Color; - - // exposure = texelFetch2D(colortex4,ivec2(10,37),0).r; - // color.rgb = worldpos; - - #ifdef LINES - SELECTION_BOX = 0; - if(dot(color.rgb,vec3(0.33333)) < 0.00001) SELECTION_BOX = 1; - #endif #ifdef OVERWORLD_SHADER #ifdef SMOOTH_SUN_ROTATION diff --git a/shaders/dimensions/all_solid.fsh b/shaders/dimensions/all_solid.fsh index 78afaf2..bf00624 100644 --- a/shaders/dimensions/all_solid.fsh +++ b/shaders/dimensions/all_solid.fsh @@ -35,7 +35,7 @@ in DATA { vec4 lmtexcoord; vec3 normalMat; - #if (defined POM && (defined WORLD && !defined ENTITIES && !defined HAND || defined COLORWHEEL)) || (!defined BLOCKENTITIES && !defined ENTITIES && !defined HAND && defined SHADER_GRASS && !defined COLORWHEEL && defined WORLD) + #if (defined POM && (defined WORLD && !defined ENTITIES && !defined HAND || defined COLORWHEEL)) || (!defined BLOCKENTITIES && !defined ENTITIES && !defined HAND && defined SHADER_GRASS && !defined COLORWHEEL && defined WORLD && !defined CUTOUT) vec4 texcoordam; // .st for add, .pq for mul #endif @@ -142,11 +142,11 @@ float R2_dither(){ #ifdef TAA float blueNoise() { - return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter); + return fract(texelFetch(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter); } #else float blueNoise() { - return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887); + return fract(texelFetch(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887); } #endif @@ -224,11 +224,11 @@ vec3 toClipSpace3(vec3 viewSpacePosition) { #if defined POM && (defined WORLD && !defined ENTITIES && !defined HAND || defined COLORWHEEL) vec4 readNormal(in vec2 coord) { - return texture2DGradARB(normals,fract(coord)*data_in.texcoordam.pq+data_in.texcoordam.st,dcdx,dcdy); + return textureGrad(normals,fract(coord)*data_in.texcoordam.pq+data_in.texcoordam.st,dcdx,dcdy); } vec4 readTexture(in vec2 coord) { - return texture2DGradARB(gtexture,fract(coord)*data_in.texcoordam.pq+data_in.texcoordam.st,dcdx,dcdy); + return textureGrad(gtexture,fract(coord)*data_in.texcoordam.pq+data_in.texcoordam.st,dcdx,dcdy); } #endif @@ -262,8 +262,8 @@ float ld(float dist) { // vec4 readNoise(in vec2 coord){ -// // return texture2D(noisetex,coord*texcoordam.pq+texcoord); -// return texture2DGradARB(noisetex,coord*texcoordam.pq + texcoordam.st,dcdx,dcdy); +// // return texture(noisetex,coord*texcoordam.pq+texcoord); +// return textureGradARB(noisetex,coord*texcoordam.pq + texcoordam.st,dcdx,dcdy); // } // float EndPortalEffect( // inout vec4 ALBEDO, @@ -303,7 +303,7 @@ float bias(){ return 1.0 - texelSize.x * 2560.0; #endif } -vec4 texture2D_POMSwitch( +vec4 texture_POMSwitch( sampler2D sampler, vec2 lightmapCoord, vec4 dcdxdcdy, @@ -312,11 +312,11 @@ vec4 texture2D_POMSwitch( ){ #if defined POM && (defined WORLD && !defined ENTITIES && !defined HAND || defined COLORWHEEL) if(ifPOM){ - return texture2DGradARB(sampler, lightmapCoord, dcdxdcdy.xy, dcdxdcdy.zw); + return textureGrad(sampler, lightmapCoord, dcdxdcdy.xy, dcdxdcdy.zw); }else #endif { - return texture2D(sampler, lightmapCoord, LOD); + return texture(sampler, lightmapCoord, LOD); } } @@ -337,13 +337,21 @@ float getTrimEmission(vec3 Albedo) { return sqrt(hsv.z); } +uniform float alphaTestRef; + //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// +layout(location = 0) out vec4 OutAlbedo; +layout(location = 1) out vec4 OutSpecular; +layout(location = 2) out vec4 OutNormalAO; + #if defined HAND || defined ENTITIES || defined BLOCKENTITIES + layout(location = 3) out vec4 OutTranslucents; + /* RENDERTARGETS:1,8,15,2 */ #else /* RENDERTARGETS:1,8,15 */ @@ -362,7 +370,7 @@ void main() { bool ifPOM = false; #endif - #if !defined BLOCKENTITIES && !defined ENTITIES && !defined HAND && defined SHADER_GRASS && !defined COLORWHEEL && defined WORLD + #if !defined BLOCKENTITIES && !defined ENTITIES && !defined HAND && defined SHADER_GRASS && !defined COLORWHEEL && defined WORLD && !defined CUTOUT bool ShaderGrass = data_in.blockID == -15; if(ShaderGrass) ifPOM = false; #else @@ -426,7 +434,7 @@ void main() { gl_FragDepth = gl_FragCoord.z; #endif - #if !defined BLOCKENTITIES && !defined ENTITIES && !defined HAND && defined SHADER_GRASS && !defined COLORWHEEL && defined WORLD + #if !defined BLOCKENTITIES && !defined ENTITIES && !defined HAND && defined SHADER_GRASS && !defined COLORWHEEL && defined WORLD && !defined CUTOUT if (falloff > 0.0 && !ShaderGrass) #else if (falloff > 0.0) @@ -484,7 +492,7 @@ void main() { float opaqueMasks = 1.0; #ifndef HAND - #ifdef WORLD + #if defined WORLD && !defined ENTITIES if(data_in.blockID == BLOCK_GROUND_WAVING_VERTICAL || data_in.blockID == BLOCK_GRASS_SHORT || data_in.blockID == BLOCK_GRASS_TALL_LOWER || data_in.blockID == BLOCK_GRASS_TALL_UPPER ) opaqueMasks = 0.60; else if(data_in.blockID == BLOCK_AIR_WAVING) opaqueMasks = 0.55; #endif @@ -501,7 +509,7 @@ void main() { #endif #endif - #if !defined BLOCKENTITIES && !defined ENTITIES && defined SHADER_GRASS && !defined COLORWHEEL + #if !defined BLOCKENTITIES && !defined ENTITIES && defined SHADER_GRASS && !defined COLORWHEEL && !defined HAND && !defined CUTOUT if(ShaderGrass) opaqueMasks = 0.8; #endif #endif @@ -524,18 +532,19 @@ void main() { vec4 Albedo = vec4(Color.rgb, 1.0); - #if !defined BLOCKENTITIES && !defined ENTITIES && !defined HAND && defined SHADER_GRASS && defined WORLD + #if !defined BLOCKENTITIES && !defined ENTITIES && !defined HAND && defined SHADER_GRASS && defined WORLD && !defined CUTOUT if (!ShaderGrass) #endif { #ifdef IRIS_FEATURE_TEXTURE_FILTERING - Albedo *= textureFilteringMode == 1 ? sampleRGSS(gtexture, adjustedTexCoord.xy, 1.0 / vec2(textureSize(gtexture, 0))) : sampleNearest(gtexture, adjustedTexCoord.xy, 1.0 / vec2(textureSize(gtexture, 0))); + vec2 texSize = 1.0 / vec2(textureSize(gtexture, 0)); + Albedo *= textureFilteringMode == 1 ? sampleRGSS(gtexture, adjustedTexCoord.xy, texSize) : sampleNearest(gtexture, adjustedTexCoord.xy, texSize); #else - Albedo *= texture2D_POMSwitch(gtexture, adjustedTexCoord.xy, vec4(dcdx,dcdy), ifPOM, textureLOD); + Albedo *= texture_POMSwitch(gtexture, adjustedTexCoord.xy, vec4(dcdx,dcdy), ifPOM, textureLOD); #endif } #else - vec4 Albedo = texture2D_POMSwitch(gtexture, adjustedTexCoord.xy, vec4(dcdx,dcdy), ifPOM, textureLOD); + vec4 Albedo = texture_POMSwitch(gtexture, adjustedTexCoord.xy, vec4(dcdx,dcdy), ifPOM, textureLOD); vec4 overlayColor; float vanillaAO; @@ -548,7 +557,7 @@ void main() { vec3 flatNormals = viewToWorld(normal); #endif - #if REPLACE_SHORT_GRASS < 2 && !defined BLOCKENTITIES && !defined ENTITIES && !defined HAND && defined SHADER_GRASS && !defined COLORWHEEL && defined WORLD + #if REPLACE_SHORT_GRASS < 2 && !defined BLOCKENTITIES && !defined ENTITIES && !defined HAND && defined SHADER_GRASS && !defined COLORWHEEL && defined WORLD && !defined CUTOUT // darken the top of grass blocks a bit if(data_in.blockID == 85 && flatNormals.y > 0.9 && !ShaderGrass) Albedo.rgb *= smoothstep(-30.0, 25.0, length(playerpos)); #endif @@ -560,17 +569,7 @@ void main() { if(step(ditherFade, R2) == 0.0) discard; #endif - #if defined WORLD && !defined ENTITIES && !defined BLOCKENTITIES && !defined HAND - #if MC_VERSION >= 12111 - if (Albedo.a < 0.5) discard; - #else - if (Albedo.a < 0.1) discard; - #endif - #endif - - #if defined ENTITIES || defined BLOCKENTITIES || defined HAND - if (Albedo.a < 0.1) discard; - #endif + if(Albedo.a < alphaTestRef) discard; #if defined IRIS_FEATURE_FADE_VARIABLE && VANILLA_CHUNK_FADING > 0 && !defined HAND #ifdef TAA @@ -623,7 +622,7 @@ void main() { float endPortalEmission = 0.0; if(PORTAL) { - const float steps = 20; + const float steps = 20.0; vec3 color = vec3(0.0); float absorbance = 1.0; @@ -659,7 +658,7 @@ void main() { float verticalGradient = (i + BN)/steps ; float verticalGradient2 = exp(-7*(1-verticalGradient*verticalGradient)); - float density = max(max(verticalGradient - texture2D(noisetex, uv/256.0 + animation.xy).b*0.5,0.0) - (1.0-texture2D(noisetex, uv/32.0 + animation.xx).r) * (0.4 + 0.1 * (texture2D(noisetex, uv/10.0 - animation.yy).b)),0.0); + float density = max(max(verticalGradient - texture(noisetex, uv/256.0 + animation.xy).b*0.5,0.0) - (1.0-texture(noisetex, uv/32.0 + animation.xx).r) * (0.4 + 0.1 * (texture(noisetex, uv/10.0 - animation.yy).b)),0.0); float volumeCoeff = exp(-density*(i+1)); @@ -723,13 +722,13 @@ void main() { #ifdef HAND if (Albedo.a > 0.1){ Albedo.a = 0.75; - gl_FragData[3] = vec4(0.0); + OutTranslucents = vec4(0.0); } else { Albedo.a = 1.0; } #endif #if defined PARTICLE_RENDERING_FIX && (defined ENTITIES || defined BLOCKENTITIES) - gl_FragData[3] = vec4(0.0); + OutTranslucents = vec4(0.0); #endif // #ifdef COLORWHEEL @@ -742,11 +741,11 @@ void main() { //////////////////////////////// //////////////////////////////// #if defined WORLD && defined MC_NORMAL_MAP - #if !defined BLOCKENTITIES && !defined ENTITIES && !defined HAND && defined SHADER_GRASS && !defined COLORWHEEL && defined WORLD + #if !defined BLOCKENTITIES && !defined ENTITIES && !defined HAND && defined SHADER_GRASS && !defined COLORWHEEL && defined WORLD && !defined CUTOUT if(!ShaderGrass) #endif { - vec4 NormalTex = texture2D_POMSwitch(normals, adjustedTexCoord.xy, vec4(dcdx,dcdy), ifPOM,textureLOD).xyzw; + vec4 NormalTex = texture_POMSwitch(normals, adjustedTexCoord.xy, vec4(dcdx,dcdy), ifPOM,textureLOD).xyzw; #ifdef MATERIAL_AO Albedo.rgb *= NormalTex.b*0.5+0.5; @@ -843,7 +842,7 @@ void main() { // normal block lightsources if(data_in.blockID >= 100 && data_in.blockID < 300) EMISSIVE = 0.5; - else if(data_in.blockID == 266 || data_in.blockID == 497) EMISSIVE = 0.2; // sculk stuff + if(data_in.blockID == 266 || data_in.blockID == 497) EMISSIVE = 0.2; // sculk stuff else if(data_in.blockID == 195) EMISSIVE = 2.3; // glow lichen @@ -878,20 +877,20 @@ void main() { vec4 SpecularTex = vec4(0.0); - #if !defined BLOCKENTITIES && !defined ENTITIES && !defined HAND && defined SHADER_GRASS && !defined COLORWHEEL && defined WORLD + #if !defined BLOCKENTITIES && !defined ENTITIES && !defined HAND && defined SHADER_GRASS && !defined COLORWHEEL && defined WORLD && !defined CUTOUT if (ShaderGrass) { SpecularTex = vec4(0.15, 0.025, 1.0, 0.0); } else #endif { - SpecularTex = texture2D_POMSwitch(specular, adjustedTexCoord.xy, vec4(dcdx,dcdy), ifPOM,textureLOD); + SpecularTex = texture_POMSwitch(specular, adjustedTexCoord.xy, vec4(dcdx,dcdy), ifPOM,textureLOD); } // SpecularTex.r = max(SpecularTex.r, rainfall); // SpecularTex.g = max(SpecularTex.g, max(Puddle_shape*0.02,0.02)); - gl_FragData[1] = vec4(0.0,0.0,0.0,0.0); - gl_FragData[1].rg = SpecularTex.rg; + OutSpecular = vec4(0.0,0.0,0.0,0.0); + OutSpecular.rg = SpecularTex.rg; #if EMISSIVE_ORES > 1 && EMISSIVE_TYPE > 1 if(data_in.blockID == 502) { @@ -925,43 +924,43 @@ void main() { #endif #if EMISSIVE_TYPE == 0 - gl_FragData[1].a = 0.0; + OutSpecular.a = 0.0; #endif #if EMISSIVE_TYPE == 1 EMISSIVE = clamp(EMISSIVE, 0.0, 0.99); - gl_FragData[1].a = EMISSIVE; + OutSpecular.a = EMISSIVE; #endif #if EMISSIVE_TYPE == 2 - gl_FragData[1].a = SpecularTex.a; + OutSpecular.a = SpecularTex.a; EMISSIVE = clamp(EMISSIVE, 0.0, 0.99); - if(emissionCheck) gl_FragData[1].a = EMISSIVE; + if(emissionCheck) OutSpecular.a = EMISSIVE; #endif #if EMISSIVE_TYPE == 3 - gl_FragData[1].a = SpecularTex.a; + OutSpecular.a = SpecularTex.a; #endif #if defined WORLD && !defined ENTITIES && !defined HAND && defined BLOCKENTITIES && !defined COLORWHEEL - if(PORTAL) gl_FragData[1].a = endPortalEmission; + if(PORTAL) OutSpecular.a = endPortalEmission; #endif #if SSS_TYPE == 0 - gl_FragData[1].b = 0.0; + OutSpecular.b = 0.0; #endif #if SSS_TYPE == 1 - gl_FragData[1].b = SSSAMOUNT; + OutSpecular.b = SSSAMOUNT; #endif #if SSS_TYPE == 2 - gl_FragData[1].b = SpecularTex.b; - if(SpecularTex.b < 65.0/255.0) gl_FragData[1].b = SSSAMOUNT; + OutSpecular.b = SpecularTex.b; + if(SpecularTex.b < 65.0/255.0) OutSpecular.b = SSSAMOUNT; #endif #if SSS_TYPE == 3 - gl_FragData[1].b = SpecularTex.b; + OutSpecular.b = SpecularTex.b; #endif #endif @@ -987,20 +986,20 @@ void main() { #if defined WORLD && !defined HAND && !defined ENTITIES // some dither to lightmaps to reduce banding. - PackLightmaps = clamp( PackLightmaps + PackLightmaps * (interleaved_gradientNoise()-0.5)*0.005,0,1); + PackLightmaps = clamp( PackLightmaps + PackLightmaps * (BN-0.5)*0.005,0,1); #endif normal = viewToWorld(normal); - #if !defined BLOCKENTITIES && !defined ENTITIES && !defined HAND && defined SHADER_GRASS && !defined COLORWHEEL && defined WORLD + #if !defined BLOCKENTITIES && !defined ENTITIES && !defined HAND && defined SHADER_GRASS && !defined COLORWHEEL && defined WORLD && !defined CUTOUT if (ShaderGrass) {flatNormals = data_in.normalMat; normal = data_in.texcoordam.xyz;} #endif vec4 data1 = clamp( encode(normal, PackLightmaps), 0.0, 1.0); - gl_FragData[0] = vec4(encodeVec2(Albedo.x,data1.x), encodeVec2(Albedo.y,data1.y), encodeVec2(Albedo.z,data1.z), encodeVec2(data1.w,Albedo.w)); + OutAlbedo = vec4(encodeVec2(Albedo.x,data1.x), encodeVec2(Albedo.y,data1.y), encodeVec2(Albedo.z,data1.z), encodeVec2(data1.w,Albedo.w)); - gl_FragData[2] = vec4(flatNormals * 0.5 + 0.5, vanillaAO); + OutNormalAO = vec4(flatNormals * 0.5 + 0.5, vanillaAO); #endif } \ No newline at end of file diff --git a/shaders/dimensions/all_solid.gsh b/shaders/dimensions/all_solid.gsh index 7870a78..1238660 100644 --- a/shaders/dimensions/all_solid.gsh +++ b/shaders/dimensions/all_solid.gsh @@ -284,10 +284,9 @@ void main() { vec2 Wvertex = vertex.xz+cameraPositionFract.xz+mod(vec2(cameraPositionInt.xz), vec2(20.0)); - vec2 randomDir = 2.0*(texture2D(noisetex, 0.75*Wvertex).xy+texture2D(noisetex, 0.35*Wvertex.yx).xy)-1.0; + vec2 randomDir = 2.0*(texture(noisetex, 0.75*Wvertex).xy+texture(noisetex, 0.35*Wvertex.yx).xy)-1.0; // vertex.xz -= 0.05*randomDir; - vec3 dir = normalize(vertex); vec3 originalVertex = vertex; @@ -297,7 +296,7 @@ void main() { worldUp *= heightMult; - originalVertex -= right*0.0625*GRASS_BASE_THICKNESS; + originalVertex -= right*0.125*GRASS_BASE_THICKNESS; vec3 verticies[21]; float grassHeights[21]; diff --git a/shaders/dimensions/all_solid.tcs b/shaders/dimensions/all_solid.tcs index 211963b..3c43b1e 100644 --- a/shaders/dimensions/all_solid.tcs +++ b/shaders/dimensions/all_solid.tcs @@ -157,16 +157,6 @@ void main() { gl_TessLevelInner[0] = 0; } - - #if REPLACE_SHORT_GRASS > 0 - if(data_in[gl_InvocationID].blockID == -10){ - gl_TessLevelOuter[0] = 0; - gl_TessLevelOuter[1] = 0; - gl_TessLevelOuter[2] = 0; - - gl_TessLevelInner[0] = 0; - } - #endif #else gl_TessLevelOuter[0] = 1; gl_TessLevelOuter[1] = 1; diff --git a/shaders/dimensions/all_solid.vsh b/shaders/dimensions/all_solid.vsh index dd8a800..045878a 100644 --- a/shaders/dimensions/all_solid.vsh +++ b/shaders/dimensions/all_solid.vsh @@ -5,6 +5,8 @@ #include "/lib/entities.glsl" #include "/lib/items.glsl" +#include "/lib/SSBOs.glsl" + /* !! DO NOT REMOVE !! This code is from Chocapic13' shaders @@ -30,7 +32,7 @@ Read the terms of modification and sharing before changing something below pleas out DATA { - #if !defined ENTITIES && !defined HAND && defined SHADER_GRASS && !defined BLOCKENTITIES + #if !defined ENTITIES && !defined HAND && defined SHADER_GRASS && !defined BLOCKENTITIES && !defined CUTOUT vec4 grassSideCheck; vec3 centerPosition; #endif @@ -57,15 +59,15 @@ out DATA { } data_out; #ifdef MC_NORMAL_MAP - attribute vec4 at_tangent; + in vec4 at_tangent; #endif uniform float frameTimeCounter; const float PI48 = 150.796447372*WAVY_SPEED; float pi2wt = PI48*frameTimeCounter; -attribute vec4 mc_Entity; -attribute vec4 mc_midTexCoord; +in vec4 mc_Entity; +in vec4 mc_midTexCoord; uniform int blockEntityId; uniform int entityId; @@ -75,9 +77,9 @@ uniform int heldItemId; uniform int heldItemId2; #ifdef IRIS_FEATURE_BLOCK_EMISSION_ATTRIBUTE - attribute vec4 at_midBlock; + in vec4 at_midBlock; #else - attribute vec3 at_midBlock; + in vec3 at_midBlock; #endif uniform int frameCounter; @@ -154,7 +156,7 @@ vec3 calcMovePlants(in vec3 pos) { return vec3(move1.x,move1y,move1.y)*5.*WAVY_STRENGTH; } -vec3 calcWaveLeaves(in vec3 pos, in float fm, in float mm, in float ma, in float f0, in float f1, in float f2, in float f3, in float f4, in float f5) { +vec3 calcWaveLeaves(in vec3 pos) { float magnitude = abs(sin(dot(vec4(frameTimeCounter, pos),vec4(1.0,0.005,0.005,0.005)))*0.5+0.72)*0.013; vec3 ret = (sin(pi2wt*vec3(0.0063,0.0224,0.0015)*1.5 - pos))*magnitude; @@ -162,8 +164,8 @@ vec3 calcWaveLeaves(in vec3 pos, in float fm, in float mm, in float ma, in float return ret; } -vec3 calcMoveLeaves(in vec3 pos, in float f0, in float f1, in float f2, in float f3, in float f4, in float f5, in vec3 amp1, in vec3 amp2) { - vec3 move1 = calcWaveLeaves(pos , 0.0054, 0.0400, 0.0400, 0.0127, 0.0089, 0.0114, 0.0063, 0.0224, 0.0015) * amp1; +vec3 calcMoveLeaves(in vec3 pos, in vec3 amp1) { + vec3 move1 = calcWaveLeaves(pos) * amp1; return move1*5.*WAVY_STRENGTH; } vec3 srgbToLinear2(vec3 srgb){ @@ -211,7 +213,7 @@ float densityAtPos(in vec3 pos){ vec2 coord = uv / 512.0; //The y channel has an offset to avoid using two textures fetches - vec2 xy = texture2D(noisetex, coord).yx; + vec2 xy = texture(noisetex, coord).yx; return mix(xy.r,xy.g, f.y); } @@ -306,86 +308,69 @@ void main() { #if !defined ENTITIES && !defined HAND && defined SHADER_GRASS && (defined GRASS_DETECT_FALLOFF || defined GRASS_DETECT_INV_FALLOFF || REPLACE_SHORT_GRASS > 0) && !defined BLOCKENTITIES - data_out.grassSideCheck = vec4(0.0); - - if(length(worldpos) < min(GRASS_RANGE, 0.5*float(LpvSize)) && data_out.blockID == 85 && worldNormals.y > 0.9) { + #ifndef CUTOUT + data_out.grassSideCheck = vec4(0.0); + + if(length(worldpos) < min(GRASS_RANGE, 0.5*float(LpvSize)) && data_out.blockID == 85 && worldNormals.y > 0.9) { - float fractYPos = fract(worldpos.y+cameraPosition.y); - if(fractYPos > 0.9999 || fractYPos < 0.0001 || abs(fractYPos - 0.5) < 0.0001) { + float fractYPos = fract(worldpos.y+cameraPosition.y); + if(fractYPos > 0.9999 || fractYPos < 0.0001 || abs(fractYPos - 0.5) < 0.0001) { - data_out.centerPosition = worldpos + at_midBlock.xyz / 64.0; + data_out.centerPosition = worldpos + at_midBlock.xyz / 64.0; - vec3 LPVpos = GetLpvPosition(data_out.centerPosition); + vec3 LPVpos = GetLpvPosition(data_out.centerPosition); - #if REPLACE_SHORT_GRASS > 0 - uint blockTop = GetVoxelBlock(ivec3(LPVpos.x, LPVpos.y + 0.6, LPVpos.z)); - #else - uint blockTop = 0; - #endif + #if REPLACE_SHORT_GRASS > 0 + uint blockTop = GetVoxelBlock(ivec3(LPVpos.x, LPVpos.y + 0.6, LPVpos.z)); + #else + uint blockTop = 0; + #endif - if(blockTop == 12 || blockTop > 4000) { - data_out.grassSideCheck = vec4(2.0); - } - #if REPLACE_SHORT_GRASS < 2 - else { - uint blockEast = GetVoxelBlock(ivec3(LPVpos.x + 1.0, LPVpos.y + 0.6, LPVpos.z)); - uint blockWest = GetVoxelBlock(ivec3(LPVpos.x - 1.0, LPVpos.y + 0.6, LPVpos.z)); - uint blockSouth = GetVoxelBlock(ivec3(LPVpos.x, LPVpos.y + 0.6, LPVpos.z + 1.0)); - uint blockNorth = GetVoxelBlock(ivec3(LPVpos.x, LPVpos.y + 0.6, LPVpos.z - 1.0)); + if(blockTop == 12 || blockTop > 4000) { + data_out.grassSideCheck = vec4(2.0); + } + #if REPLACE_SHORT_GRASS < 2 + else { + uint blockEast = GetVoxelBlock(ivec3(LPVpos.x + 1.0, LPVpos.y + 0.6, LPVpos.z)); + uint blockWest = GetVoxelBlock(ivec3(LPVpos.x - 1.0, LPVpos.y + 0.6, LPVpos.z)); + uint blockSouth = GetVoxelBlock(ivec3(LPVpos.x, LPVpos.y + 0.6, LPVpos.z + 1.0)); + uint blockNorth = GetVoxelBlock(ivec3(LPVpos.x, LPVpos.y + 0.6, LPVpos.z - 1.0)); - if(blockEast > 4000 || blockEast == 12 || (blockEast > 80 && blockEast < 86) || blockEast == 503 || (blockEast > 406 && blockEast < 440)) {data_out.grassSideCheck.x = 1.0;} else { - #ifdef GRASS_DETECT_FALLOFF - blockEast = GetVoxelBlock(ivec3(LPVpos.x + 1.0, LPVpos.y, LPVpos.z)); - if(blockEast != 85) {data_out.grassSideCheck.x = -1.0;} + if(blockEast > 4000 || blockEast == 12 || (blockEast > 80 && blockEast < 86) || blockEast == 503 || (blockEast > 406 && blockEast < 440)) {data_out.grassSideCheck.x = 1.0;} else { + #ifdef GRASS_DETECT_FALLOFF + blockEast = GetVoxelBlock(ivec3(LPVpos.x + 1.0, LPVpos.y, LPVpos.z)); + if(blockEast != 85) {data_out.grassSideCheck.x = -1.0;} + #endif + } + if(blockWest > 4000 || blockWest == 12 || (blockWest > 80 && blockWest < 86) || blockWest == 503 || (blockWest > 406 && blockWest < 440)) {data_out.grassSideCheck.y = 1.0;} else { + #ifdef GRASS_DETECT_FALLOFF + blockWest = GetVoxelBlock(ivec3(LPVpos.x - 1.0, LPVpos.y, LPVpos.z)); + if(blockWest != 85) {data_out.grassSideCheck.y = -1.0;} + #endif + } + if(blockSouth > 4000 || blockSouth == 12 || (blockSouth > 80 && blockSouth < 86) || blockSouth == 503 || (blockSouth > 406 && blockSouth < 440)) {data_out.grassSideCheck.z = 1.0;} else { + #ifdef GRASS_DETECT_FALLOFF + blockSouth = GetVoxelBlock(ivec3(LPVpos.x, LPVpos.y, LPVpos.z+ 1.0)); + if(blockSouth != 85) {data_out.grassSideCheck.z = -1.0;} + #endif + } + if(blockNorth > 4000 || blockNorth == 12 || (blockNorth > 80 && blockNorth < 86) || blockNorth == 503 || (blockNorth > 406 && blockNorth < 440)) {data_out.grassSideCheck.w = 1.0;} else { + #ifdef GRASS_DETECT_FALLOFF + blockNorth = GetVoxelBlock(ivec3(LPVpos.x, LPVpos.y, LPVpos.z - 1.0)); + if(blockNorth != 85) {data_out.grassSideCheck.w = -1.0;} + #endif + } + #ifndef GRASS_DETECT_INV_FALLOFF + data_out.grassSideCheck = clamp(data_out.grassSideCheck, -1.0, 0.0); #endif } - if(blockWest > 4000 || blockWest == 12 || (blockWest > 80 && blockWest < 86) || blockWest == 503 || (blockWest > 406 && blockWest < 440)) {data_out.grassSideCheck.y = 1.0;} else { - #ifdef GRASS_DETECT_FALLOFF - blockWest = GetVoxelBlock(ivec3(LPVpos.x - 1.0, LPVpos.y, LPVpos.z)); - if(blockWest != 85) {data_out.grassSideCheck.y = -1.0;} - #endif - } - if(blockSouth > 4000 || blockSouth == 12 || (blockSouth > 80 && blockSouth < 86) || blockSouth == 503 || (blockSouth > 406 && blockSouth < 440)) {data_out.grassSideCheck.z = 1.0;} else { - #ifdef GRASS_DETECT_FALLOFF - blockSouth = GetVoxelBlock(ivec3(LPVpos.x, LPVpos.y, LPVpos.z+ 1.0)); - if(blockSouth != 85) {data_out.grassSideCheck.z = -1.0;} - #endif - } - if(blockNorth > 4000 || blockNorth == 12 || (blockNorth > 80 && blockNorth < 86) || blockNorth == 503 || (blockNorth > 406 && blockNorth < 440)) {data_out.grassSideCheck.w = 1.0;} else { - #ifdef GRASS_DETECT_FALLOFF - blockNorth = GetVoxelBlock(ivec3(LPVpos.x, LPVpos.y, LPVpos.z - 1.0)); - if(blockNorth != 85) {data_out.grassSideCheck.w = -1.0;} - #endif - } - #ifndef GRASS_DETECT_INV_FALLOFF - data_out.grassSideCheck = clamp(data_out.grassSideCheck, -1.0, 0.0); #endif } - #endif - } - } - - #if REPLACE_SHORT_GRASS > 0 - #if GRASS_DENSITY == 3 - float maxShortGrassRange = 28.0; - #elif GRASS_DENSITY == 2 - float maxShortGrassRange = 24.0; - #elif GRASS_DENSITY == 2 - float maxShortGrassRange = 20.0; - #else - float maxShortGrassRange = 16.0; - #endif - - if(length(worldpos) < maxShortGrassRange && data_out.blockID == 12) { - data_out.centerPosition = worldpos + at_midBlock.xyz / 64.0; - vec3 LPVpos = GetLpvPosition(data_out.centerPosition); - uint blockBelow = GetVoxelBlock(ivec3(LPVpos.x, LPVpos.y - 0.6, LPVpos.z)); - if(blockBelow == 85) data_out.blockID = -10; } #endif #endif - #ifdef WAVY_PLANTS + #if defined WAVY_PLANTS && !defined ENTITIES && !defined HAND // also use normal, so up/down facing geometry does not get detatched from its model parts. bool InterpolateFromBase = gl_MultiTexCoord0.t < max(mc_midTexCoord.t, abs(worldNormals.y)); @@ -408,7 +393,7 @@ void main() { // apply displacement for waving leaf blocks specifically, overwriting the other waving mode. these wave off of the air. they wave uniformly if(mc_Entity.x == BLOCK_AIR_WAVING) { - worldpos += calcMoveLeaves(worldpos + 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))*data_out.lmtexcoord.w; + worldpos += calcMoveLeaves(worldpos + cameraPosition, vec3(1.0,0.2,1.0))*data_out.lmtexcoord.w; } else { // apply displacement for waving plant blocks worldpos += calcMovePlants(worldpos + cameraPosition) * max(data_out.lmtexcoord.w,0.5); @@ -429,7 +414,12 @@ void main() { gl_Position = vec4(worldpos, 0.0); #endif - #ifdef BLOCKENTITIES + #if defined PLANET_CURVATURE && !defined HAND && (defined BLOCKENTITIES || defined CUTOUT) + float curvature = length(worldpos.xyz) / (16.0*8.0); + worldpos.y -= curvature*curvature * CURVATURE_AMOUNT; + #endif + + #if defined BLOCKENTITIES || defined CUTOUT gl_Position = toClipSpace3(mat3(gbufferModelView) * vec3(worldpos) + gbufferModelView[3].xyz); #endif #else @@ -445,7 +435,7 @@ void main() { #endif #endif - #if !defined SHADER_GRASS || defined ENTITIES || defined HAND || defined BLOCKENTITIES + #if !defined SHADER_GRASS || defined ENTITIES || defined HAND || defined BLOCKENTITIES || defined CUTOUT #ifdef TAA_UPSCALING gl_Position.xy = gl_Position.xy * RENDER_SCALE + RENDER_SCALE * gl_Position.w - gl_Position.w; #endif @@ -465,7 +455,7 @@ void main() { YearCycleColor(data_out.color.rgb, gl_Color.rgb, mc_Entity.x == BLOCK_AIR_WAVING, true); #endif - #if DOF_QUALITY == 5 && !defined SHADER_GRASS && (defined ENTITIES || defined HAND) + #if DOF_QUALITY == 5 && ((defined SHADER_GRASS && (defined ENTITIES || defined HAND || defined CUTOUT || defined BLOCKENTIIES)) || !defined SHADER_GRASS) vec2 jitter = clamp(jitter_offsets[frameCounter % 64], -1.0, 1.0); jitter = rotate(radians(float(frameCounter))) * jitter; jitter.y *= aspectRatio; @@ -482,4 +472,24 @@ void main() { vec2 totalOffset = (jitter * JITTER_STRENGTH) * focusMul * 1e-2; gl_Position.xy += hideGUI >= 1 ? totalOffset : vec2(0); #endif + + + #if defined SHADER_GRASS && REPLACE_SHORT_GRASS > 0 && defined CUTOUT + #if GRASS_DENSITY == 3 + const float maxShortGrassRange = 28.0; + #elif GRASS_DENSITY == 2 + const float maxShortGrassRange = 24.0; + #elif GRASS_DENSITY == 1 + const float maxShortGrassRange = 20.0; + #else + const float maxShortGrassRange = 16.0; + #endif + + if(length(worldpos) < maxShortGrassRange && data_out.blockID == 12) { + vec3 centerPosition = worldpos + at_midBlock.xyz / 64.0; + vec3 LPVpos = GetLpvPosition(centerPosition); + uint blockBelow = GetVoxelBlock(ivec3(LPVpos.x, LPVpos.y - 0.6, LPVpos.z)); + if(blockBelow == 85) gl_Position.z -= 10000.0; + } + #endif } diff --git a/shaders/dimensions/all_translucent.fsh b/shaders/dimensions/all_translucent.fsh index f8695fc..7ffa681 100644 --- a/shaders/dimensions/all_translucent.fsh +++ b/shaders/dimensions/all_translucent.fsh @@ -20,13 +20,37 @@ #include "/lib/res_params.glsl" -varying vec4 lmtexcoord; -varying vec4 color; -uniform vec4 entityColor; +in DATA { + vec4 lmtexcoord; + vec4 color; -#if defined IRIS_FEATURE_FADE_VARIABLE && VANILLA_CHUNK_FADING > 0 && !defined HAND -varying float chunkFade; -#endif + vec3 viewVector; + + vec4 normalMat; + vec4 tangent; + + #if defined IRIS_FEATURE_FADE_VARIABLE && VANILLA_CHUNK_FADING > 0 && !defined HAND + float chunkFade; + #endif + + #ifdef OVERWORLD_SHADER + flat vec3 WsunVec; + #endif + + #if defined ENTITIES && defined IS_IRIS + flat int NAMETAG; + #endif + + #ifdef LARGE_WAVE_DISPLACEMENT + vec3 largeWaveDisplacementNormal; + #endif + + #ifdef LIGHTNING + float LIGHTNING_BOLT; + #endif +}; + +uniform vec4 entityColor; #if defined OVERWORLD_SHADER || (defined END_ISLAND_LIGHT && defined END_SHADER) const bool shadowHardwareFiltering = true; @@ -39,12 +63,6 @@ varying float chunkFade; #endif uniform float lightSign; - flat varying vec3 WsunVec; -#endif - - -#if defined ENTITIES && defined IS_IRIS - flat varying int NAMETAG; #endif uniform sampler2D noisetex; @@ -80,16 +98,6 @@ uniform sampler2D normals; uniform sampler3D texLpv2; #endif -varying vec4 tangent; -varying vec4 normalMat; -varying vec3 binormal; -varying vec3 flatnormal; -#ifdef LARGE_WAVE_DISPLACEMENT -varying vec3 largeWaveDisplacementNormal; -#endif - -varying float LIGHTNING_BOLT; - uniform vec3 sunVec; uniform float near; // uniform float far; @@ -156,7 +164,6 @@ uniform float dhVoxyFarPlane; #endif #ifdef OVERWORLD_SHADER - flat varying float Flashing; #include "/lib/lightning_stuff.glsl" #include "/lib/scene_controller.glsl" @@ -233,18 +240,17 @@ float R2_dither(){ float blueNoise(){ #ifdef TAA - return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter); + return fract(texelFetch(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter); #else - return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887); + return fract(texelFetch(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887); #endif } #include "/lib/TAA_jitter.glsl" -varying vec3 viewVector; vec3 getParallaxDisplacement(vec3 waterPos, vec3 playerPos) { - float largeWaves = texture2D(noisetex, waterPos.xy / 600.0 ).b; + float largeWaves = texture(noisetex, waterPos.xy / 600.0 ).b; float largeWavesCurved = pow(1.0-pow(1.0-largeWaves,2.5),4.5); float waterHeight = getWaterHeightmap(waterPos.xy, largeWaves, largeWavesCurved); @@ -405,14 +411,14 @@ float ComputeShadowMap(inout vec3 directLightColor, vec3 playerPos, float maxDis #ifdef TRANSLUCENT_COLORED_SHADOWS // determine when opaque shadows are overlapping translucent shadows by getting the difference of opaque depth and translucent depth - float shadowDepthDiff = pow(clamp((shadow2D(shadowtex1, projectedShadowPosition).x - projectedShadowPosition.z) * 2.0,0.0,1.0),2.0); + float shadowDepthDiff = pow(clamp((texture(shadowtex1, projectedShadowPosition).x - projectedShadowPosition.z) * 2.0,0.0,1.0),2.0); // get opaque shadow data to get opaque data from translucent shadows. - float opaqueShadow = shadow2D(shadowtex0, projectedShadowPosition).x; + float opaqueShadow = texture(shadowtex0, projectedShadowPosition).x; shadowmap += max(opaqueShadow, shadowDepthDiff); // get translucent shadow data - vec4 translucentShadow = texture2D(shadowcolor0, projectedShadowPosition.xy); + vec4 translucentShadow = texture(shadowcolor0, projectedShadowPosition.xy); // this curve simply looked the nicest. it has no other meaning. float shadowAlpha = pow(1.0 - pow(translucentShadow.a,5.0),0.2); @@ -425,7 +431,7 @@ float ComputeShadowMap(inout vec3 directLightColor, vec3 playerPos, float maxDis translucentTint += mix(translucentShadow.rgb, vec3(1.0), opaqueShadow*shadowDepthDiff); #else - shadowmap += shadow2D(shadow, projectedShadowPosition).x; + shadowmap += texture(shadow, projectedShadowPosition).x; #endif #ifdef BASIC_SHADOW_FILTER @@ -538,10 +544,10 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) gl_FragData[0] = textureFilteringMode == 1 ? sampleRGSS(gtexture, lmtexcoord.xy, 1.0 / vec2(textureSize(gtexture, 0))) : sampleNearest(gtexture, lmtexcoord.xy, 1.0 / vec2(textureSize(gtexture, 0))); gl_FragData[0] *= color; #else - gl_FragData[0] = texture2D(gtexture, lmtexcoord.xy, mipmapBias) * color; + gl_FragData[0] = texture(gtexture, lmtexcoord.xy, mipmapBias) * color; #endif #else - vec4 _color = texture2D(gtexture, lmtexcoord.xy, mipmapBias); + vec4 _color = texture(gtexture, lmtexcoord.xy, mipmapBias); float ao; vec4 overlayColor; @@ -576,7 +582,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) #endif #ifndef WhiteWorld - #ifdef Vanilla_like_water + #ifdef VANILLA_LIKE_WATER if (isWater) Albedo *= sqrt(luma(Albedo)); #else if (isWater){ @@ -656,13 +662,13 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) tangent.z, tangent2.z, normal.z); - vec3 NormalTex = vec3(texture2D(normals, lmtexcoord.xy, mipmapBias).xy,0.0); + vec3 NormalTex = vec3(texture(normals, lmtexcoord.xy, mipmapBias).xy,0.0); NormalTex.xy = NormalTex.xy*2.0-1.0; NormalTex.z = clamp(sqrt(1.0 - dot(NormalTex.xy, NormalTex.xy)),0.0,1.0); vec3 rippleBump = vec3(0.0); - #if !defined HAND && !defined Vanilla_like_water + #if !defined HAND && !defined VANILLA_LIKE_WATER if (isWater){ vec3 playerPos = shadowPlayerPos; vec3 waterPos = playerPos; @@ -747,7 +753,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) vec2 waveUV = (worldPos.xz - previousCameraPositionWave2.xz) * NORMAL_SCALE; if(length(waveUV) < 0.5 && abs(worldSpaceNormal.y) > 0.5 && !noSimOngoing) { - vec4 waves = texture2D(waveSim2Sampler, waveUV+0.5); + vec4 waves = texture(waveSim2Sampler, waveUV+0.5); #endif vec3 waveNormals = normalize(vec3(waves.z, waves.w, 1.0)); bump = mix(bump, waveNormals, clamp(WATER_SIM_STRENGTH*sqrt(sqrt(abs(waves.x))), 0.0, 1.0)); @@ -790,7 +796,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) //////////////////////////////////////////////////////////////////////////////// - vec3 SpecularTex = texture2D(specular, lmtexcoord.xy, mipmapBias).rga; + vec3 SpecularTex = texture(specular, lmtexcoord.xy, mipmapBias).rga; //////////////////////////////////////////////////////////////////////////////// //////////////////////////////// DIFFUSE LIGHTING ////////////////////////////// //////////////////////////////////////////////////////////////////////////////// @@ -878,7 +884,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) vec3 lightPos = LightSourcePosition(worldPos, cameraPosition,vortexBounds); - float lightningflash = texelFetch2D(colortex4,ivec2(1,1),0).x/150.0; + float lightningflash = texelFetch(colortex4,ivec2(1,1),0).x/150.0; vec3 lightColors = LightSourceColors(vortexBounds, lightningflash); float end_NdotL = clamp(dot(worldSpaceNormal, normalize(-lightPos))*0.5+0.5,0.0,1.0); @@ -958,11 +964,11 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) //////////////////////////////// SPECULAR LIGHTING ///////////////////////////// //////////////////////////////////////////////////////////////////////////////// - #ifdef DAMAGE_BLOCK_EFFECT + #ifdef LIGHTNING #undef FORWARD_SPECULAR #endif - #ifdef FORWARD_SPECULAR + #if defined FORWARD_SPECULAR float harcodedF0 = 0.02; @@ -993,12 +999,15 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) float reflectance = 0.0; - #if !defined OVERWORLD_SHADER || (!defined END_ISLAND_LIGHT && defined END_SHADER) - vec3 WsunVec = vec3(0.0); - vec3 DirectLightColor = WsunVec; + #if !defined OVERWORLD_SHADER + vec3 sunVec = vec3(0.0); + vec3 DirectLightColor = sunVec; float Shadows = 0.0; + #else + vec3 sunVec = WsunVec; #endif - vec3 specularReflections = specularReflections(viewPos, normalize(feetPlayerPos), WsunVec, vec3(BN, vec2(interleaved_gradientNoise_temporal())), worldSpaceNormal, roughness, f0, Albedo, FinalColor*gl_FragData[0].a, DirectLightColor * Shadows * Shadows, lightmap.y, isHand, isWater, reflectance, flashLightSpecularData); + + vec3 specularReflections = specularReflections(viewPos, normalize(feetPlayerPos), sunVec, vec3(BN, vec2(interleaved_gradientNoise_temporal())), worldSpaceNormal, roughness, f0, Albedo, FinalColor*gl_FragData[0].a, DirectLightColor * Shadows * Shadows, lightmap.y, isHand, isWater, reflectance, flashLightSpecularData); gl_FragData[0].a = gl_FragData[0].a + (1.0-gl_FragData[0].a) * reflectance; @@ -1027,7 +1036,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) float maxOverdrawDistance = OVERDRAW_MAX_DISTANCE; #endif - bool WATER = texture2D(colortex7, gl_FragCoord.xy*texelSize).a > 0.0 && length(feetPlayerPos) > clamp(far-16.0*4.0, 16.0, maxOverdrawDistance) && texelFetch2D(depthtex1, ivec2(gl_FragCoord.xy), 0).x >= 1.0; + bool WATER = texture(colortex7, gl_FragCoord.xy*texelSize).a > 0.0 && length(feetPlayerPos) > clamp(far-16.0*4.0, 16.0, maxOverdrawDistance) && texelFetch(depthtex1, ivec2(gl_FragCoord.xy), 0).x >= 1.0; if(WATER && isWater) { gl_FragData[0].a = 0.0; diff --git a/shaders/dimensions/all_translucent.vsh b/shaders/dimensions/all_translucent.vsh index 5f6f014..836ed86 100644 --- a/shaders/dimensions/all_translucent.vsh +++ b/shaders/dimensions/all_translucent.vsh @@ -21,47 +21,52 @@ Read the terms of modification and sharing before changing something below pleas !! DO NOT REMOVE !! */ -varying vec4 lmtexcoord; -varying vec4 color; +out DATA { + vec4 lmtexcoord; + vec4 color; -#if defined IRIS_FEATURE_FADE_VARIABLE && VANILLA_CHUNK_FADING > 0 && !defined HAND -varying float chunkFade; -#endif + vec3 viewVector; + + vec4 normalMat; + vec4 tangent; + + #if defined IRIS_FEATURE_FADE_VARIABLE && VANILLA_CHUNK_FADING > 0 && !defined HAND + float chunkFade; + #endif + + #ifdef OVERWORLD_SHADER + flat vec3 WsunVec; + #endif + + #if defined ENTITIES && defined IS_IRIS + flat int NAMETAG; + #endif + + #ifdef LARGE_WAVE_DISPLACEMENT + vec3 largeWaveDisplacementNormal; + #endif + + #ifdef LIGHTNING + float LIGHTNING_BOLT; + #endif +}; uniform sampler2D colortex4; uniform sampler2D noisetex; #ifdef OVERWORLD_SHADER - flat varying vec3 WsunVec; - #include "/lib/scene_controller.glsl" #endif -varying vec4 normalMat; -varying vec3 binormal; -varying vec4 tangent; -varying vec3 flatnormal; - -#ifdef LARGE_WAVE_DISPLACEMENT -varying vec3 largeWaveDisplacementNormal; -#endif - uniform mat4 gbufferModelViewInverse; uniform mat4 gbufferModelView; -varying vec3 viewVector; -#if defined ENTITIES && defined IS_IRIS - flat varying int NAMETAG; -#endif - -attribute vec4 at_tangent; -attribute vec4 mc_Entity; +in vec4 at_tangent; +in vec4 mc_Entity; #if defined ENTITIES || defined BLOCKENTITIES uniform int entityId; #endif -varying float LIGHTNING_BOLT; - uniform vec3 sunPosition; uniform vec3 moonPosition; uniform vec3 cameraPosition; @@ -90,8 +95,8 @@ vec4 toClipSpace3(vec3 viewSpacePosition) { float getWave (vec3 pos, float range){ - // return pow(1.0-texture2D(noisetex, (pos.xz + frameTimeCounter * WATER_WAVE_SPEED)/150.0).b,2.0) * WATER_WAVE_STRENGTH * range; - return pow(1.0-texture2D(noisetex, (pos.xz + frameTimeCounter * WATER_WAVE_SPEED)/125.0).r,5.0) * min(WATER_WAVE_STRENGTH, 1.0) * range; + // return pow(1.0-texture(noisetex, (pos.xz + frameTimeCounter * WATER_WAVE_SPEED)/150.0).b,2.0) * WATER_WAVE_STRENGTH * range; + return pow(1.0-texture(noisetex, (pos.xz + frameTimeCounter * WATER_WAVE_SPEED)/125.0).r,5.0) * min(WATER_WAVE_STRENGTH, 1.0) * range; } vec3 getWaveNormal(vec3 posxz, float range){ @@ -127,6 +132,12 @@ vec3 getWaveNormal(vec3 posxz, float range){ void main() { gl_Position = ftransform(); + + color = vec4(gl_Color.rgb, 1.0); + #ifdef LIGHTNING + color.a = gl_Color.a; + #endif + #if defined ENTITIES && defined IS_IRIS // force out of frustum if (entityId == 1599) gl_Position.z -= 10000.0; @@ -228,7 +239,7 @@ void main() { tangent = vec4(normalize(gl_NormalMatrix * at_tangent.rgb),at_tangent.w); normalMat = vec4(normalize(gl_NormalMatrix * gl_Normal), mat); - binormal = normalize(cross(tangent.rgb,normalMat.xyz)*at_tangent.w); + vec3 binormal = normalize(cross(tangent.rgb,normalMat.xyz)*at_tangent.w); mat3 tbnMatrix = mat3(tangent.x, binormal.x, normalMat.x, tangent.y, binormal.y, normalMat.y, tangent.z, binormal.z, normalMat.z); @@ -240,16 +251,10 @@ void main() { largeWaveDisplacementNormal = normalMat.xyz; } #endif - flatnormal = normalMat.xyz; viewVector = position.xyz; if(isWater) viewVector = normalize(tbnMatrix * viewVector); - color = vec4(gl_Color.rgb, 1.0); - #ifdef LIGHTNING - color.a = gl_Color.a; - #endif - #ifdef OVERWORLD_SHADER // WsunVec = lightCol.a * normalize(mat3(gbufferModelViewInverse) * sunPosition); @@ -274,8 +279,8 @@ void main() { WsunVec = mix(WmoonVec, WsunVec, clamp(float(sunElevation > 1e-5)*2.0 - 1.0,0,1)); #endif - LIGHTNING_BOLT = 0.0; #ifdef LIGHTNING + LIGHTNING_BOLT = 0.0; normalMat.a = 0.5; if(entityId == ENTITY_LIGHTNING){ LIGHTNING_BOLT = 1.0; diff --git a/shaders/dimensions/all_vanilla_emissives.fsh b/shaders/dimensions/all_vanilla_emissives.fsh index df99c45..eb8823b 100644 --- a/shaders/dimensions/all_vanilla_emissives.fsh +++ b/shaders/dimensions/all_vanilla_emissives.fsh @@ -1,7 +1,9 @@ #include "/lib/settings.glsl" -varying vec4 color; -varying vec2 texcoord; +in DATA { + vec4 color; + vec2 texcoord; +}; uniform sampler2D gtexture; @@ -21,7 +23,7 @@ vec3 toLinear(vec3 sRGB){ void main() { - vec4 Albedo = texture2D(gtexture, texcoord); + vec4 Albedo = texture(gtexture, texcoord); #ifndef COLORWHEEL Albedo.rgb = toLinear(Albedo.rgb * color.rgb); diff --git a/shaders/dimensions/all_vanilla_emissives.vsh b/shaders/dimensions/all_vanilla_emissives.vsh index b8205b7..4b42f1f 100644 --- a/shaders/dimensions/all_vanilla_emissives.vsh +++ b/shaders/dimensions/all_vanilla_emissives.vsh @@ -8,13 +8,10 @@ Read the terms of modification and sharing before changing something below pleas !! DO NOT REMOVE !! */ -varying vec4 color; -varying vec2 texcoord; - -varying vec4 tangent; -varying vec4 normalMat; -attribute vec4 at_tangent; - +out DATA { + vec4 color; + vec2 texcoord; +}; uniform vec2 texelSize; uniform int framemod8; @@ -46,11 +43,6 @@ void main() { if(gl_Color.a < 1.0) gl_Position = vec4(10,10,10,0); #endif - #ifdef ENCHANT_GLINT - tangent = vec4(normalize(gl_NormalMatrix * at_tangent.rgb), at_tangent.w); - normalMat = vec4(normalize(gl_NormalMatrix * gl_Normal), 1.0); - #endif - #ifdef TAA_UPSCALING gl_Position.xy = gl_Position.xy * RENDER_SCALE + RENDER_SCALE * gl_Position.w - gl_Position.w; #endif diff --git a/shaders/dimensions/begin.csh b/shaders/dimensions/begin.csh index c53ed38..5a803d4 100644 --- a/shaders/dimensions/begin.csh +++ b/shaders/dimensions/begin.csh @@ -39,15 +39,15 @@ float luma(vec3 color) { } vec3 rodSample(vec2 Xi) { - float r = sqrt(1.0f - Xi.x*Xi.y); - float phi = 2 * 3.14159265359 * Xi.y; + float r = sqrt(1.0 - Xi.x*Xi.y); + float phi = 2.0 * 3.14159265359 * Xi.y; return normalize(vec3(cos(phi) * r, sin(phi) * r, Xi.x)).xzy; } //Low discrepancy 2D sequence, integration error is as low as sobol but easier to compute : http://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/ vec2 R2_samples(int n){ vec2 alpha = vec2(0.75487765, 0.56984026); - return fract(alpha * n); + return fract(alpha * float(n)); } #define interpolateValue(old_value, new_value, mixhistory) clamp(mix(old_value, new_value, clamp(mixhistory,0.0,1.0)),0.0,65000.) @@ -76,7 +76,7 @@ vec3 toLinear(vec3 sRGB){ float t = worldTime / 24000.0; - t *= 1.0 + 1.0 / MONTH_LENGTH; + t *= 1.0 + 1.0 / float(MONTH_LENGTH); float H = t * 2.0 * PI - PI; // hour angle @@ -180,7 +180,7 @@ void main() { #else float time = worldTime; #endif - + float absWorldTime = worldTimeSmooth + mod(worldDay, 100 - mod(100, MONTH_LENGTH))*24000.0 - 48000.0; // offset by two days to align to vanilla moon phases by default float yearLengthTicks = float(MONTH_LENGTH) * 12.0 * 24000.0; @@ -414,7 +414,7 @@ void main() { skyGroundColSSBO = interpolateValue(skyGroundColSSBO, skyGroundCol, mixhistory); - #ifdef ambientLight_only + #ifdef AMBIENT_LIGHT_ONLY lightSourceColorSSBO = vec3(0.0); sunColorSSBO = vec3(0.0); diff --git a/shaders/dimensions/composite.fsh b/shaders/dimensions/composite.fsh index d21134d..4a5832a 100644 --- a/shaders/dimensions/composite.fsh +++ b/shaders/dimensions/composite.fsh @@ -2,10 +2,13 @@ #include "/lib/SSBOs.glsl" -#ifndef END_SHADER - flat varying vec3 WsunVec; -#endif -flat varying vec2 TAA_Offset; +in DATA { + flat vec2 TAA_Offset; + + #ifdef OVERWORLD_SHADER + flat vec3 WsunVec; + #endif +}; #include "/lib/res_params.glsl" @@ -161,13 +164,13 @@ float R2_dither(){ } float blueNoise(){ #ifdef TAA - return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter); + return fract(texelFetch(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter); #else - return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887); + return fract(texelFetch(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887); #endif } vec4 blueNoise(vec2 coord){ - return texelFetch2D(colortex6, ivec2(coord)%512 , 0) ; + return texelFetch(colortex6, ivec2(coord)%512 , 0) ; } vec2 R2_samples(int n){ vec2 alpha = vec2(0.75487765, 0.56984026); @@ -271,7 +274,7 @@ float convertHandDepth_2(in float depth, bool hand) { vec4 viewPos = vec4(0.0); vec3 feetPlayerPos = vec3(0.0); - float depth = convertHandDepth_2(texelFetch2D(depthtex1, samplecoord, 0).x, hand); + float depth = convertHandDepth_2(texelFetch(depthtex1, samplecoord, 0).x, hand); if (depth < 1.0) { feetPlayerPos = vec3(texcoord, depth) * 2.0 - 1.0; @@ -279,7 +282,7 @@ float convertHandDepth_2(in float depth, bool hand) { viewPos.xyz /= viewPos.w; } else { - depth = texelFetch2D(dhVoxyDepthTex1, samplecoord, 0).x; + depth = texelFetch(dhVoxyDepthTex1, samplecoord, 0).x; feetPlayerPos = vec3(texcoord, depth) * 2.0 - 1.0; viewPos = iProjDiag_DH * feetPlayerPos.xyzz + dhVoxyProjectionInverse[3]; @@ -323,7 +326,7 @@ vec2 SSAO( #if defined DISTANT_HORIZONS || defined VOXY vec3 offsetViewPos = toScreenSpace_DH_SSAO((offsetUV*texelSize - jitterOffsets) * (1.0/RENDER_SCALE), offsetUV, hand); #else - float sampleDepth = convertHandDepth_2(texelFetch2D(depthtex1, offsetUV, 0).x, hand); + float sampleDepth = convertHandDepth_2(texelFetch(depthtex1, offsetUV, 0).x, hand); vec3 offsetViewPos = toScreenSpace(vec3((offsetUV*texelSize - jitterOffsets) * (1.0/RENDER_SCALE), sampleDepth)); #endif @@ -384,7 +387,7 @@ void main() { float noise = R2_dither(); vec2 texcoord = gl_FragCoord.xy*texelSize; - vec4 data = texelFetch2D(colortex1,ivec2(gl_FragCoord.xy),0); + vec4 data = texelFetch(colortex1,ivec2(gl_FragCoord.xy),0); vec4 dataUnpacked0 = vec4(decodeVec2(data.x),decodeVec2(data.y)); vec4 dataUnpacked1 = vec4(decodeVec2(data.z),decodeVec2(data.w)); vec3 normal = mat3(gbufferModelViewInverse) * clamp(worldToView( decode(dataUnpacked0.yw) ),-1.,1.); @@ -393,7 +396,7 @@ void main() { float lightLeakFix = clamp(pow(eyeBrightnessSmooth.y/240. + lightmap.y,2.0) ,0.0,1.0); - gl_FragData[1] = vec4(0.0,0.0, texelFetch2D(colortex14, ivec2(gl_FragCoord.xy), 0).b, texelFetch2D(colortex14,ivec2((floor(gl_FragCoord.xy)/VL_RENDER_SCALE*texelSize+0.5*texelSize)/texelSize),0).a); + gl_FragData[1] = vec4(0.0,0.0, texelFetch(colortex14, ivec2(gl_FragCoord.xy), 0).b, texelFetch(colortex14,ivec2((floor(gl_FragCoord.xy)/VL_RENDER_SCALE*texelSize+0.5*texelSize)/texelSize),0).a); // bool lightningBolt = abs(dataUnpacked1.w-0.5) <0.01; @@ -404,12 +407,12 @@ void main() { bool hand = abs(dataUnpacked1.w-0.75) < 0.01; // bool blocklights = abs(dataUnpacked1.w-0.8) <0.01; - float z = texelFetch2D(depthtex1,ivec2(gl_FragCoord.xy),0).x; - float z0 = texelFetch2D(depthtex0,ivec2(gl_FragCoord.xy),0).x; + float z = texelFetch(depthtex1,ivec2(gl_FragCoord.xy),0).x; + float z0 = texelFetch(depthtex0,ivec2(gl_FragCoord.xy),0).x; #if defined DISTANT_HORIZONS || defined VOXY - float DH_depth1 = texelFetch2D(dhVoxyDepthTex1,ivec2(gl_FragCoord.xy),0).x; - float DH_depth0 = texelFetch2D(dhVoxyDepthTex,ivec2(gl_FragCoord.xy),0).x; + float DH_depth1 = texelFetch(dhVoxyDepthTex1,ivec2(gl_FragCoord.xy),0).x; + float DH_depth0 = texelFetch(dhVoxyDepthTex,ivec2(gl_FragCoord.xy),0).x; float swappedDepth = z >= 1.0 ? DH_depth1 : z; #else @@ -453,7 +456,7 @@ void main() { else gl_FragData[2] = vec4(vec2(0.0), 65000.0, 65000.0); - vec3 FlatNormals = normalize(texture2D(colortex15,texcoord).rgb * 2.0 - 1.0); + vec3 FlatNormals = normalize(texture(colortex15,texcoord).rgb * 2.0 - 1.0); #if indirect_effect == SSAO_FILTERED || indirect_effect == SSAO_HQ @@ -472,9 +475,9 @@ void main() { /*------------- VOLUMETRICS BEHIND TRANSLUCENTS PASS-THROUGH -------------*/ // colortex10 is the history buffer used in reprojection of volumetrics, i can just hijack that. - // gl_FragData[3] = texture2D(colortex10, texcoord); + // gl_FragData[3] = texture(colortex10, texcoord); - // if(texture2D(colortex7,texcoord).a > 0.0) { + // if(texture(colortex7,texcoord).a > 0.0) { // vec4 VL = BilateralUpscale_VLFOG(colortex13, depthtex1, gl_FragCoord.xy - 1.5, ld(z)); // // gl_FragData[3].rgb += VL.rgb * gl_FragData[3].a; @@ -487,14 +490,16 @@ void main() { #if defined OVERWORLD_SHADER || (defined END_ISLAND_LIGHT && defined END_SHADER) vec3 feetPlayerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz; #ifdef END_SHADER - vec3 WsunVec = normalize(END_LIGHT_POS-(feetPlayerPos+cameraPosition)); + vec3 sunVec = normalize(END_LIGHT_POS-(feetPlayerPos+cameraPosition)); + #else + vec3 sunVec = WsunVec; #endif - float SpecularTex = texture2D(colortex8,texcoord).z; + float SpecularTex = texture(colortex8,texcoord).z; float LabSSS = clamp((-64.0 + SpecularTex * 255.0) / 191.0 ,0.0,1.0); - float NdotL = clamp(dot(normal,WsunVec),0.0,1.0); - float vanillAO = clamp(texture2D(colortex15,texcoord).a,0.0,1.0) ; + float NdotL = clamp(dot(normal, sunVec),0.0,1.0); + float vanillAO = clamp(texture(colortex15,texcoord).a,0.0,1.0) ; #ifdef END_SHADER float minshadowfilt = Min_Shadow_Filter_Radius_END; @@ -579,7 +584,7 @@ void main() { float weight = 3.0 + (i+noise) * rdMul/SHADOW_FILTER_SAMPLE_COUNT*shadowMapResolution*distortFactor/2.7; - float d = texelFetch2D(shadow, ivec2((projectedShadowPosition.xy+offsetS*rdMul)*shadowMapResolution),0).x; + float d = texelFetch(shadow, ivec2((projectedShadowPosition.xy+offsetS*rdMul)*shadowMapResolution),0).x; float b = smoothstep(weight*diffthresh/2.0, weight*diffthresh, projectedShadowPosition.z - d); blockerCount += b; diff --git a/shaders/dimensions/composite.vsh b/shaders/dimensions/composite.vsh index 5518e35..af6a1ba 100644 --- a/shaders/dimensions/composite.vsh +++ b/shaders/dimensions/composite.vsh @@ -2,8 +2,13 @@ #include "/lib/SSBOs.glsl" -flat varying vec2 TAA_Offset; -flat varying vec3 WsunVec; +out DATA { + flat vec2 TAA_Offset; + + #ifdef OVERWORLD_SHADER + flat vec3 WsunVec; + #endif +}; uniform sampler2D colortex4; @@ -14,8 +19,6 @@ uniform vec3 sunPosition; uniform mat4 gbufferModelViewInverse; -flat varying vec3 zMults; - uniform float far; uniform float near; @@ -29,21 +32,21 @@ uniform int framemod8; void main() { gl_Position = ftransform(); - #ifdef CUSTOM_MOON_ROTATION - vec3 moonVec = customMoonVecSSBO; - #ifdef SMOOTH_SUN_ROTATION - WsunVec = WsunVecSmooth; + #ifdef OVERWORLD_SHADER + #ifdef CUSTOM_MOON_ROTATION + vec3 moonVec = customMoonVecSSBO; + #ifdef SMOOTH_SUN_ROTATION + WsunVec = WsunVecSmooth; + #else + WsunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition); + #endif + WsunVec = mix(moonVec, WsunVec, float(sunElevation > 1e-5)); + // WsunVec = moonVec; #else - WsunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition); + WsunVec = (float(sunElevation > 1e-5)*2-1.)*normalize(mat3(gbufferModelViewInverse) * sunPosition); #endif - WsunVec = mix(moonVec, WsunVec, float(sunElevation > 1e-5)); - // WsunVec = moonVec; - #else - WsunVec = (float(sunElevation > 1e-5)*2-1.)*normalize(mat3(gbufferModelViewInverse) * sunPosition); #endif - zMults = vec3(1.0/(far * near),far+near,far-near); - #ifdef TAA TAA_Offset = offsets[framemod8]; #else diff --git a/shaders/dimensions/composite1.fsh b/shaders/dimensions/composite1.fsh index d249021..0c460cf 100644 --- a/shaders/dimensions/composite1.fsh +++ b/shaders/dimensions/composite1.fsh @@ -1,6 +1,6 @@ #include "/lib/settings.glsl" -#include "/lib/SSBOs.glsl +#include "/lib/SSBOs.glsl" #ifdef CUSTOM_MOON_ROTATION uniform sampler2D CoronaTex; @@ -78,7 +78,6 @@ uniform float rainStrength; #include "/lib/stars.glsl" #endif - flat varying float Flashing; #undef LIGHTSOURCE_REFLECTION #endif @@ -119,6 +118,16 @@ uniform sampler2D colortex13; uniform sampler2D colortex14; uniform sampler2D colortex15; // flat normals(rgb), vanillaAO(alpha) +in DATA { + flat vec2 TAA_Offset; + + #if !defined END_ISLAND_LIGHT || !defined END_SHADER + flat vec3 WsunVec; + #endif + flat vec3 unsigned_WsunVec; + flat vec3 WmoonVec; +}; + uniform float sunElevation; @@ -142,28 +151,19 @@ uniform float farPlane; uniform float dhVoxyFarPlane; uniform float dhVoxyNearPlane; -flat varying vec3 zMults; - uniform vec2 texelSize; uniform float viewWidth; uniform float viewHeight; uniform float aspectRatio; uniform float eyeAltitude; -flat varying vec2 TAA_Offset; - uniform int frameCounter; uniform int isEyeInWater; uniform ivec2 eyeBrightnessSmooth; uniform vec3 sunVec; -#if !defined END_ISLAND_LIGHT || !defined END_SHADER - flat varying vec3 WsunVec; -#endif -flat varying vec3 unsigned_WsunVec; -flat varying vec3 WmoonVec; -flat varying float exposure; + #ifdef IS_LPV_ENABLED uniform int heldItemId; @@ -325,14 +325,14 @@ float R2_dither2(){ float blueNoise(){ #ifdef TAA - return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter); + return fract(texelFetch(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter); #else - return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887); + return fract(texelFetch(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887); #endif } vec4 blueNoise(vec2 coord){ - return texelFetch2D(colortex6, ivec2(coord)%512 , 0) ; + return texelFetch(colortex6, ivec2(coord)%512 , 0) ; } vec2 CleanSample( @@ -422,10 +422,10 @@ float swapperlinZ(float depth, float _near, float _far) { // for (int i = 0; i < int(steps); i++) { -// float samplePos = convertHandDepth_2(texture2D(depthtex1, screenPos.xy).x, hand); +// float samplePos = convertHandDepth_2(texture(depthtex1, screenPos.xy).x, hand); // #ifdef DISTANT_HORIZONS -// if(depthCheck) samplePos = texture2D(dhDepthTex1, screenPos.xy).x; +// if(depthCheck) samplePos = texture(dhDepthTex1, screenPos.xy).x; // #endif // if(samplePos < screenPos.z && (samplePos <= max(minZ,maxZ) && samplePos >= min(minZ,maxZ))){ @@ -487,11 +487,11 @@ vec2 SSRT_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, float noise, boo #if defined DISTANT_HORIZONS || defined VOXY if(depthCheck) { - sampleDepth = texelFetch2D(dhVoxyDepthTex1, ivec2(newPos.xy/texelSize),0).x; + sampleDepth = texelFetch(dhVoxyDepthTex1, ivec2(newPos.xy/texelSize),0).x; } else #endif { - sampleDepth = convertHandDepth_2(texelFetch2D(depthtex1, ivec2(newPos.xy/texelSize),0).x,hand); + sampleDepth = convertHandDepth_2(texelFetch(depthtex1, ivec2(newPos.xy/texelSize),0).x,hand); } if(sampleDepth < newPos.z){ @@ -555,11 +555,11 @@ float SSRT_FlashLight_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, floa #if defined DISTANT_HORIZONS || defined VOXY if(depthCheck) { - samplePos = texelFetch2D(dhVoxyDepthTex1, ivec2(newPos.xy/texelSize),0).x; + samplePos = texelFetch(dhVoxyDepthTex1, ivec2(newPos.xy/texelSize),0).x; } else #endif { - samplePos = texelFetch2D(depthtex2, ivec2(newPos.xy/texelSize),0).x,hand; + samplePos = texelFetch(depthtex2, ivec2(newPos.xy/texelSize),0).x,hand; } if(samplePos < newPos.z && samplePos > 0.0){// && (samplePos <= max(minZ,maxZ) && samplePos >= min(minZ,maxZ))){ @@ -608,30 +608,30 @@ void doEdgeAwareBlur( for(int i = 0; i < 4; i++) { #if defined DISTANT_HORIZONS || defined VOXY - float offsetDepth = sqrt(texelFetch2D(depth, UV + OFFSET[i] + UV_NOISE,0).z/65000.0); + float offsetDepth = sqrt(texelFetch(depth, UV + OFFSET[i] + UV_NOISE,0).z/65000.0); #else - float offsetDepth = ld(convertHandDepth_2(texelFetch2D(depth, UV + OFFSET[i] + UV_NOISE, 0).r,hand)); + float offsetDepth = ld(convertHandDepth_2(texelFetch(depth, UV + OFFSET[i] + UV_NOISE, 0).r,hand)); #endif float edgeDiff = abs(offsetDepth - referenceDepth) < threshold ? 1.0 : 1e-7; #ifdef Variable_Penumbra_Shadows - shadow_RESULT += texelFetch2D(tex1, UV + OFFSET[i] + UV_NOISE, 0).rgb*edgeDiff; + shadow_RESULT += texelFetch(tex1, UV + OFFSET[i] + UV_NOISE, 0).rgb*edgeDiff; #endif #if indirect_effect == SSAO_FILTERED - ssao_RESULT += texelFetch2D(tex2, UV + OFFSET[i] + UV_NOISE, 0).rg*edgeDiff; + ssao_RESULT += texelFetch(tex2, UV + OFFSET[i] + UV_NOISE, 0).rg*edgeDiff; #endif edgeSum += edgeDiff; } // sample without an offset with texture filtering to get a slightly blurred sample. make sure to average without skewing the rest of the average. - filteredShadow = shadow_RESULT/edgeSum * 0.8 + 0.2 * texture2D(tex1, texelSize*gl_FragCoord.xy).rgb; + filteredShadow = shadow_RESULT/edgeSum * 0.8 + 0.2 * texture(tex1, texelSize*gl_FragCoord.xy).rgb; #if indirect_effect == SSAO_FILTERED - ambientEffects = ssao_RESULT/edgeSum * 0.8 + 0.2 * texture2D(tex2, texelSize*gl_FragCoord.xy).rg; + ambientEffects = ssao_RESULT/edgeSum * 0.8 + 0.2 * texture(tex2, texelSize*gl_FragCoord.xy).rg; #endif #if indirect_effect == SSAO_HQ - ambientEffects = texture2D(tex2, texelSize*gl_FragCoord.xy).rg; + ambientEffects = texture(tex2, texelSize*gl_FragCoord.xy).rg; #endif } @@ -674,13 +674,13 @@ vec4 BilateralUpscale_VLFOG(sampler2D tex, sampler2D depth, float referenceDepth for(int i = 0; i < samples; i++) { #if defined DISTANT_HORIZONS || defined VOXY - float offsetDepth = sqrt(texelFetch2D(depth, UV_DEPTH + (OFFSET[i] + UV_NOISE) * SCALE,0).a/65000.0); + float offsetDepth = sqrt(texelFetch(depth, UV_DEPTH + (OFFSET[i] + UV_NOISE) * SCALE,0).a/65000.0); #else - float offsetDepth = ld(texelFetch2D(depth, UV_DEPTH + (OFFSET[i] + UV_NOISE) * SCALE, 0).r); + float offsetDepth = ld(texelFetch(depth, UV_DEPTH + (OFFSET[i] + UV_NOISE) * SCALE, 0).r); #endif float edgeDiff = abs(offsetDepth - referenceDepth) < threshold ? 1.0 : 0.0; - vec4 offsetColor = texelFetch2D(tex, UV_COLOR + OFFSET[i] + UV_NOISE, 0).rgba; + vec4 offsetColor = texelFetch(tex, UV_COLOR + OFFSET[i] + UV_NOISE, 0).rgba; colorSum += offsetColor*edgeDiff; edgeSum += edgeDiff; } @@ -711,9 +711,9 @@ vec3 ComputeShadowMap_COLOR(in vec3 projectedShadowPosition, float distortFactor #endif #ifdef TRANSLUCENT_COLORED_SHADOWS - float opaqueShadow = shadow2D(shadowtex0, projectedShadowPosition).x; - float opaqueShadowT = shadow2D(shadowtex1, projectedShadowPosition).x; - vec4 translucentShadow = texture2D(shadowcolor0, projectedShadowPosition.xy); + float opaqueShadow = texture(shadowtex0, projectedShadowPosition).x; + float opaqueShadowT = texture(shadowtex1, projectedShadowPosition).x; + vec4 translucentShadow = texture(shadowcolor0, projectedShadowPosition.xy); float shadowAlpha = pow(1.0-pow(1.0-translucentShadow.a,2.0),5.0); translucentShadow.rgb = normalize(translucentShadow.rgb*translucentShadow.rgb + 0.0001) * (1.0-shadowAlpha); @@ -725,8 +725,8 @@ vec3 ComputeShadowMap_COLOR(in vec3 projectedShadowPosition, float distortFactor translucentTint += mix(translucentShadow.rgb, vec3(1.0), max(opaqueShadow, backface * (shadowAlpha < 1.0 ? 0.0 : 1.0))); FUNNYSHADOW += ((1.0-shadowAlpha) * opaqueShadowT)/samples; #else - // shadowColor += directLightColor * shadow2D(shadow, projectedShadowPosition).x; - shadowColor += vec3(1.0) * shadow2D(shadow, projectedShadowPosition).x; + // shadowColor += directLightColor * texture(shadow, projectedShadowPosition).x; + shadowColor += vec3(1.0) * texture(shadow, projectedShadowPosition).x; #endif @@ -735,7 +735,7 @@ vec3 ComputeShadowMap_COLOR(in vec3 projectedShadowPosition, float distortFactor #endif #ifdef debug_SHADOWMAP - shadowDebug = shadow2D(shadow, projectedShadowPosition).x; + shadowDebug = texture(shadow, projectedShadowPosition).x; #endif #ifdef TRANSLUCENT_COLORED_SHADOWS // directLightColor *= mix(vec3(1.0), translucentTint.rgb / samples, maxDistFade); @@ -763,13 +763,14 @@ vec3 SubsurfaceScattering_sun(vec3 albedo, float Scattering, float Density, floa // Density = 1.0; Scattering *= sss_density_multiplier; - float density = 1e-6 + Density * 2.0; + float density = 1e-6 + Density * 1.5; float scatterDepth = max(1.0 - Scattering/density, 0.0); scatterDepth *= exp(-7.0 * (1.0-scatterDepth)); + SS_shadows = exp(-7.0 * SS_shadows)*0.7; - scatterDepth = scatterDepth * mix(exp(-4.0 * SS_shadows), 1.0, (1.0-SCREENSPACE_DIRECT_SSS_BLENDING) * scatterDepth * distantSSS); + scatterDepth = scatterDepth * mix(SS_shadows, 1.0, (1.0-SCREENSPACE_DIRECT_SSS_BLENDING) * scatterDepth * distantSSS); - if(hand) scatterDepth = max(1.0 - Scattering*10.0, 0.0) * exp(-4.0 * SS_shadows); + if(hand) scatterDepth = max(1.0 - Scattering*10.0, 0.0) * SS_shadows; vec3 absorbColor = exp(max(luma(albedo) - albedo*vec3(1.0,1.1,1.2), 0.0) * -20.0 * sss_absorbance_multiplier); vec3 scatter = scatterDepth * mix(absorbColor, vec3(1.0), scatterDepth); @@ -780,7 +781,7 @@ vec3 SubsurfaceScattering_sun(vec3 albedo, float Scattering, float Density, floa if(Density < 0.01) scatter = vec3(0.0); #endif - scatter *= 1.0 + CustomPhase(lightPos)*6.0; // ~10x brighter at the peak + scatter *= 1.0 + CustomPhase(lightPos)*20.0; return scatter; } @@ -819,7 +820,7 @@ uniform float wetness; vec2 snowCoords = worldPos.xz*0.1; #if ShaderSnow > 0 || PUDDLE_MODE > 0 - float snowR = texture2D(snowTexR, snowCoords).g; + float snowR = texture(snowTexR, snowCoords).g; #endif #if PUDDLE_MODE > 0 @@ -836,7 +837,7 @@ uniform float wetness; if(isShaderGrass) UV = worldPos.xz; #endif - float noise = texture2D(noisetex, UV * 0.02).b; + float noise = texture(noisetex, UV * 0.02).b; #if PUDDLE_MODE == 1 float puddles = max(halfWet - noise,0.0); @@ -900,14 +901,14 @@ uniform float wetness; if(isWater || f0 > 229.5/255.0 || eyeInWater) snow = 0.0; - vec3 snowA = pow(texture2D(snowTexA, snowCoords).rgb, vec3(2.0/(ShaderSnowStrength-0.1))); + vec3 snowA = pow(texture(snowTexA, snowCoords).rgb, vec3(2.0/(ShaderSnowStrength-0.1))); #ifdef SHADER_GRASS if(!isShaderGrass) #endif { snowA = mix(snowA, vec3(0.8, 0.75, 0.85), 1.0-abs(flatNormals.y)); } - vec3 snowN = 2.*texture2D(snowTexN, snowCoords).rgb - 1.; + vec3 snowN = 2.*texture(snowTexN, snowCoords).rgb - 1.; snowN = snowN.xzy; @@ -948,11 +949,11 @@ void main() { float noise = BN.y; - // float z0 = texture2D(depthtex0,texcoord).x; - // float z = texture2D(depthtex1,texcoord).x; + // float z0 = texture(depthtex0,texcoord).x; + // float z = texture(depthtex1,texcoord).x; - float z0 = texelFetch2D(depthtex0, ivec2(gl_FragCoord.xy), 0).x; - float z = texelFetch2D(depthtex1, ivec2(gl_FragCoord.xy), 0).x; + float z0 = texelFetch(depthtex0, ivec2(gl_FragCoord.xy), 0).x; + float z = texelFetch(depthtex1, ivec2(gl_FragCoord.xy), 0).x; float swappedDepth = z; @@ -960,9 +961,9 @@ void main() { bool isDHrange = z >= 1.0; #if defined DISTANT_HORIZONS || defined VOXY - float DH_mixedLinearZ = sqrt(texelFetch2D(colortex12,ivec2(gl_FragCoord.xy), 0).z/65000.0); - float DH_depth0 = texelFetch2D(dhVoxyDepthTex,ivec2(gl_FragCoord.xy), 0).x; - float DH_depth1 = texelFetch2D(dhVoxyDepthTex1,ivec2(gl_FragCoord.xy), 0).x; + float DH_mixedLinearZ = sqrt(texelFetch(colortex12,ivec2(gl_FragCoord.xy), 0).z/65000.0); + float DH_depth0 = texelFetch(dhVoxyDepthTex,ivec2(gl_FragCoord.xy), 0).x; + float DH_depth1 = texelFetch(dhVoxyDepthTex1,ivec2(gl_FragCoord.xy), 0).x; float depthOpaque = z; float depthOpaqueL = linearizeDepthFast(depthOpaque, near, farPlane); @@ -985,7 +986,7 @@ void main() { ////// --------------- UNPACK OPAQUE GBUFFERS --------------- ////// - vec4 data = texelFetch2D(colortex1, ivec2(gl_FragCoord.xy), 0); + vec4 data = texelFetch(colortex1, ivec2(gl_FragCoord.xy), 0); vec3 skyboxCol = data.rgb; @@ -1014,11 +1015,11 @@ void main() { ////// --------------- UNPACK MISC --------------- ////// - vec4 SpecularTex = texelFetch2D(colortex8, ivec2(gl_FragCoord.xy), 0); + vec4 SpecularTex = texelFetch(colortex8, ivec2(gl_FragCoord.xy), 0); float LabSSS = clamp((-65.0 + SpecularTex.z * 255.0) / 190.0 ,0.0,1.0); // LabSSS = 1; - vec4 normalAndAO = texelFetch2D(colortex15, ivec2(gl_FragCoord.xy), 0); + vec4 normalAndAO = texelFetch(colortex15, ivec2(gl_FragCoord.xy), 0); vec3 FlatNormals = normalize(normalAndAO.rgb * 2.0 - 1.0); vec3 slopednormal = normal; @@ -1043,7 +1044,7 @@ void main() { // 0.9 = entity mask // 0.8 = reflective entities // 0.7 = reflective blocks - float translucentMasks = texelFetch2D(colortex7, ivec2(gl_FragCoord.xy), 0).a; + float translucentMasks = texelFetch(colortex7, ivec2(gl_FragCoord.xy), 0).a; bool isWater = translucentMasks > 0.99; // bool isReflectiveEntity = abs(translucentMasks - 0.8) < 0.01; @@ -1283,7 +1284,7 @@ void main() { shadowMapFalloff2 = 1.0; } - vec3 shadowPlayerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz; + vec3 shadowPlayerPos = feetPlayerPos; #if LIGHTLEAKFIX_MODE == 1 if(!hand) GriAndEminShadowFix(shadowPlayerPos, FlatNormals, lightLeakFix); @@ -1383,6 +1384,17 @@ void main() { SSSColor = SubsurfaceScattering_sun(albedo, ShadowBlockerDepth, sunSSS_density, clamp(dot(feetPlayerPos_normalized, WsunVec),0.0,1.0), SS_directLight.g, shadowMapFalloff2, hand); if(!eyeInWater) SSSColor *= lightLeakFix; + + #if defined END_ISLAND_LIGHT && defined END_SHADER + float fade = 0.0; + if (r < 0.5 && abs(projectedShadowPosition.z) < 1.0) fade = smoothstep(0.25, 0.2, r*r); + + SSSColor *= fade; + + #ifdef SHADER_GRASS + if(isShaderGrass) SSSColor *= 0.3; + #endif + #endif #endif #ifndef END_SHADER @@ -1402,7 +1414,7 @@ void main() { vec3 lightPos = LightSourcePosition(worldPos, cameraPosition,vortexBounds); - float lightningflash = texelFetch2D(colortex4,ivec2(1,1),0).x/150.0; + float lightningflash = texelFetch(colortex4,ivec2(1,1),0).x/150.0; vec3 lightColors = pow(lightmap.y,8) * LightSourceColors(vortexBounds, lightningflash); float end_NdotL = clamp(dot(slopednormal, normalize(-lightPos))*0.5+0.5,0.0,1.0); @@ -1549,14 +1561,14 @@ void main() { ///////////////////////////// SKY SSS ///////////////////////////// #if defined Ambient_SSS && defined OVERWORLD_SHADER && (indirect_effect == SSAO_FILTERED || indirect_effect == SSAO_HQ) - vec3 ambientColor = AmbientLightColor * ambientsss_brightness * ambient_brightness * 2.0; + vec3 ambientColor = AmbientLightColor * ambientsss_brightness * ambient_brightness; Indirect_SSS = SubsurfaceScattering_sky(albedo, SkySSS, LabSSS); Indirect_SSS *= lightmap.y; - float thingy = SkySSS; - thingy = pow(thingy,3.5); - thingy = 1-pow(1-thingy,5); + // float thingy = SkySSS; + // thingy = pow(thingy,3.5); + // thingy = 1-pow(1-thingy,5); Indirect_lighting += Indirect_SSS * ambientColor; #endif @@ -1631,7 +1643,7 @@ void main() { Background += stars * starColor * mix(clamp(-unsigned_WsunVec.y*2.0,0.0,1.0), 1.0, clamp(cameraPosition.y-15000.0, 0.0, 45000.0)/45000.0); #endif - #if !defined ambientLight_only && (RESOURCEPACK_SKY == 1 || RESOURCEPACK_SKY == 0) + #if !defined AMBIENT_LIGHT_ONLY && (RESOURCEPACK_SKY == 1 || RESOURCEPACK_SKY == 0) #ifdef CUSTOM_MOON_ROTATION float sunMoonDist = length(unsigned_WsunVec - WmoonVec); if (sunMoonDist < 0.004){ @@ -1649,7 +1661,7 @@ void main() { if (u2 > 0.0 && u2 < 1.0 && v2 > 0.0 && v2 < 1.0) { vec2 coronaUV = vec2(u2, v2); - vec3 coronaTex = texture2D(CoronaTex, coronaUV).rgb; + vec3 coronaTex = texture(CoronaTex, coronaUV).rgb; Background += 0.5 * coronaTex * coronaTex * coronaTex * coronaTex * coronaTex * smoothstep(0.004, 0.0002, sunMoonDist); } } @@ -1680,7 +1692,7 @@ void main() { vec2 moonSphericalUV = sphereMap(moonUV); #ifdef CUSTOM_MOON_ROTATION - vec3 moonTex = texture2D(moon, moonSphericalUV).rgb; + vec3 moonTex = texture(moon, moonSphericalUV).rgb; float moonVis = smoothstep(0.08, -0.03, WmoonVec.y); vec2 pos = 2.0 * moonUV - 1.0; @@ -1695,7 +1707,7 @@ void main() { #ifdef MOON_NORMALS float mask = smoothstep(-0.25, 0.12, sunLight); - vec3 normalTex = texture2D(moonN, moonSphericalUV).xyz; + vec3 normalTex = texture(moonN, moonSphericalUV).xyz; normalTex = normalTex * 2.0 - 1.0; mat3 TBN = mat3(tangent, binormal, normalize(moonDirWorld)); @@ -1727,7 +1739,7 @@ void main() { moonphaseMult = phase[moonPhase]; #endif - vec3 moonTex = (1 - vec3(0.0, 0.5, 0.7)*clamp((1-0.5*v)*moonVis, 0.0, 1.0)) * moonphaseMult * texture2D(moon, moonSphericalUV).rgb; + vec3 moonTex = (1 - vec3(0.0, 0.5, 0.7)*clamp((1-0.5*v)*moonVis, 0.0, 1.0)) * moonphaseMult * texture(moon, moonSphericalUV).rgb; #endif vec3 moonLightCol = moonColorBase2; @@ -1772,7 +1784,7 @@ void main() { gl_FragData[0].rgb *= Absorbtion; // #if defined DISTANT_HORIZONS || defined VOXY - // float DH_mixedLinearZ = sqrt(texelFetch2D(colortex12,ivec2(gl_FragCoord.xy),0).a/65000.0); + // float DH_mixedLinearZ = sqrt(texelFetch(colortex12,ivec2(gl_FragCoord.xy),0).a/65000.0); // vec4 vlBehingTranslucents = BilateralUpscale_VLFOG(colortex13, colortex12, DH_mixedLinearZ); // #else // vec4 vlBehingTranslucents = BilateralUpscale_VLFOG(colortex13, depthtex1, ld(z)); diff --git a/shaders/dimensions/composite1.vsh b/shaders/dimensions/composite1.vsh index 21d1dad..519f014 100644 --- a/shaders/dimensions/composite1.vsh +++ b/shaders/dimensions/composite1.vsh @@ -3,20 +3,18 @@ #include "/lib/SSBOs.glsl" -#ifdef END_SHADER - flat varying float Flashing; -#endif - #include "/lib/scene_controller.glsl" -flat varying vec3 WsunVec; -flat varying vec3 WmoonVec; -flat varying vec3 unsigned_WsunVec; +out DATA { + flat vec2 TAA_Offset; -flat varying float exposure; + #if !defined END_ISLAND_LIGHT || !defined END_SHADER + flat vec3 WsunVec; + #endif + flat vec3 unsigned_WsunVec; + flat vec3 WmoonVec; +}; -flat varying vec2 TAA_Offset; -flat varying vec3 zMults; uniform sampler2D colortex4; // uniform float far; @@ -42,12 +40,6 @@ uniform int framemod8; void main() { gl_Position = ftransform(); - #ifdef END_SHADER - Flashing = texelFetch2D(colortex4,ivec2(1,1),0).x/150.0; - #endif - - zMults = vec3(1.0/(far * near),far+near,far-near); - #ifdef SMOOTH_SUN_ROTATION unsigned_WsunVec = WsunVecSmooth; #else @@ -67,7 +59,9 @@ void main() { WmoonVec = moonVec; - WsunVec = mix(WmoonVec, unsigned_WsunVec, clamp(float(sunElevation > 1e-5)*2.0 - 1.0,0,1)); + #if !defined END_ISLAND_LIGHT || !defined END_SHADER + WsunVec = mix(WmoonVec, unsigned_WsunVec, clamp(float(sunElevation > 1e-5)*2.0 - 1.0,0,1)); + #endif #if defined CUSTOM_MOON_ROTATION && LIGHTNING_SHADOWS > 0 WmoonVec = customMoonVec2SSBO; diff --git a/shaders/dimensions/composite10.fsh b/shaders/dimensions/composite10.fsh index 230b6ac..5d2ab88 100644 --- a/shaders/dimensions/composite10.fsh +++ b/shaders/dimensions/composite10.fsh @@ -4,7 +4,7 @@ #include "/lib/SSBOs.glsl" -varying vec2 texcoord; +in vec2 texcoord; const bool colortex5MipmapEnabled = true; // uniform sampler2D colortex4; @@ -50,7 +50,7 @@ float cdist(vec2 coord) { return max(abs(coord.s-0.5),abs(coord.t-0.5))*2.0; } float blueNoise(){ - return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter); + return fract(texelFetch(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter); } float ld(float depth) { return (2.0 * near) / (far + near - depth * (far - near)); // (-depth * (far - near)) = (2.0 * near)/ld - far - near @@ -138,7 +138,7 @@ float h1(float a) return 1.0 + w3(a) / (w2(a) + w3(a)); } -vec4 texture2D_bicubic(sampler2D tex, vec2 uv) +vec4 texture_bicubic(sampler2D tex, vec2 uv) { vec4 texelSize = vec4(texelSize,1.0/texelSize); uv = uv*texelSize.zw; @@ -157,10 +157,10 @@ vec4 texture2D_bicubic(sampler2D tex, vec2 uv) vec2 p2 = (vec2(iuv.x + h0x, iuv.y + h1y) - 0.5) * texelSize.xy; vec2 p3 = (vec2(iuv.x + h1x, iuv.y + h1y) - 0.5) * texelSize.xy; - return g0(fuv.y) * (g0x * texture2D(tex, p0) + - g1x * texture2D(tex, p1)) + - g1(fuv.y) * (g0x * texture2D(tex, p2) + - g1x * texture2D(tex, p3)); + return g0(fuv.y) * (g0x * texture(tex, p0) + + g1x * texture(tex, p1)) + + g1(fuv.y) * (g0x * texture(tex, p2) + + g1x * texture(tex, p3)); } // vec3 lenseFlare(vec2 UV){ @@ -174,14 +174,14 @@ vec4 texture2D_bicubic(sampler2D tex, vec2 uv) // vec2 centeredUV = texcoord - 0.5; // vec3 color = vec3(0.0); -// color = texture2D(colortex7, texcoord).rgb; +// color = texture(colortex7, texcoord).rgb; // vec2 distortedUV = (centeredUV - (centeredUV ) * aberrationStrength) + 0.5; -// color += texture2D(colortex7, distortedUV).rgb; -// // color.r = texture2D(colortex7, (centeredUV - (centeredUV + centeredUV*noise) * aberrationStrength) + 0.5).r; -// // color.g = texture2D(colortex7, texcoord).g; -// // color.b = texture2D(colortex7, (centeredUV + (centeredUV + centeredUV*noise) * aberrationStrength) + 0.5).b; +// color += texture(colortex7, distortedUV).rgb; +// // color.r = texture(colortex7, (centeredUV - (centeredUV + centeredUV*noise) * aberrationStrength) + 0.5).r; +// // color.g = texture(colortex7, texcoord).g; +// // color.b = texture(colortex7, (centeredUV + (centeredUV + centeredUV*noise) * aberrationStrength) + 0.5).b; // return color; // } @@ -212,7 +212,7 @@ vec3 blackbody(float Temp) void main() { /* RENDERTARGETS:7 */ float vignette = (1.5-dot(texcoord-0.5,texcoord-0.5)*2.); - vec3 col = texture2D(colortex5,texcoord).rgb; + vec3 col = texture(colortex5,texcoord).rgb; vec2 rodExposureDepth = rodExposureDepthSSBO; rodExposureDepth.y = sqrt(rodExposureDepth.y/65000.0); @@ -222,7 +222,7 @@ void main() { #if DOF_QUALITY >= 0 /*--------------------------------*/ - float z = ld(texture2D(depthtex1, texcoord.st*RENDER_SCALE).r)*far; + float z = ld(texture(depthtex1, texcoord*RENDER_SCALE).r)*far; #if MANUAL_FOCUS == -2 float focus = rodExposureDepth.y*far; #elif MANUAL_FOCUS == -1 @@ -251,11 +251,11 @@ void main() { vec2 dispersion = (texcoord - 0.5) * pcoc * 200.0 * DOF_DISPERSION_MULT; for ( int i = 0; i < BOKEH_SAMPLES; i++) { - // bcolor += texture2DLod(colortex5, texcoord.xy + bokeh_offsets[i]*pcoc*vec2(DOF_ANAMORPHIC_RATIO,aspectRatio), dofLodLevel).rgb; + // bcolor += textureLod(colortex5, texcoord.xy + bokeh_offsets[i]*pcoc*vec2(DOF_ANAMORPHIC_RATIO,aspectRatio), dofLodLevel).rgb; - bcolor.r += texture2DLod(colortex5, texcoord.xy + (bokeh_offsets[i] + dispersion)*pcoc*vec2(DOF_ANAMORPHIC_RATIO,aspectRatio), dofLodLevel).r; - bcolor.g += texture2DLod(colortex5, texcoord.xy + bokeh_offsets[i]*pcoc*vec2(DOF_ANAMORPHIC_RATIO,aspectRatio), dofLodLevel).g; - bcolor.b += texture2DLod(colortex5, texcoord.xy + (bokeh_offsets[i] - dispersion)*pcoc*vec2(DOF_ANAMORPHIC_RATIO,aspectRatio), dofLodLevel).b; + bcolor.r += textureLod(colortex5, texcoord + (bokeh_offsets[i] + dispersion)*pcoc*vec2(DOF_ANAMORPHIC_RATIO,aspectRatio), dofLodLevel).r; + bcolor.g += textureLod(colortex5, texcoord + bokeh_offsets[i]*pcoc*vec2(DOF_ANAMORPHIC_RATIO,aspectRatio), dofLodLevel).g; + bcolor.b += textureLod(colortex5, texcoord + (bokeh_offsets[i] - dispersion)*pcoc*vec2(DOF_ANAMORPHIC_RATIO,aspectRatio), dofLodLevel).b; } col = bcolor/BOKEH_SAMPLES; #endif @@ -266,19 +266,19 @@ void main() { vec2 resScale = vec2(1920.,1080.)/clampedRes; vec2 bloomTileUV = (((gl_FragCoord.xy)*2.0 + 0.5)*texelSize/2.0) / clampedRes*vec2(1920.,1080.); - vec3 bloomTile0 = texture2D_bicubic(colortex3, bloomTileUV/2.).rgb; //1/4 res - vec3 bloomTile1 = texture2D_bicubic(colortex6, bloomTileUV/4.).rgb; //1/8 res - vec3 bloomTile2 = texture2D_bicubic(colortex6, bloomTileUV/8.+vec2(0.25*resScale.x+2.5*texelSize.x,.0)).rgb; //1/16 res - vec3 bloomTile3 = texture2D_bicubic(colortex6, bloomTileUV/16.+vec2(0.375*resScale.x+4.5*texelSize.x,.0)).rgb; //1/32 res - vec3 bloomTile4 = texture2D_bicubic(colortex6, bloomTileUV/32.+vec2(0.4375*resScale.x+6.5*texelSize.x,.0)).rgb; //1/64 res - vec3 bloomTile5 = texture2D_bicubic(colortex6, bloomTileUV/64.+vec2(0.46875*resScale.x+8.5*texelSize.x,.0)).rgb; //1/128 res - vec3 bloomTile6 = texture2D_bicubic(colortex6, bloomTileUV/128.+vec2(0.484375*resScale.x+10.5*texelSize.x,.0)).rgb; //1/256 res + vec3 bloomTile0 = texture_bicubic(colortex3, bloomTileUV/2.).rgb; //1/4 res + vec3 bloomTile1 = texture_bicubic(colortex6, bloomTileUV/4.).rgb; //1/8 res + vec3 bloomTile2 = texture_bicubic(colortex6, bloomTileUV/8.+vec2(0.25*resScale.x+2.5*texelSize.x,.0)).rgb; //1/16 res + vec3 bloomTile3 = texture_bicubic(colortex6, bloomTileUV/16.+vec2(0.375*resScale.x+4.5*texelSize.x,.0)).rgb; //1/32 res + vec3 bloomTile4 = texture_bicubic(colortex6, bloomTileUV/32.+vec2(0.4375*resScale.x+6.5*texelSize.x,.0)).rgb; //1/64 res + vec3 bloomTile5 = texture_bicubic(colortex6, bloomTileUV/64.+vec2(0.46875*resScale.x+8.5*texelSize.x,.0)).rgb; //1/128 res + vec3 bloomTile6 = texture_bicubic(colortex6, bloomTileUV/128.+vec2(0.484375*resScale.x+10.5*texelSize.x,.0)).rgb; //1/256 res #ifdef OLD_BLOOM vec3 bloom = (bloomTile0 + bloomTile1 + bloomTile2 + bloomTile3 + bloomTile4 + bloomTile5 + bloomTile6) / 7.0; vec3 fogBloom = bloom; - float lightScat = clamp((BLOOM_STRENGTH+3) * 0.05 * pow(exposure.a, 0.2) ,0.0,1.0) * vignette; + float lightScat = clamp((BLOOM_STRENGTH+3.0) * 0.05 * pow(exposure.a, 0.2) ,0.0,1.0) * vignette; #else float weights[7] = float[]( 1.0, 1.0/2.0, 1.0/3.0, 1.0/5.5, 1.0/8.0, 1.0/10.0, 1.0/12.0 ); vec3 bloom = (bloomTile0*weights[0] + bloomTile1*weights[1] + bloomTile2*weights[2] + bloomTile3*weights[3] + bloomTile4*weights[4] + bloomTile5*weights[5] + bloomTile6*weights[6]) / bloomWeight(); @@ -287,7 +287,7 @@ void main() { float lightScat = clamp(BLOOM_STRENGTH * 0.3,0.0,1.0) * vignette; #endif - float VL_abs = texture2D(colortex7, texcoord*RENDER_SCALE).r; + float VL_abs = texture(colortex7, texcoord*RENDER_SCALE).r; float bloomyFog_Mult = BLOOMY_FOG; if(isEyeInWater == 1) bloomyFog_Mult = UNDERWATER_BLOOMY_FOG; @@ -301,7 +301,7 @@ void main() { float purkinje = clamp(rodExposureDepth.x/(1.0+rodExposureDepth.x)*pstrength,0,1); #endif - VL_abs = clamp((1.0-VL_abs)*bloomyFog_Mult*0.75*(1.0+rainStrength) * (1.0-purkinje*0.3),0.0,1.0)*clamp(1.0-pow(cdist(texcoord.xy),15.0),0.0,1.0); + VL_abs = clamp((1.0-VL_abs)*bloomyFog_Mult*0.75*(1.0+rainStrength) * (1.0-purkinje*0.3),0.0,1.0)*clamp(1.0-pow(cdist(texcoord),15.0),0.0,1.0); col = (mix(col, fogBloom, VL_abs) + bloom*lightScat) * exposure.rgb; float lum = dot(col, vec3(0.15,0.3,0.55)); @@ -311,7 +311,7 @@ void main() { col = mix(lum * vec3(Purkinje_R, Purkinje_G, Purkinje_B) * Purkinje_Multiplier, col, rodCurve); #else - VL_abs = clamp((1.0-VL_abs)*bloomyFog_Mult*0.75*(1.0+rainStrength),0.0,1.0)*clamp(1.0-pow(cdist(texcoord.xy),15.0),0.0,1.0); + VL_abs = clamp((1.0-VL_abs)*bloomyFog_Mult*0.75*(1.0+rainStrength),0.0,1.0)*clamp(1.0-pow(cdist(texcoord),15.0),0.0,1.0); col = (mix(col, fogBloom, VL_abs) + bloom*lightScat) * exposure.rgb; #endif @@ -351,7 +351,7 @@ void main() { float _far = far*4.0; if (depth >= 1.0) { - depth = texture2D(dhVoxyDepthTex, texcoord).x; + depth = texture(dhVoxyDepthTex, texcoord).x; _near = dhVoxyNearPlane; _far = dhVoxyFarPlane; } diff --git a/shaders/dimensions/composite10.vsh b/shaders/dimensions/composite10.vsh index 4c89120..892369c 100644 --- a/shaders/dimensions/composite10.vsh +++ b/shaders/dimensions/composite10.vsh @@ -1,6 +1,7 @@ #include "/lib/settings.glsl" -varying vec2 texcoord; +out vec2 texcoord; + //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// diff --git a/shaders/dimensions/composite11.fsh b/shaders/dimensions/composite11.fsh index 9de2aaf..0201586 100644 --- a/shaders/dimensions/composite11.fsh +++ b/shaders/dimensions/composite11.fsh @@ -1,6 +1,7 @@ #include "/lib/settings.glsl" -varying vec2 texcoord; +in vec2 texcoord; + uniform vec2 texelSize; uniform sampler2D colortex7; @@ -57,17 +58,17 @@ vec4 SampleTextureCatmullRom(sampler2D tex, vec2 uv, vec2 texSize ) texPos12 *= texelSize; vec4 result = vec4(0.0); - result += texture2D(tex, vec2(texPos0.x, texPos0.y)) * w0.x * w0.y; - result += texture2D(tex, vec2(texPos12.x, texPos0.y)) * w12.x * w0.y; - result += texture2D(tex, vec2(texPos3.x, texPos0.y)) * w3.x * w0.y; + result += texture(tex, vec2(texPos0.x, texPos0.y)) * w0.x * w0.y; + result += texture(tex, vec2(texPos12.x, texPos0.y)) * w12.x * w0.y; + result += texture(tex, vec2(texPos3.x, texPos0.y)) * w3.x * w0.y; - result += texture2D(tex, vec2(texPos0.x, texPos12.y)) * w0.x * w12.y; - result += texture2D(tex, vec2(texPos12.x, texPos12.y)) * w12.x * w12.y; - result += texture2D(tex, vec2(texPos3.x, texPos12.y)) * w3.x * w12.y; + result += texture(tex, vec2(texPos0.x, texPos12.y)) * w0.x * w12.y; + result += texture(tex, vec2(texPos12.x, texPos12.y)) * w12.x * w12.y; + result += texture(tex, vec2(texPos3.x, texPos12.y)) * w3.x * w12.y; - result += texture2D(tex, vec2(texPos0.x, texPos3.y)) * w0.x * w3.y; - result += texture2D(tex, vec2(texPos12.x, texPos3.y)) * w12.x * w3.y; - result += texture2D(tex, vec2(texPos3.x, texPos3.y)) * w3.x * w3.y; + result += texture(tex, vec2(texPos0.x, texPos3.y)) * w0.x * w3.y; + result += texture(tex, vec2(texPos12.x, texPos3.y)) * w12.x * w3.y; + result += texture(tex, vec2(texPos3.x, texPos3.y)) * w3.x * w3.y; return result; } @@ -106,10 +107,10 @@ vec3 colorGrading(vec3 color) { vec3 contrastAdaptiveSharpening(vec3 color, vec2 texcoord){ float sharpen_strength = float(SHARPENING)/100.0; //Weights : 1 in the center, 0.5 middle, 0.25 corners - vec3 albedoCurrent1 = texture2D(colortex7, texcoord + vec2(texelSize.x,texelSize.y)/MC_RENDER_QUALITY*0.5).rgb; - vec3 albedoCurrent2 = texture2D(colortex7, texcoord + vec2(texelSize.x,-texelSize.y)/MC_RENDER_QUALITY*0.5).rgb; - vec3 albedoCurrent3 = texture2D(colortex7, texcoord + vec2(-texelSize.x,-texelSize.y)/MC_RENDER_QUALITY*0.5).rgb; - vec3 albedoCurrent4 = texture2D(colortex7, texcoord + vec2(-texelSize.x,texelSize.y)/MC_RENDER_QUALITY*0.5).rgb; + vec3 albedoCurrent1 = texture(colortex7, texcoord + vec2(texelSize.x,texelSize.y)/MC_RENDER_QUALITY*0.5).rgb; + vec3 albedoCurrent2 = texture(colortex7, texcoord + vec2(texelSize.x,-texelSize.y)/MC_RENDER_QUALITY*0.5).rgb; + vec3 albedoCurrent3 = texture(colortex7, texcoord + vec2(-texelSize.x,-texelSize.y)/MC_RENDER_QUALITY*0.5).rgb; + vec3 albedoCurrent4 = texture(colortex7, texcoord + vec2(-texelSize.x,texelSize.y)/MC_RENDER_QUALITY*0.5).rgb; vec3 m1 = -0.5/3.5*color + albedoCurrent1/3.5 + albedoCurrent2/3.5 + albedoCurrent3/3.5 + albedoCurrent4/3.5; @@ -141,7 +142,7 @@ float interleaved_gradientNoise(){ return noise; } float blueNoise(){ - return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter); + return fract(texelFetch(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter); } vec3 chromaticAberration(vec2 UV){ @@ -154,9 +155,9 @@ vec3 chromaticAberration(vec2 UV){ float aberrationStrength = CHROMATIC_ABERRATION_STRENGTH * vignette; vec3 color = vec3(0.0); - color.r = texture2D(colortex7, (centeredUV - (centeredUV + centeredUV*noise) * aberrationStrength) + 0.5).r; - color.g = texture2D(colortex7, texcoord).g; - color.b = texture2D(colortex7, (centeredUV + (centeredUV + centeredUV*noise) * aberrationStrength) + 0.5).b; + color.r = texture(colortex7, (centeredUV - (centeredUV + centeredUV*noise) * aberrationStrength) + 0.5).r; + color.g = texture(colortex7, texcoord).g; + color.b = texture(colortex7, (centeredUV + (centeredUV + centeredUV*noise) * aberrationStrength) + 0.5).b; return color; } @@ -168,7 +169,7 @@ void main() { #ifdef CHROMATIC_ABERRATION vec3 color = chromaticAberration(texcoord); #else - vec3 color = texture2D(colortex7,texcoord).rgb; + vec3 color = texture(colortex7,texcoord).rgb; #endif #if SHARPENING > 0 diff --git a/shaders/dimensions/composite11.vsh b/shaders/dimensions/composite11.vsh index eccbe10..8f1b8a8 100644 --- a/shaders/dimensions/composite11.vsh +++ b/shaders/dimensions/composite11.vsh @@ -1,7 +1,6 @@ #include "/lib/settings.glsl" -varying vec2 texcoord; - +out vec2 texcoord; //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// diff --git a/shaders/dimensions/composite2.fsh b/shaders/dimensions/composite2.fsh index 0fa355c..a4cb353 100644 --- a/shaders/dimensions/composite2.fsh +++ b/shaders/dimensions/composite2.fsh @@ -34,9 +34,12 @@ uniform sampler2D colortex7; uniform sampler2D colortex10; uniform sampler2D colortex14; -flat varying vec3 WsunVec; -flat varying vec3 WrealSunVec; -flat varying vec3 WmoonVec; +in DATA { + flat vec3 WsunVec; + flat vec3 WrealSunVec; + flat vec3 WmoonVec; +}; + uniform vec3 sunVec; uniform float sunElevation; @@ -60,9 +63,7 @@ uniform vec3 relativeEyePosition; uniform int frameCounter; uniform float frameTimeCounter; -// varying vec2 texcoord; uniform vec2 texelSize; -flat varying vec2 TAA_Offset; uniform int isEyeInWater; uniform float rainStrength; @@ -243,7 +244,7 @@ float interleaved_gradientNoise(){ } float blueNoise(){ - return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter ); + return fract(texelFetch(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter ); } float R2_dither(){ @@ -359,17 +360,17 @@ vec4 waterVolumetrics(vec3 rayStart, vec3 rayEnd, float rayLength, vec2 dither, vec3 pos = vec3(spPos.xy*distortFactor, spPos.z); if (abs(pos.x) < 1.0-0.5/2048. && abs(pos.y) < 1.0-0.5/2048){ pos = pos*vec3(0.5,0.5,0.5/6.0)+0.5; - // sh = shadow2D( shadow, pos).x; + // sh = texture( shadow, pos).x; #ifdef TRANSLUCENT_COLORED_SHADOWS - sh = vec3(shadow2D(shadowtex0, pos).x); + sh = vec3(texture(shadowtex0, pos).x); - if(shadow2D(shadowtex1, pos).x > pos.z && sh.x < 1.0){ - vec4 translucentShadow = texture2D(shadowcolor0, pos.xy); + if(texture(shadowtex1, pos).x > pos.z && sh.x < 1.0){ + vec4 translucentShadow = texture(shadowcolor0, pos.xy); if(translucentShadow.a < 0.9) sh = normalize(translucentShadow.rgb+0.0001); } #else - sh = vec3(shadow2D(shadow, pos).x); + sh = vec3(texture(shadow, pos).x); #endif } @@ -400,7 +401,7 @@ vec4 waterVolumetrics(vec3 rayStart, vec3 rayEnd, float rayLength, vec2 dither, } vec4 blueNoise(vec2 coord){ - return texelFetch2D(colortex6, ivec2(coord)%512 , 0) ; + return texelFetch(colortex6, ivec2(coord)%512 , 0) ; } vec2 R2_samples(int n){ vec2 alpha = vec2(0.75487765, 0.56984026); @@ -502,10 +503,10 @@ float godrayTest( in vec3 viewPos, in vec3 lightDir, float noise, float vanillad for (int i = 0; i < int(samples); i++) { newPos.xy = clamp(newPos.xy, screenEdges, 1.0-screenEdges); - float sampleDepth = invLinZ(sqrt(texelFetch2D(colortex4, ivec2(newPos.xy/texelSize/4.0),0).a/65000.0)); + float sampleDepth = invLinZ(sqrt(texelFetch(colortex4, ivec2(newPos.xy/texelSize/4.0),0).a/65000.0)); #ifdef DISTANT_HORIZONS - if(depthCheck) sampleDepth = texelFetch2D(dhDepthTex1, ivec2(newPos.xy/texelSize),0).x; + if(depthCheck) sampleDepth = texelFetch(dhDepthTex1, ivec2(newPos.xy/texelSize),0).x; #endif godrays += (swapperlinZ(sampleDepth, _near, _far) > 1.0 ? 1.0 : lightRange); @@ -578,17 +579,17 @@ vec4 waterVolumetrics_alt( vec3 rayStart, vec3 rayEnd, float estEndDepth, float vec3 pos = vec3(spPos.xy*distortFactor, spPos.z); if (abs(pos.x) < 1.0-0.5/2048. && abs(pos.y) < 1.0-0.5/2048.){ pos = pos*vec3(0.5,0.5,0.5/6.0)+0.5; - // sh = shadow2D( shadow, pos).x; + // sh = texture( shadow, pos).x; #ifdef TRANSLUCENT_COLORED_SHADOWS - sh2 *= vec3(shadow2D(shadowtex0, pos).x); + sh2 *= vec3(texture(shadowtex0, pos).x); - if(shadow2D(shadowtex1, pos).x > pos.z && sh2.x < 1.0){ - vec4 translucentShadow = texture2D(shadowcolor0, pos.xy); + if(texture(shadowtex1, pos).x > pos.z && sh2.x < 1.0){ + vec4 translucentShadow = texture(shadowcolor0, pos.xy); if(translucentShadow.a < 0.9) sh2 = normalize(translucentShadow.rgb+0.0001); } #else - sh2 *= vec3(shadow2D(shadow, pos).x); + sh2 *= vec3(texture(shadow, pos).x); #endif } #endif @@ -641,21 +642,21 @@ void main() { vec2 tc = floor(gl_FragCoord.xy)/VL_RENDER_SCALE*texelSize + texelSize*0.5; // vec2 tc = (gl_FragCoord.xy - 0.5)/VL_RENDER_SCALE*texelSize; - // bool iswater = texture2D(colortex7,tc).a > 0.99; + // bool iswater = texture(colortex7,tc).a > 0.99; ivec2 texcoord = ivec2(tc/texelSize); - float alpha = texelFetch2D(colortex7,texcoord,0).a ; - float blendedAlpha = texelFetch2D(colortex2, texcoord,0).a; + float alpha = texelFetch(colortex7,texcoord,0).a ; + float blendedAlpha = texelFetch(colortex2, texcoord,0).a; bool iswater = alpha > 0.99; - float z0 = texelFetch2D(depthtex0, texcoord,0).x; + float z0 = texelFetch(depthtex0, texcoord,0).x; // z0 = depth < 0.56 ? convertHandDepth(depth) : depth; #if defined DISTANT_HORIZONS || defined VOXY - float DH_z0 = texelFetch2D(dhVoxyDepthTex, texcoord,0).x; + float DH_z0 = texelFetch(dhVoxyDepthTex, texcoord,0).x; #else float DH_z0 = 0.0; #endif @@ -716,7 +717,7 @@ void main() { bool eyeInWater = isEyeInWater == 1; if (eyeInWater){ - vec4 underWaterFog = waterVolumetrics(vec3(0.0), viewPos0, length(viewPos0), vec2(noise_1), totEpsilon, scatterCoef, indirectLightColor_dynamic, directLightColor, dot(normalize(viewPos0), normalize(sunVec * lightSourceCheck)), LPV_ILLUMINATION.rgb); + vec4 underWaterFog = waterVolumetrics(vec3(0.0), viewPos0, length(viewPos0), vec2(noise_1, BN.y), totEpsilon, scatterCoef, indirectLightColor_dynamic, directLightColor, dot(normalize(viewPos0), normalize(sunVec * lightSourceCheck)), LPV_ILLUMINATION.rgb); VolumetricFog = vec4(underWaterFog.rgb, 1.0); } else { #ifdef OVERWORLD_SHADER @@ -727,8 +728,8 @@ void main() { #endif #ifdef CAVE_FOG - #if (CAVE_DETECTION == 0.0) || (CAVE_DETECTION == 1.0) - #if (CAVE_DETECTION == 1.0) + #if CAVE_DETECTION == 0.0 || CAVE_DETECTION == 1.0 + #if CAVE_DETECTION == 1.0 float caveFactor = 1.0-smoothstep(60.0, 63.0, cameraPosition.y); #else float caveFactor = 1.0; @@ -742,7 +743,7 @@ void main() { VolumetricClouds.a = mix(VolumetricClouds.a, 1.0, skyhole); #endif - // vec3 sceneColor = texelFetch2D(colortex3,texcoord,0).rgb * VolumetricClouds.a + VolumetricClouds.rgb; + // vec3 sceneColor = texelFetch(colortex3,texcoord,0).rgb * VolumetricClouds.a + VolumetricClouds.rgb; VolumetricFog = GetVolumetricFog(viewPos0, WsunVec, BN, directLightColor, indirectLight_fog, indirectLightColor_dynamic, cloudPlaneDistance); #if defined LPV_VL_FOG_ILLUMINATION && defined IS_LPV_ENABLED @@ -782,16 +783,16 @@ void main() { if(blendedAlpha > 0.0 || iswater){ #ifdef OVERWORLD_SHADER - vec2 lightmap = decodeVec2(texelFetch2D(colortex14,texcoord,0).z); + vec2 lightmap = decodeVec2(texelFetch(colortex14,texcoord,0).z); #else - vec2 lightmap = decodeVec2(texelFetch2D(colortex14,texcoord,0).z); + vec2 lightmap = decodeVec2(texelFetch(colortex14,texcoord,0).z); lightmap.y = 1.0; #endif - float z1 = texelFetch2D(depthtex1, texcoord,0).x; + float z1 = texelFetch(depthtex1, texcoord,0).x; #if defined DISTANT_HORIZONS || defined VOXY - float DH_z1 = texelFetch2D(dhVoxyDepthTex1, texcoord,0).x; + float DH_z1 = texelFetch(dhVoxyDepthTex1, texcoord,0).x; #else float DH_z1 = 0.0; #endif diff --git a/shaders/dimensions/composite2.vsh b/shaders/dimensions/composite2.vsh index 3cc90c3..8f2e1dd 100644 --- a/shaders/dimensions/composite2.vsh +++ b/shaders/dimensions/composite2.vsh @@ -2,16 +2,18 @@ #include "/lib/util.glsl" #include "/lib/res_params.glsl" -#ifdef CUSTOM_MOON_ROTATION +#if defined CUSTOM_MOON_ROTATION && defined OVERWORLD_SHADER #include "/lib/SSBOs.glsl" #endif #include "/lib/scene_controller.glsl" -flat varying vec3 WsunVec; -flat varying vec3 WrealSunVec; -flat varying vec3 WmoonVec; +out DATA { + flat vec3 WsunVec; + flat vec3 WrealSunVec; + flat vec3 WmoonVec; +}; uniform vec2 texelSize; @@ -24,7 +26,6 @@ uniform mat4 gbufferModelViewInverse; uniform int frameCounter; -flat varying vec2 TAA_Offset; uniform int framemod8; #include "/lib/TAA_jitter.glsl" @@ -77,11 +78,4 @@ void main() { WsunVec = vec3(0.0, 1.0, 0.0); WrealSunVec = vec3(0.0, 1.0, 0.0); #endif - - #ifdef TAA - TAA_Offset = offsets[framemod8]; - #else - TAA_Offset = vec2(0.0); - #endif - } diff --git a/shaders/dimensions/composite3.fsh b/shaders/dimensions/composite3.fsh index f732ad1..c0b6c02 100644 --- a/shaders/dimensions/composite3.fsh +++ b/shaders/dimensions/composite3.fsh @@ -2,11 +2,12 @@ #include "/lib/SSBOs.glsl" -flat varying vec3 zMults; - -flat varying vec2 TAA_Offset; -flat varying vec3 WsunVec; -flat varying vec3 WmoonVec; +#ifdef OVERWORLD_SHADER + in DATA { + flat vec3 WsunVec; + flat vec3 WmoonVec; + }; +#endif uniform sampler2D noisetex; uniform sampler2D depthtex0; @@ -126,9 +127,9 @@ uniform float eyeAltitude; #define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z) #define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz) -float ld(float depth) { - return 1.0 / (zMults.y - depth * zMults.z); // (-depth * (far - near)) = (2.0 * near)/ld - far - near -} +// float ld(float depth) { +// return 1.0 / (zMults.y - depth * zMults.z); // (-depth * (far - near)) = (2.0 * near)/ld - far - near +// } float convertHandDepth(float depth) { float ndcDepth = depth * 2.0 - 1.0; @@ -184,14 +185,14 @@ float R2_dither(){ float blueNoise(){ #ifdef TAA - return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter); + return fract(texelFetch(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter); #else - return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887); + return fract(texelFetch(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887); #endif } vec4 blueNoise(vec2 coord){ - return texelFetch2D(colortex6, ivec2(coord)%512 , 0) ; + return texelFetch(colortex6, ivec2(coord)%512 , 0) ; } vec3 normVec (vec3 vec){ @@ -285,31 +286,31 @@ vec3 doRefractionEffect( inout vec2 passTexcoord, vec2 normal, float linearDista #if FAKE_DISPERSION_AMOUNT > 0 // do not offset texcoord if alpha is 1.0 - refractAmount *= min( decodeVec2(texelFetch2D(colortex11, ivec2(clampUV(texcoord - ((normal + dispersion) + smudge)*refractAmount, texcoord)/texelSize),0).b).g, - decodeVec2(texelFetch2D(colortex11, ivec2(clampUV(texcoord - ((normal - dispersion) + smudge)*refractAmount, texcoord)/texelSize),0).b).g ) > 0.0 ? 1.0 : 0.0; + refractAmount *= min( decodeVec2(texelFetch(colortex11, ivec2(clampUV(texcoord - ((normal + dispersion) + smudge)*refractAmount, texcoord)/texelSize),0).b).g, + decodeVec2(texelFetch(colortex11, ivec2(clampUV(texcoord - ((normal - dispersion) + smudge)*refractAmount, texcoord)/texelSize),0).b).g ) > 0.0 ? 1.0 : 0.0; // create offsets vec2 offsetTexcoord = clampUV(texcoord - (normal + smudge)*refractAmount, texcoord); passTexcoord = offsetTexcoord; // sample color with offsetted texcoord. in this case, the red and blue channels have offsets in opposite directions for a dispersion effect. - color.g = texture2D(colortex3, offsetTexcoord).g; + color.g = texture(colortex3, offsetTexcoord).g; offsetTexcoord = clampUV(texcoord - ((normal + dispersion) + smudge)*refractAmount, texcoord); - color.r = texture2D(colortex3, offsetTexcoord).r; + color.r = texture(colortex3, offsetTexcoord).r; offsetTexcoord = clampUV(texcoord - ((normal - dispersion) + smudge)*refractAmount, texcoord); - color.b = texture2D(colortex3, offsetTexcoord).b; + color.b = texture(colortex3, offsetTexcoord).b; #else // do not offset texcoord if alpha is 1.0 - refractAmount *= decodeVec2(texelFetch2D(colortex11, ivec2(clampUV(texcoord - (normal + smudge)*refractAmount, texcoord)/texelSize),0).b).g > 0.0 ? 1.0 : 0.0; + refractAmount *= decodeVec2(texelFetch(colortex11, ivec2(clampUV(texcoord - (normal + smudge)*refractAmount, texcoord)/texelSize),0).b).g > 0.0 ? 1.0 : 0.0; // create offsets vec2 offsetTexcoord = clampUV(texcoord - (normal + smudge)*refractAmount, texcoord); passTexcoord = offsetTexcoord; // sample color with distorted texcoords - color.rgb = texture2D(colortex3, offsetTexcoord).rgb; + color.rgb = texture(colortex3, offsetTexcoord).rgb; #endif return color; @@ -370,18 +371,18 @@ vec4 bilateralUpsample(vec2 fragcoord, sampler2D colortex, out float outerEdgeRe #if defined DISTANT_HORIZONS || defined VOXY float offsetDepth; if(!behindTranslucents) { - offsetDepth = sqrt(texelFetch2D(depth, UV_DEPTH + (OFFSET[i] + UV_NOISE) * SCALE,0).z/65000.0); + offsetDepth = sqrt(texelFetch(depth, UV_DEPTH + (OFFSET[i] + UV_NOISE) * SCALE,0).z/65000.0); } else { - offsetDepth = sqrt(texelFetch2D(depth, UV_DEPTH + (OFFSET[i] + UV_NOISE) * SCALE,0).a/65000.0); + offsetDepth = sqrt(texelFetch(depth, UV_DEPTH + (OFFSET[i] + UV_NOISE) * SCALE,0).a/65000.0); } #else - float offsetDepth = linearize(texelFetch2D(depth, UV_DEPTH + (OFFSET[i] + UV_NOISE) * SCALE, 0).r); + float offsetDepth = linearize(texelFetch(depth, UV_DEPTH + (OFFSET[i] + UV_NOISE) * SCALE, 0).r); #endif float edgeDiff = abs(offsetDepth - referenceDepth) < threshold ? 1.0 : 1e-7; outerEdgeResults = max(outerEdgeResults, abs(referenceDepth - offsetDepth)); - vec4 offsetColor = texelFetch2D(colortex, UV_COLOR + OFFSET[i] + UV_NOISE, 0).rgba; + vec4 offsetColor = texelFetch(colortex, UV_COLOR + OFFSET[i] + UV_NOISE, 0).rgba; colorSum += offsetColor*edgeDiff; edgeSum += edgeDiff; @@ -405,7 +406,7 @@ vec4 VLTemporalFiltering(vec3 viewPos, in float referenceDepth, sampler2D depth, vec2 velocity = previousPosition.xy - offsetTexcoord; previousPosition.xy = offsetTexcoord + velocity; - vec4 currentFrame = texture2D(colortex0, VLtexCoord); + vec4 currentFrame = texture(colortex0, VLtexCoord); // return vec4(outerEdgeResults,0,0,1); // return upsampledCurrentFrame; @@ -418,19 +419,19 @@ vec4 VLTemporalFiltering(vec3 viewPos, in float referenceDepth, sampler2D depth, vec4 upsampledCurrentFrame = bilateralUpsample(gl_FragCoord.xy , colortex0, outerEdgeResults, referenceDepth, depth, hand, false); // vec4 upsampledCurrentFrame = BilateralUpscale(colortex0, depth, gl_FragCoord.xy - 1.5, referenceDepth); - vec4 col1 = texture2D(colortex0, VLtexCoord + vec2( texelSize.x, texelSize.y)); - vec4 col2 = texture2D(colortex0, VLtexCoord + vec2( texelSize.x, -texelSize.y)); - vec4 col3 = texture2D(colortex0, VLtexCoord + vec2(-texelSize.x, -texelSize.y)); - vec4 col4 = texture2D(colortex0, VLtexCoord + vec2(-texelSize.x, texelSize.y)); - vec4 col5 = texture2D(colortex0, VLtexCoord + vec2( 0.0, texelSize.y)); - vec4 col6 = texture2D(colortex0, VLtexCoord + vec2( 0.0, -texelSize.y)); - vec4 col7 = texture2D(colortex0, VLtexCoord + vec2(-texelSize.x, 0.0)); - vec4 col8 = texture2D(colortex0, VLtexCoord + vec2( texelSize.x, 0.0)); + vec4 col1 = texture(colortex0, VLtexCoord + vec2( texelSize.x, texelSize.y)); + vec4 col2 = texture(colortex0, VLtexCoord + vec2( texelSize.x, -texelSize.y)); + vec4 col3 = texture(colortex0, VLtexCoord + vec2(-texelSize.x, -texelSize.y)); + vec4 col4 = texture(colortex0, VLtexCoord + vec2(-texelSize.x, texelSize.y)); + vec4 col5 = texture(colortex0, VLtexCoord + vec2( 0.0, texelSize.y)); + vec4 col6 = texture(colortex0, VLtexCoord + vec2( 0.0, -texelSize.y)); + vec4 col7 = texture(colortex0, VLtexCoord + vec2(-texelSize.x, 0.0)); + vec4 col8 = texture(colortex0, VLtexCoord + vec2( texelSize.x, 0.0)); vec4 colMax = max(currentFrame,max(col1,max(col2,max(col3, max(col4, max(col5, max(col6, max(col7, col8)))))))); vec4 colMin = min(currentFrame,min(col1,min(col2,min(col3, min(col4, min(col5, min(col6, min(col7, col8)))))))); - vec4 frameHistory = texture2D(colortex10, previousPosition.xy*RENDER_SCALE); + vec4 frameHistory = texture(colortex10, previousPosition.xy*RENDER_SCALE); vec4 clampedFrameHistory = clamp(frameHistory, colMin, colMax); float blendingFactor = 0.1; @@ -545,7 +546,7 @@ void main() { ////// --------------- SETUP STUFF --------------- ////// vec2 texcoord = gl_FragCoord.xy*texelSize; - float depth = texelFetch2D(depthtex0, ivec2(gl_FragCoord.xy),0).x; + float depth = texelFetch(depthtex0, ivec2(gl_FragCoord.xy),0).x; bool hand = depth < 0.56; float z = depth; @@ -554,7 +555,7 @@ void main() { float swappedDepth = z; #if defined DISTANT_HORIZONS || defined VOXY - float DH_depth0 = texelFetch2D(dhVoxyDepthTex, ivec2(gl_FragCoord.xy),0).x; + float DH_depth0 = texelFetch(dhVoxyDepthTex, ivec2(gl_FragCoord.xy),0).x; float depthOpaque = z; float depthOpaqueL = linearizeDepthFast(depthOpaque, near, farPlane); @@ -575,12 +576,12 @@ void main() { bool isSky = swappedDepth >= 1.0; #if !defined DISTANT_HORIZONS && !defined VOXY || (AURORA_LOCATION > 0 && defined OVERWORLD_SHADER) - float z2 = texelFetch2D(depthtex1, ivec2(gl_FragCoord.xy),0).x; + float z2 = texelFetch(depthtex1, ivec2(gl_FragCoord.xy),0).x; #endif #if AURORA_LOCATION > 0 && defined OVERWORLD_SHADER #if defined DISTANT_HORIZONS || defined VOXY - float DH_depth1 = texelFetch2D(dhVoxyDepthTex, ivec2(gl_FragCoord.xy),0).x; + float DH_depth1 = texelFetch(dhVoxyDepthTex, ivec2(gl_FragCoord.xy),0).x; bool isSkyTranslucent = z2 >= 1.0 && DH_depth1 >= 1.0; #else bool isSkyTranslucent = z2 >= 1.0; @@ -604,11 +605,11 @@ void main() { // float lightleakfixfast = clamp(eyeBrightness.y/240.,0.0,1.0); ////// --------------- UNPACK OPAQUE GBUFFERS --------------- ////// - // float opaqueMasks = decodeVec2(texture2D(colortex1,texcoord).a).y; + // float opaqueMasks = decodeVec2(texture(colortex1,texcoord).a).y; // bool isOpaque_entity = abs(opaqueMasks-0.45) < 0.01; ////// --------------- UNPACK TRANSLUCENT GBUFFERS --------------- ////// - vec4 data = texelFetch2D(colortex11,ivec2(texcoord/texelSize),0).rgba; + vec4 data = texelFetch(colortex11,ivec2(texcoord/texelSize),0).rgba; vec4 unpack0 = vec4(decodeVec2(data.r),decodeVec2(data.g)) ; vec4 unpack1 = vec4(decodeVec2(data.b),decodeVec2(data.a)) ; @@ -625,7 +626,7 @@ void main() { // 0.9 = entity mask // 0.8 = reflective entities // 0.7 = reflective blocks - float translucentMasks = texelFetch2D(colortex7, ivec2(gl_FragCoord.xy),0).a; + float translucentMasks = texelFetch(colortex7, ivec2(gl_FragCoord.xy),0).a; bool isWater = translucentMasks > 0.99; bool isReflectiveEntity = abs(translucentMasks - 0.8) < 0.01; @@ -634,7 +635,7 @@ void main() { ////// --------------- get volumetrics #if defined DISTANT_HORIZONS || defined VOXY - float DH_mixedLinearZ = sqrt(texelFetch2D(colortex12,ivec2(gl_FragCoord.xy),0).z/65000.0); + float DH_mixedLinearZ = sqrt(texelFetch(colortex12,ivec2(gl_FragCoord.xy),0).z/65000.0); vec4 temporallyFilteredVL = VLTemporalFiltering(viewPos, DH_mixedLinearZ, colortex12, hand); #else vec4 temporallyFilteredVL = VLTemporalFiltering(viewPos, frDepth, depthtex0, hand); @@ -649,7 +650,7 @@ void main() { #if FAKE_REFRACTION_AMOUNT > 0 vec3 color = doRefractionEffect(refractedCoord, tangentNormals.xy, linearDistance, isReflectiveEntity, isWater && isEyeInWater == 1); #else - vec3 color = texture2D(colortex3, texcoord).rgb; + vec3 color = texture(colortex3, texcoord).rgb; #endif ////// --------------- lightning effect @@ -705,61 +706,61 @@ void main() { // TODO: There has to be a better way to do this............. if (randomTex < 1.0) { - lightningTex = texture2D(lightningTex1, uv); + lightningTex = texture(lightningTex1, uv); } else if (randomTex < 2.0) { - lightningTex = texture2D(lightningTex2, uv); + lightningTex = texture(lightningTex2, uv); } else if (randomTex < 3.0) { u = 1.3*dot(dirDiff, tangent) + 0.5/uvScalar; uv = vec2(u, v) * uvScalar; - lightningTex = texture2D(lightningTex3, uv); + lightningTex = texture(lightningTex3, uv); } else if (randomTex < 4.0) { - lightningTex = texture2D(lightningTex4, uv); + lightningTex = texture(lightningTex4, uv); } else if (randomTex < 5.0) { - lightningTex = texture2D(lightningTex5, uv); + lightningTex = texture(lightningTex5, uv); } else if (randomTex < 6.0) { u = 1.25*dot(dirDiff, tangent) + 0.5/uvScalar; uv = vec2(u, v) * uvScalar; - lightningTex = texture2D(lightningTex6, uv); + lightningTex = texture(lightningTex6, uv); } else if (randomTex < 7.0) { - lightningTex = texture2D(lightningTex7, uv); + lightningTex = texture(lightningTex7, uv); } else if (randomTex < 8.0) { - lightningTex = texture2D(lightningTex8, uv); + lightningTex = texture(lightningTex8, uv); } else if (randomTex < 9.0) { u = 1.4*dot(dirDiff, tangent) + 0.5/uvScalar; uv = vec2(u, v) * uvScalar; - lightningTex = texture2D(lightningTex9, uv); + lightningTex = texture(lightningTex9, uv); } else if (randomTex < 10.0) { - lightningTex = texture2D(lightningTex10, uv); + lightningTex = texture(lightningTex10, uv); } else if (randomTex < 11.0) { u = 0.5*dot(dirDiff, tangent)+0.5/uvScalar; v = 0.7*dot(dirDiff, binormal) + 0.5/uvScalar; uv = vec2(u, v) * uvScalar; - lightningTex = texture2D(lightningTex11, uv); + lightningTex = texture(lightningTex11, uv); } else if (randomTex < 12.0) { u = 0.45*dot(dirDiff, tangent)+0.5/uvScalar; v = 0.7*dot(dirDiff, binormal) + 0.5/uvScalar; uv = vec2(u, v) * uvScalar; - lightningTex = texture2D(lightningTex12, uv); + lightningTex = texture(lightningTex12, uv); } else if (randomTex < 13.0) { u = 0.45*dot(dirDiff, tangent)+0.5/uvScalar; v = 0.7*dot(dirDiff, binormal) + 0.5/uvScalar; uv = vec2(u, v) * uvScalar; - lightningTex = texture2D(lightningTex13, uv); + lightningTex = texture(lightningTex13, uv); } else if (randomTex < 14.0) { u = 0.5*dot(dirDiff, tangent)+0.5/uvScalar; v = 0.7*dot(dirDiff, binormal) + 0.5/uvScalar; uv = vec2(u, v) * uvScalar; - lightningTex = texture2D(lightningTex14, uv); + lightningTex = texture(lightningTex14, uv); } else if (randomTex < 15.0) { u = 0.45*dot(dirDiff, tangent)+0.5/uvScalar; v = 0.7*dot(dirDiff, binormal) + 0.5/uvScalar; uv = vec2(u, v) * uvScalar; - lightningTex = texture2D(lightningTex15, uv); + lightningTex = texture(lightningTex15, uv); } else { u = 0.4*dot(dirDiff, tangent)+0.5/uvScalar; v = 0.7*dot(dirDiff, binormal) + 0.5/uvScalar; uv = vec2(u, v) * uvScalar; - lightningTex = texture2D(lightningTex16, uv); + lightningTex = texture(lightningTex16, uv); } lightningTex.rgb *= vec3(CUSTOM_LIGHTNING_R, CUSTOM_LIGHTNING_G, CUSTOM_LIGHTNING_B) * CUMULONIMBUS_LIGHTNING_BRIGHTNESS * 0.01; @@ -796,14 +797,14 @@ void main() { ////// --------------- get volumetrics behind translucents float blank = 0.0; #if defined DISTANT_HORIZONS || defined VOXY - DH_mixedLinearZ = sqrt(texelFetch2D(colortex12,ivec2(gl_FragCoord.xy),0).a/65000.0); + DH_mixedLinearZ = sqrt(texelFetch(colortex12,ivec2(gl_FragCoord.xy),0).a/65000.0); vec4 VLBehindTranslucents = bilateralUpsample(refractedCoord/texelSize, colortex13, blank, DH_mixedLinearZ, colortex12, hand, true); #else - vec4 VLBehindTranslucents = bilateralUpsample(refractedCoord/texelSize, colortex13, blank, linearize(texelFetch2D(depthtex1, ivec2(refractedCoord/texelSize),0).x), depthtex1, hand, true); + vec4 VLBehindTranslucents = bilateralUpsample(refractedCoord/texelSize, colortex13, blank, linearize(texelFetch(depthtex1, ivec2(refractedCoord/texelSize),0).x), depthtex1, hand, true); #endif ////// --------------- START BLENDING FOGS AND FORWARD RENDERED COLOR - vec4 TranslucentShader = texture2D(colortex2, texcoord); + vec4 TranslucentShader = texelFetch(colortex2, ivec2(gl_FragCoord.xy), 0); bool translucentCheck = TranslucentShader.a > 0.0 && TranslucentShader.a < 1.0; @@ -890,9 +891,9 @@ void main() { #else float clippingDistance = 4.0 * far; #endif - #if RAINBOW_DISTANCE > 0.99999*clippingDistance + if (RAINBOW_DISTANCE > 0.99999*clippingDistance) { if (linearDistance > 0.99999*clippingDistance) linearDistance = 1.1 * RAINBOW_DISTANCE; // allow rainbow distances greater than clipping distance - #endif + } float angleFromSun = degrees(acos(cosAngle)); float rainbowHue = 1.0 - smoothstep(41.4, 44.0, angleFromSun); // remove the red at the bottom @@ -917,7 +918,7 @@ void main() { // (bloomy) rain effect #ifdef OVERWORLD_SHADER #if RAIN_MODE == 0 // brighten the color behind - float rainDrops = texelFetch2D(colortex9,ivec2(texcoord/texelSize),0).a; + float rainDrops = texelFetch(colortex9,ivec2(texcoord/texelSize),0).a; if(hand) rainDrops *= (1.0-TranslucentShader.a); if(rainDrops > 0.01) { @@ -925,7 +926,7 @@ void main() { color.rgb += color.rgb * RAIN_BRIGHTNESS * rainDrops; } #else // add albedo of weather particle - vec4 rainDrops = texelFetch2D(colortex9,ivec2(texcoord/texelSize),0); + vec4 rainDrops = texelFetch(colortex9,ivec2(texcoord/texelSize),0); if(hand) rainDrops.a *= (1.0-TranslucentShader.a); if(rainDrops.a > 0.01) { @@ -938,7 +939,7 @@ void main() { ////// --------------- FINALIZE #ifdef display_LUT float zoomLevel = 2.0; - vec3 thingy = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy/zoomLevel),0).rgb /1200.0; + vec3 thingy = texelFetch(colortex4,ivec2(gl_FragCoord.xy/zoomLevel),0).rgb /1200.0; if(luma(thingy) > 0.0){ color.rgb = thingy; @@ -956,7 +957,7 @@ void main() { gl_FragData[1].rgb = clamp(color.rgb, 0.0,68000.0); // gl_FragData[1].rgb = vec3(tangentNormals.xy,0.0) * 0.1 ; - // gl_FragData[1].rgb = vec3(1.0) * ld( (data.a > 0.0 ? data.a : texture2D(depthtex0, texcoord).x ) ) ; + // gl_FragData[1].rgb = vec3(1.0) * ld( (data.a > 0.0 ? data.a : texture(depthtex0, texcoord).x ) ) ; // gl_FragData[1].rgb = gl_FragData[1].rgb * (1.0-TranslucentShader.a) + TranslucentShader.rgb*10.0; // gl_FragData[1].rgb = 1-(texcoord.x > 0.5 ? vec3(TranslucentShader.a) : vec3(data.a)); diff --git a/shaders/dimensions/composite3.vsh b/shaders/dimensions/composite3.vsh index 0d58c4c..d311477 100644 --- a/shaders/dimensions/composite3.vsh +++ b/shaders/dimensions/composite3.vsh @@ -2,16 +2,17 @@ #include "/lib/SSBOs.glsl" -varying vec2 texcoord; -flat varying vec3 zMults; - #if defined BorderFog || (defined CUMULONIMBUS_LIGHTNING && CUMULONIMBUS) > 0 uniform sampler2D colortex4; #include "/lib/scene_controller.glsl" #endif -flat varying vec3 WsunVec; -flat varying vec3 WmoonVec; +#ifdef OVERWORLD_SHADER + out DATA { + flat vec3 WsunVec; + flat vec3 WmoonVec; + }; +#endif uniform float far; uniform float near; @@ -22,7 +23,6 @@ uniform mat4 gbufferModelViewInverse; uniform vec3 sunPosition; uniform vec3 moonPosition; uniform float sunElevation; -flat varying vec2 TAA_Offset; uniform int framemod8; #include "/lib/TAA_jitter.glsl" @@ -55,13 +55,5 @@ void main() { #endif #endif - #ifdef TAA - TAA_Offset = offsets[framemod8]; - #else - TAA_Offset = vec2(0.0); - #endif - zMults = vec3(1.0/(far * near),far+near,far-near); - gl_Position = ftransform(); - texcoord = gl_MultiTexCoord0.xy; } diff --git a/shaders/dimensions/composite4.fsh b/shaders/dimensions/composite4.fsh index 7da0a73..b7e4966 100644 --- a/shaders/dimensions/composite4.fsh +++ b/shaders/dimensions/composite4.fsh @@ -23,45 +23,45 @@ void main() { vec2 jitter = offsets[framemod8]*texelSize*0.5; ivec2 center = ivec2(clamp(gl_FragCoord.xy*texelSize, screenEdges, 1.0-screenEdges)/texelSize); - // vec3 current = texelFetch2D(colortex3, center, 0).rgb; + // vec3 current = texelFetch(colortex3, center, 0).rgb; // vec3 cMin = current; // vec3 cMax = current; - // current = texelFetch2D(colortex3, center + ivec2(-1, -1), 0).rgb; + // current = texelFetch(colortex3, center + ivec2(-1, -1), 0).rgb; // cMin = min(cMin, current); // cMax = max(cMax, current); - // current = texelFetch2D(colortex3, center + ivec2(-1, 0), 0).rgb; + // current = texelFetch(colortex3, center + ivec2(-1, 0), 0).rgb; // cMin = min(cMin, current); // cMax = max(cMax, current); - // current = texelFetch2D(colortex3, center + ivec2(-1, 1), 0).rgb; + // current = texelFetch(colortex3, center + ivec2(-1, 1), 0).rgb; // cMin = min(cMin, current); // cMax = max(cMax, current); - // current = texelFetch2D(colortex3, center + ivec2(0, -1), 0).rgb; + // current = texelFetch(colortex3, center + ivec2(0, -1), 0).rgb; // cMin = min(cMin, current); // cMax = max(cMax, current); - // current = texelFetch2D(colortex3, center + ivec2(0, 1), 0).rgb; + // current = texelFetch(colortex3, center + ivec2(0, 1), 0).rgb; // cMin = min(cMin, current); // cMax = max(cMax, current); - // current = texelFetch2D(colortex3, center + ivec2(1, -1), 0).rgb; + // current = texelFetch(colortex3, center + ivec2(1, -1), 0).rgb; // cMin = min(cMin, current); // cMax = max(cMax, current); - // current = texelFetch2D(colortex3, center + ivec2(1, 0), 0).rgb; + // current = texelFetch(colortex3, center + ivec2(1, 0), 0).rgb; // cMin = min(cMin, current); // cMax = max(cMax, current); - // current = texelFetch2D(colortex3, center + ivec2(1, 1), 0).rgb; + // current = texelFetch(colortex3, center + ivec2(1, 1), 0).rgb; // cMin = min(cMin, current); // cMax = max(cMax, current); // gl_FragData[0].rgb = cMax; // gl_FragData[1].rgb = cMin; - vec3 col0 = texelFetch2D(colortex3, center, 0).rgb; - vec3 col1 = texelFetch2D(colortex3, center + ivec2(1, 1), 0).rgb; - vec3 col2 = texelFetch2D(colortex3, center + ivec2(1, -1), 0).rgb; - vec3 col3 = texelFetch2D(colortex3, center + ivec2(-1, -1), 0).rgb; - vec3 col4 = texelFetch2D(colortex3, center + ivec2(-1, 1), 0).rgb; - vec3 col5 = texelFetch2D(colortex3, center + ivec2(0, 1), 0).rgb; - vec3 col6 = texelFetch2D(colortex3, center + ivec2(0, -1), 0).rgb; - vec3 col7 = texelFetch2D(colortex3, center + ivec2(-1, 0), 0).rgb; - vec3 col8 = texelFetch2D(colortex3, center + ivec2(1, 0), 0).rgb; + vec3 col0 = texelFetch(colortex3, center, 0).rgb; + vec3 col1 = texelFetch(colortex3, center + ivec2(1, 1), 0).rgb; + vec3 col2 = texelFetch(colortex3, center + ivec2(1, -1), 0).rgb; + vec3 col3 = texelFetch(colortex3, center + ivec2(-1, -1), 0).rgb; + vec3 col4 = texelFetch(colortex3, center + ivec2(-1, 1), 0).rgb; + vec3 col5 = texelFetch(colortex3, center + ivec2(0, 1), 0).rgb; + vec3 col6 = texelFetch(colortex3, center + ivec2(0, -1), 0).rgb; + vec3 col7 = texelFetch(colortex3, center + ivec2(-1, 0), 0).rgb; + vec3 col8 = texelFetch(colortex3, center + ivec2(1, 0), 0).rgb; vec3 colMax = max(col0,max(col1,max(col2,max(col3, max(col4, max(col5, max(col6, max(col7, col8)))))))); vec3 colMin = min(col0,min(col1,min(col2,min(col3, min(col4, min(col5, min(col6, min(col7, col8)))))))); diff --git a/shaders/dimensions/composite5.fsh b/shaders/dimensions/composite5.fsh index 055faab..94bc12b 100644 --- a/shaders/dimensions/composite5.fsh +++ b/shaders/dimensions/composite5.fsh @@ -51,9 +51,11 @@ const bool colortex15Clear = false; */ #endif +in DATA { + vec2 texcoord; + flat float tempOffsets; +}; -varying vec2 texcoord; -flat varying float tempOffsets; uniform sampler2D colortex0; uniform sampler2D colortex1; uniform sampler2D colortex3; @@ -219,7 +221,7 @@ vec4 smoothfilter(in sampler2D tex, in vec2 uv) uv = (uv - 0.5)/textureResolution; - return texture2D(tex, uv); + return texture(tex, uv); } vec2 smoothfilterUV(in vec2 uv) { @@ -256,14 +258,14 @@ vec3 FastCatmulRom(sampler2D colorTex, vec2 texcoord, vec4 rtMetrics, float shar vec2 w12 = w1 + w2; vec2 tc12 = rtMetrics.xy * (centerPosition + w2 / w12); - vec3 centerColor = texture2D(colorTex, vec2(tc12.x, tc12.y)).rgb; + vec3 centerColor = texture(colorTex, vec2(tc12.x, tc12.y)).rgb; vec2 tc0 = rtMetrics.xy * (centerPosition - 1.0); vec2 tc3 = rtMetrics.xy * (centerPosition + 2.0); - vec4 color = vec4(texture2D(colorTex, vec2(tc12.x, tc0.y )).rgb, 1.0) * (w12.x * w0.y ) + - vec4(texture2D(colorTex, vec2(tc0.x, tc12.y)).rgb, 1.0) * (w0.x * w12.y) + + vec4 color = vec4(texture(colorTex, vec2(tc12.x, tc0.y )).rgb, 1.0) * (w12.x * w0.y ) + + vec4(texture(colorTex, vec2(tc0.x, tc12.y)).rgb, 1.0) * (w0.x * w12.y) + vec4(centerColor, 1.0) * (w12.x * w12.y) + - vec4(texture2D(colorTex, vec2(tc3.x, tc12.y)).rgb, 1.0) * (w3.x * w12.y) + - vec4(texture2D(colorTex, vec2(tc12.x, tc3.y )).rgb, 1.0) * (w12.x * w3.y ); + vec4(texture(colorTex, vec2(tc3.x, tc12.y)).rgb, 1.0) * (w3.x * w12.y) + + vec4(texture(colorTex, vec2(tc12.x, tc3.y )).rgb, 1.0) * (w12.x * w3.y ); return color.rgb/color.a; @@ -274,11 +276,11 @@ vec3 closestToCamera5taps(vec2 texcoord, sampler2D depth) vec2 du = vec2(texelSize.x*2., 0.0); vec2 dv = vec2(0.0, texelSize.y*2.); - vec3 dtl = vec3(texcoord,0.) + vec3(-texelSize, texture2D(depth, texcoord - dv - du).x); - vec3 dtr = vec3(texcoord,0.) + vec3( texelSize.x, -texelSize.y, texture2D(depth, texcoord - dv + du).x); - vec3 dmc = vec3(texcoord,0.) + vec3( 0.0, 0.0, texture2D(depth, texcoord).x); - vec3 dbl = vec3(texcoord,0.) + vec3(-texelSize.x, texelSize.y, texture2D(depth, texcoord + dv - du).x); - vec3 dbr = vec3(texcoord,0.) + vec3( texelSize.x, texelSize.y, texture2D(depth, texcoord + dv + du).x); + vec3 dtl = vec3(texcoord,0.) + vec3(-texelSize, texture(depth, texcoord - dv - du).x); + vec3 dtr = vec3(texcoord,0.) + vec3( texelSize.x, -texelSize.y, texture(depth, texcoord - dv + du).x); + vec3 dmc = vec3(texcoord,0.) + vec3( 0.0, 0.0, texture(depth, texcoord).x); + vec3 dbl = vec3(texcoord,0.) + vec3(-texelSize.x, texelSize.y, texture(depth, texcoord + dv - du).x); + vec3 dbr = vec3(texcoord,0.) + vec3( texelSize.x, texelSize.y, texture(depth, texcoord + dv + du).x); vec3 dmin = dmc; dmin = dmin.z > dtr.z ? dtr : dmin; @@ -304,11 +306,11 @@ vec3 closestToCamera5taps_DH(vec2 texcoord, sampler2D depth, sampler2D dhDepth, vec3 dbl = vec3(texcoord,0.); vec3 dbr = vec3(texcoord,0.); - dtl += vec3(-texelSize, depthCheck ? texture2D(dhDepth, texcoord - dv - du).x : texture2D(depth, texcoord - dv - du).x); - dtr += vec3( texelSize.x, -texelSize.y, depthCheck ? texture2D(dhDepth, texcoord - dv + du).x : texture2D(depth, texcoord - dv + du).x); - dmc += vec3( 0.0, 0.0, depthCheck ? texture2D(dhDepth, texcoord).x : texture2D(depth, texcoord).x); - dbl += vec3(-texelSize.x, texelSize.y, depthCheck ? texture2D(dhDepth, texcoord + dv - du).x : texture2D(depth, texcoord + dv - du).x); - dbr += vec3( texelSize.x, texelSize.y, depthCheck ? texture2D(dhDepth, texcoord + dv + du).x : texture2D(depth, texcoord + dv + du).x); + dtl += vec3(-texelSize, depthCheck ? texture(dhDepth, texcoord - dv - du).x : texture(depth, texcoord - dv - du).x); + dtr += vec3( texelSize.x, -texelSize.y, depthCheck ? texture(dhDepth, texcoord - dv + du).x : texture(depth, texcoord - dv + du).x); + dmc += vec3( 0.0, 0.0, depthCheck ? texture(dhDepth, texcoord).x : texture(depth, texcoord).x); + dbl += vec3(-texelSize.x, texelSize.y, depthCheck ? texture(dhDepth, texcoord + dv - du).x : texture(depth, texcoord + dv - du).x); + dbr += vec3( texelSize.x, texelSize.y, depthCheck ? texture(dhDepth, texcoord + dv + du).x : texture(depth, texcoord + dv + du).x); vec3 dmin = dmc; dmin = dmin.z > dtr.z ? dtr : dmin; @@ -332,7 +334,7 @@ vec4 computeTAA(vec2 texcoord, bool hand){ // get previous frames position stuff for UV //use velocity from the nearest texel from camera in a 3x3 box in order to improve edge quality in motion #if defined DISTANT_HORIZONS || defined VOXY - bool depthCheck = texture2D(depthtex0,adjTC).x >= 1.0; + bool depthCheck = texture(depthtex0,adjTC).x >= 1.0; vec3 closestToCamera = closestToCamera5taps_DH(adjTC, depthtex0, dhVoxyDepthTex, depthCheck); vec3 viewPos = toScreenSpace_DH_special(closestToCamera, depthCheck); #else @@ -357,7 +359,7 @@ vec4 computeTAA(vec2 texcoord, bool hand){ #ifdef TAA_UPSCALING vec3 currentFrame = smoothfilter(colortex3, adjTC_noJitter).rgb; #else - vec3 currentFrame = texelFetch2D(colortex3, ivec2(adjTC_noJitter/texelSize), 0).rgb; + vec3 currentFrame = texelFetch(colortex3, ivec2(adjTC_noJitter/texelSize), 0).rgb; #endif //reject history if off-screen and early exit @@ -365,19 +367,19 @@ vec4 computeTAA(vec2 texcoord, bool hand){ #ifdef TAA_UPSCALING // Interpolating neighboorhood clampling boundaries between pixels - vec3 colMax = texture2D(colortex0, adjTC).rgb; - vec3 colMin = texture2D(colortex6, adjTC).rgb; + vec3 colMax = texture(colortex0, adjTC).rgb; + vec3 colMin = texture(colortex6, adjTC).rgb; #else //Assuming the history color is a blend of the 3x3 neighborhood, we clamp the history to the min and max of each channel in the 3x3 neighborhood vec3 col0 = currentFrame; // can use this because its the center sample. - vec3 col1 = texture2D(colortex3, adjTC_noJitter + vec2( texelSize.x, texelSize.y)).rgb; - vec3 col2 = texture2D(colortex3, adjTC_noJitter + vec2( texelSize.x, -texelSize.y)).rgb; - vec3 col3 = texture2D(colortex3, adjTC_noJitter + vec2(-texelSize.x, -texelSize.y)).rgb; - vec3 col4 = texture2D(colortex3, adjTC_noJitter + vec2(-texelSize.x, texelSize.y)).rgb; - vec3 col5 = texture2D(colortex3, adjTC_noJitter + vec2( 0.0, texelSize.y)).rgb; - vec3 col6 = texture2D(colortex3, adjTC_noJitter + vec2( 0.0, -texelSize.y)).rgb; - vec3 col7 = texture2D(colortex3, adjTC_noJitter + vec2(-texelSize.x, 0.0)).rgb; - vec3 col8 = texture2D(colortex3, adjTC_noJitter + vec2( texelSize.x, 0.0)).rgb; + vec3 col1 = texture(colortex3, adjTC_noJitter + vec2( texelSize.x, texelSize.y)).rgb; + vec3 col2 = texture(colortex3, adjTC_noJitter + vec2( texelSize.x, -texelSize.y)).rgb; + vec3 col3 = texture(colortex3, adjTC_noJitter + vec2(-texelSize.x, -texelSize.y)).rgb; + vec3 col4 = texture(colortex3, adjTC_noJitter + vec2(-texelSize.x, texelSize.y)).rgb; + vec3 col5 = texture(colortex3, adjTC_noJitter + vec2( 0.0, texelSize.y)).rgb; + vec3 col6 = texture(colortex3, adjTC_noJitter + vec2( 0.0, -texelSize.y)).rgb; + vec3 col7 = texture(colortex3, adjTC_noJitter + vec2(-texelSize.x, 0.0)).rgb; + vec3 col8 = texture(colortex3, adjTC_noJitter + vec2( texelSize.x, 0.0)).rgb; vec3 colMax = max(col0,max(col1,max(col2,max(col3, max(col4, max(col5, max(col6, max(col7, col8)))))))); vec3 colMin = min(col0,min(col1,min(col2,min(col3, min(col4, min(col5, min(col6, min(col7, col8)))))))); @@ -416,7 +418,7 @@ vec4 computeTAA(vec2 texcoord, bool hand){ // when this is on, do "infinite frame accumulation " if (hideGUI == 0) return vec4(finalResult, 1.0); - vec4 superSampledHistory = texture2D(colortex5, previousPosition.xy); + vec4 superSampledHistory = texture(colortex5, previousPosition.xy); vec3 superSampledResult = superSampledHistory.rgb * superSampledHistory.a + currentFrame; return vec4(superSampledResult/(superSampledHistory.a+1.0), superSampledHistory.a+1.0); @@ -432,9 +434,9 @@ void main() { #ifdef TAA vec2 taauTC = clamp(texcoord*RENDER_SCALE, vec2(0.0), RENDER_SCALE - texelSize*2.0); - float dataUnpacked = decodeVec2(texelFetch2D(colortex1,ivec2(gl_FragCoord.xy*RENDER_SCALE),0).w).y; + float dataUnpacked = decodeVec2(texelFetch(colortex1,ivec2(gl_FragCoord.xy*RENDER_SCALE),0).w).y; - bool hand = abs(dataUnpacked-0.75) < 0.01 && texture2D(depthtex1,taauTC).x < 1.0; + bool hand = abs(dataUnpacked-0.75) < 0.01 && texture(depthtex1,taauTC).x < 1.0; vec4 color = computeTAA(texcoord, hand); @@ -444,7 +446,7 @@ void main() { gl_FragData[0] = clamp(fp10Dither(color, triangularize(interleaved_gradientNoise())), 0.0, 65000.0); #endif #else - vec3 color = clamp(fp10Dither(vec4(texture2D(colortex3,texcoord).rgb,1.0), triangularize(interleaved_gradientNoise())).rgb,0.0,65000.); + vec3 color = clamp(fp10Dither(vec4(texture(colortex3,texcoord).rgb,1.0), triangularize(interleaved_gradientNoise())).rgb,0.0,65000.); gl_FragData[0].rgb = color; #endif } \ No newline at end of file diff --git a/shaders/dimensions/composite5.vsh b/shaders/dimensions/composite5.vsh index a63e066..1a229d7 100644 --- a/shaders/dimensions/composite5.vsh +++ b/shaders/dimensions/composite5.vsh @@ -1,8 +1,11 @@ #include "/lib/util.glsl" #include "/lib/res_params.glsl" -varying vec2 texcoord; -flat varying float tempOffsets; +out DATA { + vec2 texcoord; + flat float tempOffsets; +}; + uniform sampler2D colortex4; uniform int frameCounter; diff --git a/shaders/dimensions/composite6.fsh b/shaders/dimensions/composite6.fsh index 2333d3d..50a07d6 100644 --- a/shaders/dimensions/composite6.fsh +++ b/shaders/dimensions/composite6.fsh @@ -29,28 +29,28 @@ vec2 quarterResTC = gl_FragCoord.xy*2.0*resScale*texelSize; // vec2 texcoord = (gl_FragCoord.xy*2.0*resScale*texelSize) * RENDER_SCALE; -// bool hand = abs(decodeVec2(texture2D(colortex1,texcoord).w).y-0.75) < 0.01 && texture2D(depthtex0,texcoord).x < 1.0; +// bool hand = abs(decodeVec2(texture(colortex1,texcoord).w).y-0.75) < 0.01 && texture(depthtex0,texcoord).x < 1.0; //0.5 - gl_FragData[0] = texture2D(colortex5,quarterResTC-1.0*vec2(texelSize.x,texelSize.y))/4.*0.5; - gl_FragData[0] += texture2D(colortex5,quarterResTC+1.0*vec2(texelSize.x,texelSize.y))/4.*0.5; - gl_FragData[0] += texture2D(colortex5,quarterResTC+vec2(-1.0*texelSize.x,1.0*texelSize.y))/4.*0.5; - gl_FragData[0] += texture2D(colortex5,quarterResTC+vec2(1.0*texelSize.x,-1.0*texelSize.y))/4.*0.5; + gl_FragData[0] = texture(colortex5,quarterResTC-1.0*vec2(texelSize.x,texelSize.y))/4.*0.5; + gl_FragData[0] += texture(colortex5,quarterResTC+1.0*vec2(texelSize.x,texelSize.y))/4.*0.5; + gl_FragData[0] += texture(colortex5,quarterResTC+vec2(-1.0*texelSize.x,1.0*texelSize.y))/4.*0.5; + gl_FragData[0] += texture(colortex5,quarterResTC+vec2(1.0*texelSize.x,-1.0*texelSize.y))/4.*0.5; //0.25 - gl_FragData[0] += texture2D(colortex5,quarterResTC-2.0*vec2(texelSize.x,0.0))/2.*0.125; - gl_FragData[0] += texture2D(colortex5,quarterResTC+2.0*vec2(0.0,texelSize.y))/2.*0.125; - gl_FragData[0] += texture2D(colortex5,quarterResTC+2.0*vec2(0.0,-texelSize.y))/2.*0.125; - gl_FragData[0] += texture2D(colortex5,quarterResTC+2.0*vec2(-texelSize.x,0.0))/2.*0.125; + gl_FragData[0] += texture(colortex5,quarterResTC-2.0*vec2(texelSize.x,0.0))/2.*0.125; + gl_FragData[0] += texture(colortex5,quarterResTC+2.0*vec2(0.0,texelSize.y))/2.*0.125; + gl_FragData[0] += texture(colortex5,quarterResTC+2.0*vec2(0.0,-texelSize.y))/2.*0.125; + gl_FragData[0] += texture(colortex5,quarterResTC+2.0*vec2(-texelSize.x,0.0))/2.*0.125; //0.125 - gl_FragData[0] += texture2D(colortex5,quarterResTC-2.0*vec2(texelSize.x,texelSize.y))/4.*0.125; - gl_FragData[0] += texture2D(colortex5,quarterResTC+2.0*vec2(texelSize.x,texelSize.y))/4.*0.125; - gl_FragData[0] += texture2D(colortex5,quarterResTC+vec2(-2.0*texelSize.x,2.0*texelSize.y))/4.*0.125; - gl_FragData[0] += texture2D(colortex5,quarterResTC+vec2(2.0*texelSize.x,-2.0*texelSize.y))/4.*0.125; + gl_FragData[0] += texture(colortex5,quarterResTC-2.0*vec2(texelSize.x,texelSize.y))/4.*0.125; + gl_FragData[0] += texture(colortex5,quarterResTC+2.0*vec2(texelSize.x,texelSize.y))/4.*0.125; + gl_FragData[0] += texture(colortex5,quarterResTC+vec2(-2.0*texelSize.x,2.0*texelSize.y))/4.*0.125; + gl_FragData[0] += texture(colortex5,quarterResTC+vec2(2.0*texelSize.x,-2.0*texelSize.y))/4.*0.125; //0.125 - gl_FragData[0] += texture2D(colortex5,quarterResTC)*0.125; + gl_FragData[0] += texture(colortex5,quarterResTC)*0.125; gl_FragData[0].rgb = clamp(gl_FragData[0].rgb,0.0,65000.); if (quarterResTC.x > 1.0 - 3.5*texelSize.x || quarterResTC.y > 1.0 -3.5*texelSize.y || quarterResTC.x < 3.5*texelSize.x || quarterResTC.y < 3.5*texelSize.y) gl_FragData[0].rgb = vec3(0.0); diff --git a/shaders/dimensions/composite7.fsh b/shaders/dimensions/composite7.fsh index dff9325..6dd0aab 100644 --- a/shaders/dimensions/composite7.fsh +++ b/shaders/dimensions/composite7.fsh @@ -15,25 +15,25 @@ vec2 resScale = max(vec2(viewWidth,viewHeight),vec2(1920.0,1080.))/vec2(1920.,10 vec2 quarterResTC = gl_FragCoord.xy*2.*texelSize; //0.5 - gl_FragData[0] = texture2D(colortex3,quarterResTC-1.0*vec2(texelSize.x,texelSize.y))/4.*0.5; - gl_FragData[0] += texture2D(colortex3,quarterResTC+1.0*vec2(texelSize.x,texelSize.y))/4.*0.5; - gl_FragData[0] += texture2D(colortex3,quarterResTC+vec2(-1.0*texelSize.x,1.0*texelSize.y))/4.*0.5; - gl_FragData[0] += texture2D(colortex3,quarterResTC+vec2(1.0*texelSize.x,-1.0*texelSize.y))/4.*0.5; + gl_FragData[0] = texture(colortex3,quarterResTC-1.0*vec2(texelSize.x,texelSize.y))/4.*0.5; + gl_FragData[0] += texture(colortex3,quarterResTC+1.0*vec2(texelSize.x,texelSize.y))/4.*0.5; + gl_FragData[0] += texture(colortex3,quarterResTC+vec2(-1.0*texelSize.x,1.0*texelSize.y))/4.*0.5; + gl_FragData[0] += texture(colortex3,quarterResTC+vec2(1.0*texelSize.x,-1.0*texelSize.y))/4.*0.5; //0.25 - gl_FragData[0] += texture2D(colortex3,quarterResTC-2.0*vec2(texelSize.x,0.0))/2.*0.125; - gl_FragData[0] += texture2D(colortex3,quarterResTC+2.0*vec2(0.0,texelSize.y))/2.*0.125; - gl_FragData[0] += texture2D(colortex3,quarterResTC+2.0*vec2(0.0,-texelSize.y))/2.*0.125; - gl_FragData[0] += texture2D(colortex3,quarterResTC+2.0*vec2(-texelSize.x,0.0))/2.*0.125; + gl_FragData[0] += texture(colortex3,quarterResTC-2.0*vec2(texelSize.x,0.0))/2.*0.125; + gl_FragData[0] += texture(colortex3,quarterResTC+2.0*vec2(0.0,texelSize.y))/2.*0.125; + gl_FragData[0] += texture(colortex3,quarterResTC+2.0*vec2(0.0,-texelSize.y))/2.*0.125; + gl_FragData[0] += texture(colortex3,quarterResTC+2.0*vec2(-texelSize.x,0.0))/2.*0.125; //0.125 - gl_FragData[0] += texture2D(colortex3,quarterResTC-2.0*vec2(texelSize.x,texelSize.y))/4.*0.125; - gl_FragData[0] += texture2D(colortex3,quarterResTC+2.0*vec2(texelSize.x,texelSize.y))/4.*0.125; - gl_FragData[0] += texture2D(colortex3,quarterResTC+vec2(-2.0*texelSize.x,2.0*texelSize.y))/4.*0.125; - gl_FragData[0] += texture2D(colortex3,quarterResTC+vec2(2.0*texelSize.x,-2.0*texelSize.y))/4.*0.125; + gl_FragData[0] += texture(colortex3,quarterResTC-2.0*vec2(texelSize.x,texelSize.y))/4.*0.125; + gl_FragData[0] += texture(colortex3,quarterResTC+2.0*vec2(texelSize.x,texelSize.y))/4.*0.125; + gl_FragData[0] += texture(colortex3,quarterResTC+vec2(-2.0*texelSize.x,2.0*texelSize.y))/4.*0.125; + gl_FragData[0] += texture(colortex3,quarterResTC+vec2(2.0*texelSize.x,-2.0*texelSize.y))/4.*0.125; //0.125 - gl_FragData[0] += texture2D(colortex3,quarterResTC)*0.125; + gl_FragData[0] += texture(colortex3,quarterResTC)*0.125; gl_FragData[0].rgb = clamp(gl_FragData[0].rgb,0.0,65000.); diff --git a/shaders/dimensions/composite8.fsh b/shaders/dimensions/composite8.fsh index 655eada..288aba1 100644 --- a/shaders/dimensions/composite8.fsh +++ b/shaders/dimensions/composite8.fsh @@ -1,6 +1,5 @@ uniform sampler2D colortex6; uniform vec2 texelSize; -varying vec2 texcoord; uniform float viewWidth; uniform float viewHeight; vec2 resScale = vec2(1920.,1080.)/max(vec2(viewWidth,viewHeight),vec2(1920.0,1080.)); @@ -12,7 +11,7 @@ vec3 gauss1D(vec2 coord,vec2 dir,float alpha,int maxIT){ float weight = exp(-i*i*alpha*4.0); //here we take advantage of bilinear filtering for 2x less sample, as a side effect the gaussian won't be totally centered for small blurs vec2 spCoord = coord+dir*texelSize*(2.0*i+0.5); - tot += vec4(texture2D(colortex6,spCoord).rgb,1.0)*weight*float(spCoord.x > minTC && spCoord.x < maxTC); + tot += vec4(texture(colortex6,spCoord).rgb,1.0)*weight*float(spCoord.x > minTC && spCoord.x < maxTC); } return tot.rgb/max(1.0,tot.a); } diff --git a/shaders/dimensions/composite8.vsh b/shaders/dimensions/composite8.vsh index cbc9838..0c48242 100644 --- a/shaders/dimensions/composite8.vsh +++ b/shaders/dimensions/composite8.vsh @@ -1,6 +1,6 @@ uniform float viewWidth; uniform float viewHeight; -varying vec2 texcoord; + //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// @@ -14,5 +14,4 @@ void main() { gl_Position.y = (gl_Position.y*0.5+0.5)*0.25/clampedRes.y*1080.0*2.0-1.0; //0-0.5 gl_Position.x = (gl_Position.x*0.5+0.5)*0.5/clampedRes.x*1920.0*2.0-1.0; - texcoord = gl_MultiTexCoord0.xy/clampedRes*vec2(1920.,1080.); } diff --git a/shaders/dimensions/composite9.fsh b/shaders/dimensions/composite9.fsh index 0a5a2ae..1065deb 100644 --- a/shaders/dimensions/composite9.fsh +++ b/shaders/dimensions/composite9.fsh @@ -1,6 +1,5 @@ uniform sampler2D colortex6; uniform vec2 texelSize; -varying vec2 texcoord; uniform float viewWidth; uniform float viewHeight; vec2 resScale = vec2(1920.,1080.)/max(vec2(viewWidth,viewHeight),vec2(1920.0,1080.)); @@ -11,9 +10,9 @@ vec3 gauss1D(vec2 coord,vec2 dir,float alpha,int maxIT){ for (int i = -maxIT;i minTC && spCoord.y < maxTC); + tot += vec4(texture(colortex6,spCoord).rgb,1.0)*weight*float(spCoord.y > minTC && spCoord.y < maxTC); } - return tot.rgb/max(1.0,tot.a); + return tot.rgb/max(1.0,tot.a); } //////////////////////////////VOID MAIN////////////////////////////// diff --git a/shaders/dimensions/composite9.vsh b/shaders/dimensions/composite9.vsh index cbc9838..0c48242 100644 --- a/shaders/dimensions/composite9.vsh +++ b/shaders/dimensions/composite9.vsh @@ -1,6 +1,6 @@ uniform float viewWidth; uniform float viewHeight; -varying vec2 texcoord; + //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// @@ -14,5 +14,4 @@ void main() { gl_Position.y = (gl_Position.y*0.5+0.5)*0.25/clampedRes.y*1080.0*2.0-1.0; //0-0.5 gl_Position.x = (gl_Position.x*0.5+0.5)*0.5/clampedRes.x*1920.0*2.0-1.0; - texcoord = gl_MultiTexCoord0.xy/clampedRes*vec2(1920.,1080.); } diff --git a/shaders/dimensions/deferred.csh b/shaders/dimensions/deferred.csh index c1aa67d..ce1f9cd 100644 --- a/shaders/dimensions/deferred.csh +++ b/shaders/dimensions/deferred.csh @@ -39,7 +39,7 @@ void main() { for (int i = 0; i < maxITexp; i++){ vec2 ij = R2_samples((frameCounter%2000)*maxITexp+i); vec2 tc = 0.5 + (ij-0.5) * 0.7; - vec3 sp = texture2D(colortex6, tc/16. * resScale+vec2(0.375*resScale.x+4.5*texelSize.x,.0)).rgb; + vec3 sp = texture(colortex6, tc/16. * resScale+vec2(0.375*resScale.x+4.5*texelSize.x,.0)).rgb; avgExp += log(sqrt(luma(sp))); avgB += log(min(dot(sp,vec3(0.07,0.22,0.71)),8e-2)); } @@ -63,7 +63,7 @@ void main() { float exposure = max(targetExposure*EXPOSURE_MULTIPLIER, 0.0); - float currCenterDepth = ld(texture2D(depthtex2, vec2(0.5)*RENDER_SCALE).r); + float currCenterDepth = ld(texture(depthtex2, vec2(0.5)*RENDER_SCALE).r); float centerDepth = mix(sqrt(rodExposureDepthSSBO.y/65000.0), currCenterDepth, clamp(DoF_Adaptation_Speed*exp(-0.016/frameTime+1.0)/(6.0+currCenterDepth*far),0.0,1.0)); centerDepth = centerDepth * centerDepth * 65000.0; diff --git a/shaders/dimensions/deferred1.fsh b/shaders/dimensions/deferred1.fsh index 943af2c..2bc23d5 100644 --- a/shaders/dimensions/deferred1.fsh +++ b/shaders/dimensions/deferred1.fsh @@ -58,16 +58,16 @@ vec2 decodeVec2(float a){ void main() { /* RENDERTARGETS:4,12 */ - vec3 oldTex = texelFetch2D(colortex4, ivec2(gl_FragCoord.xy), 0).xyz; - float newTex = texelFetch2D(depthtex1, ivec2(gl_FragCoord.xy*4), 0).x; + vec3 oldTex = texelFetch(colortex4, ivec2(gl_FragCoord.xy), 0).xyz; + float newTex = texelFetch(depthtex1, ivec2(gl_FragCoord.xy*4), 0).x; - float dataUnpacked = decodeVec2(texelFetch2D(colortex1,ivec2(gl_FragCoord.xy*4),0).w).y; + float dataUnpacked = decodeVec2(texelFetch(colortex1,ivec2(gl_FragCoord.xy*4),0).w).y; bool hand = abs(dataUnpacked-0.75) < 0.01; if(hand) convertHandDepth(newTex); #if defined DISTANT_HORIZONS || defined VOXY - float QuarterResDepth = texelFetch2D(dhVoxyDepthTex, ivec2(gl_FragCoord.xy*4), 0).x; + float QuarterResDepth = texelFetch(dhVoxyDepthTex, ivec2(gl_FragCoord.xy*4), 0).x; QuarterResDepth = DH_linZ(QuarterResDepth); gl_FragData[1].a = QuarterResDepth*QuarterResDepth*65000.0; if(QuarterResDepth >= 1.0) gl_FragData[1].a = 66000.0; diff --git a/shaders/dimensions/deferred2.fsh b/shaders/dimensions/deferred2.fsh index 01f0f09..90dfdc5 100644 --- a/shaders/dimensions/deferred2.fsh +++ b/shaders/dimensions/deferred2.fsh @@ -37,20 +37,20 @@ void main() { #if RESOURCEPACK_SKY != 0 vec2 texcoord = gl_FragCoord.xy * texelSize; - gl_FragData[0] = texelFetch2D(colortex1, ivec2(gl_FragCoord.xy),0); + gl_FragData[0] = texelFetch(colortex1, ivec2(gl_FragCoord.xy),0); if( - texelFetch2D(depthtex0, ivec2(gl_FragCoord.xy), 0).x < 1.0 + texelFetch(depthtex0, ivec2(gl_FragCoord.xy), 0).x < 1.0 #if defined DISTANT_HORIZONS || defined VOXY - || texelFetch2D(dhVoxyDepthTex, ivec2(gl_FragCoord.xy), 0).x < 1.0 + || texelFetch(dhVoxyDepthTex, ivec2(gl_FragCoord.xy), 0).x < 1.0 #endif ) { // doing this for precision reasons, DH does NOT like depth => 1.0 }else{ - vec3 skyColor = texelFetch2D(colortex2, ivec2(gl_FragCoord.xy),0).rgb; + vec3 skyColor = texelFetch(colortex2, ivec2(gl_FragCoord.xy),0).rgb; skyColor.rgb = max(skyColor.rgb - skyColor.rgb * interleaved_gradientNoise()*0.05, 0.0); gl_FragData[0].rgb = skyColor/50.0; diff --git a/shaders/dimensions/final.fsh b/shaders/dimensions/final.fsh index ffc4faa..fde1343 100644 --- a/shaders/dimensions/final.fsh +++ b/shaders/dimensions/final.fsh @@ -20,7 +20,7 @@ uniform sampler2D shadowcolor1; layout (rgba16f) uniform image2D cloudDepthTex; #endif -varying vec2 texcoord; +in vec2 texcoord; uniform vec2 texelSize; uniform float frameTimeCounter; uniform int frameCounter; @@ -62,7 +62,7 @@ float interleaved_gradientNoise(){ return noise; } float blueNoise(){ - return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter); + return fract(texelFetch(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter); } float convertHandDepth_2(in float depth, bool hand) { @@ -123,7 +123,7 @@ vec3 doMotionBlur(vec2 texcoord, float depth, float noise, bool hand){ for (int i = 0; i < int(samples); i++) { texcoord += velocity; - color += texture2D(colortex7, clamp(texcoord, screenEdges, 1.0-screenEdges)).rgb; + color += texture(colortex7, clamp(texcoord, screenEdges, 1.0-screenEdges)).rgb; } @@ -156,7 +156,7 @@ void main() { float noise = blueNoise(); #if defined MOTION_BLUR - float depth = texture2D(depthtex0, texcoord*RENDER_SCALE).r; + float depth = texture(depthtex0, texcoord*RENDER_SCALE).r; bool hand = depth < 0.56; float depth2 = convertHandDepth_2(depth, hand); @@ -174,9 +174,9 @@ void main() { _texcoord += vec2(0.5); - vec3 COLOR = texture2D(colortex7, _texcoord).rgb; + vec3 COLOR = texture(colortex7, _texcoord).rgb; #else - vec3 COLOR = texture2D(colortex7, texcoord).rgb; + vec3 COLOR = texture(colortex7, texcoord).rgb; #endif #endif @@ -216,13 +216,13 @@ void main() { // float zoom = 0.1; // shadowUV = ((shadowUV-0.5) - (shadowUV-0.5)*zoom) + 0.5; - if(shadowUV.x < 1.0 && shadowUV.y < 1.0 && hideGUI == 1) COLOR = texture2D(shadowcolor1,shadowUV).rgb; + if(shadowUV.x < 1.0 && shadowUV.y < 1.0 && hideGUI == 1) COLOR = texture(shadowcolor1,shadowUV).rgb; #endif #if DEBUG_VIEW == debug_DEPTHTEX0 - COLOR = vec3(ld(texture2D(depthtex0, texcoord*RENDER_SCALE).r)); + COLOR = vec3(ld(texture(depthtex0, texcoord*RENDER_SCALE).r)); #endif #if DEBUG_VIEW == debug_DEPTHTEX1 - COLOR = vec3(ld(texture2D(depthtex1, texcoord*RENDER_SCALE).r)); + COLOR = vec3(ld(texture(depthtex1, texcoord*RENDER_SCALE).r)); #endif #if DEBUG_VIEW == debug_CLOUDDEPTHTEX && defined CUMULONIMBUS_LIGHTNING && CUMULONIMBUS > 0 COLOR = imageLoad(cloudDepthTex, ivec2(gl_FragCoord.xy*VL_RENDER_SCALE*RENDER_SCALE)).rgb; @@ -240,8 +240,4 @@ void main() { if (length(waveNormals.xy) > 0.0) gl_FragColor.rgb += waveNormals; } #endif - - // gl_FragColor.rgb = texture2D(colortex10, texcoord).rgb; - - //if(gl_FragCoord.x < 512 && gl_FragCoord.y < 512) gl_FragColor.rgb = vec3(imageLoad(cloudShadow, ivec2(gl_FragCoord.x,gl_FragCoord.y)*2).g); } diff --git a/shaders/dimensions/final.vsh b/shaders/dimensions/final.vsh index eccbe10..7af7395 100644 --- a/shaders/dimensions/final.vsh +++ b/shaders/dimensions/final.vsh @@ -1,6 +1,6 @@ #include "/lib/settings.glsl" -varying vec2 texcoord; +out vec2 texcoord; //////////////////////////////VOID MAIN////////////////////////////// diff --git a/shaders/dimensions/prepare4.fsh b/shaders/dimensions/prepare4.fsh index bfa592b..e124b86 100644 --- a/shaders/dimensions/prepare4.fsh +++ b/shaders/dimensions/prepare4.fsh @@ -93,7 +93,7 @@ float R2_dither(){ return fract(alpha.x * gl_FragCoord.x + alpha.y * 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); + return fract(texelFetch(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter); } #define DHVLFOG @@ -291,11 +291,11 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+ vec3 moonColor2 = moonColorSSBO; #endif - vec3 sky = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy)-ivec2(257,0),0).rgb/150.0; + vec3 sky = texelFetch(colortex4,ivec2(gl_FragCoord.xy)-ivec2(257,0),0).rgb/150.0; sky = mix(averageSkyCol_CloudsSSBO / 600.0, sky, pow(clamp(viewVector.y+1.0,0.0,1.0),5.0)); vec3 suncol = lightSourceColorSSBO; - #ifdef ambientLight_only + #ifdef AMBIENT_LIGHT_ONLY suncol = vec3(0.0); #endif @@ -372,7 +372,7 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+ float flash = 0.0; float maxWaitTime = 5; - float Timer = texelFetch2D(colortex4, ivec2(3,1), 0).x/150.0; + float Timer = texelFetch(colortex4, ivec2(3,1), 0).x/150.0; Timer -= frameTime; if(Timer <= 0.0){ @@ -401,7 +401,7 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+ if (gl_FragCoord.x > pixelPos2.x && gl_FragCoord.x < pixelPos2.x + 1 && gl_FragCoord.y > pixelPos2.y && gl_FragCoord.y < pixelPos2.y + 1){ mixhistory = clamp(500.0 * frameTime,0.0,1.0); - vec3 LastPos = (texelFetch2D(colortex4,ivec2(2,1),0).xyz/150.0) * 2.0 - 1.0; + vec3 LastPos = (texelFetch(colortex4,ivec2(2,1),0).xyz/150.0) * 2.0 - 1.0; LastPos += (hash31(frameCounter / 50) * 2.0 - 1.0); LastPos = LastPos * 0.5 + 0.5; @@ -416,7 +416,7 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+ #endif //Temporally accumulate sky and light values -vec3 frameHistory = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy),0).rgb; +vec3 frameHistory = texelFetch(colortex4,ivec2(gl_FragCoord.xy),0).rgb; vec3 currentFrame = gl_FragData[0].rgb*150.; diff --git a/shaders/dimensions/voxy_translucent.glsl b/shaders/dimensions/voxy_translucent.glsl index 0869344..b1f93ef 100644 --- a/shaders/dimensions/voxy_translucent.glsl +++ b/shaders/dimensions/voxy_translucent.glsl @@ -179,7 +179,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) bool isWater = blockID == 8; #ifndef WhiteWorld - #ifdef Vanilla_like_water + #ifdef VANILLA_LIKE_WATER if (isWater) Albedo *= luma(Albedo); #else if (isWater){ @@ -252,7 +252,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) float indoors = min(max(parameters.lightMap.y-0.5,0.0)/0.4,1.0); vec3 FinalColor = (Indirect_lighting + Direct_lighting*indoors) * Albedo; - #ifndef Vanilla_like_water + #ifndef VANILLA_LIKE_WATER if(isWater && abs(normal.y) > 0.1){ vec3 waterPos = (feetPlayerPos+cameraPosition).xzy; diff --git a/shaders/lang/en_us.lang b/shaders/lang/en_us.lang index 33a3ed1..23c9b44 100644 --- a/shaders/lang/en_us.lang +++ b/shaders/lang/en_us.lang @@ -1,6 +1,6 @@ option.SHADER_VERSION_LABEL = §d§lECLIPSE§r - A Bliss Edit prefix.SHADER_VERSION_LABEL = V - value.SHADER_VERSION_LABEL.482 = 5.9.2 + value.SHADER_VERSION_LABEL.482 = 5.10.0 # if you're here to translate, this is not a joke, these do what they say profile.POTATO=§4Potato diff --git a/shaders/lang/pt_br.lang b/shaders/lang/pt_br.lang index 11fa508..2ce7c9b 100644 --- a/shaders/lang/pt_br.lang +++ b/shaders/lang/pt_br.lang @@ -12,7 +12,7 @@ screen.Misc_Settings = Configurações Diversas option.ORB_B = Orb Azul option.WhiteWorld=Mundo Branco - option.ambientLight_only=Apenas Luz Ambiente + option.AMBIENT_LIGHT_ONLY=Apenas Luz Ambiente option.Glass_Tint=Tintura de Vidro option.display_LUT=Mostrar LUT option.SSS_view=Visualização de SSS vindo do Céu diff --git a/shaders/lang/ru_RU.lang b/shaders/lang/ru_RU.lang index b4e4906..e398b4a 100644 --- a/shaders/lang/ru_RU.lang +++ b/shaders/lang/ru_RU.lang @@ -381,8 +381,8 @@ screen.World = Мир option.Water_Absorb_G = Поглощ. зеленый (вода) option.Water_Absorb_B = Поглощ. синий (вода) - option.Vanilla_like_water = Ванильная вода - option.Vanilla_like_water.comment = Влючите ваниильную текстуру воды + option.VANILLA_LIKE_WATER = Ванильная вода + option.VANILLA_LIKE_WATER.comment = Влючите ваниильную текстуру воды screen.Post_Processing = Постобработка @@ -538,8 +538,8 @@ screen.the_orb = Сфера option.ORB_B = Сфера синего option.WhiteWorld = Белый мир option.WhiteWorld.comment = ЭТО ОТЛАДОЧНЫЙ РЕЖИМ. используется для упрощения просмотра AO. используется для лучшего просмотра поддельного GI (зеленый свет) -option.ambientLight_only = Только рассеянный свет -option.ambientLight_only.comment = ЭТО ОТЛАДОЧНЫЙ РЕЖИМ. выключите солнечный свет. Производительность не увеличивается, тени по-прежнему работают в фоновом режиме +option.AMBIENT_LIGHT_ONLY = Только рассеянный свет +option.AMBIENT_LIGHT_ONLY.comment = ЭТО ОТЛАДОЧНЫЙ РЕЖИМ. выключите солнечный свет. Производительность не увеличивается, тени по-прежнему работают в фоновом режиме option.HURT_AND_DEATH_EFFECT = Эффект боли и смерти option.PLANET_GROUND_BRIGHTNESS = Яркость поверхности планеты option.ORIGINAL_CHOCAPIC_SKY = Оригинальное Chocapic небо diff --git a/shaders/lang/zh_cn.lang b/shaders/lang/zh_cn.lang index 13ee4f7..ece41bc 100644 --- a/shaders/lang/zh_cn.lang +++ b/shaders/lang/zh_cn.lang @@ -1,6 +1,6 @@ option.SHADER_VERSION_LABEL = §d§lECLIPSE§r - Bliss 编辑版 prefix.SHADER_VERSION_LABEL = 版本 - value.SHADER_VERSION_LABEL.482 = 5.9.2 + value.SHADER_VERSION_LABEL.482 = 5.10.0 # 如果你是来翻译的,这不是玩笑,这些选项的功能正如其名 profile.POTATO=§4土豆 (极低配置) @@ -105,7 +105,7 @@ option.WATER_CAUSTICS_BRIGHTNESS = 水体焦散线亮度 option.WATER_CAUSTICS_POWER = 水体焦散线强度 option.FORCE_TRANSLUCENT_GLASS = 强制半透明玻璃 option.LARGE_WAVE_DISPLACEMENT = 大型波浪 -option.Vanilla_like_water = 原版水体样式 +option.VANILLA_LIKE_WATER = 原版水体样式 option.INCLUDE_UNLISTED_ENTITIES = 识别未添加实体 screen.DEBUG_STUFF = §c调试设置§r diff --git a/shaders/lib/PhotonGTAO.glsl b/shaders/lib/PhotonGTAO.glsl index d196543..9b69d0a 100644 --- a/shaders/lib/PhotonGTAO.glsl +++ b/shaders/lib/PhotonGTAO.glsl @@ -122,7 +122,7 @@ float calculate_maximum_horizon_angle( for (int i = 0; i < GTAO_HORIZON_STEPS; ++i, ray_pos += ray_step) { - float depth = texelFetch2D(depthtex1, ivec2(clamp(ray_pos,0.0,1.0) * view_res * taau_render_scale - 0.5), 0).x; + float depth = texelFetch(depthtex1, ivec2(clamp(ray_pos,0.0,1.0) * view_res * taau_render_scale - 0.5), 0).x; if (depth == 1.0 || depth < hand_depth || depth == screen_pos.z) continue; diff --git a/shaders/lib/diffuse_lighting.glsl b/shaders/lib/diffuse_lighting.glsl index a946e21..0ea56de 100644 --- a/shaders/lib/diffuse_lighting.glsl +++ b/shaders/lib/diffuse_lighting.glsl @@ -51,11 +51,11 @@ #if defined DISTANT_HORIZONS || defined VOXY if(depthCheck) { - samplePos = texelFetch2D(dhVoxyDepthTex1, ivec2(newPos.xy/texelSize),0).x; + samplePos = texelFetch(dhVoxyDepthTex1, ivec2(newPos.xy/texelSize),0).x; } else #endif { - samplePos = texelFetch2D(depthtex2, ivec2(newPos.xy/texelSize),0).x,hand; + samplePos = texelFetch(depthtex2, ivec2(newPos.xy/texelSize),0).x,hand; } if(samplePos < newPos.z && samplePos > 0.0){// && (samplePos <= max(minZ,maxZ) && samplePos >= min(minZ,maxZ))){ @@ -221,7 +221,7 @@ vec3 calculateFlashlight(in vec2 texcoord, in vec3 viewPos, in vec3 albedo, in v #endif float projectedCircle = clamp(1.0 - shiftedLinearDistance*FLASHLIGHT_SIZE,0.0,1.0); - float lenseDirt = texture2D(noisetex, scaledViewPos * 0.2 + 0.1).b; + float lenseDirt = texture(noisetex, scaledViewPos * 0.2 + 0.1).b; float lenseShape = (pow(abs(pow(abs(projectedCircle-1.0),2.0)*2.0 - 0.5),2.0) + lenseDirt*0.2) * 10.0; float offsetNdotL = clamp(dot(-normal, normalize(shiftedPlayerPos)),0,1); diff --git a/shaders/lib/end_fog.glsl b/shaders/lib/end_fog.glsl index 4b1cd8e..de17e00 100644 --- a/shaders/lib/end_fog.glsl +++ b/shaders/lib/end_fog.glsl @@ -78,7 +78,7 @@ vec3 LightSourcePosition(vec3 worldPos, vec3 cameraPos, float vortexBounds){ lightningPos += fract(cameraPos/cellSize)*cellSize - cellSize*0.5; // make the position offset to random places (RNG.xyz from non-clearing buffer). - vec3 randomOffset = (texelFetch2D(colortex4,ivec2(2,1),0).xyz / 150.0) * 2.0 - 1.0; + vec3 randomOffset = (texelFetch(colortex4,ivec2(2,1),0).xyz / 150.0) * 2.0 - 1.0; lightningPos -= randomOffset * 2.5; #ifdef THE_ORB @@ -102,7 +102,7 @@ float densityAtPosFog(in vec3 pos){ f = (f*f) * (3.-2.*f); vec2 uv = p.xz + f.xz + p.y * vec2(0.0,193.0); vec2 coord = uv / 512.0; - vec2 xy = texture2D(noisetex, coord).yx; + vec2 xy = texture(noisetex, coord).yx; return mix(xy.r,xy.g, f.y); } @@ -132,10 +132,10 @@ void VolumeBounds(inout float Volume, vec3 Origin){ float thickness = 25.0 * radius; float Torus = (thickness - clamp( pow( length( vec2(length(Origin.xz) - radius, Origin2.y) ),2.0) - radius, 0.0, thickness) ) / thickness; - Origin2.xz *= 0.5; - Origin2.y -= 100; + // Origin2.xz *= 0.5; + // Origin2.y -= 100; - float orb = clamp((1.0 - length(Origin2) / 15.0) * 1.0,0.0,1.0); + // float orb = clamp((1.0 - length(Origin2) / 15.0) * 1.0,0.0,1.0); Volume = max(Volume - Bounds - Torus, 0); } @@ -145,7 +145,7 @@ float fogShape(in vec3 pos){ float vortexBounds = clamp(vortexBoundRange - length(pos), 0.0,1.0); vec3 samplePos = pos*vec3(1.0,1.0/48.0,1.0); - float fogYstart = -60; + // float fogYstart = -60; // this is below down where you fall to your death. float voidZone = max(exp2(-1.0 * sqrt(max(pos.y - -60,0.0))) ,0.0) ; @@ -234,6 +234,8 @@ vec4 GetVolumetricFog( float verticalFactor = abs(normalize(dVWorld).y); verticalFactor = pow(verticalFactor, 2.0); + float rayLength = length(dVWorld); + #if defined DISTANT_HORIZONS || defined VOXY int SAMPLECOUNT = 19; float expFactor = 33.0; @@ -246,7 +248,7 @@ vec4 GetVolumetricFog( vec3 progressW = vec3(0.0); - float maxLength = min(length(dVWorld), maxDist)/length(dVWorld); + float maxLength = min(rayLength, maxDist)/rayLength; dVWorld *= maxLength; @@ -264,15 +266,16 @@ vec4 GetVolumetricFog( float skyPhase = (0.5 + pow(clamp(normalize(wpos).y*0.5+0.5,0.0,1.0),4.0)*5.0) * 0.1; - vec3 hazeColor = normalize(gl_Fog.color.rgb + 1e-6) * 0.1; + // vec3 hazeColor = normalize(gl_Fog.color.rgb + 1e-6) * 0.1; - float lightningflash = texelFetch2D(colortex4,ivec2(1,1),0).x/150.0; + float lightningflash = texelFetch(colortex4,ivec2(1,1),0).x/150.0; for (int i = 0; i < SAMPLECOUNT; i++) { float d = (pow(expFactor, float(i+dither)/float(SAMPLECOUNT))/expFactor - 1.0/expFactor)/(1-1.0/expFactor); float dd = pow(expFactor, float(i+dither2)/float(SAMPLECOUNT)) * log(expFactor) / float(SAMPLECOUNT)/(expFactor-1.0); - vec3 progressW = gbufferModelViewInverse[3].xyz+cameraPosition + d*dVWorld; + vec3 progressP = gbufferModelViewInverse[3].xyz + d*dVWorld; + vec3 progressW = progressP + cameraPosition; //------ END STORM EFFECT @@ -289,7 +292,7 @@ vec4 GetVolumetricFog( float volumeDensity = fogShape(progressW); - float clearArea = 1.0-min(max(1.0 - length(progressW - cameraPosition) / 100,0.0),1.0); + float clearArea = 1.0-min(max(1.0 - length(progressP) / 100,0.0),1.0); float stormDensity = min(volumeDensity, clearArea*clearArea * END_STORM_DENSTIY); #ifdef THE_ORB @@ -314,7 +317,7 @@ vec4 GetVolumetricFog( #if defined FLASHLIGHT && defined FLASHLIGHT_FOG_ILLUMINATION - vec3 shiftedViewPos = mat3(gbufferModelView)*(progressW-cameraPosition) + vec3(-0.25, 0.2, 0.0); + vec3 shiftedViewPos = mat3(gbufferModelView)*progressP + vec3(-0.25, 0.2, 0.0); vec3 shiftedPlayerPos = mat3(gbufferModelViewInverse) * shiftedViewPos; vec2 scaledViewPos = shiftedViewPos.xy / max(-shiftedViewPos.z - 0.5, 1e-7); float linearDistance = length(shiftedPlayerPos); diff --git a/shaders/lib/gameplay_effects.glsl b/shaders/lib/gameplay_effects.glsl index a0551d7..259594e 100644 --- a/shaders/lib/gameplay_effects.glsl +++ b/shaders/lib/gameplay_effects.glsl @@ -69,7 +69,7 @@ void applyGameplayEffects(inout vec3 color, in vec2 texcoord, float noise){ scale.z = eyeInWater ? 0.0 : exitWater; - float waterDrops = texture2D(noisetex, (texcoord - vec2(0.0, scale.z)) * scale.xy).r ; + float waterDrops = texture(noisetex, (texcoord - vec2(0.0, scale.z)) * scale.xy).r ; if(eyeInWater) waterDrops = 0.0; if(isEyeInWater == 0 && exitWater > 0.0) waterDrops = sqrt(min(max(waterDrops - (1.0-sqrt(exitWater))*0.7,0.0) * (1.0 + exitWater),1.0)) * 0.3; @@ -78,7 +78,7 @@ void applyGameplayEffects(inout vec3 color, in vec2 texcoord, float noise){ } if(enterWater > 0.0){ vec2 zoomTC = 0.5 + (texcoord - 0.5) * (1.0 - (1.0-sqrt(1.0-enterWater)) ); - float waterSplash = texture2D(noisetex, zoomTC * vec2(aspectRatio,1.0)).r * (1.0-enterWater); + float waterSplash = texture(noisetex, zoomTC * vec2(aspectRatio,1.0)).r * (1.0-enterWater); distortmask = max(distortmask, waterSplash); } @@ -90,7 +90,7 @@ void applyGameplayEffects(inout vec3 color, in vec2 texcoord, float noise){ vec2 UV = zoomin; - float flameDistort = texture2D(noisetex, UV * vec2(aspectRatio,1.0) - vec2(0.0,frameTimeCounter*0.3)).b * clamp(-texcoord.y*0.3+0.3,0.0,1.0) * ON_FIRE_DISTORT_EFFECT_STRENGTH * exitLava; + float flameDistort = texture(noisetex, UV * vec2(aspectRatio,1.0) - vec2(0.0,frameTimeCounter*0.3)).b * clamp(-texcoord.y*0.3+0.3,0.0,1.0) * ON_FIRE_DISTORT_EFFECT_STRENGTH * exitLava; distortmask = max(distortmask, flameDistort); } @@ -101,7 +101,7 @@ void applyGameplayEffects(inout vec3 color, in vec2 texcoord, float noise){ vec2 zoomUV = 0.5 + (texcoord - 0.5) * (1.0 - distortmask); #ifndef PIXELATED - vec3 distortedColor = texture2D(colortex7, zoomUV).rgb; + vec3 distortedColor = texture(colortex7, zoomUV).rgb; #else vec2 fragCoord = zoomUV*view_res; vec3 distortedColor = texelFetch(colortex7, ivec2(fragCoord)-ivec2(mod(fragCoord, PIXELIZATION_STRENGTH)), 0).rgb; diff --git a/shaders/lib/indirect_lighting_effects.glsl b/shaders/lib/indirect_lighting_effects.glsl index b940847..ef313c8 100644 --- a/shaders/lib/indirect_lighting_effects.glsl +++ b/shaders/lib/indirect_lighting_effects.glsl @@ -75,14 +75,14 @@ vec4 BilateralUpscale_SSAO(sampler2D tex, sampler2D depth, vec2 coord, float ref ivec2 radius = getRadius[i]; #if defined DISTANT_HORIZONS || defined VOXY - float offsetDepth = sqrt(texelFetch2D(depth, posDepth + radius * scaling + pos * scaling,0).a/65000.0); + float offsetDepth = sqrt(texelFetch(depth, posDepth + radius * scaling + pos * scaling,0).a/65000.0); #else - float offsetDepth = ld(texelFetch2D(depth, posDepth + radius * scaling + pos * scaling, 0).r); + float offsetDepth = ld(texelFetch(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 += texelFetch(tex, posColor + radius + pos, 0) * EDGES; SUM += EDGES; } @@ -127,9 +127,9 @@ vec3 rayTrace_GI(vec3 dir,vec3 position,float dither, float quality){ for (int i = 0; i <= int(quality); i++) { #ifdef UseQuarterResDepth - float sampleDepth = sqrt(texelFetch2D(colortex4,ivec2(spos.xy/texelSize/4.0),0).a/65000.0); + float sampleDepth = sqrt(texelFetch(colortex4,ivec2(spos.xy/texelSize/4.0),0).a/65000.0); #else - float sampleDepth = linZ(texelFetch2D(depthtex1,ivec2(spos.xy/ texelSize),0).r); + float sampleDepth = linZ(texelFetch(depthtex1,ivec2(spos.xy/ texelSize),0).r); #endif float sp = invLinZ(sampleDepth) ; @@ -150,7 +150,7 @@ float convertHandDepth_3(in float depth, bool hand) { return ndcDepth * 0.5 + 0.5; } -vec3 RT_alternate(vec3 dir, vec3 position, float noise, float stepsizes, bool hand, inout float CURVE ){ +vec3 RT_alternate(vec3 dir, vec3 position, float noise, float stepsizes, bool hand, inout float CURVE){ vec3 worldpos = mat3(gbufferModelViewInverse) * position; @@ -195,9 +195,9 @@ vec3 RT_alternate(vec3 dir, vec3 position, float noise, float stepsizes, bool ha if (spos.x < 0.0 || spos.y < 0.0 || spos.z < 0.0 || spos.x > 1.0 || spos.y > 1.0 || spos.z > 1.0) return vec3(1.1); #ifdef UseQuarterResDepth - float sp = invLinZ(sqrt(texelFetch2D(colortex4,ivec2(spos.xy/ texelSize/4),0).w/65000.0)); + float sp = invLinZ(sqrt(texelFetch(colortex4,ivec2(spos.xy/ texelSize/4),0).w/65000.0)); #else - float sp = texelFetch2D(depthtex1,ivec2(spos.xy/texelSize),0).r; + float sp = texelFetch(depthtex1,ivec2(spos.xy/texelSize),0).r; #endif float currZ = linZ(spos.z); @@ -280,7 +280,7 @@ vec3 ApplySSRT( previousPosition.xy = projMAD(gbufferPreviousProjection, previousPosition).xy / -previousPosition.z * 0.5 + 0.5; if (previousPosition.x > 0.0 && previousPosition.y > 0.0 && previousPosition.x < 1.0 && previousPosition.y < 1.0){ - bouncedLight = texture2D(colortex5, previousPosition.xy).rgb * GI_Strength * CURVE; + bouncedLight = texelFetch(colortex5, ivec2(previousPosition.xy/texelSize),0).rgb * GI_Strength * CURVE; radiance += bouncedLight; radiance2 += bouncedLight; diff --git a/shaders/lib/nether_fog.glsl b/shaders/lib/nether_fog.glsl index 0e3829f..8e4c6e2 100644 --- a/shaders/lib/nether_fog.glsl +++ b/shaders/lib/nether_fog.glsl @@ -8,7 +8,7 @@ float densityAtPosFog(in vec3 pos){ f = (f*f) * (3.-2.*f); vec2 uv = p.xz + f.xz + p.y * vec2(0.0,193.0); vec2 coord = uv / 512.0; - vec2 xy = texture2D(noisetex, coord).yx; + vec2 xy = texture(noisetex, coord).yx; return mix(xy.r,xy.g, f.y); } @@ -17,7 +17,7 @@ float cloudVol(in vec3 pos){ float Wind = pow(max(pos.y-30.,0.0) / 15.0,2.1); - float Plumes = texture2D(noisetex, (samplePos.xz + Wind)/256.0).b; + float Plumes = texture(noisetex, (samplePos.xz + Wind)/256.0).b; float floorPlumes = clamp(0.3 - exp(Plumes * -6),0,1); Plumes *= Plumes; diff --git a/shaders/lib/overworld_fog.glsl b/shaders/lib/overworld_fog.glsl index b7a31ff..c0e07ba 100644 --- a/shaders/lib/overworld_fog.glsl +++ b/shaders/lib/overworld_fog.glsl @@ -8,7 +8,7 @@ float densityAtPosFog(in vec3 pos){ f = (f*f) * (3.-2.*f); vec2 uv = p.xz + f.xz + p.y * vec2(0.0,193.0); vec2 coord = uv / 512.0; - vec2 xy = texture2D(noisetex, coord).yx; + vec2 xy = texture(noisetex, coord).yx; return mix(xy.r,xy.g, f.y); } @@ -155,7 +155,7 @@ vec4 GetVolumetricFog( skyLightPhased *= skyPhase; LightSourcePhased *= sunPhase; - #ifdef ambientLight_only + #ifdef AMBIENT_LIGHT_ONLY LightSourcePhased = vec3(0.0); #endif @@ -200,14 +200,14 @@ vec4 GetVolumetricFog( shadowPos = shadowPos*vec3(0.5,0.5,0.5/6.0)+0.5; #ifdef TRANSLUCENT_COLORED_SHADOWS - sh = vec3(shadow2D(shadowtex0, shadowPos).x); + sh = vec3(texture(shadowtex0, shadowPos).x); - if(shadow2D(shadowtex1, shadowPos).x > shadowPos.z && sh.x < 1.0){ - vec4 translucentShadow = texture2D(shadowcolor0, shadowPos.xy); + if(texture(shadowtex1, shadowPos).x > shadowPos.z && sh.x < 1.0){ + vec4 translucentShadow = texture(shadowcolor0, shadowPos.xy); if(translucentShadow.a < 0.9) sh = normalize(translucentShadow.rgb+0.0001); } #else - sh = vec3(shadow2D(shadow, shadowPos).x); + sh = vec3(texture(shadow, shadowPos).x); #endif } @@ -236,7 +236,7 @@ vec4 GetVolumetricFog( #endif vec3 Lightning = Iris_Lightningflash_VLfog(progressP); - vec3 lighting = DirectLight + indirectLight + 0.1 * Lightning; + vec3 lighting = DirectLight + indirectLight + 0.0025 * Lightning; color += (lighting - lighting * fogVolumeCoeff) * totalAbsorbance; diff --git a/shaders/lib/scene_controller.glsl b/shaders/lib/scene_controller.glsl index 5d8f761..ff24af3 100644 --- a/shaders/lib/scene_controller.glsl +++ b/shaders/lib/scene_controller.glsl @@ -190,84 +190,3 @@ void applySceneControllerParameters( // fog = (uniform fog density, cloudy fog density) // ... and more, eventually -// #if !defined VOXY_PROGRAM && !defined CLOUD_SHADOW_PASS -// flat varying struct sceneController { -// vec2 smallCumulus; -// vec2 largeCumulus; -// vec2 altostratus; -// vec2 cirrus; -// vec2 fog; -// } SC_parameters; -// #else -// struct sceneController { -// vec2 smallCumulus; -// vec2 largeCumulus; -// vec2 altostratus; -// vec2 cirrus; -// vec2 fog; -// } SC_parameters; -// #endif - -vec3 writeSceneControllerParameters( - vec2 uv, - vec2 smallCumulus, - vec2 largeCumulus, - vec2 altostratus, - vec2 cirrus, - vec2 fog -){ - - // in colortex4, data is written in a 3x3 pixel area from (1,1) to (3,3) - // avoiding use of any variation of (0,0) to avoid weird textture wrapping issues - // 4th compnent/alpha is storing 1/4 res depth so i cant store there lol - - /* (1,3) */ bool topLeft = uv.x > 1 && uv.x < 2 && uv.y > 3 && uv.y < 4; - /* (2,3) */ bool topMiddle = uv.x > 2 && uv.x < 3 && uv.y > 3 && uv.y < 4; - /* (3,3) */ bool topRight = uv.x > 3 && uv.x < 5 && uv.y > 3 && uv.y < 4; - // /* (1,2) */ bool middleLeft = uv.x > 1 && uv.x < 2 && uv.y > 2 && uv.y < 3; - // /* (2,2) */ bool middleMiddle = uv.x > 2 && uv.x < 3 && uv.y > 2 && uv.y < 3; - // /* (3,2) */ bool middleRight = uv.x > 3 && uv.x < 5 && uv.y > 2 && uv.y < 3; - // /* (1,1) */ bool bottomLeft = uv.x > 1 && uv.x < 2 && uv.y > 1 && uv.y < 2; - /* (2,1) */ bool bottomMiddle = uv.x > 2 && uv.x < 3 && uv.y > 1 && uv.y < 2; - // /* (3,1) */ bool bottomRight = uv.x > 3 && uv.x < 5 && uv.y > 1 && uv.y < 2; - - vec3 data = vec3(0.0,0.0,0.0); - - if(topLeft) data = vec3(smallCumulus.xy, largeCumulus.x); - if(topMiddle) data = vec3(largeCumulus.y, altostratus.xy); - if(topRight) data = vec3(cirrus.xy, 0.0); - if(bottomMiddle) data = vec3(fog.xy, 0.0); - - // if(topRight) data = vec4(groundSunColor,fogSunColor.r); - // if(middleLeft) data = vec4(groundAmbientColor,fogSunColor.g); - // if(middleMiddle) data = vec4(fogAmbientColor,fogSunColor.b); - // if(middleRight) data = vec4(cloudSunColor,cloudAmbientColor.r); - // if(bottomLeft) data = vec4(cloudAmbientColor.gb,0.0,0.0); - // if(bottomMiddle) data = vec4(0.0); - // if(bottomRight) data = vec4(0.0); - - return data; -} - -void readSceneControllerParameters( - sampler2D colortex, - out vec2 smallCumulus, - out vec2 largeCumulus, - out vec2 altostratus, - out vec2 cirrus, - out vec2 fog -){ - - // in colortex4, read the data stored within the 3 components of the sampled pixels, and pass it to the fragment stage - // 4th compnent/alpha is storing 1/4 res depth so i cant store there lol - vec3 data1 = texelFetch(colortex,ivec2(1,3),0).rgb/150.0; - vec3 data2 = texelFetch(colortex,ivec2(2,3),0).rgb/150.0; - vec3 data3 = texelFetch(colortex,ivec2(3,3),0).rgb/150.0; - vec3 data4 = texelFetch(colortex,ivec2(2,1),0).rgb/150.0; - - smallCumulus = vec2(data1.x,data1.y); - largeCumulus = vec2(data1.z,data2.x); - altostratus = vec2(data2.y,data2.z); - cirrus = vec2(data3.x,data3.y); - fog = vec2(data4.x,data4.y); -} diff --git a/shaders/lib/settings.glsl b/shaders/lib/settings.glsl index 5e19a5a..75e672d 100644 --- a/shaders/lib/settings.glsl +++ b/shaders/lib/settings.glsl @@ -6,7 +6,7 @@ // ----- WATER RELATED SETTINGS ----- // //////////////////////////////////////// -// #define Vanilla_like_water +// #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 WATER_WAVE_SPEED 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.1 // [0.0 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 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 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0] @@ -467,7 +467,7 @@ uniform vec3 unsigned_WmoonVecSmooth; #define Cloud_Speed 2.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] #ifdef VOLUMETRIC_CLOUDS - #ifndef ambientLight_only + #ifndef AMBIENT_LIGHT_ONLY #define CLOUDS_SHADOWS #endif #ifdef CLOUDS_SHADOWS @@ -937,7 +937,7 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631) #define SKY_GROUND_G 1.0 // [0.00 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 1.0] #define SKY_GROUND_B 1.0 // [0.00 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 1.0] -// #define ambientLight_only // THIS IS A DEBUG VIEW. turn the sunlight off. DOES NOT increase performance, the shadows are still working in the background +// #define AMBIENT_LIGHT_ONLY // THIS IS A DEBUG VIEW. turn the sunlight off. DOES NOT increase performance, the shadows are still working in the background // #define WhiteWorld // THIS IS A DEBUG VIEW. uses to see AO easier. used to see fake GI better (green light) // #define Compositing_Sky // make the sky some color to make compositing a sky in some photoediting software easier. // #define display_LUT diff --git a/shaders/lib/sky_gradient.glsl b/shaders/lib/sky_gradient.glsl index 4216571..0374eea 100644 --- a/shaders/lib/sky_gradient.glsl +++ b/shaders/lib/sky_gradient.glsl @@ -104,7 +104,7 @@ float h1(float a) return 1.0 + w3(a) / (w2(a) + w3(a)); } -vec4 texture2D_bicubic(sampler2D tex, vec2 uv) +vec4 texture_bicubic(sampler2D tex, vec2 uv) { vec4 texelSize = vec4(texelSize,1.0/texelSize); uv = uv*texelSize.zw; @@ -128,7 +128,7 @@ vec4 texture2D_bicubic(sampler2D tex, vec2 uv) g1(fuv.y) * (g0x * texture(tex, p2) + g1x * texture(tex, p3)); } -vec4 texture2D_bicubic_offset(sampler2D tex, vec2 uv, float noise, float scale) +vec4 texture_bicubic_offset(sampler2D tex, vec2 uv, float noise, float scale) { float offsets = noise * (2.0 * 3.141592653589793238462643383279502884197169); vec2 circleOffsets = vec2(sin(offsets), cos(offsets)) * scale; @@ -178,7 +178,7 @@ vec3 skyFromTex(vec3 pos,sampler2D sampler){ // vec3 skyFromTexLOD(vec3 pos,sampler2D sampler, float LOD){ // vec2 p = sphereToCarte(pos); // -// return texture2DLod(sampler,p*texelSize*256.+vec2(18.5,1.5)*texelSize,LOD).rgb; +// return textureLod(sampler,p*texelSize*256.+vec2(18.5,1.5)*texelSize,LOD).rgb; // } vec4 skyCloudsFromTex(vec3 pos,sampler2D sampler){ diff --git a/shaders/lib/specular.glsl b/shaders/lib/specular.glsl index a4b7daf..39d03b4 100644 --- a/shaders/lib/specular.glsl +++ b/shaders/lib/specular.glsl @@ -325,10 +325,10 @@ vec4 screenSpaceReflections( // vec2 clampedRes = max(vec2(viewWidth,viewHeight),vec2(1920.0,1080.)); // vec2 resScale = vec2(1920.,1080.)/clampedRes; // vec2 bloomTileUV = (((previousPosition.xy/texelSize)*2.0 + 0.5)*texelSize/2.0) / clampedRes*vec2(1920.,1080.); - // reflection.rgb = texture2D(colortex6, bloomTileUV / 4.0).rgb; - reflection.rgb = texture2D(colortex5, previousPosition.xy).rgb; + // reflection.rgb = texture(colortex6, bloomTileUV / 4.0).rgb; + reflection.rgb = texture(colortex5, previousPosition.xy).rgb; #else - reflection.rgb = texture2DLod(colortex5, previousPosition.xy, LOD).rgb; + reflection.rgb = textureLod(colortex5, previousPosition.xy, LOD).rgb; #endif } @@ -348,7 +348,7 @@ vec4 screenSpaceReflections( // ); // // reflectLength = pow(1-pow(1-reflectLength,2),5) * 6; // reflectLength = (exp(-4*(1-reflectLength))) * 6; -// Reflections.rgb = texture2D(colortex6, bloomTileoffsetUV[0]).rgb; +// Reflections.rgb = texture(colortex6, bloomTileoffsetUV[0]).rgb; return reflection; } diff --git a/shaders/lib/texFiltering.glsl b/shaders/lib/texFiltering.glsl index 7d58676..0d22040 100644 --- a/shaders/lib/texFiltering.glsl +++ b/shaders/lib/texFiltering.glsl @@ -5,7 +5,7 @@ vec4 smoothfilter(in sampler2D tex, in vec2 uv, in vec2 textureResolution) vec2 fuv = fract( uv ); uv = iuv + (fuv*fuv)*(3.0-2.0*fuv); uv = uv/textureResolution - 0.5/textureResolution; - return texture2D( tex, uv); + return texture( tex, uv); } float shadowsmoothfilter(in sampler2DShadow tex, in vec3 uv,in float textureResolution) @@ -15,5 +15,5 @@ float shadowsmoothfilter(in sampler2DShadow tex, in vec3 uv,in float textureReso vec2 fuv = fract( uv.xy ); uv.xy = iuv + (fuv*fuv)*(3.0-2.0*fuv); uv.xy = uv.xy/textureResolution - 0.5/textureResolution; - return shadow2D( tex, uv).x; + return texture( tex, uv).x; } diff --git a/shaders/lib/volumetricClouds.glsl b/shaders/lib/volumetricClouds.glsl index b05622d..9571481 100644 --- a/shaders/lib/volumetricClouds.glsl +++ b/shaders/lib/volumetricClouds.glsl @@ -303,7 +303,7 @@ vec2 getCumulonimbusShape(int LOD, in vec3 position, float minHeight, float maxH float posToMax = maxHeight - position.y; float cumulonimbusScale = 1.0; - //largeCloud = texture2D(noisetex, (samplePos.zx - cloud_movement*6.0) / 17000.0 * cumulonimbusScale * 0.2).b; + //largeCloud = texture(noisetex, (samplePos.zx - cloud_movement*6.0) / 17000.0 * cumulonimbusScale * 0.2).b; //largeCloud = abs(largeCloud* -8.0); @@ -850,14 +850,14 @@ vec4 raymarchCloud( shadowPos = shadowPos*vec3(0.5,0.5,0.5/6.0)+0.5; #ifdef TRANSLUCENT_COLORED_SHADOWS - sh = vec3(shadow2D(shadowtex0, shadowPos).x); + sh = vec3(texture(shadowtex0, shadowPos).x); - if(shadow2D(shadowtex1, shadowPos).x > shadowPos.z && sh.x < 1.0){ + if(texture(shadowtex1, shadowPos).x > shadowPos.z && sh.x < 1.0){ vec4 translucentShadow = texture(shadowcolor0, shadowPos.xy); if(translucentShadow.a < 0.9) sh = normalize(translucentShadow.rgb+0.0001); } #else - sh = vec3(shadow2D(shadow, shadowPos).x); + sh = vec3(texture(shadow, shadowPos).x); #endif } #else diff --git a/shaders/shaders.properties b/shaders/shaders.properties index 03e5414..e211ebf 100644 --- a/shaders/shaders.properties +++ b/shaders/shaders.properties @@ -8,11 +8,11 @@ profile.POTATO = QUARTER_RES_SSR !TERRAIN_SHADOW_ON_CLOUDS LP profile.VERY_LOW = QUARTER_RES_SSR !TERRAIN_SHADOW_ON_CLOUDS LPV_HANDHELD_SHADOWS_QUALITY:0 !SHADER_GRASS !HQ_CLOUD_UPSAMPLE WATER_INTERACTION:1 WATER_SIM_DISTANCE:1 WATER_SIM_SCALE:0 WATER_SIM_FRAMERATE:30 !MOON_NORMALS RAINBOW:0 !CUSTOM_MOON_ROTATION CUSTOM_SHADOWS_QUALITY:0 !END_ISLAND_LIGHT CloudLayer0_distance:100000.0 CloudLayer1_distance:100000.0 !RIPPLE_PUDDLES !RIPPLE_WATER PUDDLE_MODE:0 ShaderSnow:0 CUMULONIMBUS:0 CloudLayer0 !CloudLayer1 !CloudLayer2 !CloudLayer3 VL_RENDER_SCALE:0.25 indirect_effect:VANILLA_AO RAY_COUNT:4 VL_SAMPLES:4 REALMOON shadowMapResolution:1024 shadowDistance:96.0 !DH_SCREENSPACE_REFLECTIONS !LPV_ENABLED !SAND_STORMS !SNOW_STORMS TAA_UPSCALING SCALE_FACTOR:0.8 SHARPENING:50 EXPOSURE_MULTIPLIER:1.0 ambientsss_brightness:1.0 TONEMAP:ToneMap_AgX_minimal_merlin AO_Strength:1.0 SCREENSPACE_DIRECT_SSS_BLENDING:0.5 WATER_CAUSTICS_POWER:1.0 Sky_Brightness:1.0 TOD_Fog_mult:1.0 Water_Absorb_R:0.392389 Water_Absorb_G:0.108329 Water_Absorb_B:0.0660636 Dirt_Scatter_B:0.39 Dirt_Scatter_G:0.39 Dirt_Scatter_R:0.6 ambient_brightness:1.0 WHITE_BALANCE:6500 Sun_temp:6300 Haze_amount:1.0 CROSSTALK:0.0 BLOOM_STRENGTH:1.0 SATURATION:0.0 Dirt_Amount:0.1 Dirt_Absorb_R:0.68 Dirt_Absorb_G:0.4 Dirt_Absorb_B:0.38 profile.LOW = QUARTER_RES_SSR !TERRAIN_SHADOW_ON_CLOUDS LPV_HANDHELD_SHADOWS_QUALITY:0 !SHADER_GRASS !HQ_CLOUD_UPSAMPLE WATER_INTERACTION:2 WATER_SIM_DISTANCE:2 WATER_SIM_SCALE:0 WATER_SIM_FRAMERATE:30 !MOON_NORMALS RAINBOW:1 CUSTOM_MOON_ROTATION CUSTOM_SHADOWS_QUALITY:0 !END_ISLAND_LIGHT CloudLayer0_distance:100000.0 CloudLayer1_distance:100000.0 !RIPPLE_PUDDLES !RIPPLE_WATER PUDDLE_MODE:0 ShaderSnow:0 CUMULONIMBUS:0 CloudLayer0 !CloudLayer1 CloudLayer2 !CloudLayer3 VL_RENDER_SCALE:0.25 indirect_effect:SSAO_FILTERED RAY_COUNT:4 VL_SAMPLES:6 REALMOON shadowMapResolution:1536 shadowDistance:112.0 !DH_SCREENSPACE_REFLECTIONS !LPV_ENABLED SAND_STORMS SNOW_STORMS TAA_UPSCALING SCALE_FACTOR:0.9 SHARPENING:45 EXPOSURE_MULTIPLIER:1.0 ambientsss_brightness:1.0 TONEMAP:ToneMap_AgX_minimal_merlin AO_Strength:1.0 SCREENSPACE_DIRECT_SSS_BLENDING:0.5 WATER_CAUSTICS_POWER:1.0 Sky_Brightness:1.0 TOD_Fog_mult:1.0 Water_Absorb_R:0.392389 Water_Absorb_G:0.108329 Water_Absorb_B:0.0660636 Dirt_Scatter_B:0.39 Dirt_Scatter_G:0.39 Dirt_Scatter_R:0.6 ambient_brightness:1.0 WHITE_BALANCE:6500 Sun_temp:6300 Haze_amount:1.0 CROSSTALK:0.0 BLOOM_STRENGTH:1.0 SATURATION:0.0 Dirt_Amount:0.1 Dirt_Absorb_R:0.68 Dirt_Absorb_G:0.4 Dirt_Absorb_B:0.38 profile.MEDIUM = QUARTER_RES_SSR !TERRAIN_SHADOW_ON_CLOUDS LPV_HANDHELD_SHADOWS_QUALITY:0 !SHADER_GRASS HQ_CLOUD_UPSAMPLE WATER_INTERACTION:2 WATER_SIM_DISTANCE:2 WATER_SIM_SCALE:1 WATER_SIM_FRAMERATE:30 MOON_NORMALS RAINBOW:1 CUSTOM_MOON_ROTATION CUSTOM_SHADOWS_QUALITY:1 END_ISLAND_LIGHT CloudLayer0_distance:100000.0 CloudLayer1_distance:100000.0 !RIPPLE_PUDDLES RIPPLE_WATER PUDDLE_MODE:0 ShaderSnow:0 CUMULONIMBUS:0 CloudLayer0 CloudLayer1 CloudLayer2 !CloudLayer3 VL_RENDER_SCALE:0.5 indirect_effect:SSAO_FILTERED RAY_COUNT:4 VL_SAMPLES:6 REALMOON shadowMapResolution:2048 shadowDistance:128.0 DH_SCREENSPACE_REFLECTIONS !LPV_ENABLED SAND_STORMS SNOW_STORMS !TAA_UPSCALING SCALE_FACTOR:0.75 SHARPENING:45 EXPOSURE_MULTIPLIER:1.0 ambientsss_brightness:1.0 TONEMAP:ToneMap_AgX_minimal_merlin AO_Strength:1.0 SCREENSPACE_DIRECT_SSS_BLENDING:0.5 WATER_CAUSTICS_POWER:1.0 Sky_Brightness:1.0 TOD_Fog_mult:1.0 Water_Absorb_R:0.392389 Water_Absorb_G:0.108329 Water_Absorb_B:0.0660636 Dirt_Scatter_B:0.39 Dirt_Scatter_G:0.39 Dirt_Scatter_R:0.6 ambient_brightness:1.0 WHITE_BALANCE:6500 Sun_temp:6300 Haze_amount:1.0 CROSSTALK:0.0 BLOOM_STRENGTH:1.0 SATURATION:0.0 Dirt_Amount:0.1 Dirt_Absorb_R:0.68 Dirt_Absorb_G:0.4 Dirt_Absorb_B:0.38 -profile.ALTERNATE_MEDIUM = QUARTER_RES_SSR !TERRAIN_SHADOW_ON_CLOUDS LPV_HANDHELD_SHADOWS_QUALITY:0 !SHADER_GRASS HQ_CLOUD_UPSAMPLE WATER_INTERACTION:2 WATER_SIM_DISTANCE:2 WATER_SIM_SCALE:1 WATER_SIM_FRAMERATE:30 MOON_NORMALS RAINBOW:1 CUSTOM_MOON_ROTATION CUSTOM_SHADOWS_QUALITY:1 END_ISLAND_LIGHT CloudLayer0_distance:100000.0 CloudLayer1_distance:100000.0 !RIPPLE_PUDDLES RIPPLE_WATER PUDDLE_MODE:0 ShaderSnow:0 CUMULONIMBUS:0 CloudLayer0 CloudLayer1 CloudLayer2 !CloudLayer3 VL_RENDER_SCALE:0.5 indirect_effect:SSAO_FILTERED RAY_COUNT:4 VL_SAMPLES:6 REALMOON shadowMapResolution:2048 shadowDistance:128.0 DH_SCREENSPACE_REFLECTIONS !LPV_ENABLED SAND_STORMS SNOW_STORMS !TAA_UPSCALING SCALE_FACTOR:0.75 SHARPENING:45 EXPOSURE_MULTIPLIER:1.1 ambientsss_brightness:0.5 TONEMAP:ToneMap_Hejl2015 AO_Strength:0.4 SCREENSPACE_DIRECT_SSS_BLENDING:0.4 WATER_CAUSTICS_POWER:0.55 Sky_Brightness:0.7 TOD_Fog_mult:0.5 Water_Absorb_R:0.38 Water_Absorb_G:0.28 Water_Absorb_B:0.36 Dirt_Scatter_B:0.14 Dirt_Scatter_G:0.13 Dirt_Scatter_R:0.14 ambient_brightness:0.7 WHITE_BALANCE:7000 Sun_temp:6200 Haze_amount:0.6 CROSSTALK:0.14 BLOOM_STRENGTH:0.5 SATURATION:-0.16 Dirt_Amount:2.0 Dirt_Absorb_R:1.0 Dirt_Absorb_G:1.0 Dirt_Absorb_B:1.0 +profile.ALTERNATE_MEDIUM = QUARTER_RES_SSR !TERRAIN_SHADOW_ON_CLOUDS LPV_HANDHELD_SHADOWS_QUALITY:0 !SHADER_GRASS HQ_CLOUD_UPSAMPLE WATER_INTERACTION:2 WATER_SIM_DISTANCE:2 WATER_SIM_SCALE:1 WATER_SIM_FRAMERATE:30 MOON_NORMALS RAINBOW:1 CUSTOM_MOON_ROTATION CUSTOM_SHADOWS_QUALITY:1 END_ISLAND_LIGHT CloudLayer0_distance:100000.0 CloudLayer1_distance:100000.0 !RIPPLE_PUDDLES RIPPLE_WATER PUDDLE_MODE:0 ShaderSnow:0 CUMULONIMBUS:0 CloudLayer0 CloudLayer1 CloudLayer2 !CloudLayer3 VL_RENDER_SCALE:0.5 indirect_effect:SSAO_FILTERED RAY_COUNT:4 VL_SAMPLES:6 REALMOON shadowMapResolution:2048 shadowDistance:128.0 DH_SCREENSPACE_REFLECTIONS !LPV_ENABLED SAND_STORMS SNOW_STORMS !TAA_UPSCALING SCALE_FACTOR:0.75 SHARPENING:45 EXPOSURE_MULTIPLIER:1.1 ambientsss_brightness:0.7 TONEMAP:ToneMap_Hejl2015 AO_Strength:0.4 SCREENSPACE_DIRECT_SSS_BLENDING:0.4 WATER_CAUSTICS_POWER:0.55 Sky_Brightness:0.7 TOD_Fog_mult:0.5 Water_Absorb_R:0.38 Water_Absorb_G:0.28 Water_Absorb_B:0.36 Dirt_Scatter_B:0.14 Dirt_Scatter_G:0.13 Dirt_Scatter_R:0.14 ambient_brightness:0.7 WHITE_BALANCE:7000 Sun_temp:6200 Haze_amount:0.6 CROSSTALK:0.14 BLOOM_STRENGTH:0.5 SATURATION:-0.16 Dirt_Amount:2.0 Dirt_Absorb_R:1.0 Dirt_Absorb_G:1.0 Dirt_Absorb_B:1.0 profile.HIGH = QUARTER_RES_SSR TERRAIN_SHADOW_ON_CLOUDS LPV_HANDHELD_SHADOWS_QUALITY:0 !SHADER_GRASS HQ_CLOUD_UPSAMPLE WATER_INTERACTION:2 WATER_SIM_DISTANCE:2 WATER_SIM_SCALE:1 WATER_SIM_FRAMERATE:60 MOON_NORMALS RAINBOW:1 CUSTOM_MOON_ROTATION CUSTOM_SHADOWS_QUALITY:1 END_ISLAND_LIGHT CloudLayer0_distance:100000.0 CloudLayer1_distance:100000.0 RIPPLE_PUDDLES RIPPLE_WATER PUDDLE_MODE:1 ShaderSnow:1 CUMULONIMBUS:0 CloudLayer0 CloudLayer1 CloudLayer2 !CloudLayer3 VL_RENDER_SCALE:0.5 indirect_effect:SSAO_FILTERED RAY_COUNT:4 VL_SAMPLES:8 REALMOON shadowMapResolution:2560 shadowDistance:128.0 DH_SCREENSPACE_REFLECTIONS LPV_ENABLED SAND_STORMS SNOW_STORMS !TAA_UPSCALING SCALE_FACTOR:0.75 SHARPENING:45 EXPOSURE_MULTIPLIER:1.0 ambientsss_brightness:1.0 TONEMAP:ToneMap_AgX_minimal_merlin AO_Strength:1.0 SCREENSPACE_DIRECT_SSS_BLENDING:0.5 WATER_CAUSTICS_POWER:1.0 Sky_Brightness:1.0 TOD_Fog_mult:1.0 Water_Absorb_R:0.392389 Water_Absorb_G:0.108329 Water_Absorb_B:0.0660636 Dirt_Scatter_B:0.39 Dirt_Scatter_G:0.39 Dirt_Scatter_R:0.6 ambient_brightness:1.0 WHITE_BALANCE:6500 Sun_temp:6300 Haze_amount:1.0 CROSSTALK:0.0 BLOOM_STRENGTH:1.0 SATURATION:0.0 Dirt_Amount:0.1 Dirt_Absorb_R:0.68 Dirt_Absorb_G:0.4 Dirt_Absorb_B:0.38 -profile.ALTERNATE_HIGH = QUARTER_RES_SSR TERRAIN_SHADOW_ON_CLOUDS LPV_HANDHELD_SHADOWS_QUALITY:0 !SHADER_GRASS HQ_CLOUD_UPSAMPLE WATER_INTERACTION:2 WATER_SIM_DISTANCE:2 WATER_SIM_SCALE:1 WATER_SIM_FRAMERATE:60 MOON_NORMALS RAINBOW:1 CUSTOM_MOON_ROTATION CUSTOM_SHADOWS_QUALITY:1 END_ISLAND_LIGHT CloudLayer0_distance:100000.0 CloudLayer1_distance:100000.0 RIPPLE_PUDDLES RIPPLE_WATER PUDDLE_MODE:1 ShaderSnow:1 CUMULONIMBUS:0 CloudLayer0 CloudLayer1 CloudLayer2 !CloudLayer3 VL_RENDER_SCALE:0.5 indirect_effect:SSAO_FILTERED RAY_COUNT:4 VL_SAMPLES:8 REALMOON shadowMapResolution:2560 shadowDistance:128.0 DH_SCREENSPACE_REFLECTIONS LPV_ENABLED SAND_STORMS SNOW_STORMS !TAA_UPSCALING SCALE_FACTOR:0.75 SHARPENING:45 EXPOSURE_MULTIPLIER:1.1 ambientsss_brightness:0.5 TONEMAP:ToneMap_Hejl2015 AO_Strength:0.4 SCREENSPACE_DIRECT_SSS_BLENDING:0.4 WATER_CAUSTICS_POWER:0.55 Sky_Brightness:0.7 TOD_Fog_mult:0.5 Water_Absorb_R:0.38 Water_Absorb_G:0.28 Water_Absorb_B:0.36 Dirt_Scatter_B:0.14 Dirt_Scatter_G:0.13 Dirt_Scatter_R:0.14 ambient_brightness:0.7 WHITE_BALANCE:7000 Sun_temp:6200 Haze_amount:0.6 CROSSTALK:0.14 BLOOM_STRENGTH:0.5 SATURATION:-0.16 Dirt_Amount:2.0 Dirt_Absorb_R:1.0 Dirt_Absorb_G:1.0 Dirt_Absorb_B:1.0 +profile.ALTERNATE_HIGH = QUARTER_RES_SSR TERRAIN_SHADOW_ON_CLOUDS LPV_HANDHELD_SHADOWS_QUALITY:0 !SHADER_GRASS HQ_CLOUD_UPSAMPLE WATER_INTERACTION:2 WATER_SIM_DISTANCE:2 WATER_SIM_SCALE:1 WATER_SIM_FRAMERATE:60 MOON_NORMALS RAINBOW:1 CUSTOM_MOON_ROTATION CUSTOM_SHADOWS_QUALITY:1 END_ISLAND_LIGHT CloudLayer0_distance:100000.0 CloudLayer1_distance:100000.0 RIPPLE_PUDDLES RIPPLE_WATER PUDDLE_MODE:1 ShaderSnow:1 CUMULONIMBUS:0 CloudLayer0 CloudLayer1 CloudLayer2 !CloudLayer3 VL_RENDER_SCALE:0.5 indirect_effect:SSAO_FILTERED RAY_COUNT:4 VL_SAMPLES:8 REALMOON shadowMapResolution:2560 shadowDistance:128.0 DH_SCREENSPACE_REFLECTIONS LPV_ENABLED SAND_STORMS SNOW_STORMS !TAA_UPSCALING SCALE_FACTOR:0.75 SHARPENING:45 EXPOSURE_MULTIPLIER:1.1 ambientsss_brightness:0.7 TONEMAP:ToneMap_Hejl2015 AO_Strength:0.4 SCREENSPACE_DIRECT_SSS_BLENDING:0.4 WATER_CAUSTICS_POWER:0.55 Sky_Brightness:0.7 TOD_Fog_mult:0.5 Water_Absorb_R:0.38 Water_Absorb_G:0.28 Water_Absorb_B:0.36 Dirt_Scatter_B:0.14 Dirt_Scatter_G:0.13 Dirt_Scatter_R:0.14 ambient_brightness:0.7 WHITE_BALANCE:7000 Sun_temp:6200 Haze_amount:0.6 CROSSTALK:0.14 BLOOM_STRENGTH:0.5 SATURATION:-0.16 Dirt_Amount:2.0 Dirt_Absorb_R:1.0 Dirt_Absorb_G:1.0 Dirt_Absorb_B:1.0 profile.HIGH_GRASS = QUARTER_RES_SSR TERRAIN_SHADOW_ON_CLOUDS LPV_HANDHELD_SHADOWS_QUALITY:0 SHADER_GRASS HQ_CLOUD_UPSAMPLE WATER_INTERACTION:2 WATER_SIM_DISTANCE:2 WATER_SIM_SCALE:1 WATER_SIM_FRAMERATE:60 MOON_NORMALS RAINBOW:1 CUSTOM_MOON_ROTATION CUSTOM_SHADOWS_QUALITY:1 END_ISLAND_LIGHT CloudLayer0_distance:100000.0 CloudLayer1_distance:100000.0 RIPPLE_PUDDLES RIPPLE_WATER PUDDLE_MODE:1 ShaderSnow:1 CUMULONIMBUS:0 CloudLayer0 CloudLayer1 CloudLayer2 !CloudLayer3 VL_RENDER_SCALE:0.5 indirect_effect:SSAO_FILTERED RAY_COUNT:4 VL_SAMPLES:8 REALMOON shadowMapResolution:2560 shadowDistance:128.0 DH_SCREENSPACE_REFLECTIONS LPV_ENABLED SAND_STORMS SNOW_STORMS !TAA_UPSCALING SCALE_FACTOR:0.75 SHARPENING:45 EXPOSURE_MULTIPLIER:1.0 ambientsss_brightness:1.0 TONEMAP:ToneMap_AgX_minimal_merlin AO_Strength:1.0 SCREENSPACE_DIRECT_SSS_BLENDING:0.5 WATER_CAUSTICS_POWER:1.0 Sky_Brightness:1.0 TOD_Fog_mult:1.0 Water_Absorb_R:0.392389 Water_Absorb_G:0.108329 Water_Absorb_B:0.0660636 Dirt_Scatter_B:0.39 Dirt_Scatter_G:0.39 Dirt_Scatter_R:0.6 ambient_brightness:1.0 WHITE_BALANCE:6500 Sun_temp:6300 Haze_amount:1.0 CROSSTALK:0.0 BLOOM_STRENGTH:1.0 SATURATION:0.0 Dirt_Amount:0.1 Dirt_Absorb_R:0.68 Dirt_Absorb_G:0.4 Dirt_Absorb_B:0.38 -profile.ALTERNATE_HIGH_GRASS = QUARTER_RES_SSR TERRAIN_SHADOW_ON_CLOUDS LPV_HANDHELD_SHADOWS_QUALITY:0 SHADER_GRASS HQ_CLOUD_UPSAMPLE WATER_INTERACTION:2 WATER_SIM_DISTANCE:2 WATER_SIM_SCALE:1 WATER_SIM_FRAMERATE:60 MOON_NORMALS RAINBOW:1 CUSTOM_MOON_ROTATION CUSTOM_SHADOWS_QUALITY:1 END_ISLAND_LIGHT CloudLayer0_distance:100000.0 CloudLayer1_distance:100000.0 RIPPLE_PUDDLES RIPPLE_WATER PUDDLE_MODE:1 ShaderSnow:1 CUMULONIMBUS:0 CloudLayer0 CloudLayer1 CloudLayer2 !CloudLayer3 VL_RENDER_SCALE:0.5 indirect_effect:SSAO_FILTERED RAY_COUNT:4 VL_SAMPLES:8 REALMOON shadowMapResolution:2560 shadowDistance:128.0 DH_SCREENSPACE_REFLECTIONS LPV_ENABLED SAND_STORMS SNOW_STORMS !TAA_UPSCALING SCALE_FACTOR:0.75 SHARPENING:45 EXPOSURE_MULTIPLIER:1.1 ambientsss_brightness:0.5 TONEMAP:ToneMap_Hejl2015 AO_Strength:0.4 SCREENSPACE_DIRECT_SSS_BLENDING:0.4 WATER_CAUSTICS_POWER:0.55 Sky_Brightness:0.7 TOD_Fog_mult:0.5 Water_Absorb_R:0.38 Water_Absorb_G:0.28 Water_Absorb_B:0.36 Dirt_Scatter_B:0.14 Dirt_Scatter_G:0.13 Dirt_Scatter_R:0.14 ambient_brightness:0.7 WHITE_BALANCE:7000 Sun_temp:6200 Haze_amount:0.6 CROSSTALK:0.14 BLOOM_STRENGTH:0.5 SATURATION:-0.16 Dirt_Amount:2.0 Dirt_Absorb_R:1.0 Dirt_Absorb_G:1.0 Dirt_Absorb_B:1.0 +profile.ALTERNATE_HIGH_GRASS = QUARTER_RES_SSR TERRAIN_SHADOW_ON_CLOUDS LPV_HANDHELD_SHADOWS_QUALITY:0 SHADER_GRASS HQ_CLOUD_UPSAMPLE WATER_INTERACTION:2 WATER_SIM_DISTANCE:2 WATER_SIM_SCALE:1 WATER_SIM_FRAMERATE:60 MOON_NORMALS RAINBOW:1 CUSTOM_MOON_ROTATION CUSTOM_SHADOWS_QUALITY:1 END_ISLAND_LIGHT CloudLayer0_distance:100000.0 CloudLayer1_distance:100000.0 RIPPLE_PUDDLES RIPPLE_WATER PUDDLE_MODE:1 ShaderSnow:1 CUMULONIMBUS:0 CloudLayer0 CloudLayer1 CloudLayer2 !CloudLayer3 VL_RENDER_SCALE:0.5 indirect_effect:SSAO_FILTERED RAY_COUNT:4 VL_SAMPLES:8 REALMOON shadowMapResolution:2560 shadowDistance:128.0 DH_SCREENSPACE_REFLECTIONS LPV_ENABLED SAND_STORMS SNOW_STORMS !TAA_UPSCALING SCALE_FACTOR:0.75 SHARPENING:45 EXPOSURE_MULTIPLIER:1.1 ambientsss_brightness:0.7 TONEMAP:ToneMap_Hejl2015 AO_Strength:0.4 SCREENSPACE_DIRECT_SSS_BLENDING:0.4 WATER_CAUSTICS_POWER:0.55 Sky_Brightness:0.7 TOD_Fog_mult:0.5 Water_Absorb_R:0.38 Water_Absorb_G:0.28 Water_Absorb_B:0.36 Dirt_Scatter_B:0.14 Dirt_Scatter_G:0.13 Dirt_Scatter_R:0.14 ambient_brightness:0.7 WHITE_BALANCE:7000 Sun_temp:6200 Haze_amount:0.6 CROSSTALK:0.14 BLOOM_STRENGTH:0.5 SATURATION:-0.16 Dirt_Amount:2.0 Dirt_Absorb_R:1.0 Dirt_Absorb_G:1.0 Dirt_Absorb_B:1.0 profile.VERY_HIGH = !QUARTER_RES_SSR TERRAIN_SHADOW_ON_CLOUDS LPV_HANDHELD_SHADOWS_QUALITY:1 SHADER_GRASS HQ_CLOUD_UPSAMPLE WATER_INTERACTION:2 WATER_SIM_DISTANCE:3 WATER_SIM_SCALE:1 WATER_SIM_FRAMERATE:60 MOON_NORMALS RAINBOW:1 CUSTOM_MOON_ROTATION CUSTOM_SHADOWS_QUALITY:2 END_ISLAND_LIGHT CloudLayer0_distance:100000.0 CloudLayer1_distance:100000.0 RIPPLE_PUDDLES RIPPLE_WATER PUDDLE_MODE:1 ShaderSnow:1 CUMULONIMBUS:0 CloudLayer0 CloudLayer1 CloudLayer2 CloudLayer3 VL_RENDER_SCALE:1.0 indirect_effect:SSAO_HQ RAY_COUNT:4 VL_SAMPLES:8 REALMOON shadowMapResolution:3172 shadowDistance:144.0 DH_SCREENSPACE_REFLECTIONS LPV_ENABLED SAND_STORMS SNOW_STORMS !TAA_UPSCALING SCALE_FACTOR:0.75 SHARPENING:45 EXPOSURE_MULTIPLIER:1.0 ambientsss_brightness:1.0 TONEMAP:ToneMap_AgX_minimal_merlin AO_Strength:1.0 SCREENSPACE_DIRECT_SSS_BLENDING:0.5 WATER_CAUSTICS_POWER:1.0 Sky_Brightness:1.0 TOD_Fog_mult:1.0 Water_Absorb_R:0.392389 Water_Absorb_G:0.108329 Water_Absorb_B:0.0660636 Dirt_Scatter_B:0.39 Dirt_Scatter_G:0.39 Dirt_Scatter_R:0.6 ambient_brightness:1.0 WHITE_BALANCE:6500 Sun_temp:6300 Haze_amount:1.0 CROSSTALK:0.0 BLOOM_STRENGTH:1.0 SATURATION:0.0 Dirt_Amount:0.1 Dirt_Absorb_R:0.68 Dirt_Absorb_G:0.4 Dirt_Absorb_B:0.38 profile.ULTRA = !QUARTER_RES_SSR TERRAIN_SHADOW_ON_CLOUDS LPV_HANDHELD_SHADOWS_QUALITY:1 SHADER_GRASS HQ_CLOUD_UPSAMPLE WATER_INTERACTION:2 WATER_SIM_DISTANCE:3 WATER_SIM_SCALE:2 WATER_SIM_FRAMERATE:60 MOON_NORMALS RAINBOW:1 CUSTOM_MOON_ROTATION CUSTOM_SHADOWS_QUALITY:2 END_ISLAND_LIGHT CloudLayer0_distance:100000.0 CloudLayer1_distance:100000.0 RIPPLE_PUDDLES RIPPLE_WATER PUDDLE_MODE:1 ShaderSnow:1 CUMULONIMBUS:1 CloudLayer0 CloudLayer1 CloudLayer2 CloudLayer3 VL_RENDER_SCALE:1.0 indirect_effect:SSGI RAY_COUNT:6 VL_SAMPLES:10 REALMOON shadowMapResolution:4096 shadowDistance:144.0 DH_SCREENSPACE_REFLECTIONS LPV_ENABLED SAND_STORMS SNOW_STORMS !TAA_UPSCALING SCALE_FACTOR:0.75 SHARPENING:45 EXPOSURE_MULTIPLIER:1.0 ambientsss_brightness:1.0 TONEMAP:ToneMap_AgX_minimal_merlin AO_Strength:1.0 SCREENSPACE_DIRECT_SSS_BLENDING:0.5 WATER_CAUSTICS_POWER:1.0 Sky_Brightness:1.0 TOD_Fog_mult:1.0 Water_Absorb_R:0.392389 Water_Absorb_G:0.108329 Water_Absorb_B:0.0660636 Dirt_Scatter_B:0.39 Dirt_Scatter_G:0.39 Dirt_Scatter_R:0.6 ambient_brightness:1.0 WHITE_BALANCE:6500 Sun_temp:6300 Haze_amount:1.0 CROSSTALK:0.0 BLOOM_STRENGTH:1.0 SATURATION:0.0 Dirt_Amount:0.1 Dirt_Absorb_R:0.68 Dirt_Absorb_G:0.4 Dirt_Absorb_B:0.38 @@ -191,10 +191,6 @@ blend.composite.colortex14 = off # Alpha test alphaTest.gbuffers_weather = off -alphaTest.gbuffers_terrain = off -alphaTest.gbuffers_entities = off -alphaTest.gbuffers_block = off -alphaTest.gbuffers_hand = off alphaTest.gbuffers_water = off alphaTest.gbuffers_skybasic = off alphaTest.gbuffers_skytextured = off @@ -519,10 +515,10 @@ SHADER_VERSION_LABEL \ screen.Misc_Settings = [EXPERIMENTAL_STUFF] [DEBUG_STUFF] [LEGACY_STUFF] TRANSLUCENT_ENTITIES [selection_box_outline] [scene_controller] AEROCHROME_MODE AEROCHROME_PINKNESS AEROCHROME_WOOL_ENABLED screen.EXPERIMENTAL_STUFF.columns = 2 - screen.EXPERIMENTAL_STUFF = BLOOMY_PARTICLES BIOME_TINT_WATER HYPER_DETAILED_WAVES LIT_PARTICLE_BRIGHTNESS WATER_CAUSTICS_BRIGHTNESS WATER_CAUSTICS_POWER FORCE_TRANSLUCENT_GLASS LARGE_WAVE_DISPLACEMENT Vanilla_like_water INCLUDE_UNLISTED_ENTITIES PIXELATED PIXELIZATION_STRENGTH MAX_COLORS_PER_CHANNEL HARDCODED_EMISSIVES_APPROX TRANSLUCENT_ENTITIES_DITHER_FALLBACK ENCHANT_GLINT_BRIGHTNESS + screen.EXPERIMENTAL_STUFF = BLOOMY_PARTICLES BIOME_TINT_WATER HYPER_DETAILED_WAVES LIT_PARTICLE_BRIGHTNESS WATER_CAUSTICS_BRIGHTNESS WATER_CAUSTICS_POWER FORCE_TRANSLUCENT_GLASS LARGE_WAVE_DISPLACEMENT VANILLA_LIKE_WATER INCLUDE_UNLISTED_ENTITIES PIXELATED PIXELIZATION_STRENGTH MAX_COLORS_PER_CHANNEL HARDCODED_EMISSIVES_APPROX TRANSLUCENT_ENTITIES_DITHER_FALLBACK ENCHANT_GLINT_BRIGHTNESS screen.DEBUG_STUFF.columns = 2 - screen.DEBUG_STUFF = [the_end_orb] DEBUG_VIEW display_LUT WhiteWorld SSS_view ambientLight_only LIGHTNING_FLASH DISABLE_ENCHANT_GLINT DISABLE_VANILLA_EMISSIVES PARTICLE_RENDERING_FIX ISOLATE_RESOURCEPACK_SKY CAVE_DETECTION + screen.DEBUG_STUFF = [the_end_orb] DEBUG_VIEW display_LUT WhiteWorld SSS_view AMBIENT_LIGHT_ONLY LIGHTNING_FLASH DISABLE_ENCHANT_GLINT DISABLE_VANILLA_EMISSIVES PARTICLE_RENDERING_FIX ISOLATE_RESOURCEPACK_SKY CAVE_DETECTION screen.LEGACY_STUFF.columns = 2 screen.LEGACY_STUFF = ORIGINAL_CHOCAPIC_SKY OLD_BLOOM OLD_CAVE_DETECTION CLOUD_PHASE OLD_STARS @@ -601,46 +597,40 @@ uniform.vec3.lightningEffect = vec3(77.0 * lightningFlash, 153.0 * lightningFlas variable.int.BiomeTransitionTime = 60 #ifdef SWAMP_ENV - uniform.float.isSwamps = smooth(if(in(biome, 6, 52, 7), 1,0), BiomeTransitionTime, BiomeTransitionTime) + uniform.float.isSwamps = smooth(if(in(biome_category, CAT_SWAMP), 1,0), BiomeTransitionTime, BiomeTransitionTime) #else uniform.float.isSwamps = 0.0 #endif #ifdef JUNGLE_ENV - uniform.float.isJungles = smooth(if(in(biome, 23, 24, 25), 1,0), BiomeTransitionTime, BiomeTransitionTime) + uniform.float.isJungles = smooth(if(in(biome_category, CAT_JUNGLE), 1,0), BiomeTransitionTime, BiomeTransitionTime) #else uniform.float.isJungles = 0.0 #endif #ifdef DARKFOREST_ENV - uniform.float.isDarkForests = smooth(if(in(biome, 11), 1,0), BiomeTransitionTime, BiomeTransitionTime) + uniform.float.isDarkForests = smooth(if(in(biome, BIOME_DARK_FOREST), 1,0), BiomeTransitionTime, BiomeTransitionTime) #else uniform.float.isDarkForests = 0.0 #endif -#ifdef MANGROVE_ENV - uniform.float.isMangroveSwamp = smooth(if(in(biome, 7), 1,0), BiomeTransitionTime, BiomeTransitionTime) -#else - uniform.float.isMangroveSwamp = 0.0 -#endif - #ifdef SNOW_STORMS - uniform.float.snowStorm = smooth(if(in(biome, 31, 32, 33, 34), rainStrength, 0), 15, 30) + uniform.float.snowStorm = smooth(if(in(biome_category, CAT_ICY), rainStrength, 0), 15, 30) #else uniform.float.snowStorm = 0.0; #endif #ifdef SAND_STORMS #if defined IS_IRIS - uniform.float.sandStorm = smooth(if(in(biome, 5, 26, 27, 28), thunderStrength, 0), 15, 30) + uniform.float.sandStorm = smooth(if(in(biome_category, CAT_DESERT, CAT_MESA), thunderStrength, 0), 15, 30) #else - uniform.float.sandStorm = smooth(if(in(biome, 5, 26, 27, 28), rainStrength, 0), 15, 30) + uniform.float.sandStorm = smooth(if(in(biome_category, CAT_DESERT, CAT_MESA), rainStrength, 0), 15, 30) #endif #else uniform.float.sandStorm = 0.0; #endif -uniform.float.noPuddleAreas = smooth(if(in(biome, 3, 4, 16, 37, 39, 48, 49, 31, 32, 33, 34, 5, 17, 18, 26, 27, 28), 0,1), 15,15) +uniform.float.noPuddleAreas = smooth(if(biome_precipitation != 1, 0,1), 15,15) ############################ ####### RANDOM STUFF ####### @@ -744,8 +734,6 @@ uniform.float.snowAmount = 0.0 uniform.bool.isInColdArea = temperature < 0.4 uniform.bool.isInHotArea = temperature > 1.0 -uniform.bool.isInJungleBiomes = in(biome_category, CAT_JUNGLE) - # the idea is to record the altitude at which you entered a body of water. # using the smooth() function to interpolate to the newest value of eyeAltitude over time, i can make it take a very long time to interpolate. essentially freezing/unfreezing the value in place at any time i need to. diff --git a/shaders/world-1/clrwl_shadow.vsh b/shaders/world-1/clrwl_shadow.vsh index 7737922..b754b2a 100644 --- a/shaders/world-1/clrwl_shadow.vsh +++ b/shaders/world-1/clrwl_shadow.vsh @@ -20,13 +20,13 @@ Read the terms of modification and sharing before changing something below pleas */ #ifdef IS_LPV_ENABLED - attribute vec4 mc_Entity; + in vec4 mc_Entity; #ifdef IRIS_FEATURE_BLOCK_EMISSION_ATTRIBUTE - attribute vec4 at_midBlock; + in vec4 at_midBlock; #else - attribute vec3 at_midBlock; + in vec3 at_midBlock; #endif - attribute vec3 vaPosition; + in vec3 vaPosition; uniform mat4 shadowModelViewInverse; diff --git a/shaders/world-1/gbuffers_terrain_cutout.fsh b/shaders/world-1/gbuffers_terrain_cutout.fsh new file mode 100644 index 0000000..bc4f5e3 --- /dev/null +++ b/shaders/world-1/gbuffers_terrain_cutout.fsh @@ -0,0 +1,8 @@ +#version 430 compatibility + +#define NETHER_SHADER + +#define WORLD +#define CUTOUT + +#include "/dimensions/all_solid.fsh" \ No newline at end of file diff --git a/shaders/world-1/gbuffers_terrain_cutout.vsh b/shaders/world-1/gbuffers_terrain_cutout.vsh new file mode 100644 index 0000000..d4ed914 --- /dev/null +++ b/shaders/world-1/gbuffers_terrain_cutout.vsh @@ -0,0 +1,8 @@ +#version 430 compatibility + +#define NETHER_SHADER + +#define WORLD +#define CUTOUT + +#include "/dimensions/all_solid.vsh" \ No newline at end of file diff --git a/shaders/world-1/shadow.vsh b/shaders/world-1/shadow.vsh index b037e6c..af87370 100644 --- a/shaders/world-1/shadow.vsh +++ b/shaders/world-1/shadow.vsh @@ -15,13 +15,13 @@ Read the terms of modification and sharing before changing something below pleas */ #ifdef IS_LPV_ENABLED - attribute vec4 mc_Entity; + in vec4 mc_Entity; #ifdef IRIS_FEATURE_BLOCK_EMISSION_ATTRIBUTE - attribute vec4 at_midBlock; + in vec4 at_midBlock; #else - attribute vec3 at_midBlock; + in vec3 at_midBlock; #endif - attribute vec3 vaPosition; + in vec3 vaPosition; uniform mat4 shadowModelViewInverse; diff --git a/shaders/world0/clrwl_shadow.fsh b/shaders/world0/clrwl_shadow.fsh index fd365da..cbe0b51 100644 --- a/shaders/world0/clrwl_shadow.fsh +++ b/shaders/world0/clrwl_shadow.fsh @@ -2,10 +2,10 @@ #include "/lib/settings.glsl" -varying vec4 color; +in vec4 color; -varying vec2 texcoord; -uniform sampler2D tex; +in vec2 texcoord; +uniform sampler2D gtexture; uniform sampler2D noisetex; //////////////////////////////VOID MAIN////////////////////////////// @@ -15,13 +15,13 @@ uniform sampler2D noisetex; //////////////////////////////VOID MAIN////////////////////////////// float blueNoise(){ - return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 ); + return fract(texelFetch(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 ); } /* RENDERTARGETS: 0 */ void main() { - vec4 color = texture2D(tex,texcoord.xy); + vec4 color = texture(gtexture,texcoord.xy); vec2 lmcoord; float ao; vec4 overlayColor; diff --git a/shaders/world0/clrwl_shadow.vsh b/shaders/world0/clrwl_shadow.vsh index d22814f..b2a67ab 100644 --- a/shaders/world0/clrwl_shadow.vsh +++ b/shaders/world0/clrwl_shadow.vsh @@ -20,9 +20,15 @@ Read the terms of modification and sharing before changing something below pleas !! DO NOT REMOVE !! */ +out vec2 texcoord; +out vec4 color; + +in vec4 mc_midTexCoord; +in vec4 mc_Entity; + #define SHADOW_MAP_BIAS 0.5 const float PI = 3.1415927; -varying vec2 texcoord; + uniform mat4 shadowProjectionInverse; uniform mat4 shadowProjection; uniform mat4 shadowModelViewInverse; @@ -47,11 +53,7 @@ uniform vec3 shadowViewDir; uniform vec3 shadowCamera; uniform vec3 shadowLightVec; uniform float shadowMaxProj; -attribute vec4 mc_midTexCoord; -varying vec4 color; -varying vec3 vertexPos; -attribute vec4 mc_Entity; uniform int blockEntityId; uniform int entityId; @@ -62,9 +64,9 @@ uniform int entityId; #if defined IS_LPV_ENABLED #ifdef IRIS_FEATURE_BLOCK_EMISSION_ATTRIBUTE - attribute vec4 at_midBlock; + in vec4 at_midBlock; #else - attribute vec3 at_midBlock; + in vec3 at_midBlock; #endif uniform int currentRenderedItemId; uniform int renderStage; @@ -147,8 +149,6 @@ vec3 viewToWorld(vec3 viewPos) { return pos.xyz; } -varying vec3 playerpos; - // uniform int renderStage; // uniform mat4 gbufferModelViewInverse; @@ -210,7 +210,7 @@ void main() { // #endif // #if defined IS_LPV_ENABLED || defined WAVY_PLANTS || !defined PLANET_CURVATURE - playerpos = mat3(shadowModelViewInverse) * position + shadowModelViewInverse[3].xyz; + vec3 playerpos = mat3(shadowModelViewInverse) * position + shadowModelViewInverse[3].xyz; // #endif #if defined IS_LPV_ENABLED && defined MC_GL_ARB_shader_image_load_store diff --git a/shaders/world0/dh_shadow.fsh b/shaders/world0/dh_shadow.fsh index e278729..d76fef4 100644 --- a/shaders/world0/dh_shadow.fsh +++ b/shaders/world0/dh_shadow.fsh @@ -3,12 +3,12 @@ #include "/lib/settings.glsl" -flat varying int water; -varying vec2 texcoord; +in flat int water; +in vec2 texcoord; -varying float overdrawCull; +in float overdrawCull; -uniform sampler2D tex; +uniform sampler2D gtexture; //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// @@ -27,5 +27,5 @@ void main() { return; } - gl_FragData[0] = texture2D(tex, texcoord.xy); + gl_FragData[0] = texture(gtexture, texcoord.xy); } diff --git a/shaders/world0/dh_shadow.vsh b/shaders/world0/dh_shadow.vsh index cc99d4c..15dff89 100644 --- a/shaders/world0/dh_shadow.vsh +++ b/shaders/world0/dh_shadow.vsh @@ -10,7 +10,7 @@ Read the terms of modification and sharing before changing something below pleas #define SHADOW_MAP_BIAS 0.5 const float PI = 3.1415927; -varying vec2 texcoord; +out vec2 texcoord; uniform mat4 shadowProjectionInverse; uniform mat4 shadowProjection; uniform mat4 shadowModelViewInverse; @@ -18,7 +18,7 @@ uniform mat4 shadowModelView; uniform mat4 gbufferProjection; uniform mat4 gbufferProjectionInverse; -flat varying int water; +out flat int water; @@ -42,7 +42,7 @@ vec4 toClipSpace3(vec3 viewSpacePosition) { -varying float overdrawCull; +out float overdrawCull; // uniform int renderStage; void main() { diff --git a/shaders/world0/gbuffers_skytextured.fsh b/shaders/world0/gbuffers_skytextured.fsh index 0da1869..3ff86ac 100644 --- a/shaders/world0/gbuffers_skytextured.fsh +++ b/shaders/world0/gbuffers_skytextured.fsh @@ -2,8 +2,8 @@ #include "/lib/settings.glsl" #if RESOURCEPACK_SKY != 0 - varying vec4 color; - varying vec2 texcoord; + in vec4 color; + in vec2 texcoord; uniform sampler2D gtexture; uniform sampler2D depthtex0; @@ -30,7 +30,7 @@ void main() { #if RESOURCEPACK_SKY != 0 /* RENDERTARGETS:2 */ - vec4 COLOR = texture2D(gtexture, texcoord.xy) * color; + vec4 COLOR = texture(gtexture, texcoord.xy) * color; bool isSun = renderStage == MC_RENDER_STAGE_SUN || renderStage == 4; bool isMoon = renderStage == MC_RENDER_STAGE_MOON || renderStage == 5; diff --git a/shaders/world0/gbuffers_skytextured.vsh b/shaders/world0/gbuffers_skytextured.vsh index bf4411b..c79e845 100644 --- a/shaders/world0/gbuffers_skytextured.vsh +++ b/shaders/world0/gbuffers_skytextured.vsh @@ -9,8 +9,8 @@ Read the terms of modification and sharing before changing something below please ! !! DO NOT REMOVE !! */ - varying vec4 color; - varying vec2 texcoord; + out vec4 color; + out vec2 texcoord; uniform vec2 texelSize; uniform int framemod8; const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.), diff --git a/shaders/world0/gbuffers_terrain_cutout.fsh b/shaders/world0/gbuffers_terrain_cutout.fsh new file mode 100644 index 0000000..56d0afa --- /dev/null +++ b/shaders/world0/gbuffers_terrain_cutout.fsh @@ -0,0 +1,8 @@ +#version 430 compatibility + +#define OVERWORLD_SHADER + +#define WORLD +#define CUTOUT + +#include "/dimensions/all_solid.fsh" \ No newline at end of file diff --git a/shaders/world0/gbuffers_terrain_cutout.vsh b/shaders/world0/gbuffers_terrain_cutout.vsh new file mode 100644 index 0000000..e552fdd --- /dev/null +++ b/shaders/world0/gbuffers_terrain_cutout.vsh @@ -0,0 +1,8 @@ +#version 430 compatibility + +#define OVERWORLD_SHADER + +#define WORLD +#define CUTOUT + +#include "/dimensions/all_solid.vsh" \ No newline at end of file diff --git a/shaders/world0/shadow.fsh b/shaders/world0/shadow.fsh index dd9828e..eb34e80 100644 --- a/shaders/world0/shadow.fsh +++ b/shaders/world0/shadow.fsh @@ -2,11 +2,12 @@ #include "/lib/settings.glsl" -varying vec4 color; +in DATA { + vec2 texcoord; + vec3 color; + vec3 playerpos; +}; -varying vec2 texcoord; -varying vec3 playerpos; -uniform sampler2D tex; uniform sampler2D gtexture; uniform sampler2D noisetex; @@ -18,7 +19,7 @@ in float LIGHTNING; uniform float frameTimeCounter; float blueNoise(){ - return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 ); + return fract(texelFetch(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 ); } uniform int renderStage; @@ -42,7 +43,7 @@ void main() { if (step(ditherFade, blueNoise()) == 0.0) discard; #endif - vec4 shadowColor = vec4(texture2D(tex,texcoord.xy).rgb * color.rgb, texture2DLod(tex, texcoord.xy, 0).a); + vec4 shadowColor = vec4(texture(gtexture,texcoord.xy).rgb * color, textureLod(gtexture, texcoord.xy, 0).a); // #ifdef TRANSLUCENT_COLORED_SHADOWS // if(shadowColor.a > 0.9999) shadowColor.rgb = vec3(0.0); @@ -50,7 +51,7 @@ void main() { gl_FragData[0] = shadowColor; - // gl_FragData[0] = vec4(texture2D(tex,texcoord.xy).rgb * color.rgb, texture2DLod(tex, texcoord.xy, 0).a); + // gl_FragData[0] = vec4(texture(tex,texcoord.xy).rgb * color.rgb, textureLod(tex, texcoord.xy, 0).a); #ifdef Stochastic_Transparent_Shadows if(gl_FragData[0].a < blueNoise() && (renderStage == MC_RENDER_STAGE_TERRAIN_TRANSLUCENT || renderStage == MC_RENDER_STAGE_ENTITIES || renderStage == MC_RENDER_STAGE_BLOCK_ENTITIES || renderStage == MC_RENDER_STAGE_NONE)) { discard; return;} diff --git a/shaders/world0/shadow.vsh b/shaders/world0/shadow.vsh index 8d52f57..ab4f35d 100644 --- a/shaders/world0/shadow.vsh +++ b/shaders/world0/shadow.vsh @@ -18,9 +18,18 @@ Read the terms of modification and sharing before changing something below pleas !! DO NOT REMOVE !! */ +out DATA { + vec2 texcoord; + vec3 color; + vec3 playerpos; +}; + +in vec4 mc_midTexCoord; +in vec4 mc_Entity; + #define SHADOW_MAP_BIAS 0.5 const float PI = 3.1415927; -varying vec2 texcoord; + uniform mat4 shadowProjectionInverse; uniform mat4 shadowProjection; uniform mat4 shadowModelViewInverse; @@ -45,11 +54,7 @@ uniform vec3 shadowViewDir; uniform vec3 shadowCamera; uniform vec3 shadowLightVec; uniform float shadowMaxProj; -attribute vec4 mc_midTexCoord; -varying vec4 color; -varying vec3 vertexPos; -attribute vec4 mc_Entity; uniform int blockEntityId; uniform int entityId; @@ -60,9 +65,9 @@ uniform int entityId; #if defined IS_LPV_ENABLED || WATER_INTERACTION == 2 || defined SHADER_GRASS #ifdef IRIS_FEATURE_BLOCK_EMISSION_ATTRIBUTE - attribute vec4 at_midBlock; + in vec4 at_midBlock; #else - attribute vec3 at_midBlock; + in vec3 at_midBlock; #endif uniform int currentRenderedItemId; uniform int renderStage; @@ -145,14 +150,12 @@ vec3 viewToWorld(vec3 viewPos) { return pos.xyz; } -varying vec3 playerpos; - // uniform int renderStage; // uniform mat4 gbufferModelViewInverse; void main() { - texcoord.xy = gl_MultiTexCoord0.xy; - color = gl_Color; + texcoord.xy = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; + color = gl_Color.rgb; vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz; diff --git a/shaders/world0_with_aether_flag/dh_shadow.fsh b/shaders/world0_with_aether_flag/dh_shadow.fsh index e278729..d76fef4 100644 --- a/shaders/world0_with_aether_flag/dh_shadow.fsh +++ b/shaders/world0_with_aether_flag/dh_shadow.fsh @@ -3,12 +3,12 @@ #include "/lib/settings.glsl" -flat varying int water; -varying vec2 texcoord; +in flat int water; +in vec2 texcoord; -varying float overdrawCull; +in float overdrawCull; -uniform sampler2D tex; +uniform sampler2D gtexture; //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// @@ -27,5 +27,5 @@ void main() { return; } - gl_FragData[0] = texture2D(tex, texcoord.xy); + gl_FragData[0] = texture(gtexture, texcoord.xy); } diff --git a/shaders/world0_with_aether_flag/dh_shadow.vsh b/shaders/world0_with_aether_flag/dh_shadow.vsh index cc99d4c..15dff89 100644 --- a/shaders/world0_with_aether_flag/dh_shadow.vsh +++ b/shaders/world0_with_aether_flag/dh_shadow.vsh @@ -10,7 +10,7 @@ Read the terms of modification and sharing before changing something below pleas #define SHADOW_MAP_BIAS 0.5 const float PI = 3.1415927; -varying vec2 texcoord; +out vec2 texcoord; uniform mat4 shadowProjectionInverse; uniform mat4 shadowProjection; uniform mat4 shadowModelViewInverse; @@ -18,7 +18,7 @@ uniform mat4 shadowModelView; uniform mat4 gbufferProjection; uniform mat4 gbufferProjectionInverse; -flat varying int water; +out flat int water; @@ -42,7 +42,7 @@ vec4 toClipSpace3(vec3 viewSpacePosition) { -varying float overdrawCull; +out float overdrawCull; // uniform int renderStage; void main() { diff --git a/shaders/world0_with_aether_flag/gbuffers_skytextured.fsh b/shaders/world0_with_aether_flag/gbuffers_skytextured.fsh index 0da1869..3ff86ac 100644 --- a/shaders/world0_with_aether_flag/gbuffers_skytextured.fsh +++ b/shaders/world0_with_aether_flag/gbuffers_skytextured.fsh @@ -2,8 +2,8 @@ #include "/lib/settings.glsl" #if RESOURCEPACK_SKY != 0 - varying vec4 color; - varying vec2 texcoord; + in vec4 color; + in vec2 texcoord; uniform sampler2D gtexture; uniform sampler2D depthtex0; @@ -30,7 +30,7 @@ void main() { #if RESOURCEPACK_SKY != 0 /* RENDERTARGETS:2 */ - vec4 COLOR = texture2D(gtexture, texcoord.xy) * color; + vec4 COLOR = texture(gtexture, texcoord.xy) * color; bool isSun = renderStage == MC_RENDER_STAGE_SUN || renderStage == 4; bool isMoon = renderStage == MC_RENDER_STAGE_MOON || renderStage == 5; diff --git a/shaders/world0_with_aether_flag/gbuffers_skytextured.vsh b/shaders/world0_with_aether_flag/gbuffers_skytextured.vsh index bf4411b..c79e845 100644 --- a/shaders/world0_with_aether_flag/gbuffers_skytextured.vsh +++ b/shaders/world0_with_aether_flag/gbuffers_skytextured.vsh @@ -9,8 +9,8 @@ Read the terms of modification and sharing before changing something below please ! !! DO NOT REMOVE !! */ - varying vec4 color; - varying vec2 texcoord; + out vec4 color; + out vec2 texcoord; uniform vec2 texelSize; uniform int framemod8; const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.), diff --git a/shaders/world0_with_aether_flag/gbuffers_terrain_cutout.fsh b/shaders/world0_with_aether_flag/gbuffers_terrain_cutout.fsh new file mode 100644 index 0000000..56ef988 --- /dev/null +++ b/shaders/world0_with_aether_flag/gbuffers_terrain_cutout.fsh @@ -0,0 +1,9 @@ +#version 430 compatibility + +#define OVERWORLD_SHADER +#define AETHER_FLAG + +#define WORLD +#define CUTOUT + +#include "/dimensions/all_solid.fsh" \ No newline at end of file diff --git a/shaders/world0_with_aether_flag/gbuffers_terrain_cutout.vsh b/shaders/world0_with_aether_flag/gbuffers_terrain_cutout.vsh new file mode 100644 index 0000000..39d5b4a --- /dev/null +++ b/shaders/world0_with_aether_flag/gbuffers_terrain_cutout.vsh @@ -0,0 +1,9 @@ +#version 430 compatibility + +#define OVERWORLD_SHADER +#define AETHER_FLAG + +#define WORLD +#define CUTOUT + +#include "/dimensions/all_solid.vsh" \ No newline at end of file diff --git a/shaders/world0_with_aether_flag/shadow.fsh b/shaders/world0_with_aether_flag/shadow.fsh index 3bb0d46..9dfca27 100644 --- a/shaders/world0_with_aether_flag/shadow.fsh +++ b/shaders/world0_with_aether_flag/shadow.fsh @@ -2,10 +2,11 @@ #include "/lib/settings.glsl" -varying vec4 color; +in vec3 color; -varying vec2 texcoord; -uniform sampler2D tex; +in vec2 texcoord; + +uniform sampler2D gtexture; uniform sampler2D noisetex; uniform int renderStage; @@ -17,13 +18,13 @@ uniform int renderStage; //////////////////////////////VOID MAIN////////////////////////////// float blueNoise(){ - return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 ); + return fract(texelFetch(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 ); } void main() { - vec4 shadowColor = vec4(texture2D(tex,texcoord.xy).rgb * color.rgb, texture2DLod(tex, texcoord.xy, 0).a); + vec4 shadowColor = vec4(texture(gtexture,texcoord.xy).rgb * color.rgb, textureLod(gtexture, texcoord.xy, 0).a); // #ifdef TRANSLUCENT_COLORED_SHADOWS // if(shadowColor.a > 0.9999) shadowColor.rgb = vec3(0.0); @@ -31,7 +32,7 @@ void main() { gl_FragData[0] = shadowColor; - // gl_FragData[0] = vec4(texture2D(tex,texcoord.xy).rgb * color.rgb, texture2DLod(tex, texcoord.xy, 0).a); + // gl_FragData[0] = vec4(texture(tex,texcoord.xy).rgb * color.rgb, textureLod(tex, texcoord.xy, 0).a); #ifdef Stochastic_Transparent_Shadows if(gl_FragData[0].a < blueNoise() && (renderStage == MC_RENDER_STAGE_TERRAIN_TRANSLUCENT || renderStage == MC_RENDER_STAGE_ENTITIES || renderStage == MC_RENDER_STAGE_BLOCK_ENTITIES)) { discard; return;} diff --git a/shaders/world0_with_aether_flag/shadow.vsh b/shaders/world0_with_aether_flag/shadow.vsh index 8d52f57..a8db746 100644 --- a/shaders/world0_with_aether_flag/shadow.vsh +++ b/shaders/world0_with_aether_flag/shadow.vsh @@ -18,9 +18,15 @@ Read the terms of modification and sharing before changing something below pleas !! DO NOT REMOVE !! */ +out vec3 color; +out vec2 texcoord; + +in vec4 mc_midTexCoord; +in vec4 mc_Entity; + #define SHADOW_MAP_BIAS 0.5 const float PI = 3.1415927; -varying vec2 texcoord; + uniform mat4 shadowProjectionInverse; uniform mat4 shadowProjection; uniform mat4 shadowModelViewInverse; @@ -45,11 +51,7 @@ uniform vec3 shadowViewDir; uniform vec3 shadowCamera; uniform vec3 shadowLightVec; uniform float shadowMaxProj; -attribute vec4 mc_midTexCoord; -varying vec4 color; -varying vec3 vertexPos; -attribute vec4 mc_Entity; uniform int blockEntityId; uniform int entityId; @@ -60,9 +62,9 @@ uniform int entityId; #if defined IS_LPV_ENABLED || WATER_INTERACTION == 2 || defined SHADER_GRASS #ifdef IRIS_FEATURE_BLOCK_EMISSION_ATTRIBUTE - attribute vec4 at_midBlock; + in vec4 at_midBlock; #else - attribute vec3 at_midBlock; + in vec3 at_midBlock; #endif uniform int currentRenderedItemId; uniform int renderStage; @@ -145,14 +147,12 @@ vec3 viewToWorld(vec3 viewPos) { return pos.xyz; } -varying vec3 playerpos; - // uniform int renderStage; // uniform mat4 gbufferModelViewInverse; void main() { - texcoord.xy = gl_MultiTexCoord0.xy; - color = gl_Color; + texcoord.xy = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; + color = gl_Color.rgb; vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz; @@ -208,7 +208,7 @@ void main() { // #endif // #if defined IS_LPV_ENABLED || defined WAVY_PLANTS || !defined PLANET_CURVATURE - playerpos = mat3(shadowModelViewInverse) * position + shadowModelViewInverse[3].xyz; + vec3 playerpos = mat3(shadowModelViewInverse) * position + shadowModelViewInverse[3].xyz; // #endif #if defined IS_LPV_ENABLED && defined MC_GL_ARB_shader_image_load_store || WATER_INTERACTION == 2 || defined SHADER_GRASS diff --git a/shaders/world0_with_twilight_forest_flag/dh_shadow.fsh b/shaders/world0_with_twilight_forest_flag/dh_shadow.fsh index e278729..d76fef4 100644 --- a/shaders/world0_with_twilight_forest_flag/dh_shadow.fsh +++ b/shaders/world0_with_twilight_forest_flag/dh_shadow.fsh @@ -3,12 +3,12 @@ #include "/lib/settings.glsl" -flat varying int water; -varying vec2 texcoord; +in flat int water; +in vec2 texcoord; -varying float overdrawCull; +in float overdrawCull; -uniform sampler2D tex; +uniform sampler2D gtexture; //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// @@ -27,5 +27,5 @@ void main() { return; } - gl_FragData[0] = texture2D(tex, texcoord.xy); + gl_FragData[0] = texture(gtexture, texcoord.xy); } diff --git a/shaders/world0_with_twilight_forest_flag/dh_shadow.vsh b/shaders/world0_with_twilight_forest_flag/dh_shadow.vsh index cc99d4c..15dff89 100644 --- a/shaders/world0_with_twilight_forest_flag/dh_shadow.vsh +++ b/shaders/world0_with_twilight_forest_flag/dh_shadow.vsh @@ -10,7 +10,7 @@ Read the terms of modification and sharing before changing something below pleas #define SHADOW_MAP_BIAS 0.5 const float PI = 3.1415927; -varying vec2 texcoord; +out vec2 texcoord; uniform mat4 shadowProjectionInverse; uniform mat4 shadowProjection; uniform mat4 shadowModelViewInverse; @@ -18,7 +18,7 @@ uniform mat4 shadowModelView; uniform mat4 gbufferProjection; uniform mat4 gbufferProjectionInverse; -flat varying int water; +out flat int water; @@ -42,7 +42,7 @@ vec4 toClipSpace3(vec3 viewSpacePosition) { -varying float overdrawCull; +out float overdrawCull; // uniform int renderStage; void main() { diff --git a/shaders/world0_with_twilight_forest_flag/gbuffers_skytextured.fsh b/shaders/world0_with_twilight_forest_flag/gbuffers_skytextured.fsh index 0da1869..3ff86ac 100644 --- a/shaders/world0_with_twilight_forest_flag/gbuffers_skytextured.fsh +++ b/shaders/world0_with_twilight_forest_flag/gbuffers_skytextured.fsh @@ -2,8 +2,8 @@ #include "/lib/settings.glsl" #if RESOURCEPACK_SKY != 0 - varying vec4 color; - varying vec2 texcoord; + in vec4 color; + in vec2 texcoord; uniform sampler2D gtexture; uniform sampler2D depthtex0; @@ -30,7 +30,7 @@ void main() { #if RESOURCEPACK_SKY != 0 /* RENDERTARGETS:2 */ - vec4 COLOR = texture2D(gtexture, texcoord.xy) * color; + vec4 COLOR = texture(gtexture, texcoord.xy) * color; bool isSun = renderStage == MC_RENDER_STAGE_SUN || renderStage == 4; bool isMoon = renderStage == MC_RENDER_STAGE_MOON || renderStage == 5; diff --git a/shaders/world0_with_twilight_forest_flag/gbuffers_skytextured.vsh b/shaders/world0_with_twilight_forest_flag/gbuffers_skytextured.vsh index bf4411b..c79e845 100644 --- a/shaders/world0_with_twilight_forest_flag/gbuffers_skytextured.vsh +++ b/shaders/world0_with_twilight_forest_flag/gbuffers_skytextured.vsh @@ -9,8 +9,8 @@ Read the terms of modification and sharing before changing something below please ! !! DO NOT REMOVE !! */ - varying vec4 color; - varying vec2 texcoord; + out vec4 color; + out vec2 texcoord; uniform vec2 texelSize; uniform int framemod8; const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.), diff --git a/shaders/world0_with_twilight_forest_flag/gbuffers_terrain_cutout.fsh b/shaders/world0_with_twilight_forest_flag/gbuffers_terrain_cutout.fsh new file mode 100644 index 0000000..967b839 --- /dev/null +++ b/shaders/world0_with_twilight_forest_flag/gbuffers_terrain_cutout.fsh @@ -0,0 +1,9 @@ +#version 430 compatibility + +#define OVERWORLD_SHADER +#define TWILIGHT_FOREST_FLAG + +#define WORLD +#define CUTOUT + +#include "/dimensions/all_solid.fsh" \ No newline at end of file diff --git a/shaders/world0_with_twilight_forest_flag/gbuffers_terrain_cutout.vsh b/shaders/world0_with_twilight_forest_flag/gbuffers_terrain_cutout.vsh new file mode 100644 index 0000000..ed69eda --- /dev/null +++ b/shaders/world0_with_twilight_forest_flag/gbuffers_terrain_cutout.vsh @@ -0,0 +1,9 @@ +#version 430 compatibility + +#define OVERWORLD_SHADER +#define TWILIGHT_FOREST_FLAG + +#define WORLD +#define CUTOUT + +#include "/dimensions/all_solid.vsh" \ No newline at end of file diff --git a/shaders/world0_with_twilight_forest_flag/shadow.fsh b/shaders/world0_with_twilight_forest_flag/shadow.fsh index 3bb0d46..c6ef851 100644 --- a/shaders/world0_with_twilight_forest_flag/shadow.fsh +++ b/shaders/world0_with_twilight_forest_flag/shadow.fsh @@ -2,10 +2,10 @@ #include "/lib/settings.glsl" -varying vec4 color; +in vec3 color; -varying vec2 texcoord; -uniform sampler2D tex; +in vec2 texcoord; +uniform sampler2D gtexture; uniform sampler2D noisetex; uniform int renderStage; @@ -17,13 +17,13 @@ uniform int renderStage; //////////////////////////////VOID MAIN////////////////////////////// float blueNoise(){ - return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 ); + return fract(texelFetch(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 ); } void main() { - vec4 shadowColor = vec4(texture2D(tex,texcoord.xy).rgb * color.rgb, texture2DLod(tex, texcoord.xy, 0).a); + vec4 shadowColor = vec4(texture(gtexture,texcoord.xy).rgb * color.rgb, textureLod(gtexture, texcoord.xy, 0).a); // #ifdef TRANSLUCENT_COLORED_SHADOWS // if(shadowColor.a > 0.9999) shadowColor.rgb = vec3(0.0); @@ -31,7 +31,7 @@ void main() { gl_FragData[0] = shadowColor; - // gl_FragData[0] = vec4(texture2D(tex,texcoord.xy).rgb * color.rgb, texture2DLod(tex, texcoord.xy, 0).a); + // gl_FragData[0] = vec4(texture(tex,texcoord.xy).rgb * color.rgb, textureLod(tex, texcoord.xy, 0).a); #ifdef Stochastic_Transparent_Shadows if(gl_FragData[0].a < blueNoise() && (renderStage == MC_RENDER_STAGE_TERRAIN_TRANSLUCENT || renderStage == MC_RENDER_STAGE_ENTITIES || renderStage == MC_RENDER_STAGE_BLOCK_ENTITIES)) { discard; return;} diff --git a/shaders/world0_with_twilight_forest_flag/shadow.vsh b/shaders/world0_with_twilight_forest_flag/shadow.vsh index 8d52f57..7cea6c3 100644 --- a/shaders/world0_with_twilight_forest_flag/shadow.vsh +++ b/shaders/world0_with_twilight_forest_flag/shadow.vsh @@ -18,9 +18,14 @@ Read the terms of modification and sharing before changing something below pleas !! DO NOT REMOVE !! */ +out vec2 texcoord; +out vec3 color; + +in vec4 mc_midTexCoord; +in vec4 mc_Entity; + #define SHADOW_MAP_BIAS 0.5 const float PI = 3.1415927; -varying vec2 texcoord; uniform mat4 shadowProjectionInverse; uniform mat4 shadowProjection; uniform mat4 shadowModelViewInverse; @@ -45,11 +50,7 @@ uniform vec3 shadowViewDir; uniform vec3 shadowCamera; uniform vec3 shadowLightVec; uniform float shadowMaxProj; -attribute vec4 mc_midTexCoord; -varying vec4 color; -varying vec3 vertexPos; -attribute vec4 mc_Entity; uniform int blockEntityId; uniform int entityId; @@ -60,9 +61,9 @@ uniform int entityId; #if defined IS_LPV_ENABLED || WATER_INTERACTION == 2 || defined SHADER_GRASS #ifdef IRIS_FEATURE_BLOCK_EMISSION_ATTRIBUTE - attribute vec4 at_midBlock; + in vec4 at_midBlock; #else - attribute vec3 at_midBlock; + in vec3 at_midBlock; #endif uniform int currentRenderedItemId; uniform int renderStage; @@ -145,14 +146,12 @@ vec3 viewToWorld(vec3 viewPos) { return pos.xyz; } -varying vec3 playerpos; - // uniform int renderStage; // uniform mat4 gbufferModelViewInverse; void main() { - texcoord.xy = gl_MultiTexCoord0.xy; - color = gl_Color; + texcoord.xy = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; + color = gl_Color.rgb; vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz; @@ -208,7 +207,7 @@ void main() { // #endif // #if defined IS_LPV_ENABLED || defined WAVY_PLANTS || !defined PLANET_CURVATURE - playerpos = mat3(shadowModelViewInverse) * position + shadowModelViewInverse[3].xyz; + vec3 playerpos = mat3(shadowModelViewInverse) * position + shadowModelViewInverse[3].xyz; // #endif #if defined IS_LPV_ENABLED && defined MC_GL_ARB_shader_image_load_store || WATER_INTERACTION == 2 || defined SHADER_GRASS diff --git a/shaders/world1/clrwl_shadow.fsh b/shaders/world1/clrwl_shadow.fsh index 80d3957..1ac9ad5 100644 --- a/shaders/world1/clrwl_shadow.fsh +++ b/shaders/world1/clrwl_shadow.fsh @@ -5,33 +5,22 @@ #define COLORWHEEL -varying vec4 color; +in vec4 color; +in vec2 texcoord; -varying vec2 texcoord; -uniform sampler2D tex; uniform sampler2D gtexture; uniform sampler2D noisetex; -#if defined DISTANT_HORIZONS && DH_CHUNK_FADING > 1 - uniform float far; -#endif - -varying float LIGHTNING; -uniform float frameTimeCounter; - - //////////////////////////////VOID MAIN////////////////////////////// float blueNoise(){ - return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 ); + return fract(texelFetch(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 ); } void main() { #ifdef END_ISLAND_LIGHT - if (LIGHTNING > 0.0) discard; - - vec4 color = texture2D(tex,texcoord.xy); + vec4 color = texture(gtexture,texcoord.xy); vec2 lmcoord; float ao; @@ -43,7 +32,7 @@ void main() { gl_FragData[0] = color; - // gl_FragData[0] = vec4(texture2D(tex,texcoord.xy).rgb * color.rgb, texture2DLod(tex, texcoord.xy, 0).a); + // gl_FragData[0] = vec4(texture(tex,texcoord.xy).rgb * color.rgb, textureLod(tex, texcoord.xy, 0).a); #ifdef Stochastic_Transparent_Shadows if(gl_FragData[0].a < blueNoise()) { discard; return;} diff --git a/shaders/world1/clrwl_shadow.vsh b/shaders/world1/clrwl_shadow.vsh index 1f42e98..cb9ca9c 100644 --- a/shaders/world1/clrwl_shadow.vsh +++ b/shaders/world1/clrwl_shadow.vsh @@ -28,13 +28,13 @@ Read the terms of modification and sharing before changing something below pleas #endif #if defined IS_LPV_ENABLED - attribute vec4 mc_Entity; + in vec4 mc_Entity; #ifdef IRIS_FEATURE_BLOCK_EMISSION_ATTRIBUTE - attribute vec4 at_midBlock; + in vec4 at_midBlock; #else - attribute vec3 at_midBlock; + in vec3 at_midBlock; #endif - attribute vec3 vaPosition; + in vec3 vaPosition; uniform vec3 chunkOffset; uniform vec3 cameraPosition; @@ -47,11 +47,10 @@ Read the terms of modification and sharing before changing something below pleas #include "/lib/voxel_write.glsl" #endif -varying float LIGHTNING; // out float entity; -varying vec4 color; +out vec4 color; -varying vec2 texcoord; +out vec2 texcoord; //#include "/lib/Shadow_Params.glsl" @@ -81,7 +80,6 @@ void main() { // hide lightning and dragon death beams vec3 normal = normalize(gl_NormalMatrix * gl_Normal); - LIGHTNING = 0.0; if (renderStage == MC_RENDER_STAGE_ENTITIES && (entityId == ENTITY_LIGHTNING || (entityId == 0 && gl_Color.a < 0.2 && abs(normal.y) < 0.2))) LIGHTNING = 1.0; gl_Position = customShadowPerspectiveSSBO * customShadowMatrixSSBO * vec4(feetPlayerPos, 1.0); diff --git a/shaders/world1/gbuffers_terrain.gsh b/shaders/world1/gbuffers_terrain.gsh index e690daa..0781a5f 100644 --- a/shaders/world1/gbuffers_terrain.gsh +++ b/shaders/world1/gbuffers_terrain.gsh @@ -1,6 +1,6 @@ #version 430 compatibility -#define OVERWORLD_SHADER +#define END_SHADER #define WORLD diff --git a/shaders/world1/gbuffers_terrain.tcs b/shaders/world1/gbuffers_terrain.tcs index b764b85..e37247a 100644 --- a/shaders/world1/gbuffers_terrain.tcs +++ b/shaders/world1/gbuffers_terrain.tcs @@ -1,6 +1,6 @@ #version 430 compatibility -#define OVERWORLD_SHADER +#define END_SHADER #define WORLD diff --git a/shaders/world1/gbuffers_terrain.tes b/shaders/world1/gbuffers_terrain.tes index fde3ac9..bd2b054 100644 --- a/shaders/world1/gbuffers_terrain.tes +++ b/shaders/world1/gbuffers_terrain.tes @@ -1,6 +1,6 @@ #version 430 compatibility -#define OVERWORLD_SHADER +#define END_SHADER #define WORLD diff --git a/shaders/world1/gbuffers_terrain_cutout.fsh b/shaders/world1/gbuffers_terrain_cutout.fsh new file mode 100644 index 0000000..81727da --- /dev/null +++ b/shaders/world1/gbuffers_terrain_cutout.fsh @@ -0,0 +1,8 @@ +#version 430 compatibility + +#define END_SHADER + +#define WORLD +#define CUTOUT + +#include "/dimensions/all_solid.fsh" \ No newline at end of file diff --git a/shaders/world1/gbuffers_terrain_cutout.vsh b/shaders/world1/gbuffers_terrain_cutout.vsh new file mode 100644 index 0000000..2552d76 --- /dev/null +++ b/shaders/world1/gbuffers_terrain_cutout.vsh @@ -0,0 +1,8 @@ +#version 430 compatibility + +#define END_SHADER + +#define WORLD +#define CUTOUT + +#include "/dimensions/all_solid.vsh" \ No newline at end of file diff --git a/shaders/world1/gbuffers_weather.fsh b/shaders/world1/gbuffers_weather.fsh index 17cd863..5c6a9e3 100644 --- a/shaders/world1/gbuffers_weather.fsh +++ b/shaders/world1/gbuffers_weather.fsh @@ -1,8 +1,8 @@ #version 430 compatibility -varying vec4 lmtexcoord; -varying vec4 color; +in vec4 lmtexcoord; +in vec4 color; uniform sampler2D gtexture; uniform sampler2D gaux1; @@ -36,10 +36,10 @@ vec3 toScreenSpaceVector(vec3 p) { void main() { /* RENDERTARGETS:2 */ - gl_FragData[0] = texture2D(gtexture, lmtexcoord.xy)*color; + gl_FragData[0] = texture(gtexture, lmtexcoord.xy)*color; gl_FragData[0].a = clamp(gl_FragData[0].a -0.1,0.0,1.0)*0.5; vec3 albedo = toLinear(gl_FragData[0].rgb*color.rgb); - vec3 ambient = texture2D(gaux1,(lmtexcoord.zw*15.+0.5)*texelSize).rgb; + vec3 ambient = texture(gaux1,(lmtexcoord.zw*15.+0.5)*texelSize).rgb; gl_FragData[0].rgb = dot(albedo,vec3(1.0))*ambient*10./3.0/150.*0.1; diff --git a/shaders/world1/gbuffers_weather.vsh b/shaders/world1/gbuffers_weather.vsh index e34bc68..1d9e6ac 100644 --- a/shaders/world1/gbuffers_weather.vsh +++ b/shaders/world1/gbuffers_weather.vsh @@ -8,8 +8,8 @@ Read the terms of modification and sharing before changing something below pleas !! DO NOT REMOVE !! */ -varying vec4 lmtexcoord; -varying vec4 color; +out vec4 lmtexcoord; +out vec4 color; uniform vec2 texelSize; uniform int framemod8; diff --git a/shaders/world1/shadow.fsh b/shaders/world1/shadow.fsh index f8cc9f3..a2d07f6 100644 --- a/shaders/world1/shadow.fsh +++ b/shaders/world1/shadow.fsh @@ -2,10 +2,12 @@ #include "/lib/settings.glsl" -varying vec4 color; +in DATA { + float LIGHTNING; + vec4 color; + vec2 texcoord; +}; -varying vec2 texcoord; -uniform sampler2D tex; uniform sampler2D gtexture; uniform sampler2D noisetex; @@ -13,7 +15,6 @@ uniform sampler2D noisetex; uniform float far; #endif -varying float LIGHTNING; uniform float frameTimeCounter; uniform int renderStage; @@ -22,7 +23,7 @@ uniform int renderStage; //////////////////////////////VOID MAIN////////////////////////////// float blueNoise(){ - return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 ); + return fract(texelFetch(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 ); } @@ -30,7 +31,7 @@ void main() { #ifdef END_ISLAND_LIGHT if (LIGHTNING > 0.0) discard; - vec4 shadowColor = vec4(texture2D(tex,texcoord.xy).rgb * color.rgb, texture2DLod(tex, texcoord.xy, 0).a); + vec4 shadowColor = vec4(texture(gtexture,texcoord.xy).rgb * color.rgb, textureLod(gtexture, texcoord.xy, 0).a); // #ifdef TRANSLUCENT_COLORED_SHADOWS // if(shadowColor.a > 0.9999) shadowColor.rgb = vec3(0.0); @@ -39,7 +40,7 @@ void main() { gl_FragData[0] = shadowColor; - // gl_FragData[0] = vec4(texture2D(tex,texcoord.xy).rgb * color.rgb, texture2DLod(tex, texcoord.xy, 0).a); + // gl_FragData[0] = vec4(texture(tex,texcoord.xy).rgb * color.rgb, textureLod(tex, texcoord.xy, 0).a); #ifdef Stochastic_Transparent_Shadows if(gl_FragData[0].a < blueNoise() && (renderStage == MC_RENDER_STAGE_TERRAIN_TRANSLUCENT || renderStage == MC_RENDER_STAGE_ENTITIES || renderStage == MC_RENDER_STAGE_BLOCK_ENTITIES)) { discard; return;} diff --git a/shaders/world1/shadow.vsh b/shaders/world1/shadow.vsh index 0002132..3a73070 100644 --- a/shaders/world1/shadow.vsh +++ b/shaders/world1/shadow.vsh @@ -16,6 +16,13 @@ This code is from Chocapic13' shaders Read the terms of modification and sharing before changing something below please ! !! DO NOT REMOVE !! */ + +out DATA { + float LIGHTNING; + vec4 color; + vec2 texcoord; +}; + #if defined IS_LPV_ENABLED || defined END_ISLAND_LIGHT || WATER_INTERACTION == 2 || defined SHADER_GRASS uniform int renderStage; uniform mat4 shadowModelViewInverse; @@ -25,13 +32,13 @@ Read the terms of modification and sharing before changing something below pleas #endif #if defined IS_LPV_ENABLED || WATER_INTERACTION == 2 || defined SHADER_GRASS - attribute vec4 mc_Entity; + in vec4 mc_Entity; #ifdef IRIS_FEATURE_BLOCK_EMISSION_ATTRIBUTE - attribute vec4 at_midBlock; + in vec4 at_midBlock; #else - attribute vec3 at_midBlock; + in vec3 at_midBlock; #endif - attribute vec3 vaPosition; + in vec3 vaPosition; uniform vec3 chunkOffset; uniform vec3 cameraPosition; @@ -44,12 +51,6 @@ Read the terms of modification and sharing before changing something below pleas #include "/lib/voxel_write.glsl" #endif -varying float LIGHTNING; -// out float entity; -varying vec4 color; - -varying vec2 texcoord; - //#include "/lib/Shadow_Params.glsl" @@ -73,7 +74,7 @@ void main() { #endif #ifdef END_ISLAND_LIGHT - texcoord.xy = gl_MultiTexCoord0.xy; + texcoord.xy = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; color = gl_Color; // hide lightning and dragon death beams