Files
minecraft-pt/shaders/Lib/Programs/Composite/Sky_End_FS.glsl
T

28 lines
759 B
GLSL

// MinecraftPT — Sky_End_FS
// End dimension sky rendering pass.
#include "/Lib/Settings.glsl"
#include "/Lib/BasicFunctions/LightingConstants.glsl"
#include "/Lib/Utilities.glsl"
#include "/Lib/IndividualFunctions/EndSky.glsl"
uniform sampler2D depthtex0;
layout(location = 0) out vec4 colorOut;
void main(){
ivec2 texelCoord = ivec2(gl_FragCoord.xy);
float depth = texelFetch(depthtex0, texelCoord, 0).r;
if (depth < 1.0){
discard;
}
vec4 viewPos = gbufferProjectionInverse * vec4(vec2(texelCoord) / screenSize * 2.0 - 1.0, 1.0, 1.0);
vec3 viewDir = normalize(viewPos.xyz / viewPos.w);
vec3 worldDir = normalize(mat3(gbufferModelViewInverse) * viewDir);
vec3 color = GetEndSky(worldDir, GetSunDirWorld());
colorOut = vec4(color, 1.0);
}