ADDED material AO. made Volumetric fogs all converge better. made "ambient light only" work universally. removed fallback dimension.

This commit is contained in:
Xonk
2023-10-20 20:26:41 -04:00
parent ca39a0a6dd
commit fd0e4c45be
76 changed files with 80 additions and 581 deletions

View File

@ -149,7 +149,7 @@ void main() {
Direct_lighting *= phaseg(clamp(dot(feetPlayerPos_normalized, WsunVec),0.0,1.0), 0.65)*2 + 0.5;
#endif
vec3 AmbientLightColor = averageSkyCol_Clouds;
vec3 AmbientLightColor = averageSkyCol_Clouds * 3.0;
#endif
@ -161,10 +161,6 @@ void main() {
vec3 AmbientLightColor = vec3(1.0);
#endif
#ifdef FALLBACK_SHADER
vec3 AmbientLightColor = vec3(1.0);
#endif
Indirect_lighting = DoAmbientLightColor(AmbientLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), clamp(lightmap.xy,0,1));
#ifndef LINES

View File

@ -442,8 +442,13 @@ void main() {
//////////////////////////////// ////////////////////////////////
#if defined WORLD && defined MC_NORMAL_MAP
vec3 NormalTex = texture2D_POMSwitch(normals, adjustedTexCoord.xy, vec4(dcdx,dcdy), ifPOM).xyw;
float Heightmap = 1.0 - NormalTex.z;
vec4 NormalTex = texture2D_POMSwitch(normals, adjustedTexCoord.xy, vec4(dcdx,dcdy), ifPOM).xyzw;
#ifdef MATERIAL_AO
Albedo.rgb *= NormalTex.b*0.5+0.5;
#endif
float Heightmap = 1.0 - NormalTex.w;
NormalTex.xy = NormalTex.xy * 2.0-1.0;
NormalTex.z = sqrt(max(1.0 - dot(NormalTex.xy, NormalTex.xy), 0.0));
@ -455,6 +460,7 @@ void main() {
gl_FragDepth = toClipSpace3(truePos).z;
#endif
if(PHYSICSMOD_SNOW < 1) normal = applyBump(tbnMatrix, NormalTex.xyz, mix(1.0,1-Puddle_shape,rainfall) );
#endif

View File

@ -306,12 +306,12 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
#endif
#ifdef Vanilla_like_water
if (iswater > 0.5) {
gl_FragData[0].a = luma(Albedo.rgb);
if (iswater > 0.95){
// gl_FragData[0].a = luma(Albedo.rgb);
Albedo = color.rgb * sqrt(luma(Albedo.rgb));
}
#else
if (iswater > 0.9) {
if (iswater > 0.95){
Albedo = vec3(0.0);
gl_FragData[0] = vec4(vec3(0.0),1.0/255.0);
}
@ -468,10 +468,6 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
vec3 AmbientLightColor = vec3(1.0);
#endif
#ifdef FALLBACK_SHADER
vec3 AmbientLightColor = vec3(1.0);
#endif
Indirect_lighting = DoAmbientLightColor(AmbientLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.xy);
vec3 FinalColor = (Indirect_lighting + Direct_lighting) * Albedo;

View File

@ -90,8 +90,9 @@ vec2 decodeVec2(float a){
return fract( a * constant1 ) * constant2 ;
}
float R2_dither(){
vec2 coord = gl_FragCoord.xy + (frameCounter%40000) * 2.0;
vec2 alpha = vec2(0.75487765, 0.56984026);
return fract(alpha.x * gl_FragCoord.x + alpha.y * gl_FragCoord.y + 1.0/1.6180339887 * frameCounter);
return fract(alpha.x * coord.x + alpha.y * coord.y ) ;
}
float blueNoise(){
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter);
@ -228,8 +229,9 @@ void main() {
float diffthreshM = diffthresh*mult*d0*k/20.;
float avgDepth = 0.0;
int seed = (frameCounter%40000) + frameCounter*2;
float noise = fract(R2_samples(seed).y + blueNoise(gl_FragCoord.xy).y);
// int seed = (frameCounter%40000) + frameCounter*2;
// float noise = fract(R2_samples(seed).y + blueNoise(gl_FragCoord.xy).y);
float noise = R2_dither();
for(int i = 0; i < VPS_Search_Samples; i++){

View File

@ -37,11 +37,6 @@ const bool colortex5MipmapEnabled = true;
// #define LIGHTSOURCE_REFLECTION
#endif
#ifdef FALLBACK_SHADER
uniform sampler2D colortex4;
uniform float nightVision;
// #define LIGHTSOURCE_REFLECTION
#endif
uniform sampler2D noisetex; //noise
uniform sampler2D depthtex1; //depth
@ -624,7 +619,7 @@ void main() {
vec2 bnoise = blueNoise(gl_FragCoord.xy).rg;
int seed = (frameCounter%40000) + frameCounter*2;
float noise = fract(R2_samples(seed).y + bnoise.y);
float noise_2 = blueNoise();
float noise_2 = R2_dither();
vec2 tempOffset = TAA_Offset;
vec3 viewPos = toScreenSpace(vec3(texcoord/RENDER_SCALE - TAA_Offset*texelSize*0.5,z));
@ -643,7 +638,7 @@ void main() {
vec3 normal = decode(dataUnpacked0.yw);
vec2 lightmap = dataUnpacked1.yz;
#ifndef OVERWORLD_SHADER
#if defined END_SHADER || defined NETHER_SHADER
lightmap.y = 1.0;
#endif
@ -700,9 +695,7 @@ void main() {
float NdotL = 1.0;
#ifdef OVERWORLD_SHADER
#ifndef ambientLight_only
DirectLightColor = lightCol.rgb/80.0;
#endif
DirectLightColor = lightCol.rgb/80.0;
#ifdef PER_BIOME_ENVIRONMENT
BiomeSunlightColor(DirectLightColor);
@ -754,15 +747,6 @@ void main() {
#if defined NETHER_SHADER || defined END_SHADER
gl_FragData[0].rgb = vec3(0);
#endif
#ifdef FALLBACK_SHADER
vec3 Background = vec3(0.5,0.3,1.0)*0.025;
Background += vec3(0.8,1.0,0.5) * 0.5 * pow(normalize(-feetPlayerPos_normalized).y*0.5+0.5,3.0);
Background += stars(feetPlayerPos_normalized) * 100.0 * pow(normalize(feetPlayerPos_normalized).y*0.5+0.5,3.0);
gl_FragData[0].rgb = clamp(Background, 0.0, 65000.);
#endif
} else {
@ -829,8 +813,7 @@ void main() {
for(int i = 0; i < samples; i++){
// vec2 offsetS = SpiralSample(i, 7, 8, noise)*0.5;
vec2 offsetS = tapLocation_simple(i, 7, 9, noise) * 0.5;
vec2 offsetS = tapLocation_simple(i, 7, 9, noise_2) * 0.5;
float isShadow = shadow2D(shadow, projectedShadowPosition + vec3(rdMul*offsetS, smallbias) ).x;
Shadows += isShadow/samples;
@ -965,10 +948,6 @@ void main() {
vec3 AmbientLightColor = vec3(1.0);
#endif
#ifdef FALLBACK_SHADER
vec3 AmbientLightColor = vec3(1.0);
#endif
Indirect_lighting = DoAmbientLightColor(AmbientLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.xy);
// Indirect_lighting += LightningFlashLighting;
@ -1050,14 +1029,14 @@ void main() {
#endif
//////////////////////////////// SKY SSS ////////////////////////////////
#ifdef Ambient_SSS
#if defined Ambient_SSS && defined OVERWORLD_SHADER
if (!hand){
#if indirect_effect != 1
SkySSS = ScreenSpace_SSS(viewPos, FlatNormals, hand, isLeaf, noise);
#endif
vec3 ambientColor = (AmbientLightColor / 30.0) * 2.5;
vec3 ambientColor = (averageSkyCol_Clouds / 10.0);
float skylightmap = pow(lightmap.y,3);
Indirect_SSS = SubsurfaceScattering_sky(albedo, SkySSS, LabSSS);

View File

@ -56,11 +56,6 @@ uniform ivec2 eyeBrightnessSmooth;
#include "/lib/end_fog.glsl"
#endif
#ifdef FALLBACK_SHADER
uniform sampler2D colortex4;
#include "/lib/fallback_fog.glsl"
#endif
#define fsign(a) (clamp((a)*1e35,0.,1.)*2.-1.)
float interleaved_gradientNoise(){

View File

@ -86,11 +86,6 @@ float blueNoise(){
#include "/lib/end_fog.glsl"
#endif
#ifdef FALLBACK_SHADER
uniform sampler2D colortex4;
#include "/lib/fallback_fog.glsl"
#endif
void main() {
/* DRAWBUFFERS:4 */
@ -115,14 +110,26 @@ float mixhistory = 0.07;
if (gl_FragCoord.x > 1. && gl_FragCoord.x < 2. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4((skyGroundCol/150.0) * AmbientLightTint,1.0);
if (gl_FragCoord.x > 6. && gl_FragCoord.x < 7. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(lightSourceColor,1.0);
#ifdef ambientLight_only
if (gl_FragCoord.x > 6. && gl_FragCoord.x < 7. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(0.0,0.0,0.0,1.0);
if (gl_FragCoord.x > 8. && gl_FragCoord.x < 9. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(sunColor,1.0);
if (gl_FragCoord.x > 8. && gl_FragCoord.x < 9. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(0.0,0.0,0.0,1.0);
if (gl_FragCoord.x > 13. && gl_FragCoord.x < 14. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(moonColor,1.0);
if (gl_FragCoord.x > 13. && gl_FragCoord.x < 14. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(0.0,0.0,0.0,1.0);
#else
if (gl_FragCoord.x > 6. && gl_FragCoord.x < 7. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(lightSourceColor,1.0);
if (gl_FragCoord.x > 8. && gl_FragCoord.x < 9. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(sunColor,1.0);
if (gl_FragCoord.x > 13. && gl_FragCoord.x < 14. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(moonColor,1.0);
#endif
////////////////////////////////
/// --- ATMOSPHERE IMAGE --- ///