2023-07-07 13:56:38 +01:00
|
|
|
#include "/lib/settings.glsl"
|
2023-01-12 15:28:19 -05:00
|
|
|
|
2023-01-12 15:00:14 -05:00
|
|
|
uniform sampler2D depthtex0;
|
2024-02-05 16:04:37 -05:00
|
|
|
uniform sampler2D dhDepthTex;
|
2025-03-21 21:50:36 -04:00
|
|
|
uniform sampler2D colortex1;
|
|
|
|
uniform sampler2D colortex2;
|
2023-01-12 15:00:14 -05:00
|
|
|
uniform vec2 texelSize;
|
2024-05-16 19:56:32 -04:00
|
|
|
|
2025-03-22 00:07:30 -04:00
|
|
|
|
|
|
|
float interleaved_gradientNoise(){
|
|
|
|
// vec2 coord = gl_FragCoord.xy + (frameCounter%40000);
|
|
|
|
vec2 coord = gl_FragCoord.xy ;
|
|
|
|
// vec2 coord = gl_FragCoord.xy;
|
|
|
|
float noise = fract( 52.9829189 * fract( (coord.x * 0.06711056) + (coord.y * 0.00583715)) );
|
|
|
|
return noise ;
|
|
|
|
}
|
2023-01-12 15:00:14 -05:00
|
|
|
//////////////////////////////VOID MAIN//////////////////////////////
|
|
|
|
//////////////////////////////VOID MAIN//////////////////////////////
|
|
|
|
//////////////////////////////VOID MAIN//////////////////////////////
|
|
|
|
//////////////////////////////VOID MAIN//////////////////////////////
|
|
|
|
//////////////////////////////VOID MAIN//////////////////////////////
|
|
|
|
|
2025-03-21 21:50:36 -04:00
|
|
|
/* RENDERTARGETS:1,2 */
|
2025-03-22 00:07:30 -04:00
|
|
|
|
2023-04-16 16:18:26 -04:00
|
|
|
|
2023-01-12 15:00:14 -05:00
|
|
|
void main() {
|
2024-06-19 21:44:21 -04:00
|
|
|
|
2025-03-21 21:50:36 -04:00
|
|
|
vec2 texcoord = gl_FragCoord.xy * texelSize;
|
2024-06-19 21:44:21 -04:00
|
|
|
|
2025-03-21 21:50:36 -04:00
|
|
|
gl_FragData[0] = texelFetch2D(colortex1, ivec2(gl_FragCoord.xy),0);
|
2024-06-19 21:44:21 -04:00
|
|
|
|
2025-03-22 00:07:30 -04:00
|
|
|
if(
|
|
|
|
texelFetch2D(depthtex0, ivec2(gl_FragCoord.xy), 0).x < 1.0
|
|
|
|
|
|
|
|
#ifdef DISTANT_HORIZONS
|
|
|
|
|| texelFetch2D(dhDepthTex, ivec2(gl_FragCoord.xy), 0).x < 1.0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
) {
|
2025-03-21 21:50:36 -04:00
|
|
|
// doing this for precision reasons, DH does NOT like depth => 1.0
|
|
|
|
}else{
|
2025-03-22 00:07:30 -04:00
|
|
|
|
|
|
|
vec3 skyColor = texelFetch2D(colortex2, ivec2(gl_FragCoord.xy),0).rgb;
|
|
|
|
skyColor.rgb = max(skyColor.rgb - skyColor.rgb * interleaved_gradientNoise()*0.05, 0.0);
|
2024-05-16 19:56:32 -04:00
|
|
|
|
2025-03-22 00:07:30 -04:00
|
|
|
gl_FragData[0].rgb = skyColor/50.0;
|
2025-03-21 21:50:36 -04:00
|
|
|
gl_FragData[0].a = 0.0;
|
2024-06-10 23:26:19 -04:00
|
|
|
|
2025-03-21 21:50:36 -04:00
|
|
|
}
|
2023-01-12 15:00:14 -05:00
|
|
|
|
2025-03-21 21:50:36 -04:00
|
|
|
gl_FragData[1] = vec4(0,0,0,0);
|
2023-01-12 15:00:14 -05:00
|
|
|
|
2023-10-07 22:18:20 -04:00
|
|
|
}
|