67 lines
1.8 KiB
Plaintext
Raw Normal View History

2023-01-12 15:00:14 -05:00
#version 120
//#extension GL_ARB_shader_texture_lod : disable
2023-10-08 15:16:13 -04:00
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
varying vec2 texcoord;
uniform sampler2D tex;
uniform sampler2D noisetex;
uniform int frameCounter;
2024-03-20 21:44:25 -04:00
uniform float frameTimeCounter;
uniform vec3 cameraPosition;
varying vec4 color;
varying float materials;
flat varying vec4 playerpos;
#include "/lib/waterBump.glsl"
2023-01-12 15:00:14 -05:00
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
2023-01-12 15:28:19 -05:00
2024-03-20 21:44:25 -04:00
uniform mat4 gbufferProjectionInverse;
uniform mat4 gbufferModelViewInverse;
uniform mat4 gbufferModelView;
uniform mat4 shadowModelView;
uniform mat4 shadowModelViewInverse;
uniform mat4 shadowProjection;
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
vec3 toScreenSpace(vec3 p) {
vec4 iProjDiag = vec4(gbufferProjectionInverse[0].x, gbufferProjectionInverse[1].y, gbufferProjectionInverse[2].zw);
vec3 p3 = p * 2. - 1.;
vec4 fragposition = iProjDiag * p3.xyzz + gbufferProjectionInverse[3];
return fragposition.xyz / fragposition.w;
}
float blueNoise(){
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 );
2023-01-12 15:00:14 -05:00
}
2024-03-20 21:44:25 -04:00
2023-01-12 15:00:14 -05:00
void main() {
2024-03-20 21:44:25 -04:00
gl_FragData[0] = texture2D(tex,texcoord.xy) * color;
2023-01-12 15:00:14 -05:00
#ifdef SHADOW_DISABLE_ALPHA_MIPMAPS
2024-03-20 21:44:25 -04:00
gl_FragData[0].a = texture2DLod(tex, texcoord.xy, 0).a;
2023-01-12 15:00:14 -05:00
#endif
#ifdef Stochastic_Transparent_Shadows
if(gl_FragData[0].a < blueNoise()) { discard; return;}
#endif
2023-07-02 17:27:20 -04:00
#ifdef RENDER_ENTITY_SHADOWS
#endif
2024-03-20 21:44:25 -04:00
// if(materials > 0.95){
// // gl_FragData[0] = vec4(0.3,0.8,1.0,0.1);
// gl_FragData[0] = vec4(1.0,1.0,1.0,0.1);
// }
2023-01-12 15:00:14 -05:00
}