2023-10-08 10:18:20 +08:00
|
|
|
#include "/lib/settings.glsl"
|
|
|
|
#include "/lib/util.glsl"
|
2023-10-09 03:33:05 +08:00
|
|
|
#include "/lib/res_params.glsl"
|
2023-10-08 10:18:20 +08:00
|
|
|
|
|
|
|
flat varying vec4 lightCol;
|
|
|
|
flat varying vec3 averageSkyCol;
|
2024-03-02 11:48:09 +08:00
|
|
|
flat varying vec3 averageSkyCol_Clouds;
|
2023-10-08 10:18:20 +08:00
|
|
|
|
2024-06-20 09:44:21 +08:00
|
|
|
#if defined LPV_VL_FOG_ILLUMINATION && defined IS_LPV_ENABLED
|
|
|
|
flat varying float exposure;
|
|
|
|
#endif
|
|
|
|
|
2024-05-22 12:01:17 +08:00
|
|
|
#if defined Daily_Weather
|
|
|
|
flat varying vec4 dailyWeatherParams0;
|
|
|
|
flat varying vec4 dailyWeatherParams1;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-08 10:18:20 +08:00
|
|
|
flat varying vec3 WsunVec;
|
|
|
|
flat varying vec3 refractedSunVec;
|
|
|
|
|
2024-03-02 11:48:09 +08:00
|
|
|
uniform vec2 texelSize;
|
2023-10-08 10:18:20 +08:00
|
|
|
|
|
|
|
uniform sampler2D colortex4;
|
|
|
|
|
|
|
|
uniform float sunElevation;
|
|
|
|
uniform vec3 sunPosition;
|
|
|
|
uniform mat4 gbufferModelViewInverse;
|
|
|
|
uniform int frameCounter;
|
|
|
|
|
|
|
|
|
2024-06-20 09:44:21 +08:00
|
|
|
flat varying vec2 TAA_Offset;
|
|
|
|
uniform int framemod8;
|
2024-07-07 09:03:31 +08:00
|
|
|
#include "/lib/TAA_jitter.glsl"
|
|
|
|
|
2023-04-17 04:18:26 +08:00
|
|
|
|
2023-01-13 04:00:14 +08:00
|
|
|
//////////////////////////////VOID MAIN//////////////////////////////
|
|
|
|
//////////////////////////////VOID MAIN//////////////////////////////
|
|
|
|
//////////////////////////////VOID MAIN//////////////////////////////
|
|
|
|
//////////////////////////////VOID MAIN//////////////////////////////
|
|
|
|
//////////////////////////////VOID MAIN//////////////////////////////
|
|
|
|
|
2023-10-08 10:18:20 +08:00
|
|
|
|
2023-10-15 11:34:52 +08:00
|
|
|
uniform float frameTimeCounter;
|
2023-10-08 10:18:20 +08:00
|
|
|
#include "/lib/Shadow_Params.glsl"
|
2024-03-02 11:48:09 +08:00
|
|
|
#include "/lib/sky_gradient.glsl"
|
2023-01-13 04:00:14 +08:00
|
|
|
void main() {
|
|
|
|
gl_Position = ftransform();
|
2023-08-03 12:23:29 +08:00
|
|
|
|
2023-10-09 03:33:05 +08:00
|
|
|
gl_Position.xy = (gl_Position.xy*0.5+0.5)*(0.01+VL_RENDER_RESOLUTION)*2.0-1.0;
|
2023-10-08 10:18:20 +08:00
|
|
|
|
2024-03-02 11:48:09 +08:00
|
|
|
#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;
|
2024-05-22 12:01:17 +08:00
|
|
|
|
|
|
|
#if defined Daily_Weather
|
2024-06-11 11:26:19 +08:00
|
|
|
dailyWeatherParams0 = vec4((texelFetch2D(colortex4,ivec2(1,1),0).rgb/150.0)/2.0, 0.0);
|
|
|
|
dailyWeatherParams1 = vec4((texelFetch2D(colortex4,ivec2(2,1),0).rgb/150.0)/2.0, 0.0);
|
2024-05-22 12:01:17 +08:00
|
|
|
|
2024-06-11 11:26:19 +08:00
|
|
|
dailyWeatherParams0.a = (texelFetch2D(colortex4,ivec2(3,1),0).x/150.0)/2.0;
|
|
|
|
dailyWeatherParams1.a = (texelFetch2D(colortex4,ivec2(3,1),0).y/150.0)/2.0;
|
2024-05-22 12:01:17 +08:00
|
|
|
#endif
|
|
|
|
|
2024-03-02 11:48:09 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef NETHER_SHADER
|
|
|
|
lightCol.rgb = vec3(0.0);
|
|
|
|
averageSkyCol = vec3(0.0);
|
2024-03-23 10:58:19 +08:00
|
|
|
averageSkyCol_Clouds = vec3(2.0, 1.0, 0.5) * 10.0;
|
2024-03-02 11:48:09 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef END_SHADER
|
|
|
|
lightCol.rgb = vec3(0.0);
|
|
|
|
averageSkyCol = vec3(0.0);
|
|
|
|
averageSkyCol_Clouds = vec3(5.0);
|
|
|
|
#endif
|
2023-10-08 10:18:20 +08:00
|
|
|
|
2024-03-02 11:48:09 +08:00
|
|
|
lightCol.a = float(sunElevation > 1e-5)*2.0 - 1.0;
|
2023-10-08 10:18:20 +08:00
|
|
|
WsunVec = lightCol.a * normalize(mat3(gbufferModelViewInverse) * sunPosition);
|
2024-03-02 11:48:09 +08:00
|
|
|
|
2023-10-08 10:18:20 +08:00
|
|
|
refractedSunVec = refract(WsunVec, -vec3(0.0,1.0,0.0), 1.0/1.33333);
|
2024-06-20 09:44:21 +08:00
|
|
|
|
|
|
|
#if defined LPV_VL_FOG_ILLUMINATION && defined IS_LPV_ENABLED
|
|
|
|
exposure = texelFetch2D(colortex4,ivec2(10,37),0).r;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TAA
|
|
|
|
TAA_Offset = offsets[framemod8];
|
|
|
|
#else
|
|
|
|
TAA_Offset = vec2(0.0);
|
|
|
|
#endif
|
|
|
|
|
2023-01-13 04:00:14 +08:00
|
|
|
}
|