diff --git a/shaders/dimensions/DH_generic.fsh b/shaders/dimensions/DH_generic.fsh index c55c724..1fbca36 100644 --- a/shaders/dimensions/DH_generic.fsh +++ b/shaders/dimensions/DH_generic.fsh @@ -41,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) || texture2D(depthtex1, gl_FragCoord.xy*texelSize).x < 1.0){ discard; return;} + if(length(playerPos) < clamp(far-16*4, 16, maxOverdrawDistance) || texture(depthtex1, gl_FragCoord.xy*texelSize).x < 1.0){ discard; return;} #endif diff --git a/shaders/dimensions/DH_solid.fsh b/shaders/dimensions/DH_solid.fsh index 8587176..d88d7c9 100644 --- a/shaders/dimensions/DH_solid.fsh +++ b/shaders/dimensions/DH_solid.fsh @@ -70,7 +70,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); } diff --git a/shaders/dimensions/DH_translucent.fsh b/shaders/dimensions/DH_translucent.fsh index 403b5c9..52d4d4f 100644 --- a/shaders/dimensions/DH_translucent.fsh +++ b/shaders/dimensions/DH_translucent.fsh @@ -173,7 +173,7 @@ vec3 doScreenSpaceReflectiom(vec3 dir, vec3 position, float dither, float qualit if(spos.x < 0 || spos.x > 1 || spos.y < 0 || spos.y > 1) return vec3(1.1); - float sampleDepth = sqrt(texelFetch2D(colortex12,ivec2(spos.xy/texelSize/4),0).a/65000.0); + float sampleDepth = sqrt(texelFetch(colortex12,ivec2(spos.xy/texelSize/4),0).a/65000.0); float sp = DH_inv_ld(sampleDepth); if(sp < max(minZ, maxZ) && sp > min(minZ, maxZ)) return vec3(spos.xy/RENDER_SCALE,sp); @@ -405,7 +405,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; @@ -435,7 +435,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 - length(playerPos)/clamp(far-16*4, 16, maxOverdrawDistance),0.0)*5,1.0); - if(texture2D(depthtex0, gl_FragCoord.xy*texelSize).x < 1.0 || distancefade > 0.0){ + if(texture(depthtex0, gl_FragCoord.xy*texelSize).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 413d2aa..6bc146e 100644 --- a/shaders/dimensions/DH_translucent.vsh +++ b/shaders/dimensions/DH_translucent.vsh @@ -96,10 +96,10 @@ void main() { lightmapCoords = gl_MultiTexCoord1.xy; - lightCol.rgb = texelFetch2D(colortex4,ivec2(6,37),0).rgb; + lightCol.rgb = texelFetch(colortex4,ivec2(6,37),0).rgb; lightCol.a = float(sunElevation > 1e-5)*2.0 - 1.0; - averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(0,37),0).rgb; + averageSkyCol_Clouds = texelFetch(colortex4,ivec2(0,37),0).rgb; #ifdef OVERWORLD_SHADER #define READ_SCENE_CONTROLLER_PARAMETERS diff --git a/shaders/dimensions/all_particles.fsh b/shaders/dimensions/all_particles.fsh index 5526fa8..864569a 100644 --- a/shaders/dimensions/all_particles.fsh +++ b/shaders/dimensions/all_particles.fsh @@ -172,7 +172,7 @@ float ComputeShadowMap(inout vec3 directLightColor, vec3 playerPos, float maxDis 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); @@ -334,7 +334,7 @@ void main() { vec4 Albedo = texture2D_POMSwitch(texture, adjustedTexCoord.xy, vec4(dcdx,dcdy)); #else - vec4 Albedo = texture2D(texture, adjustedTexCoord.xy); + vec4 Albedo = texture(texture, adjustedTexCoord.xy); #endif Albedo.rgb = toLinear(Albedo.rgb); @@ -360,7 +360,7 @@ void main() { vec3 feetPlayerPos = mat3(gbufferModelViewInverse) * viewPos; vec3 feetPlayerPos_normalized = normalize(feetPlayerPos); - vec4 TEXTURE = texture2D(texture, lmtexcoord.xy)*color; + vec4 TEXTURE = texture(texture, lmtexcoord.xy)*color; #ifdef WhiteWorld TEXTURE.rgb = vec3(1.0); diff --git a/shaders/dimensions/all_particles.vsh b/shaders/dimensions/all_particles.vsh index 54452ec..4c3513f 100644 --- a/shaders/dimensions/all_particles.vsh +++ b/shaders/dimensions/all_particles.vsh @@ -132,9 +132,9 @@ void main() { #endif #ifdef OVERWORLD_SHADER - lightCol.rgb = texelFetch2D(colortex4,ivec2(6,37),0).rgb; + lightCol.rgb = texelFetch(colortex4,ivec2(6,37),0).rgb; lightCol.a = float(sunElevation > 1e-5)*2.0 - 1.0; - averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(0,37),0).rgb; + averageSkyCol_Clouds = texelFetch(colortex4,ivec2(0,37),0).rgb; WsunVec = lightCol.a * normalize(mat3(gbufferModelViewInverse) * sunPosition); #define READ_SCENE_CONTROLLER_PARAMETERS diff --git a/shaders/dimensions/all_solid.fsh b/shaders/dimensions/all_solid.fsh index 17a7cff..77cd0fa 100644 --- a/shaders/dimensions/all_solid.fsh +++ b/shaders/dimensions/all_solid.fsh @@ -105,9 +105,9 @@ float R2_dither(){ float blueNoise(){ #if TAA_MODE > 0 - 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 } @@ -228,7 +228,7 @@ vec4 texture2D_POMSwitch( if(ifPOM){ return texture2DGradARB(sampler, lightmapCoord, dcdxdcdy.xy, dcdxdcdy.zw); }else{ - return texture2D(sampler, lightmapCoord, LOD); + return texture(sampler, lightmapCoord, LOD); } } @@ -439,7 +439,7 @@ void main() { float verticalGradient = (i + blueNoise())/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)); diff --git a/shaders/dimensions/all_solid.vsh b/shaders/dimensions/all_solid.vsh index fe9c6f7..1c880c9 100644 --- a/shaders/dimensions/all_solid.vsh +++ b/shaders/dimensions/all_solid.vsh @@ -121,7 +121,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); } diff --git a/shaders/dimensions/all_translucent.fsh b/shaders/dimensions/all_translucent.fsh index e46d15c..5260aa6 100644 --- a/shaders/dimensions/all_translucent.fsh +++ b/shaders/dimensions/all_translucent.fsh @@ -181,9 +181,9 @@ float R2_dither(){ float blueNoise(){ #if TAA_MODE > 0 - 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 } @@ -192,7 +192,7 @@ float blueNoise(){ 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); @@ -336,7 +336,7 @@ float ComputeShadowMap(inout vec3 directLightColor, vec3 playerPos, float maxDis 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); @@ -443,7 +443,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) /////////////////////////////////// ALBEDO ///////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// - gl_FragData[0] = texture2D(texture, lmtexcoord.xy, mipmapBias) * color; + gl_FragData[0] = texture(texture, lmtexcoord.xy, mipmapBias) * color; float UnchangedAlpha = gl_FragData[0].a; @@ -517,7 +517,7 @@ 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); @@ -572,7 +572,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 ////////////////////////////// //////////////////////////////////////////////////////////////////////////////// @@ -665,7 +665,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) vec3 lightPos = LightSourcePosition(feetPlayerPos+cameraPosition, 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); @@ -793,11 +793,11 @@ 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*4, 16, maxOverdrawDistance) && texture2D(depthtex1, gl_FragCoord.xy*texelSize).x >= 1.0; - // bool WATER = length(feetPlayerPos) > clamp(far-16*4, 17.5, maxOverdrawDistance) && texelFetch2D(depthtex1, ivec2(gl_FragCoord.xy), 0).x >= 1.0 || texelFetch2D(depthtex1, ivec2(gl_FragCoord.xy), 0).x < gl_FragCoord.z; - // float depth = texelFetch2D(depthtex1, ivec2(gl_FragCoord.xy), 0).x; - // bool WATER = (abs(depth - texelFetch2D(dhDepthTex0, ivec2(gl_FragCoord.xy), 0).x) > 0.23 && length(feetPlayerPos) > clamp(far-16*4, 16, maxOverdrawDistance)) || (length(feetPlayerPos) > clamp(far-16*4, 20, maxOverdrawDistance) && depth >= 1.0);// && texelFetch2D(depthtex1, ivec2(gl_FragCoord.xy), 0).x < 1.0; - // bool WATER = texelFetch2D(dhDepthTex0, ivec2(gl_FragCoord.xy),0).x == texelFetch2D(depthtex1, ivec2(gl_FragCoord.xy), 0).x; + bool WATER = texture(colortex7, gl_FragCoord.xy*texelSize).a > 0.0 && length(feetPlayerPos) > clamp(far-16*4, 16, maxOverdrawDistance) && texture(depthtex1, gl_FragCoord.xy*texelSize).x >= 1.0; + // bool WATER = length(feetPlayerPos) > clamp(far-16*4, 17.5, maxOverdrawDistance) && texelFetch(depthtex1, ivec2(gl_FragCoord.xy), 0).x >= 1.0 || texelFetch(depthtex1, ivec2(gl_FragCoord.xy), 0).x < gl_FragCoord.z; + // float depth = texelFetch(depthtex1, ivec2(gl_FragCoord.xy), 0).x; + // bool WATER = (abs(depth - texelFetch(dhDepthTex0, ivec2(gl_FragCoord.xy), 0).x) > 0.23 && length(feetPlayerPos) > clamp(far-16*4, 16, maxOverdrawDistance)) || (length(feetPlayerPos) > clamp(far-16*4, 20, maxOverdrawDistance) && depth >= 1.0);// && texelFetch(depthtex1, ivec2(gl_FragCoord.xy), 0).x < 1.0; + // bool WATER = texelFetch(dhDepthTex0, ivec2(gl_FragCoord.xy),0).x == texelFetch(depthtex1, ivec2(gl_FragCoord.xy), 0).x; if(WATER) { gl_FragData[0].a = 0.0; diff --git a/shaders/dimensions/all_translucent.vsh b/shaders/dimensions/all_translucent.vsh index b17116f..78361af 100644 --- a/shaders/dimensions/all_translucent.vsh +++ b/shaders/dimensions/all_translucent.vsh @@ -95,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) * WATER_WAVE_STRENGTH * 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) * WATER_WAVE_STRENGTH * range; } vec3 getWaveNormal(vec3 posxz, float range){ @@ -237,10 +237,10 @@ void main() { color = vec4(gl_Color.rgb, 1.0); #ifdef OVERWORLD_SHADER - lightCol.rgb = texelFetch2D(colortex4,ivec2(6,37),0).rgb; + lightCol.rgb = texelFetch(colortex4,ivec2(6,37),0).rgb; lightCol.a = float(sunElevation > 1e-5)*2.0 - 1.0; - averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(0,37),0).rgb; + averageSkyCol_Clouds = texelFetch(colortex4,ivec2(0,37),0).rgb; // WsunVec = lightCol.a * normalize(mat3(gbufferModelViewInverse) * sunPosition); diff --git a/shaders/dimensions/all_vanilla_emissives.fsh b/shaders/dimensions/all_vanilla_emissives.fsh index ba16378..f3fd733 100644 --- a/shaders/dimensions/all_vanilla_emissives.fsh +++ b/shaders/dimensions/all_vanilla_emissives.fsh @@ -21,7 +21,7 @@ vec3 toLinear(vec3 sRGB){ void main() { - vec4 Albedo = texture2D(texture, texcoord); + vec4 Albedo = texture(texture, texcoord); Albedo.rgb = toLinear(Albedo.rgb * color.rgb); #if defined BEACON_BEAM diff --git a/shaders/dimensions/composite.fsh b/shaders/dimensions/composite.fsh index 5253c0a..5180f13 100644 --- a/shaders/dimensions/composite.fsh +++ b/shaders/dimensions/composite.fsh @@ -161,13 +161,13 @@ float R2_dither(){ } float blueNoise(){ #if TAA_MODE > 0 - 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); @@ -261,6 +261,28 @@ float convertHandDepth_2(in float depth, bool hand) { return ndcDepth * 0.5 + 0.5; } +vec3 toScreenSpace_LOD_TEST( in vec2 texcoord, in float depth) { + + vec4 viewPos = vec4(0.0); + vec3 feetPlayerPos = vec3(0.0); + vec4 iProjDiag = vec4(0.0); + + if (depth < 1.0) { + iProjDiag = vec4(gbufferProjectionInverse[0].x, gbufferProjectionInverse[1].y, gbufferProjectionInverse[2].zw); + feetPlayerPos = vec3(texcoord, depth) * 2.0 - 1.0; + viewPos = iProjDiag * feetPlayerPos.xyzz + gbufferProjectionInverse[3]; + viewPos.xyz /= viewPos.w; + } else { + depth = texelFetch(LOD_DEPTHTEX1, ivec2(texcoord/texelSize), 0).x; + iProjDiag = vec4(LOD_PROJECTION_INVERSE[0].x, LOD_PROJECTION_INVERSE[1].y, LOD_PROJECTION_INVERSE[2].zw); + feetPlayerPos = vec3(texcoord, depth) * 2.0 - 1.0; + viewPos = iProjDiag * feetPlayerPos.xyzz + LOD_PROJECTION_INVERSE[3]; + viewPos.xyz /= viewPos.w; + } + + return viewPos.xyz; +} + vec2 SSAO( vec3 viewPos, vec3 normal, vec3 flatnormal, bool hand, float noise, bool isLOD ){ @@ -294,17 +316,10 @@ vec2 SSAO( #ifdef USING_LOD_MOD - float sampleDHDepth = 1.0; - float sampleDepth = 1.0; - if(isLOD){ - sampleDHDepth = texelFetch2D(LOD_DEPTHTEX1, offsetUV, 0).x; - }else{ - sampleDepth = convertHandDepth_2(texelFetch2D(depthtex1, offsetUV, 0).x, hand); - } - - vec3 offsetViewPos = toScreenSpace_DH((offsetUV*texelSize - jitterOffsets) * (1.0/RENDER_SCALE), sampleDepth, sampleDHDepth); + float sampleDepth = convertHandDepth_2(texelFetch(depthtex1, offsetUV, 0).x, hand); + vec3 offsetViewPos = toScreenSpace_LOD_TEST((offsetUV*texelSize - jitterOffsets) * (1.0/RENDER_SCALE), sampleDepth); #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 @@ -366,7 +381,7 @@ void main() { 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.); @@ -375,7 +390,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,0.0, texelFetch2D(colortex14,ivec2((floor(gl_FragCoord.xy)/VL_RENDERING_RESOLUTION_SCALE*texelSize+0.5*texelSize)/texelSize),0).a); + gl_FragData[1] = vec4(0.0,0.0,0.0, texelFetch(colortex14,ivec2((floor(gl_FragCoord.xy)/VL_RENDERING_RESOLUTION_SCALE*texelSize+0.5*texelSize)/texelSize),0).a); // bool lightningBolt = abs(dataUnpacked1.w-0.5) <0.01; @@ -386,10 +401,10 @@ void main() { bool hand = abs(dataUnpacked1.w-0.75) < 0.01; // bool blocklights = abs(dataUnpacked1.w-0.8) <0.01; - float z = convertHandDepth_2(texelFetch2D(depthtex1,ivec2(gl_FragCoord.xy),0).x,hand); + float z = convertHandDepth_2(texelFetch(depthtex1,ivec2(gl_FragCoord.xy),0).x,hand); #ifdef USING_LOD_MOD - float DH_depth1 = texelFetch2D(LOD_DEPTHTEX1,ivec2(gl_FragCoord.xy),0).x; + float DH_depth1 = texelFetch(LOD_DEPTHTEX1,ivec2(gl_FragCoord.xy),0).x; float swappedDepth = z >= 1.0 ? DH_depth1 : z; #else float DH_depth1 = 1.0; @@ -421,7 +436,7 @@ void main() { } #endif - 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 if(z >= 1.0) FlatNormals = normal; @@ -439,9 +454,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; @@ -452,11 +467,11 @@ void main() { #ifdef OVERWORLD_SHADER - 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 vanillAO = clamp(texture(colortex15,texcoord).a,0.0,1.0) ; float minshadowfilt = Min_Shadow_Filter_Radius; float maxshadowfilt = Max_Shadow_Filter_Radius; @@ -517,7 +532,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/composite1.fsh b/shaders/dimensions/composite1.fsh index 2cb2bef..3143acb 100644 --- a/shaders/dimensions/composite1.fsh +++ b/shaders/dimensions/composite1.fsh @@ -271,14 +271,14 @@ float R2_dither2(){ float blueNoise(){ #if TAA_MODE > 0 - 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( @@ -367,12 +367,12 @@ vec2 SSRT_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, float noise, boo #ifdef USING_LOD_MOD float sampleDepth = 0.0; if(depthCheck){ - sampleDepth = texelFetch2D(LOD_DEPTHTEX1, ivec2(newPos.xy/texelSize),0).x; + sampleDepth = texelFetch(LOD_DEPTHTEX1, ivec2(newPos.xy/texelSize),0).x; }else{ - sampleDepth = convertHandDepth_2(texelFetch2D(depthtex1, ivec2(newPos.xy/texelSize),0).x,hand); + sampleDepth = convertHandDepth_2(texelFetch(depthtex1, ivec2(newPos.xy/texelSize),0).x,hand); } #else - float sampleDepth = convertHandDepth_2(texelFetch2D(depthtex1, ivec2(newPos.xy/texelSize),0).x,hand); + float sampleDepth = convertHandDepth_2(texelFetch(depthtex1, ivec2(newPos.xy/texelSize),0).x,hand); #endif if(sampleDepth < newPos.z){ @@ -430,12 +430,12 @@ float SSRT_FlashLight_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, floa #ifdef USING_LOD_MOD float samplePos = 0.0; if(depthCheck){ - samplePos = texture2D(LOD_DEPTHTEX1, screenPos.xy).x; + samplePos = texture(LOD_DEPTHTEX1, screenPos.xy).x; }else{ - samplePos = texture2D(depthtex2, screenPos.xy).x; + samplePos = texture(depthtex2, screenPos.xy).x; } #else - float samplePos = texture2D(depthtex2, screenPos.xy).x; + float samplePos = texture(depthtex2, screenPos.xy).x; #endif if(samplePos < screenPos.z){// && (samplePos <= max(minZ,maxZ) && samplePos >= min(minZ,maxZ))){ @@ -486,31 +486,31 @@ void doEdgeAwareBlur( for(int i = 0; i < 4; i++) { #ifdef USING_LOD_MOD - float offsetDepth = sqrt(texelFetch2D(depth, UV + OFFSET[i] + UV_NOISE,0).a/65000.0); + float offsetDepth = sqrt(texelFetch(depth, UV + OFFSET[i] + UV_NOISE,0).a/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 } @@ -543,13 +543,13 @@ vec4 BilateralUpscale_VLFOG(sampler2D tex, sampler2D depth, float referenceDepth for(int i = 0; i < 4; i++) { #ifdef USING_LOD_MOD - 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 : 1e-7; - 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; } @@ -690,7 +690,7 @@ void applyPuddles( vec2 UV = mix(worldPos.xz, worldPos.xy*vec2(2.0, 0.5)+driprate, abs(flatNormals.z)); UV = mix(UV, worldPos.zy*vec2(2.0, 0.5)+driprate, abs(flatNormals.x)); - float noise = texture2D(noisetex, UV * 0.02).b; + float noise = texture(noisetex, UV * 0.02).b; float lightmapMax = min(max(lightmap - 0.9,0.0) * 10.0,1.0) ; float lightmapMin = min(max(lightmap - 0.8,0.0) * 5.0,1.0) ; @@ -767,16 +767,16 @@ void main() { // float z0 = texture2D(depthtex0,texcoord).x; // float z = texture2D(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; bool isDHrange = z >= 1.0; #ifdef USING_LOD_MOD - float DH_mixedLinearZ = sqrt(texture2D(colortex12,texcoord).a/65000.0); - float DH_depth0 = texture2D(LOD_DEPTHTEX0,texcoord).x; - float DH_depth1 = texture2D(LOD_DEPTHTEX1 ,texcoord).x; + float DH_mixedLinearZ = sqrt(texture(colortex12,texcoord).a/65000.0); + float DH_depth0 = texture(LOD_DEPTHTEX0,texcoord).x; + float DH_depth1 = texture(LOD_DEPTHTEX1 ,texcoord).x; float depthOpaque = z; float depthOpaqueL = linearizeDepthFast(depthOpaque, near, farPlane); @@ -799,7 +799,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; @@ -829,11 +829,12 @@ 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); + float labPorosity = clamp(SpecularTex.z * 255.0, 0.0,64.5)/64.5; // LabSSS = 1; - vec4 normalAndAO = texture2D(colortex15,texcoord); + vec4 normalAndAO = texture(colortex15,texcoord); vec3 FlatNormals = normalize(normalAndAO.rgb * 2.0 - 1.0); vec3 slopednormal = normal; @@ -863,7 +864,7 @@ void main() { // 0.9 = entity mask // 0.8 = reflective entities // 0.7 = reflective blocks - float translucentMasks = texture2D(colortex7, texcoord).a; + float translucentMasks = texture(colortex7, texcoord).a; bool isWater = translucentMasks > 0.99; // bool isReflectiveEntity = abs(translucentMasks - 0.8) < 0.01; @@ -1155,7 +1156,7 @@ void main() { vec3 lightPos = LightSourcePosition(feetPlayerPos+cameraPosition, 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); diff --git a/shaders/dimensions/composite1.vsh b/shaders/dimensions/composite1.vsh index 9d27d72..4063441 100644 --- a/shaders/dimensions/composite1.vsh +++ b/shaders/dimensions/composite1.vsh @@ -47,21 +47,21 @@ void main() { gl_Position = ftransform(); #ifdef END_SHADER - Flashing = texelFetch2D(colortex4,ivec2(1,1),0).x/150.0; + Flashing = texelFetch(colortex4,ivec2(1,1),0).x/150.0; #endif zMults = vec3(1.0/(far * near),far+near,far-near); - lightCol.rgb = texelFetch2D(colortex4,ivec2(6,37),0).rgb; + lightCol.rgb = texelFetch(colortex4,ivec2(6,37),0).rgb; lightCol.a = float(sunElevation > 1e-5)*2.0 - 1.0; - moonCol = texelFetch2D(colortex4,ivec2(9,37),0).rgb; + moonCol = texelFetch(colortex4,ivec2(9,37),0).rgb; #if defined FLASHLIGHT && defined FLASHLIGHT_BOUNCED_INDIRECT - albedoSmooth = texelFetch2D(colortex4,ivec2(15.5,2.5),0).rgb; + albedoSmooth = texelFetch(colortex4,ivec2(15.5,2.5),0).rgb; #endif - averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(0,37),0).rgb; + averageSkyCol_Clouds = texelFetch(colortex4,ivec2(0,37),0).rgb; unsigned_WsunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition); diff --git a/shaders/dimensions/composite10.fsh b/shaders/dimensions/composite10.fsh index 7040d9c..5ccf61d 100644 --- a/shaders/dimensions/composite10.fsh +++ b/shaders/dimensions/composite10.fsh @@ -58,7 +58,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 @@ -153,10 +153,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){ @@ -229,12 +229,12 @@ void main() { if(isEyeInWater == 1) bloomyFog_Mult = UNDERWATER_BLOOMY_FOG; #if DOF_QUALITY == -1 || DOF_QUALITY == 5 - vec3 col = texture2D(colortex5,texcoord).rgb; + vec3 col = texture(colortex5,texcoord).rgb; #endif #if DOF_QUALITY >= 0 /*--------------------------------*/ - float z = ld(texture2D(depthtex1, texcoord.st*RENDER_SCALE).r)*far; + float z = ld(texture(depthtex1, texcoord.st*RENDER_SCALE).r)*far; #if MANUAL_FOCUS == -2 float focus = rodExposureDepth.y*far; @@ -299,7 +299,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; #if PURKINJE_AMOUNT > 0 float pstrength = float(PURKINJE_AMOUNT) / 100.0; @@ -364,7 +364,7 @@ void main() { float _far = far*4.0; if (depth >= 1.0) { - depth = texture2D(LOD_DEPTHTEX0, texcoord).x; + depth = texture(LOD_DEPTHTEX0, texcoord).x; _near = LOD_NEARPLANE; _far = LOD_FARPLANE; } diff --git a/shaders/dimensions/composite10.vsh b/shaders/dimensions/composite10.vsh index d07930f..83f47a0 100644 --- a/shaders/dimensions/composite10.vsh +++ b/shaders/dimensions/composite10.vsh @@ -18,7 +18,7 @@ void main() { gl_Position = ftransform(); texcoord = gl_MultiTexCoord0.xy; - exposure = vec4(vec3(texelFetch2D(colortex4,ivec2(10,37),0).r),texelFetch2D(colortex4,ivec2(10,37),0).r); - rodExposureDepth = texelFetch2D(colortex4,ivec2(14,37),0).rg; + exposure = vec4(vec3(texelFetch(colortex4,ivec2(10,37),0).r),texelFetch(colortex4,ivec2(10,37),0).r); + rodExposureDepth = texelFetch(colortex4,ivec2(14,37),0).rg; rodExposureDepth.y = sqrt(rodExposureDepth.y/65000.0); } \ No newline at end of file diff --git a/shaders/dimensions/composite11.fsh b/shaders/dimensions/composite11.fsh index 109b2ce..a01de1f 100644 --- a/shaders/dimensions/composite11.fsh +++ b/shaders/dimensions/composite11.fsh @@ -59,17 +59,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; } @@ -108,10 +108,10 @@ vec3 colorGrading(vec3 color) { vec3 contrastAdaptiveSharpening(vec3 color, vec2 texcoord){ float sharpen_strength = float(SHARPENING_AMOUNT)/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; @@ -143,7 +143,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){ @@ -156,9 +156,9 @@ vec3 chromaticAberration(vec2 UV){ float aberrationStrength = (float(CHROMATIC_ABERRATION_AMOUNT)/20.0) * 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; } @@ -170,7 +170,7 @@ void main() { #if CHROMATIC_ABERRATION_AMOUNT > 0 vec3 color = chromaticAberration(texcoord); #else - vec3 color = texture2D(colortex7,texcoord).rgb; + vec3 color = texture(colortex7,texcoord).rgb; #endif #if SHARPENING_AMOUNT > 0 diff --git a/shaders/dimensions/composite2.fsh b/shaders/dimensions/composite2.fsh index aa5b727..07d4937 100644 --- a/shaders/dimensions/composite2.fsh +++ b/shaders/dimensions/composite2.fsh @@ -72,7 +72,7 @@ uniform float skyLightLevelSmooth; uniform float waterEnteredAltitude; 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); @@ -258,7 +258,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(){ @@ -332,7 +332,7 @@ vec4 waterVolumetrics(vec3 rayStart, vec3 rayEnd, float rayLength, vec2 dither, sh = vec3(shadow2D(shadowtex0, pos).x); if(shadow2D(shadowtex1, pos).x > pos.z && sh.x < 1.0){ - vec4 translucentShadow = texture2D(shadowcolor0, pos.xy); + vec4 translucentShadow = texture(shadowcolor0, pos.xy); if(translucentShadow.a < 0.9) sh = normalize(translucentShadow.rgb+0.0001); } #else @@ -446,10 +446,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); @@ -526,7 +526,7 @@ vec4 waterVolumetrics_alt( vec3 rayStart, vec3 rayEnd, float estEndDepth, float sh = vec3(shadow2D(shadowtex0, pos).x); if(shadow2D(shadowtex1, pos).x > pos.z && sh.x < 1.0){ - vec4 translucentShadow = texture2D(shadowcolor0, pos.xy); + vec4 translucentShadow = texture(shadowcolor0, pos.xy); if(translucentShadow.a < 0.9) sh = normalize(translucentShadow.rgb+0.0001); } #else @@ -580,27 +580,27 @@ void main() { // vec2 tc = floor(gl_FragCoord.xy)/VL_RENDERING_RESOLUTION_SCALE*texelSize + 0.5*texelSize; #ifdef OVERWORLD_SHADER - vec2 lightmap = decodeVec2(texelFetch2D(colortex14,texcoord_cast,0).x); + vec2 lightmap = decodeVec2(texelFetch(colortex14,texcoord_cast,0).x); // #ifdef DISTANT_HORIZONS // if(z >= 1.0) lightmap.y = 0.99; // #endif #else - vec2 lightmap = decodeVec2(texelFetch2D(colortex14,texcoord_cast,0).a); + vec2 lightmap = decodeVec2(texelFetch(colortex14,texcoord_cast,0).a); lightmap.y = 1.0; #endif - float alpha = texelFetch2D(colortex7,texcoord_cast,0).a; - float blendedAlpha = texelFetch2D(colortex2, texcoord_cast,0).a; + float alpha = texelFetch(colortex7,texcoord_cast,0).a; + float blendedAlpha = texelFetch(colortex2, texcoord_cast,0).a; bool iswater = alpha > 0.99; - float z0 = texelFetch2D(depthtex0, texcoord_cast,0).x; - float z1 = texelFetch2D(depthtex1, texcoord_cast,0).x; + float z0 = texelFetch(depthtex0, texcoord_cast,0).x; + float z1 = texelFetch(depthtex1, texcoord_cast,0).x; #ifdef USING_LOD_MOD - float DH_z0 = texelFetch2D(LOD_DEPTHTEX0, texcoord_cast,0).x; - float DH_z1 = texelFetch2D(LOD_DEPTHTEX1, texcoord_cast,0).x; + float DH_z0 = texelFetch(LOD_DEPTHTEX0, texcoord_cast,0).x; + float DH_z1 = texelFetch(LOD_DEPTHTEX1, texcoord_cast,0).x; #else float DH_z0 = 0.0; float DH_z1 = 0.0; diff --git a/shaders/dimensions/composite2.vsh b/shaders/dimensions/composite2.vsh index 7905ed7..54165bd 100644 --- a/shaders/dimensions/composite2.vsh +++ b/shaders/dimensions/composite2.vsh @@ -42,9 +42,9 @@ void main() { #ifdef OVERWORLD_SHADER - lightCol.rgb = texelFetch2D(colortex4,ivec2(6,37),0).rgb; - averageSkyCol = texelFetch2D(colortex4,ivec2(1,37),0).rgb; - averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(0,37),0).rgb; + lightCol.rgb = texelFetch(colortex4,ivec2(6,37),0).rgb; + averageSkyCol = texelFetch(colortex4,ivec2(1,37),0).rgb; + averageSkyCol_Clouds = texelFetch(colortex4,ivec2(0,37),0).rgb; #define READ_SCENE_CONTROLLER_PARAMETERS #include "/lib/scene_controller.glsl" diff --git a/shaders/dimensions/composite3.fsh b/shaders/dimensions/composite3.fsh index 98bd00d..cdc07db 100644 --- a/shaders/dimensions/composite3.fsh +++ b/shaders/dimensions/composite3.fsh @@ -125,14 +125,14 @@ float R2_dither(){ float blueNoise(){ #if TAA_MODE > 0 - 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){ @@ -221,31 +221,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; @@ -290,15 +290,15 @@ vec4 bilateralUpsample(vec2 fragcoord, sampler2D colortex, out float outerEdgeRe for(int i = 0; i < 5; i++) { #ifdef USING_LOD_MOD - 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 = 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; @@ -323,7 +323,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); // to fill pixel gaps in geometry edges, do a bilateral upsample. // pass a mask to only show upsampled color around the edges of blocks. this is so it doesnt blur reprojected results. @@ -339,19 +339,19 @@ vec4 VLTemporalFiltering(vec3 viewPos, in float referenceDepth, sampler2D depth, float clampRadius = mix(2.0, 1.0, clamp(length(velocity/texelSize),0.0,1.0) ); - vec4 col1 = texture2D(colortex0, VLtexCoord + vec2( texelSize.x, texelSize.y)*clampRadius); - vec4 col2 = texture2D(colortex0, VLtexCoord + vec2( texelSize.x, -texelSize.y)*clampRadius); - vec4 col3 = texture2D(colortex0, VLtexCoord + vec2(-texelSize.x, -texelSize.y)*clampRadius); - vec4 col4 = texture2D(colortex0, VLtexCoord + vec2(-texelSize.x, texelSize.y)*clampRadius); - vec4 col5 = texture2D(colortex0, VLtexCoord + vec2( 0.0, texelSize.y)*clampRadius); - vec4 col6 = texture2D(colortex0, VLtexCoord + vec2( 0.0, -texelSize.y)*clampRadius); - vec4 col7 = texture2D(colortex0, VLtexCoord + vec2(-texelSize.x, 0.0)*clampRadius); - vec4 col8 = texture2D(colortex0, VLtexCoord + vec2( texelSize.x, 0.0)*clampRadius); + vec4 col1 = texture(colortex0, VLtexCoord + vec2( texelSize.x, texelSize.y)*clampRadius); + vec4 col2 = texture(colortex0, VLtexCoord + vec2( texelSize.x, -texelSize.y)*clampRadius); + vec4 col3 = texture(colortex0, VLtexCoord + vec2(-texelSize.x, -texelSize.y)*clampRadius); + vec4 col4 = texture(colortex0, VLtexCoord + vec2(-texelSize.x, texelSize.y)*clampRadius); + vec4 col5 = texture(colortex0, VLtexCoord + vec2( 0.0, texelSize.y)*clampRadius); + vec4 col6 = texture(colortex0, VLtexCoord + vec2( 0.0, -texelSize.y)*clampRadius); + vec4 col7 = texture(colortex0, VLtexCoord + vec2(-texelSize.x, 0.0)*clampRadius); + vec4 col8 = texture(colortex0, VLtexCoord + vec2( texelSize.x, 0.0)*clampRadius); 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; @@ -450,20 +450,20 @@ void main() { #if DEBUG_VIEW == debug_DEFERRED_RENDERING gl_FragData[0].r = 1.0; // pass fog alpha so bloom can do bloomy fog - gl_FragData[1].rgb = clamp(texture2D(colortex3, texcoord).rgb, 0.0,68000.0); + gl_FragData[1].rgb = clamp(texture(colortex3, texcoord).rgb, 0.0,68000.0); return; #endif - 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; - float z2 = texelFetch2D(depthtex1, ivec2(gl_FragCoord.xy),0).x; + float z2 = texelFetch(depthtex1, ivec2(gl_FragCoord.xy),0).x; float frDepth = linearize(z); float swappedDepth = z; #ifdef USING_LOD_MOD - float DH_depth0 = texture2D(LOD_DEPTHTEX0,texcoord).x; + float DH_depth0 = texture(LOD_DEPTHTEX0,texcoord).x; float depthOpaque = z; float depthOpaqueL = linearizeDepthFast(depthOpaque, near, farPlane); @@ -496,11 +496,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)) ; @@ -517,7 +517,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; @@ -526,7 +526,7 @@ void main() { ////// --------------- get volumetrics #ifdef USING_LOD_MOD - 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 temporallyFilteredVL = VLTemporalFiltering(viewPos, DH_mixedLinearZ, colortex12, hand); #else vec4 temporallyFilteredVL = VLTemporalFiltering(viewPos, frDepth, depthtex0, hand); @@ -543,7 +543,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 @@ -552,11 +552,11 @@ void main() { #ifdef USING_LOD_MOD vec4 VLBehindTranslucents = bilateralUpsample(refractedCoord/texelSize, colortex13, blank, DH_mixedLinearZ, depthtex1, hand); #else - vec4 VLBehindTranslucents = bilateralUpsample(refractedCoord/texelSize, colortex13, blank, linearize(texelFetch2D(depthtex1, ivec2(refractedCoord/texelSize),0).x), depthtex1, hand); + vec4 VLBehindTranslucents = bilateralUpsample(refractedCoord/texelSize, colortex13, blank, linearize(texelFetch(depthtex1, ivec2(refractedCoord/texelSize),0).x), depthtex1, hand); #endif ////// --------------- START BLENDING FOGS AND FORWARD RENDERED COLOR - vec4 TranslucentShader = texture2D(colortex2, texcoord); + vec4 TranslucentShader = texture(colortex2, texcoord); // ensure that bloomy fog mask in this VLBehindTranslucents.a does not darken outside of glass areas. if(TranslucentShader.a > 0.0 && TranslucentShader.a < 1.0) color.rgb = color.rgb * VLBehindTranslucents.a + VLBehindTranslucents.rgb; @@ -604,7 +604,7 @@ void main() { ////// --------------- bloomy rain effect #ifdef OVERWORLD_SHADER - float rainDrops = texelFetch2D(colortex9,ivec2(texcoord/texelSize),0).a; + float rainDrops = texelFetch(colortex9,ivec2(texcoord/texelSize),0).a; if(rainDrops > 0.0) { bloomyFogMult *= clamp(1.0 - pow(rainDrops*5.0,2),0.0,1.0); diff --git a/shaders/dimensions/composite3.vsh b/shaders/dimensions/composite3.vsh index 1e7f766..ed8dcb9 100644 --- a/shaders/dimensions/composite3.vsh +++ b/shaders/dimensions/composite3.vsh @@ -34,7 +34,7 @@ void main() { #ifdef OVERWORLD_SHADER #ifdef BorderFog - skyGroundColor = texelFetch2D(colortex4,ivec2(1,37),0).rgb / 1200.0 * Sky_Brightness; + skyGroundColor = texelFetch(colortex4,ivec2(1,37),0).rgb / 1200.0 * Sky_Brightness; #endif WsunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition); #endif diff --git a/shaders/dimensions/composite4.fsh b/shaders/dimensions/composite4.fsh index 438bd88..b866beb 100644 --- a/shaders/dimensions/composite4.fsh +++ b/shaders/dimensions/composite4.fsh @@ -52,15 +52,15 @@ void main() { // 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 7c2b13d..af845c8 100644 --- a/shaders/dimensions/composite5.fsh +++ b/shaders/dimensions/composite5.fsh @@ -206,7 +206,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) { @@ -243,14 +243,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; @@ -261,11 +261,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; @@ -291,11 +291,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; @@ -319,7 +319,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 #ifdef USING_LOD_MOD - bool depthCheck = texture2D(depthtex0,adjTC).x >= 1.0; + bool depthCheck = texture(depthtex0,adjTC).x >= 1.0; vec3 closestToCamera = closestToCamera5taps_DH(adjTC, depthtex0, LOD_DEPTHTEX0, depthCheck); vec3 viewPos = toScreenSpace_DH_special(closestToCamera, depthCheck); #else @@ -351,7 +351,7 @@ vec4 computeTAA(vec2 texcoord, bool hand){ #if TAA_MODE == 3 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 @@ -359,19 +359,19 @@ vec4 computeTAA(vec2 texcoord, bool hand){ #if TAA_MODE == 3 // 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)*clampRadius).rgb; - vec3 col2 = texture2D(colortex3, adjTC_noJitter + vec2( texelSize.x, -texelSize.y)*clampRadius).rgb; - vec3 col3 = texture2D(colortex3, adjTC_noJitter + vec2(-texelSize.x, -texelSize.y)*clampRadius).rgb; - vec3 col4 = texture2D(colortex3, adjTC_noJitter + vec2(-texelSize.x, texelSize.y)*clampRadius).rgb; - vec3 col5 = texture2D(colortex3, adjTC_noJitter + vec2( 0.0, texelSize.y)*clampRadius).rgb; - vec3 col6 = texture2D(colortex3, adjTC_noJitter + vec2( 0.0, -texelSize.y)*clampRadius).rgb; - vec3 col7 = texture2D(colortex3, adjTC_noJitter + vec2(-texelSize.x, 0.0)*clampRadius).rgb; - vec3 col8 = texture2D(colortex3, adjTC_noJitter + vec2( texelSize.x, 0.0)*clampRadius).rgb; + vec3 col1 = texture(colortex3, adjTC_noJitter + vec2( texelSize.x, texelSize.y)*clampRadius).rgb; + vec3 col2 = texture(colortex3, adjTC_noJitter + vec2( texelSize.x, -texelSize.y)*clampRadius).rgb; + vec3 col3 = texture(colortex3, adjTC_noJitter + vec2(-texelSize.x, -texelSize.y)*clampRadius).rgb; + vec3 col4 = texture(colortex3, adjTC_noJitter + vec2(-texelSize.x, texelSize.y)*clampRadius).rgb; + vec3 col5 = texture(colortex3, adjTC_noJitter + vec2( 0.0, texelSize.y)*clampRadius).rgb; + vec3 col6 = texture(colortex3, adjTC_noJitter + vec2( 0.0, -texelSize.y)*clampRadius).rgb; + vec3 col7 = texture(colortex3, adjTC_noJitter + vec2(-texelSize.x, 0.0)*clampRadius).rgb; + vec3 col8 = texture(colortex3, adjTC_noJitter + vec2( texelSize.x, 0.0)*clampRadius).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)))))))); @@ -409,7 +409,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); @@ -425,9 +425,9 @@ void main() { #if TAA_MODE > 0 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); @@ -437,7 +437,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/composite6.fsh b/shaders/dimensions/composite6.fsh index caa2f91..a7173e4 100644 --- a/shaders/dimensions/composite6.fsh +++ b/shaders/dimensions/composite6.fsh @@ -32,25 +32,25 @@ vec2 quarterResTC = gl_FragCoord.xy*2.0*resScale*texelSize; // bool hand = abs(decodeVec2(texture2D(colortex1,texcoord).w).y-0.75) < 0.01 && texture2D(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,-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,-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 2a23c91..c836177 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,-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,-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..2838dea 100644 --- a/shaders/dimensions/composite8.fsh +++ b/shaders/dimensions/composite8.fsh @@ -12,7 +12,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/composite9.fsh b/shaders/dimensions/composite9.fsh index 0a5a2ae..1c6aa45 100644 --- a/shaders/dimensions/composite9.fsh +++ b/shaders/dimensions/composite9.fsh @@ -11,7 +11,7 @@ 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); } diff --git a/shaders/dimensions/deferred.fsh b/shaders/dimensions/deferred.fsh index 9e291ff..96b132b 100644 --- a/shaders/dimensions/deferred.fsh +++ b/shaders/dimensions/deferred.fsh @@ -105,7 +105,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 diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z) @@ -272,7 +272,7 @@ float mixhistory = 0.06; mixhistory = 0.01; - vec3 data = texelFetch2D(colortex1, ivec2(0.5/texelSize), 0).rgb; + vec3 data = texelFetch(colortex1, ivec2(0.5/texelSize), 0).rgb; vec3 decodeAlbedo = vec3(decodeVec2(data.x).x,decodeVec2(data.y).x, decodeVec2(data.z).x); vec3 albedo = toLinear(decodeAlbedo); @@ -327,7 +327,7 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+ WsunVec = mix(WmoonVec, WsunVec, clamp(float(sunElevation > 1e-5)*2.0-1.0 ,0,1)); - 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_Clouds * AmbientLightTint * 0.25, sky, pow(clamp(viewVector.y+1.0,0.0,1.0),5.0)); vec3 suncol = lightSourceColor; @@ -396,7 +396,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){ @@ -425,7 +425,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; @@ -438,9 +438,10 @@ 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/deferred.vsh b/shaders/dimensions/deferred.vsh index 078690b..e532968 100644 --- a/shaders/dimensions/deferred.vsh +++ b/shaders/dimensions/deferred.vsh @@ -206,7 +206,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)); } @@ -214,7 +214,7 @@ void main() { avgExp = exp(avgExp/maxITexp); avgB = exp(avgB/maxITexp); - avgBrightness = clamp(mix(avgExp,texelFetch2D(colortex4,ivec2(10,37),0).g,0.95),0.00003051757,65000.0); + avgBrightness = clamp(mix(avgExp,texelFetch(colortex4,ivec2(10,37),0).g,0.95),0.00003051757,65000.0); float L = max(avgBrightness,1e-8); float keyVal = 1.03-2.0/(log(L*4000/150.*8./3.0+1.0)/log(10.0)+2.0); @@ -224,14 +224,14 @@ void main() { float targetExposure = (EXPOSURE_DARKENING * 0.35)/log(L + 1.0 + EXPOSURE_BRIGHTENING * 0.05); // float targetExposure = 0.18/log2(L*2.5+1.045)*0.62; // choc original - avgL2 = clamp(mix(avgB,texelFetch2D(colortex4,ivec2(10,37),0).b,0.985),0.00003051757,65000.0); + avgL2 = clamp(mix(avgB,texelFetch(colortex4,ivec2(10,37),0).b,0.985),0.00003051757,65000.0); float targetrodExposure = max(0.012/log2(avgL2+1.002)-0.1,0.0)*1.2; exposure = max(targetExposure*EXPOSURE_MULTIPLIER, 0.0); - float currCenterDepth = ld(texture2D(depthtex2, vec2(0.5)*RENDER_SCALE).r); - centerDepth = mix(sqrt(texelFetch2D(colortex4,ivec2(14,37),0).g/65000.0), currCenterDepth, clamp(DoF_Adaptation_Speed*exp(-0.016/frameTime+1.0)/(6.0+currCenterDepth*far),0.0,1.0)); + float currCenterDepth = ld(texture(depthtex2, vec2(0.5)*RENDER_SCALE).r); + centerDepth = mix(sqrt(texelFetch(colortex4,ivec2(14,37),0).g/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; rodExposure = targetrodExposure; diff --git a/shaders/dimensions/deferred1.fsh b/shaders/dimensions/deferred1.fsh index 0ce4578..0802327 100644 --- a/shaders/dimensions/deferred1.fsh +++ b/shaders/dimensions/deferred1.fsh @@ -38,17 +38,19 @@ vec2 decodeVec2(float a){ //////////////////////////////VOID MAIN////////////////////////////// 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; + /* RENDERTARGETS:4,12 */ - float dataUnpacked = decodeVec2(texelFetch2D(colortex1,ivec2(gl_FragCoord.xy*4),0).w).y; + + vec3 oldTex = texelFetch(colortex4, ivec2(gl_FragCoord.xy), 0).xyz; + float newTex = texelFetch(depthtex1, ivec2(gl_FragCoord.xy*4), 0).x; + + 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); #ifdef USING_LOD_MOD - float QuarterResDepth = texelFetch2D(LOD_DEPTHTEX0, ivec2(gl_FragCoord.xy*4), 0).x; + float QuarterResDepth = texelFetch(LOD_DEPTHTEX0, ivec2(gl_FragCoord.xy*4), 0).x; QuarterResDepth = DH_linZ(QuarterResDepth); gl_FragData[1].a = QuarterResDepth*QuarterResDepth*65000.0; #endif diff --git a/shaders/dimensions/deferred2.fsh b/shaders/dimensions/deferred2.fsh index 3555521..2049759 100644 --- a/shaders/dimensions/deferred2.fsh +++ b/shaders/dimensions/deferred2.fsh @@ -30,20 +30,20 @@ void main() { 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 #ifdef USING_LOD_MOD - || texelFetch2D(LOD_DEPTHTEX0, ivec2(gl_FragCoord.xy), 0).x < 1.0 + || texelFetch(LOD_DEPTHTEX0, 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 e0d69b0..3ed4ccf 100644 --- a/shaders/dimensions/final.fsh +++ b/shaders/dimensions/final.fsh @@ -57,7 +57,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 convertHandDepth_2(in float depth, bool hand) { @@ -118,7 +118,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; } @@ -144,8 +144,8 @@ void main() { float noise = blueNoise(); - float depth = texture2D(depthtex0, texcoord*RENDER_SCALE).r; #if MOTION_BLUR_AMOUNT > 0 + float depth = texture(depthtex0, texcoord_offset*RENDER_SCALE).r; bool hand = depth < 0.56; float depth2 = convertHandDepth_2(depth, hand); diff --git a/shaders/lib/PhotonGTAO.glsl b/shaders/lib/PhotonGTAO.glsl index 05bf243..7898ad4 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 a71181a..0fa7550 100644 --- a/shaders/lib/diffuse_lighting.glsl +++ b/shaders/lib/diffuse_lighting.glsl @@ -136,7 +136,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 8e94b59..7a9e458 100644 --- a/shaders/lib/end_fog.glsl +++ b/shaders/lib/end_fog.glsl @@ -82,7 +82,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 @@ -106,7 +106,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); } @@ -257,7 +257,7 @@ vec4 GetVolumetricFog( 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); diff --git a/shaders/lib/indirect_lighting_effects.glsl b/shaders/lib/indirect_lighting_effects.glsl index c48b1ea..f758f10 100644 --- a/shaders/lib/indirect_lighting_effects.glsl +++ b/shaders/lib/indirect_lighting_effects.glsl @@ -76,9 +76,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) ; @@ -145,9 +145,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); @@ -228,8 +228,8 @@ 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 = texelFetch2D(colortex5, ivec2(previousPosition.xy/texelSize),0).rgb * GI_Strength * CURVE; - // bouncedLight = texture2D(colortex5, previousPosition.xy).rgb * GI_Strength * CURVE; + bouncedLight = texelFetch(colortex5, ivec2(previousPosition.xy/texelSize),0).rgb * GI_Strength * CURVE; + // bouncedLight = texture(colortex5, previousPosition.xy).rgb * GI_Strength * CURVE; radiance += bouncedLight; diff --git a/shaders/lib/nether_fog.glsl b/shaders/lib/nether_fog.glsl index 5da4200..1bcf9b5 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 611bddb..224c6e8 100644 --- a/shaders/lib/overworld_fog.glsl +++ b/shaders/lib/overworld_fog.glsl @@ -9,7 +9,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); } @@ -58,7 +58,7 @@ vec3 sampleShadowmapVL(vec3 start, vec3 shadowMapRayStartPos, vec3 shadowMapRayP shadowColor = vec3(shadow2D(shadowtex0, shadowPos).x); if(shadow2D(shadowtex1, shadowPos).x > shadowPos.z && shadowColor.x < 1.0){ - vec4 translucentShadow = texture2D(shadowcolor0, shadowPos.xy); + vec4 translucentShadow = texture(shadowcolor0, shadowPos.xy); if(translucentShadow.a < 0.9) shadowColor = normalize(translucentShadow.rgb+0.0001); } #else diff --git a/shaders/lib/scene_controller.glsl b/shaders/lib/scene_controller.glsl index b5991b6..4d52c19 100644 --- a/shaders/lib/scene_controller.glsl +++ b/shaders/lib/scene_controller.glsl @@ -657,11 +657,11 @@ void readSceneControllerParameters( // 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 = texelFetch2D(colortex,ivec2(1,3),0).rgb/150.0; - vec3 data2 = texelFetch2D(colortex,ivec2(2,3),0).rgb/150.0; - vec3 data3 = texelFetch2D(colortex,ivec2(3,3),0).rgb/150.0; - float data4 = texelFetch2D(colortex,ivec2(1,2),0).r/150.0; - vec3 data5 = texelFetch2D(colortex,ivec2(2,2),0).rgb/150.0; // this samples a color + 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; + float data4 = texelFetch(colortex,ivec2(1,2),0).r/150.0; + vec3 data5 = texelFetch(colortex,ivec2(2,2),0).rgb/150.0; // this samples a color smallCumulus = vec2(data1.x,data1.y); largeCumulus = vec2(data1.z,data2.x); diff --git a/shaders/lib/sky_gradient.glsl b/shaders/lib/sky_gradient.glsl index 4877fbe..729b9fc 100644 --- a/shaders/lib/sky_gradient.glsl +++ b/shaders/lib/sky_gradient.glsl @@ -99,10 +99,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)); } vec2 sphereToCarte(vec3 dir) { @@ -117,7 +117,7 @@ vec3 skyFromTex(vec3 pos,sampler2D sampler){ vec2 clampUV = vec2(1.0); p = clamp(p*2.0-1.0, -clampUV, clampUV)*0.5+0.5; - return texture2D(sampler,p*texelSize*256.+vec2(18.5,1.5)*texelSize).rgb; + return texture(sampler,p*texelSize*256.+vec2(18.5,1.5)*texelSize).rgb; } vec3 skyFromTexLOD(vec3 pos,sampler2D sampler, float LOD){ vec2 p = sphereToCarte(pos); @@ -131,7 +131,7 @@ vec4 skyCloudsFromTex(vec3 pos,sampler2D sampler){ vec2 uv = clamp(p, 0.0, 1.0) * texelSize*256. + vec2(18.5+257.,1.5)*texelSize; - return texture2D(sampler, uv); + return texture(sampler, uv); } vec4 skyCloudsFromTexBLUR(vec3 pos,sampler2D sampler, float scaler){ @@ -144,7 +144,7 @@ vec4 skyCloudsFromTexBLUR(vec3 pos,sampler2D sampler, float scaler){ vec2 uv = clamp(posi, 0.0, 1.0)*scaleA + scaleB; - vec4 color = texture2D(sampler, uv); + vec4 color = texture(sampler, uv); return color; } @@ -164,7 +164,7 @@ vec4 skyCloudsFromTexLOD(vec3 pos,sampler2D sampler, float roughness){ vec2 uv = p*texelSize*256.+vec2(18.5+257.,1.5)*texelSize; - return texture2D(sampler, uv); + return texture(sampler, uv); } diff --git a/shaders/lib/specular.glsl b/shaders/lib/specular.glsl index 4c7333a..290646a 100644 --- a/shaders/lib/specular.glsl +++ b/shaders/lib/specular.glsl @@ -138,13 +138,15 @@ vec3 rayTraceSpeculars(vec3 dir, vec3 position, float dither, float quality, boo if(!hand && (spos.x < 0 || spos.x > 1 || spos.y < 0 || spos.y > 1)) return vec3(1.1); #endif - 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); + float sp = invLinZ(sampleDepth); + if(sp < max(minZ, maxZ) && sp > min(minZ, maxZ)) { hitPos = vec3(spos.xy/RENDER_SCALE, sp); #ifdef TERRIBLE_SSR_LOD_FALLBACK - if(sp >= 0.99999) hitPos = reflectedTC; + if(sp > 0.99999) hitPos = reflectedTC; #endif break; } @@ -216,8 +218,8 @@ 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; #endif diff --git a/shaders/lib/texFiltering.glsl b/shaders/lib/texFiltering.glsl index 7d58676..7f2bb93 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) diff --git a/shaders/lib/volumetricClouds.glsl b/shaders/lib/volumetricClouds.glsl index 20925c5..bd56a63 100644 --- a/shaders/lib/volumetricClouds.glsl +++ b/shaders/lib/volumetricClouds.glsl @@ -15,7 +15,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); } @@ -25,7 +25,7 @@ vec3 getPlanetAbsorb(in vec3 worldPos, in vec3 sunVector, sampler2D colortex){ float position = clamp((worldPos.y - (FAKE_PLANET_START_HEIGHT + 1.0/abs(sunVector.y*0.1)))*256.0 / FAKE_PLANET_GRADIENT_LENGTH,0.0,257.0); // float position = clamp((worldPos.y + 60.0)*256.0 / 1500.0,0.0,257.0); - vec3 skyAbsorb = texture2D(colortex, vec2(16.5, position)*texelSize).rgb / 2400.0; + vec3 skyAbsorb = texture(colortex, vec2(16.5, position)*texelSize).rgb / 2400.0; #ifdef ReflectedFog return skyAbsorb*2400.0/150.0 * 2.5; @@ -49,8 +49,8 @@ float getCloudShape(int LayerIndex, int LOD, in vec3 position, float minHeight, case SMALLCUMULUS_LAYER: { coverage = parameters.smallCumulus.x; - largeCloud = texture2D(noisetex, (samplePos.xz + cloud_movement)/5000.0 * CloudLayer0_scale).b; - smallCloud = 1.0-texture2D(noisetex, (samplePos.xz - cloud_movement)/500.0 * CloudLayer0_scale).r; + largeCloud = texture(noisetex, (samplePos.xz + cloud_movement)/5000.0 * CloudLayer0_scale).b; + smallCloud = 1.0-texture(noisetex, (samplePos.xz - cloud_movement)/500.0 * CloudLayer0_scale).r; smallCloud = abs(largeCloud-0.6) + smallCloud*smallCloud; shape = min(max(coverage - smallCloud,0.0)/(1e-6+sqrt(coverage)),1.0) ; @@ -59,8 +59,8 @@ float getCloudShape(int LayerIndex, int LOD, in vec3 position, float minHeight, case LARGECUMULUS_LAYER: { coverage = parameters.largeCumulus.x; - largeCloud = texture2D(noisetex, (samplePos.zx + cloud_movement*3.0)/10000.0 * CloudLayer1_scale).b; - smallCloud = texture2D(noisetex, (samplePos.zx - cloud_movement*3.0)/2500.0 * CloudLayer1_scale).b; + largeCloud = texture(noisetex, (samplePos.zx + cloud_movement*3.0)/10000.0 * CloudLayer1_scale).b; + smallCloud = texture(noisetex, (samplePos.zx - cloud_movement*3.0)/2500.0 * CloudLayer1_scale).b; smallCloud = abs(largeCloud* -0.7) + smallCloud; shape = min(max(coverage - smallCloud,0.0)/(1e-6+sqrt(coverage)),1.0) ; @@ -69,8 +69,8 @@ float getCloudShape(int LayerIndex, int LOD, in vec3 position, float minHeight, case ALTOSTRATUS_LAYER: { coverage = parameters.altostratus.x; - largeCloud = texture2D(noisetex, (position.xz + cloud_movement*20.0)/100000. * CloudLayer2_scale).b; - smallCloud = 1.0 - texture2D(noisetex, ((position.xz + vec2(-cloud_movement,cloud_movement)*20.0)/7500. - vec2(1.0-largeCloud, -largeCloud)/5.0) * CloudLayer2_scale).b; + largeCloud = texture(noisetex, (position.xz + cloud_movement*20.0)/100000. * CloudLayer2_scale).b; + smallCloud = 1.0 - texture(noisetex, ((position.xz + vec2(-cloud_movement,cloud_movement)*20.0)/7500. - vec2(1.0-largeCloud, -largeCloud)/5.0) * CloudLayer2_scale).b; smallCloud = largeCloud + smallCloud * 0.4 * clamp(1.5-largeCloud,0.0,1.0); shape = min(max(coverage - smallCloud,0.0) / (1e-6+sqrt(coverage)),1.0); diff --git a/shaders/world0/dh_shadow.fsh b/shaders/world0/dh_shadow.fsh index 62ec7bf..9d3f9a4 100644 --- a/shaders/world0/dh_shadow.fsh +++ b/shaders/world0/dh_shadow.fsh @@ -27,5 +27,5 @@ void main() { return; } - gl_FragData[0] = texture2D(tex, texcoord.xy); + gl_FragData[0] = texture(tex, texcoord.xy); } diff --git a/shaders/world0/gbuffers_skytextured.fsh b/shaders/world0/gbuffers_skytextured.fsh index a0daa98..19f4e98 100644 --- a/shaders/world0/gbuffers_skytextured.fsh +++ b/shaders/world0/gbuffers_skytextured.fsh @@ -30,7 +30,7 @@ void main() { #if RESOURCEPACK_SKY != 0 /* RENDERTARGETS:2 */ - vec4 COLOR = texture2D(texture, texcoord.xy) * color; + vec4 COLOR = texture(texture, 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/shadow.fsh b/shaders/world0/shadow.fsh index 265aa5d..c58473b 100644 --- a/shaders/world0/shadow.fsh +++ b/shaders/world0/shadow.fsh @@ -16,12 +16,12 @@ 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 ); } void main() { - vec4 shadowColor = vec4(texture2D(tex,texcoord.xy).rgb * color.rgb, texture2DLod(tex, texcoord.xy, 0).a); + vec4 shadowColor = vec4(texture(tex,texcoord.xy).rgb * color.rgb, texture2DLod(tex, texcoord.xy, 0).a); gl_FragData[0] = shadowColor; diff --git a/shaders/world0_with_aether_flag/dh_shadow.fsh b/shaders/world0_with_aether_flag/dh_shadow.fsh index 62ec7bf..9d3f9a4 100644 --- a/shaders/world0_with_aether_flag/dh_shadow.fsh +++ b/shaders/world0_with_aether_flag/dh_shadow.fsh @@ -27,5 +27,5 @@ void main() { return; } - gl_FragData[0] = texture2D(tex, texcoord.xy); + gl_FragData[0] = texture(tex, texcoord.xy); } diff --git a/shaders/world0_with_aether_flag/gbuffers_skytextured.fsh b/shaders/world0_with_aether_flag/gbuffers_skytextured.fsh index a0daa98..19f4e98 100644 --- a/shaders/world0_with_aether_flag/gbuffers_skytextured.fsh +++ b/shaders/world0_with_aether_flag/gbuffers_skytextured.fsh @@ -30,7 +30,7 @@ void main() { #if RESOURCEPACK_SKY != 0 /* RENDERTARGETS:2 */ - vec4 COLOR = texture2D(texture, texcoord.xy) * color; + vec4 COLOR = texture(texture, 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/shadow.fsh b/shaders/world0_with_aether_flag/shadow.fsh index 5a1d6cc..8672495 100644 --- a/shaders/world0_with_aether_flag/shadow.fsh +++ b/shaders/world0_with_aether_flag/shadow.fsh @@ -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 ); } void main() { - vec4 shadowColor = vec4(texture2D(tex,texcoord.xy).rgb * color.rgb, texture2DLod(tex, texcoord.xy, 0).a); + vec4 shadowColor = vec4(texture(tex,texcoord.xy).rgb * color.rgb, texture2DLod(tex, texcoord.xy, 0).a); #ifdef TRANSLUCENT_COLORED_SHADOWS if(shadowColor.a > 0.9999) shadowColor.rgb = vec3(0.0); diff --git a/shaders/world0_with_twilight_forest_flag/dh_shadow.fsh b/shaders/world0_with_twilight_forest_flag/dh_shadow.fsh index 62ec7bf..9d3f9a4 100644 --- a/shaders/world0_with_twilight_forest_flag/dh_shadow.fsh +++ b/shaders/world0_with_twilight_forest_flag/dh_shadow.fsh @@ -27,5 +27,5 @@ void main() { return; } - gl_FragData[0] = texture2D(tex, texcoord.xy); + gl_FragData[0] = texture(tex, texcoord.xy); } diff --git a/shaders/world0_with_twilight_forest_flag/gbuffers_skytextured.fsh b/shaders/world0_with_twilight_forest_flag/gbuffers_skytextured.fsh index a0daa98..19f4e98 100644 --- a/shaders/world0_with_twilight_forest_flag/gbuffers_skytextured.fsh +++ b/shaders/world0_with_twilight_forest_flag/gbuffers_skytextured.fsh @@ -30,7 +30,7 @@ void main() { #if RESOURCEPACK_SKY != 0 /* RENDERTARGETS:2 */ - vec4 COLOR = texture2D(texture, texcoord.xy) * color; + vec4 COLOR = texture(texture, 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/shadow.fsh b/shaders/world0_with_twilight_forest_flag/shadow.fsh index 5a1d6cc..8672495 100644 --- a/shaders/world0_with_twilight_forest_flag/shadow.fsh +++ b/shaders/world0_with_twilight_forest_flag/shadow.fsh @@ -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 ); } void main() { - vec4 shadowColor = vec4(texture2D(tex,texcoord.xy).rgb * color.rgb, texture2DLod(tex, texcoord.xy, 0).a); + vec4 shadowColor = vec4(texture(tex,texcoord.xy).rgb * color.rgb, texture2DLod(tex, texcoord.xy, 0).a); #ifdef TRANSLUCENT_COLORED_SHADOWS if(shadowColor.a > 0.9999) shadowColor.rgb = vec3(0.0);