Better ambient light for the nether. slightly better specular reflection of fog for the end

This commit is contained in:
Xonk
2023-07-29 21:26:04 -04:00
parent 234b55070a
commit 6d73d842cf
10 changed files with 80 additions and 38 deletions

View File

@ -6,11 +6,8 @@
#define NETHER
#include "/lib/diffuse_lighting.glsl"
varying vec2 texcoord;
flat varying vec3 avgAmbient;
flat varying vec2 TAA_Offset;
flat varying float tempOffsets;
@ -85,7 +82,6 @@ vec2 RENDER_SCALE = vec2(1.0);
#undef LIGHTSOURCE_REFLECTION
#define NETHERSPECULAR
#include "/lib/specular.glsl"
@ -380,9 +376,22 @@ void ScreenSpace_SSS(inout float sss, vec3 fragpos, vec2 noise, vec3 normal){
vec3 cosineHemisphereSample(vec2 Xi, float roughness){
float r = sqrt(Xi.x);
float theta = 2.0 * 3.14159265359 * Xi.y;
float x = r * cos(theta);
float y = r * sin(theta);
return vec3(x, y, sqrt(clamp(1.0 - Xi.x,0.,1.)));
}
vec3 TangentToWorld(vec3 N, vec3 H, float roughness){
vec3 UpVector = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
vec3 T = normalize(cross(UpVector, N));
vec3 B = cross(N, T);
return vec3((T * H.x) + (B * H.y) + (N * H.z));
}
void main() {
float dirtAmount = Dirt_Amount;
@ -432,8 +441,6 @@ void main() {
float vanilla_AO = normalAndAO.a;
normalAndAO.a = clamp(pow(normalAndAO.a*5,4),0,1);
bool iswater = texture2D(colortex7,texcoord).a > 0.99;
bool lightningBolt = abs(dataUnpacked1.w-0.5) <0.01;
bool isLeaf = abs(dataUnpacked1.w-0.55) <0.01;
@ -453,11 +460,13 @@ void main() {
// vec3 FogColor = (gl_Fog.color.rgb / pow(0.00001 + dot(gl_Fog.color.rgb,vec3(0.3333)),1.0) ) * 0.2;
// vec3 fogColor = (gl_Fog.color.rgb / max(pow(dot(gl_Fog.color.rgb,vec3(0.3333)),1.1),0.01) ) ;
vec3 FogColor = (gl_Fog.color.rgb / max(dot(gl_Fog.color.rgb,vec3(0.3333)),0.01) );
// vec3 FogColor = (gl_Fog.color.rgb / max(dot(gl_Fog.color.rgb,vec3(0.3333)),0.01) );
// do all ambient lighting stuff
vec3 Indirect_lighting = DoAmbientLighting_Nether(FogColor, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.x, normal, np3, p3 );
vec3 AmbientLightColor = skyCloudsFromTexLOD2(normal, colortex4, 6).rgb / 30.0;
// do all ambient lighting stuff
vec3 Indirect_lighting = DoAmbientLighting_Nether(AmbientLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.x, normal, np3, p3 );
vec3 AO = vec3( exp( (vanilla_AO*vanilla_AO) * -5) ) ;
if(!hand) Indirect_lighting *= ssao(fragpos,noise,FlatNormals) * AO;
@ -476,8 +485,13 @@ void main() {
if(lightningBolt) gl_FragData[0].rgb += vec3(77.0, 153.0, 255.0);
// gl_FragData[0].rgb = skyCloudsFromTexLOD2(np3, colortex4, 6).rgb / 30.0;
}
// ////// border Fog
// if(Translucent_Programs > 0.0){
// vec3 fragpos = toScreenSpace(vec3(texcoord-vec2(0.0)*texelSize*0.5,z));

View File

@ -5,7 +5,7 @@
varying vec2 texcoord;
flat varying vec3 avgAmbient;
// flat varying vec3 avgAmbient;
flat varying float tempOffsets;
flat varying vec2 TAA_Offset;
@ -46,6 +46,6 @@ void main() {
#endif
avgAmbient = texelFetch2D(colortex4,ivec2(0,37),0).rgb;
// avgAmbient = texelFetch2D(colortex4,ivec2(0,37),0).rgb;
zMults = vec3((far * near)*2.0,far+near,far-near);
}

View File

@ -5,12 +5,13 @@
#include "/lib/settings.glsl"
// flat varying vec3 ambientUp;
// flat varying vec3 ambientLeft;
// flat varying vec3 ambientRight;
// flat varying vec3 ambientB;
// flat varying vec3 ambientF;
// flat varying vec3 ambientDown;
flat varying vec3 ambientUp;
flat varying vec3 ambientLeft;
flat varying vec3 ambientRight;
flat varying vec3 ambientB;
flat varying vec3 ambientF;
flat varying vec3 ambientDown;
flat varying vec3 lightSourceColor;
flat varying vec3 sunColor;
flat varying vec3 sunColorCloud;
@ -74,20 +75,22 @@ const float[17] Slightmap = float[17](14.0,17.,19.0,22.0,24.0,28.0,31.0,40.0,60.
void main() {
/* DRAWBUFFERS:4 */
gl_FragData[0] = vec4(0.0);
gl_FragData[0] = vec4(0.0,0.0,0.0,0.0);
vec2 fogPos = vec2(256.0 - 256.0*0.12,1.0);
//Sky gradient with clouds
if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+257.){
if (gl_FragCoord.x > (fogPos.x - fogPos.x*0.22) && gl_FragCoord.y > 0.4 && gl_FragCoord.x < 535){
vec2 p = clamp(floor(gl_FragCoord.xy-vec2(18.+257,1.))/256.+tempOffsets/256.,0.0,1.0);
// vec2 p = clamp(floor(gl_FragCoord.xy-vec2(18.+257,1.))/256.+tempOffsets/256.,0.0,1.0);
vec2 p = clamp(floor(gl_FragCoord.xy-fogPos)/256.+tempOffsets/256.,-0.2,1.2);
vec3 viewVector = cartToSphere(p);
// vec3 BackgroundColor = (gl_Fog.color.rgb / max(dot(gl_Fog.color.rgb,vec3(0.3333)),0.01)) / 30.0;
// BackgroundColor *= abs(viewVector.y+0.5);
vec3 BackgroundColor = vec3(0.0);
vec4 VL_Fog = GetVolumetricFog(mat3(gbufferModelView)*viewVector*1024., fract(frameCounter/1.6180339887));
BackgroundColor += VL_Fog.rgb/5;
vec4 VL_Fog = GetVolumetricFog(mat3(gbufferModelView)*viewVector*256., fract(frameCounter/1.6180339887));
BackgroundColor += VL_Fog.rgb/3.0;
gl_FragData[0] = vec4(BackgroundColor,1.0);
}
@ -95,7 +98,7 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
//Temporally accumulate sky and light values
vec3 temp = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy),0).rgb;
vec3 curr = gl_FragData[0].rgb*150.;
gl_FragData[0].rgb = clamp(mix(temp,curr,0.07),0.0,65000.);
gl_FragData[0].rgb = clamp(mix(temp,curr,0.05),0.0,65000.);
//Exposure values
if (gl_FragCoord.x > 10. && gl_FragCoord.x < 11. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )