74 lines
No EOL
1.9 KiB
GLSL
74 lines
No EOL
1.9 KiB
GLSL
#include "/lib/common.glsl"
|
|
|
|
noperspective in vec2 texCoord;
|
|
|
|
flat in vec3 upVec, sunVec;
|
|
|
|
//Pipeline Constants//
|
|
const bool colortex0MipmapEnabled = true;
|
|
|
|
//Common Variables//
|
|
float farMinusNear = far - near;
|
|
vec2 view = vec2(viewWidth, viewHeight);
|
|
|
|
float vlFactor = 0.0;
|
|
|
|
//Common Functions//
|
|
float GetLinearDepth(float depth) {
|
|
return (2.0 * near) / (far + near - depth * farMinusNear);
|
|
}
|
|
|
|
//Includes//
|
|
#include "/lib/util/spaceConversion.glsl"
|
|
#include "/lib/util/dither.glsl"
|
|
#include "/lib/colors/skyColors.glsl"
|
|
#include "/lib/misc/darkOutline.glsl"
|
|
|
|
|
|
//Program//
|
|
void main() {
|
|
vec3 color = texelFetch(colortex0, texelCoord, 0).rgb;
|
|
float z0 = texelFetch(depthtex0, texelCoord, 0).r;
|
|
|
|
vec4 screenPos = vec4(texCoord, z0, 1.0);
|
|
vec4 viewPos = gbufferProjectionInverse * (screenPos * 2.0 - 1.0);
|
|
viewPos /= viewPos.w;
|
|
float lViewPos = length(viewPos);
|
|
vec3 nViewPos = normalize(viewPos.xyz);
|
|
vec3 playerPos = ViewToPlayer(viewPos.xyz);
|
|
|
|
float dither = texture2D(noisetex, texCoord * vec2(viewWidth, viewHeight) / 128.0).b;
|
|
|
|
float skyFade = 0.0;
|
|
vec3 waterRefColor = vec3(0.0);
|
|
vec3 auroraBorealis = vec3(0.0);
|
|
vec3 nightNebula = vec3(0.0);
|
|
|
|
|
|
|
|
if (z0 < 1.0) {
|
|
vec3 texture6 = texelFetch(colortex6, texelCoord, 0).rgb;
|
|
float ssao = 1.0;
|
|
bool entityOrHand = z0 < 0.56;
|
|
int materialMaskInt = int(texture6.g * 255.1);
|
|
float intenseFresnel = 0.0;
|
|
float smoothnessD = texture6.r;
|
|
vec3 reflectColor = vec3(1.0);
|
|
|
|
color.rgb *= 1.0;
|
|
waterRefColor = color;
|
|
|
|
} else { // Sky
|
|
skyFade = 1.0;
|
|
}
|
|
|
|
float cloudLinearDepth = 1.0;
|
|
vec4 clouds = vec4(0.0);
|
|
|
|
if (clouds.a < 0.5) DoDarkOutline(color, skyFade, z0, dither);
|
|
|
|
/*DRAWBUFFERS:054*/
|
|
gl_FragData[0] = vec4(color, 1.0);
|
|
gl_FragData[1] = vec4(waterRefColor, 1.0 - skyFade);
|
|
gl_FragData[2] = vec4(cloudLinearDepth, 0.0, 0.0, 1.0);
|
|
} |