added a contrast setting. make beacon beams and enchantment glint work in the end and nether. tweak lighting in the end and nether.

This commit is contained in:
Xonk
2023-07-06 20:47:26 -04:00
parent 4ec1a86639
commit b62cb8aa4b
36 changed files with 262 additions and 616 deletions

View File

@ -1,64 +1,32 @@
#version 120
//#extension GL_EXT_gpu_shader4 : disable
varying vec4 lmtexcoord;
varying vec4 color;
varying vec4 normalMat;
#define SHADOW_MAP_BIAS 0.8
varying vec2 texcoord;
uniform sampler2D texture;
uniform vec4 lightCol;
uniform vec3 sunVec;
uniform vec3 upVec;
uniform vec2 texelSize;
uniform float skyIntensityNight;
uniform float skyIntensity;
uniform float sunElevation;
uniform float rainStrength;
uniform mat4 gbufferProjectionInverse;
uniform mat4 gbufferModelViewInverse;
uniform mat4 shadowModelView;
uniform mat4 shadowProjection;
//faster and actually more precise than pow 2.2
vec3 toLinear(vec3 sRGB){
return sRGB * (sRGB * (sRGB * 0.305306011 + 0.682171111) + 0.012522878);
}
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
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 interleaved_gradientNoise(){
vec2 coord = gl_FragCoord.xy;
float noise = fract(52.9829189*fract(0.06711056*coord.x + 0.00583715*coord.y));
return noise;
vec4 encode (vec3 n, vec2 lightmaps){
n.xy = n.xy / dot(abs(n), vec3(1.0));
n.xy = n.z <= 0.0 ? (1.0 - abs(n.yx)) * sign(n.xy) : n.xy;
vec2 encn = clamp(n.xy * 0.5 + 0.5,-1.0,1.0);
return vec4(encn,vec2(lightmaps.x,lightmaps.y));
}
float facos(float sx){
float x = clamp(abs( sx ),0.,1.);
float a = sqrt( 1. - x ) * ( -0.16882 * x + 1.56734 );
return sx > 0. ? a : 3.14159265359 - a;
//encoding by jodie
float encodeVec2(vec2 a){
const vec2 constant1 = vec2( 1., 256.) / 65535.;
vec2 temp = floor( a * 255. );
return temp.x*constant1.x+temp.y*constant1.y;
}
#define SHADOW_MAP_BIAS 0.8
float calcDistort(vec2 worlpos){
vec2 pos = worlpos * 1.165;
vec2 posSQ = pos*pos;
float distb = pow(posSQ.x*posSQ.x*posSQ.x + posSQ.y*posSQ.y*posSQ.y, 1.0 / 6.0);
return 1.08695652/((1.0 - SHADOW_MAP_BIAS) + distb * SHADOW_MAP_BIAS);
float encodeVec2(float x,float y){
return encodeVec2(vec2(x,y));
}
//////////////////////////////VOID MAIN//////////////////////////////
@ -66,25 +34,14 @@ float calcDistort(vec2 worlpos){
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
/* DRAWBUFFERS:2 */
/* DRAWBUFFERS:28 */
void main() {
vec4 Albedo = vec4(texture2D(texture, texcoord).rgb*5.0,1.0);
Albedo *= color;
Albedo.rgb = toLinear(Albedo.rgb);
gl_FragData[0] = texture2D(texture, lmtexcoord.xy)*color;
gl_FragData[0].a = 1.0;
vec3 albedo = toLinear(gl_FragData[0].rgb);
float torch_lightmap = lmtexcoord.z;
vec3 diffuseLight = torch_lightmap*vec3(20.,30.,50.)*2./10. ;
vec3 color = diffuseLight*albedo;
gl_FragData[0].rgb = color*0.01;
}
gl_FragData[0] = Albedo;
gl_FragData[1] = vec4(0.0,0.0,0.0,0.9);
}