fix missing vertex color. fix particles showing through block entities. improve sampling shape of ssao, ambient SSS, and shadow filtering. remade ambient SSS. temporary patch on DH water SSR. add updated zh_cn translation

This commit is contained in:
Xonk 2024-05-09 18:24:29 -04:00
parent f11e4cd4fa
commit e1787e4355
18 changed files with 431 additions and 230 deletions

View File

@ -84,6 +84,13 @@ vec3 DH_toScreenSpace(vec3 p) {
vec3 DH_toClipSpace3(vec3 viewSpacePosition) { vec3 DH_toClipSpace3(vec3 viewSpacePosition) {
return projMAD(dhProjection, viewSpacePosition) / -viewSpacePosition.z * 0.5 + 0.5; return projMAD(dhProjection, viewSpacePosition) / -viewSpacePosition.z * 0.5 + 0.5;
} }
uniform float near;
float invLinZ (float lindepth){
return -((2.0*near/lindepth)-far-near)/(far-near);
}
float ld(float dist) {
return (2.0 * near) / (far + near - dist * (far - near));
}
// float DH_ld(float dist) { // float DH_ld(float dist) {
// return (2.0 * dhNearPlane) / (dhFarPlane + dhNearPlane - dist * (dhFarPlane - dhNearPlane)); // return (2.0 * dhNearPlane) / (dhFarPlane + dhNearPlane - dist * (dhFarPlane - dhNearPlane));
@ -142,12 +149,26 @@ const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
vec2(3,7.)/8., vec2(3,7.)/8.,
vec2(7.,-7.)/8.); vec2(7.,-7.)/8.);
// float DH_ld(float dist) {
// return (2.0 * dhNearPlane) / (dhFarPlane + dhNearPlane - dist * (dhFarPlane - dhNearPlane));
// }
// float DH_invLinZ (float lindepth){
// return -((2.0*dhNearPlane/lindepth)-dhFarPlane-dhNearPlane)/(dhFarPlane-dhNearPlane);
// }
// float linearizeDepthFast(const in float depth, const in float near, const in float far) {
// return (near * far) / (depth * (near - far) + far);
// }
// uniform float far;
vec3 rayTrace(vec3 dir, vec3 position,float dither, float fresnel, bool inwater){ vec3 rayTrace(vec3 dir, vec3 position,float dither, float fresnel, bool inwater){
float quality = mix(15,SSR_STEPS,fresnel); float quality = mix(15,SSR_STEPS,fresnel);
vec3 clipPosition = DH_toClipSpace3(position); vec3 clipPosition = DH_toClipSpace3(position);
float rayLength = ((position.z + dir.z * dhFarPlane*sqrt(3.)) > -dhNearPlane) ? float rayLength = ((position.z + dir.z * dhFarPlane*sqrt(3.)) > -dhNearPlane) ?
(-dhNearPlane -position.z) / dir.z : dhFarPlane*sqrt(3.); (-dhNearPlane - position.z) / dir.z : dhFarPlane*sqrt(3.);
vec3 direction = normalize(DH_toClipSpace3(position+dir*rayLength)-clipPosition); //convert to clip space vec3 direction = normalize(DH_toClipSpace3(position+dir*rayLength)-clipPosition); //convert to clip space
direction.xy = normalize(direction.xy); direction.xy = normalize(direction.xy);
@ -167,8 +188,8 @@ vec3 rayTrace(vec3 dir, vec3 position,float dither, float fresnel, bool inwater)
for (int i = 0; i <= int(quality); i++) { for (int i = 0; i <= int(quality); i++) {
float sp = sqrt(texelFetch2D(colortex12,ivec2(spos.xy/texelSize/4),0).a/65000.0); // float sp = DH_inv_ld(sqrt(texelFetch2D(colortex12,ivec2(spos.xy/texelSize/4),0).a/65000.0));
sp = DH_inv_ld(sp); float sp = DH_inv_ld(sqrt(texelFetch2D(colortex12,ivec2(spos.xy/texelSize/4),0).a/64000.0));
if(sp <= max(maxZ,minZ) && sp >= min(maxZ,minZ)) return vec3(spos.xy/RENDER_SCALE,sp); if(sp <= max(maxZ,minZ) && sp >= min(maxZ,minZ)) return vec3(spos.xy/RENDER_SCALE,sp);
@ -221,12 +242,6 @@ float encodeVec2(vec2 a){
float encodeVec2(float x,float y){ float encodeVec2(float x,float y){
return encodeVec2(vec2(x,y)); return encodeVec2(vec2(x,y));
} }
uniform float near;
// uniform float far;
float ld(float dist) {
return (2.0 * near) / (far + near - dist * (far - near));
}
vec3 applyBump(mat3 tbnMatrix, vec3 bump, float puddle_values){ vec3 applyBump(mat3 tbnMatrix, vec3 bump, float puddle_values){
float bumpmult = puddle_values; float bumpmult = puddle_values;
bump = bump * vec3(bumpmult, bumpmult, bumpmult) + vec3(0.0f, 0.0f, 1.0f - bumpmult); bump = bump * vec3(bumpmult, bumpmult, bumpmult) + vec3(0.0f, 0.0f, 1.0f - bumpmult);
@ -340,6 +355,10 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
float skylight = max(pow(viewToWorld(normals_and_materials.xyz).y*0.5+0.5,0.1) + SkylightDir, 0.2); float skylight = max(pow(viewToWorld(normals_and_materials.xyz).y*0.5+0.5,0.1) + SkylightDir, 0.2);
AmbientLightColor *= skylight; AmbientLightColor *= skylight;
#endif #endif
#ifndef OVERWORLD_SHADER
vec3 AmbientLightColor = vec3(0.5);
#endif
Indirect_lighting = AmbientLightColor; Indirect_lighting = AmbientLightColor;
@ -354,7 +373,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
float roughness = 0.035; float roughness = 0.035;
float f0 = 0.02; float f0 = 0.02;
// float f0 = 0.9; // f0 = 0.9;
vec3 reflectedVector = reflect(normalize(viewPos), normals); vec3 reflectedVector = reflect(normalize(viewPos), normals);
float normalDotEye = dot(normals, normalize(viewPos)); float normalDotEye = dot(normals, normalize(viewPos));
@ -367,7 +386,6 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
if(isEyeInWater == 1) fresnel = pow(clamp(1.5 + normalDotEye,0.0,1.0), 25.0); if(isEyeInWater == 1) fresnel = pow(clamp(1.5 + normalDotEye,0.0,1.0), 25.0);
#endif #endif
#ifdef SCREENSPACE_REFLECTIONS #ifdef SCREENSPACE_REFLECTIONS
vec3 rtPos = rayTrace(reflectedVector, viewPos, interleaved_gradientNoise(), fresnel, false); vec3 rtPos = rayTrace(reflectedVector, viewPos, interleaved_gradientNoise(), fresnel, false);
if (rtPos.z < 1.){ if (rtPos.z < 1.){
@ -380,11 +398,12 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
} }
} }
#endif #endif
#ifdef WATER_BACKGROUND_SPECULAR #ifdef WATER_BACKGROUND_SPECULAR
BackgroundReflection = skyCloudsFromTex(mat3(gbufferModelViewInverse) * reflectedVector, colortex4).rgb / 30.0; BackgroundReflection = skyCloudsFromTex(mat3(gbufferModelViewInverse) * reflectedVector, colortex4).rgb / 30.0;
#endif #endif
#ifdef WATER_SUN_SPECULAR #ifdef WATER_SUN_SPECULAR
SunReflection = Direct_lighting * GGX(normalize(normals), -normalize(viewPos), normalize(WsunVec2), roughness, f0) * (1.0 - Reflections.a); SunReflection = Direct_lighting * GGX(normalize(normals), -normalize(viewPos), normalize(WsunVec2), roughness, f0);
#endif #endif
Reflections_Final = mix(BackgroundReflection, Reflections.rgb, Reflections.a) * fresnel; Reflections_Final = mix(BackgroundReflection, Reflections.rgb, Reflections.a) * fresnel;
Reflections_Final += SunReflection; Reflections_Final += SunReflection;
@ -409,7 +428,6 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
gl_FragData[0].a = 0.0; gl_FragData[0].a = 0.0;
material = 0.0; material = 0.0;
} }
#endif #endif
#if DEBUG_VIEW == debug_DH_WATER_BLENDING #if DEBUG_VIEW == debug_DH_WATER_BLENDING

View File

@ -1,5 +1,9 @@
#include "/lib/settings.glsl" #include "/lib/settings.glsl"
// #if defined END_SHADER || defined NETHER_SHADER
// #undef IS_LPV_ENABLED
// #endif
#ifdef IS_LPV_ENABLED #ifdef IS_LPV_ENABLED
#extension GL_EXT_shader_image_load_store: enable #extension GL_EXT_shader_image_load_store: enable
#extension GL_ARB_shading_language_packing: enable #extension GL_ARB_shading_language_packing: enable
@ -387,7 +391,7 @@ void main() {
vec3 MinimumLightColor = vec3(1.0); vec3 MinimumLightColor = vec3(1.0);
if(isEyeInWater == 1) MinimumLightColor = vec3(10.0); if(isEyeInWater == 1) MinimumLightColor = vec3(10.0);
if(lightmap.x >= 0.9) Torch_Color *= LIT_PARTICLE_BRIGHTNESS; // if(lightmap.x >= 0.9) Torch_Color *= LIT_PARTICLE_BRIGHTNESS;
#ifdef OVERWORLD_SHADER #ifdef OVERWORLD_SHADER
directLightColor = lightCol.rgb/80.0; directLightColor = lightCol.rgb/80.0;

View File

@ -82,7 +82,7 @@ void main() {
WsunVec2 = (float(sunElevation > 1e-5)*2.0 - 1.0)*normalize(mat3(gbufferModelViewInverse) * sunPosition); WsunVec2 = (float(sunElevation > 1e-5)*2.0 - 1.0)*normalize(mat3(gbufferModelViewInverse) * sunPosition);
#endif #endif
lmtexcoord.xy = (gl_MultiTexCoord0).xy; lmtexcoord.xy = (gl_MultiTexCoord0).xy;
vec2 lmcoord = gl_MultiTexCoord1.xy / 240.0; // is this even correct? lol' vec2 lmcoord = gl_MultiTexCoord1.xy / 240.0;
lmtexcoord.zw = lmcoord; lmtexcoord.zw = lmcoord;
#ifdef DAMAGE_BLOCK_EFFECT #ifdef DAMAGE_BLOCK_EFFECT

View File

@ -280,10 +280,10 @@ vec4 texture2D_POMSwitch(
//////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN//////////////////////////////
#if defined HAND || defined ENTITIES #if defined HAND || defined ENTITIES || defined BLOCKENTITIES
/* RENDERTARGETS:1,7,8,15,2 */ /* RENDERTARGETS:1,8,15,2 */
#else #else
/* RENDERTARGETS:1,7,8,15 */ /* RENDERTARGETS:1,8,15 */
#endif #endif
void main() { void main() {
@ -446,14 +446,14 @@ void main() {
#ifdef HAND #ifdef HAND
if (Albedo.a > 0.1){ if (Albedo.a > 0.1){
Albedo.a = 0.75; Albedo.a = 0.75;
gl_FragData[4].a = 0.0; gl_FragData[3].a = 0.0;
} else { } else {
Albedo.a = 1.0; Albedo.a = 1.0;
} }
#endif #endif
#ifdef ENTITIES #if defined PARTICLE_RENDERING_FIX && (defined ENTITIES || defined BLOCKENTITIES)
gl_FragData[4].a = 0.0; gl_FragData[3].a = 0.0;
#endif #endif
//////////////////////////////// //////////////////////////////// //////////////////////////////// ////////////////////////////////
@ -494,40 +494,40 @@ void main() {
SpecularTex.r = max(SpecularTex.r, Puddle_shape); SpecularTex.r = max(SpecularTex.r, Puddle_shape);
SpecularTex.g = max(SpecularTex.g, Puddle_shape*0.02); SpecularTex.g = max(SpecularTex.g, Puddle_shape*0.02);
gl_FragData[2].rg = SpecularTex.rg; gl_FragData[1].rg = SpecularTex.rg;
#if EMISSIVE_TYPE == 0 #if EMISSIVE_TYPE == 0
gl_FragData[2].a = 0.0; gl_FragData[1].a = 0.0;
#endif #endif
#if EMISSIVE_TYPE == 1 #if EMISSIVE_TYPE == 1
gl_FragData[2].a = EMISSIVE; gl_FragData[1].a = EMISSIVE;
#endif #endif
#if EMISSIVE_TYPE == 2 #if EMISSIVE_TYPE == 2
gl_FragData[2].a = SpecularTex.a; gl_FragData[1].a = SpecularTex.a;
if(SpecularTex.a <= 0.0) gl_FragData[2].a = EMISSIVE; if(SpecularTex.a <= 0.0) gl_FragData[2].a = EMISSIVE;
#endif #endif
#if EMISSIVE_TYPE == 3 #if EMISSIVE_TYPE == 3
gl_FragData[2].a = SpecularTex.a; gl_FragData[1].a = SpecularTex.a;
#endif #endif
#if SSS_TYPE == 0 #if SSS_TYPE == 0
gl_FragData[2].b = 0.0; gl_FragData[1].b = 0.0;
#endif #endif
#if SSS_TYPE == 1 #if SSS_TYPE == 1
gl_FragData[2].b = SSSAMOUNT; gl_FragData[1].b = SSSAMOUNT;
#endif #endif
#if SSS_TYPE == 2 #if SSS_TYPE == 2
gl_FragData[2].b = SpecularTex.b; gl_FragData[1].b = SpecularTex.b;
if(SpecularTex.b < 65.0/255.0) gl_FragData[2].b = SSSAMOUNT; if(SpecularTex.b < 65.0/255.0) gl_FragData[1].b = SSSAMOUNT;
#endif #endif
#if SSS_TYPE == 3 #if SSS_TYPE == 3
gl_FragData[2].b = SpecularTex.b; gl_FragData[1].b = SpecularTex.b;
#endif #endif
// #ifndef ENTITIES // #ifndef ENTITIES
@ -565,9 +565,7 @@ void main() {
gl_FragData[0] = vec4(encodeVec2(Albedo.x,data1.x), encodeVec2(Albedo.y,data1.y), encodeVec2(Albedo.z,data1.z), encodeVec2(data1.w,Albedo.w)); gl_FragData[0] = vec4(encodeVec2(Albedo.x,data1.x), encodeVec2(Albedo.y,data1.y), encodeVec2(Albedo.z,data1.z), encodeVec2(data1.w,Albedo.w));
gl_FragData[3] = vec4(FlatNormals * 0.5 + 0.5, VanillaAO); gl_FragData[2] = vec4(FlatNormals * 0.5 + 0.5, VanillaAO);
#endif #endif
gl_FragData[1].a = 0.0;
} }

View File

@ -1,5 +1,9 @@
#include "/lib/settings.glsl" #include "/lib/settings.glsl"
// #if defined END_SHADER || defined NETHER_SHADER
// #undef IS_LPV_ENABLED
// #endif
#ifdef IS_LPV_ENABLED #ifdef IS_LPV_ENABLED
#extension GL_EXT_shader_image_load_store: enable #extension GL_EXT_shader_image_load_store: enable
#extension GL_ARB_shading_language_packing: enable #extension GL_ARB_shading_language_packing: enable
@ -43,6 +47,7 @@ uniform sampler2D colortex7;
uniform sampler2D colortex12; uniform sampler2D colortex12;
uniform sampler2D colortex14; uniform sampler2D colortex14;
uniform sampler2D colortex5; uniform sampler2D colortex5;
uniform sampler2D colortex3;
uniform sampler2D colortex6; uniform sampler2D colortex6;
uniform sampler2D texture; uniform sampler2D texture;
@ -122,6 +127,9 @@ uniform vec3 nsunColor;
float blueNoise(){ float blueNoise(){
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter); return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter);
} }
vec4 blueNoise(vec2 coord){
return texelFetch2D(colortex6, ivec2(coord)%512 , 0) ;
}
float interleaved_gradientNoise_temporal(){ float interleaved_gradientNoise_temporal(){
return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y)+frameTimeCounter*51.9521); return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y)+frameTimeCounter*51.9521);
} }
@ -239,9 +247,12 @@ float ld(float dist) {
return (2.0 * near) / (far + near - dist * (far - near)); return (2.0 * near) / (far + near - dist * (far - near));
} }
vec3 rayTrace(vec3 dir, vec3 position,float dither, float fresnel, bool inwater){ vec3 rayTrace(vec3 dir, vec3 position,float dither, float fresnel, bool inwater, inout float reflectLength){
float quality = mix(15,SSR_STEPS,fresnel); float quality = mix(15,SSR_STEPS,fresnel);
// quality = SSR_STEPS;
vec3 clipPosition = toClipSpace3(position); vec3 clipPosition = toClipSpace3(position);
float rayLength = ((position.z + dir.z * far*sqrt(3.)) > -near) ? float rayLength = ((position.z + dir.z * far*sqrt(3.)) > -near) ?
(-near -position.z) / dir.z : far*sqrt(3.); (-near -position.z) / dir.z : far*sqrt(3.);
@ -274,14 +285,19 @@ vec3 rayTrace(vec3 dir, vec3 position,float dither, float fresnel, bool inwater)
if(sp <= max(maxZ,minZ) && sp >= min(maxZ,minZ)) return vec3(spos.xy/RENDER_SCALE,sp); if(sp <= max(maxZ,minZ) && sp >= min(maxZ,minZ)) return vec3(spos.xy/RENDER_SCALE,sp);
spos += stepv; spos += stepv;
//small bias //small bias
if(inwater) { if(inwater) {
minZ = maxZ-0.000035/ld(spos.z); minZ = maxZ-0.00035/ld(spos.z);
}else{ }else{
minZ = maxZ-(0.0001/dist)/ld(spos.z); minZ = maxZ-0.0001/max(ld(spos.z), (0.0 + position.z*position.z*0.001));
} }
maxZ += stepv.z; maxZ += stepv.z;
reflectLength += 1.0 / quality; // for shit
} }
return vec3(1.1); return vec3(1.1);
@ -405,6 +421,75 @@ void convertHandDepth(inout float depth) {
ndcDepth /= MC_HAND_DEPTH; ndcDepth /= MC_HAND_DEPTH;
depth = ndcDepth * 0.5 + 0.5; depth = ndcDepth * 0.5 + 0.5;
} }
void Emission(
inout vec3 Lighting,
vec3 Albedo,
float Emission,
float exposure
){
float autoBrightnessAdjust = mix(5.0, 100.0, clamp(exp(-10.0*exposure),0.0,1.0));
if( Emission < 254.5/255.0) Lighting = mix(Lighting, Albedo * Emissive_Brightness * autoBrightnessAdjust * 0.1, pow(Emission, Emissive_Curve)); // old method.... idk why
}
/*
uniform float viewWidth;
uniform float viewHeight;
void frisvad(in vec3 n, out vec3 f, out vec3 r){
if(n.z < -0.9) {
f = vec3(0.,-1,0);
r = vec3(-1, 0, 0);
} else {
float a = 1./(1.+n.z);
float b = -n.x*n.y*a;
f = vec3(1. - n.x*n.x*a, b, -n.x) ;
r = vec3(b, 1. - n.y*n.y*a , -n.y);
}
}
mat3 CoordBase(vec3 n){
vec3 x,y;
frisvad(n,x,y);
return mat3(x,y,n);
}
vec2 R2_samples(int n){
vec2 alpha = vec2(0.75487765, 0.56984026);
return fract(alpha * n);
}
float fma(float a,float b,float c){
return a * b + c;
}
//// thank you Zombye | the paper: https://ggx-research.github.io/publication/2023/06/09/publication-ggx.html
vec3 SampleVNDFGGX(
vec3 viewerDirection, // Direction pointing towards the viewer, oriented such that +Z corresponds to the surface normal
vec2 alpha, // Roughness parameter along X and Y of the distribution
float xy // Pair of uniformly distributed numbers in [0, 1)
) {
// alpha *= alpha;
// Transform viewer direction to the hemisphere configuration
viewerDirection = normalize(vec3(alpha * viewerDirection.xy, viewerDirection.z));
// Sample a reflection direction off the hemisphere
const float tau = 6.2831853; // 2 * pi
float phi = tau * xy;
float cosTheta = fma(1.0 - xy, 1.0 + viewerDirection.z, -viewerDirection.z) ;
float sinTheta = sqrt(clamp(1.0 - cosTheta * cosTheta, 0.0, 1.0));
// xonk note, i dont know what im doing but this kinda does what i want so whatever
float attemptTailClamp = clamp(sinTheta,max(cosTheta-0.25,0), cosTheta);
float attemptTailClamp2 = clamp(cosTheta,max(sinTheta-0.25,0), sinTheta);
vec3 reflected = vec3(vec2(cos(phi), sin(phi)) * attemptTailClamp2, attemptTailClamp);
// vec3 reflected = vec3(vec2(cos(phi), sin(phi)) * sinTheta, cosTheta);
// Evaluate halfway direction
// This gives the normal on the hemisphere
vec3 halfway = reflected + viewerDirection;
// Transform the halfway direction back to hemiellispoid configuation
// This gives the final sampled normal
return normalize(vec3(alpha * halfway.xy, halfway.z));
}
*/
//////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN//////////////////////////////
@ -532,6 +617,12 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
gl_FragData[2] = vec4(encodeVec2(TangentNormal), encodeVec2(GLASS_TINT_COLORS.rg), encodeVec2(GLASS_TINT_COLORS.ba), 1.0); gl_FragData[2] = vec4(encodeVec2(TangentNormal), encodeVec2(GLASS_TINT_COLORS.rg), encodeVec2(GLASS_TINT_COLORS.ba), 1.0);
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////// SPECULARS /////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
vec3 SpecularTex = texture2D(specular, lmtexcoord.xy, Texture_MipMap_Bias).rga;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
//////////////////////////////// DIFFUSE LIGHTING ////////////////////////////// //////////////////////////////// DIFFUSE LIGHTING //////////////////////////////
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -575,16 +666,6 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
Direct_lighting = DirectLightColor * NdotL * Shadows; Direct_lighting = DirectLightColor * NdotL * Shadows;
vec3 AmbientLightColor = averageSkyCol_Clouds/30.0; vec3 AmbientLightColor = averageSkyCol_Clouds/30.0;
// vec3 ambientcoefs = slopednormal / dot(abs(slopednormal), vec3(1.0));
// float SkylightDir = ambientcoefs.y*1.5;
// if(isGrass) SkylightDir = 1.25;
// float skylight = max(pow(viewToWorld(FlatNormals).y*0.5+0.5,0.1) + SkylightDir, 0.2 + (1.0-lightmap.y)*0.8) ;
vec3 ambientcoefs = worldSpaceNormal / dot(abs(worldSpaceNormal), vec3(1.0)); vec3 ambientcoefs = worldSpaceNormal / dot(abs(worldSpaceNormal), vec3(1.0));
float SkylightDir = ambientcoefs.y*1.5; float SkylightDir = ambientcoefs.y*1.5;
@ -658,7 +739,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
#endif #endif
#ifdef WATER_REFLECTIONS #ifdef WATER_REFLECTIONS
vec2 SpecularTex = texture2D(specular, lmtexcoord.xy, Texture_MipMap_Bias).rg; // vec2 SpecularTex = texture2D(specular, lmtexcoord.xy, Texture_MipMap_Bias).rg;
// if nothing is chosen, no smoothness and no reflectance // if nothing is chosen, no smoothness and no reflectance
vec2 specularValues = vec2(1.0, 0.0); vec2 specularValues = vec2(1.0, 0.0);
@ -667,7 +748,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
if(isReflective) specularValues = vec2(1.0, 0.02); if(isReflective) specularValues = vec2(1.0, 0.02);
// detect if the specular texture is used, if it is, overwrite hardcoded values // detect if the specular texture is used, if it is, overwrite hardcoded values
if(SpecularTex.r > 0.0 && SpecularTex.g <= 1.0) specularValues = SpecularTex; if(SpecularTex.r > 0.0 && SpecularTex.g <= 1.0) specularValues = SpecularTex.rg;
float roughness = pow(1.0-specularValues.r,2.0); float roughness = pow(1.0-specularValues.r,2.0);
float f0 = isReflective ? max(specularValues.g, 0.02) : specularValues.g; float f0 = isReflective ? max(specularValues.g, 0.02) : specularValues.g;
@ -677,14 +758,15 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
f0 = max(specularValues.g, 0.02); f0 = max(specularValues.g, 0.02);
#endif #endif
// specularValues = SpecularTex; // f0 = SpecularTex.g;
// roughness = pow(1.0-specularValues.r,2.0);
// f0 = 0.9; // f0 = 0.9;
// roughness = 0.0; // roughness = 0.0;
vec3 Metals = f0 > 229.5/255.0 ? normalize(Albedo+1e-7) * (dot(Albedo,vec3(0.21, 0.72, 0.07)) * 0.7 + 0.3) : vec3(1.0); vec3 Metals = f0 > 229.5/255.0 ? normalize(Albedo+1e-7) * (dot(Albedo,vec3(0.21, 0.72, 0.07)) * 0.7 + 0.3) : vec3(1.0);
// make sure zero alpha is not forced to be full alpha by fresnel on items with funny normal padding // make sure zero alpha is not forced to be full alpha by fresnel on items with funny normal padding
if(UnchangedAlpha <= 0.0 && !isReflective) f0 = 0.0; // if(UnchangedAlpha <= 0.0 && !isReflective) f0 = 0.0;
if (f0 > 0.0){ if (f0 > 0.0){
@ -702,6 +784,17 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
float fresnel = pow(clamp(1.0 + normalDotEye, 0.0, 1.0),5.0); float fresnel = pow(clamp(1.0 + normalDotEye, 0.0, 1.0),5.0);
/*
int seed = (frameCounter%40000) + frameCounter*2;
float noise = fract(R2_samples(seed).y + (1-blueNoise()));
mat3 Basis = CoordBase(viewToWorld(normal));
vec3 ViewDir = -normalize(feetPlayerPos)*Basis;
vec3 SamplePoints = SampleVNDFGGX(ViewDir, vec2(roughness), noise);
vec3 Ln = reflect(-ViewDir, SamplePoints);
vec3 L = Basis * Ln;
fresnel = pow(clamp(1.0 + dot(-Ln, SamplePoints),0.0,1.0), 5.0);
*/
#ifdef SNELLS_WINDOW #ifdef SNELLS_WINDOW
// snells window looking thing // snells window looking thing
if(isEyeInWater == 1) fresnel = pow(clamp(1.5 + normalDotEye,0.0,1.0), 25.0); if(isEyeInWater == 1) fresnel = pow(clamp(1.5 + normalDotEye,0.0,1.0), 25.0);
@ -724,15 +817,17 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
if(isEyeInWater == 0) BackgroundReflection = skyCloudsFromTexLOD2(mat3(gbufferModelViewInverse) * reflectedVector, colortex4, 0).rgb / 30.0 * Metals; if(isEyeInWater == 0) BackgroundReflection = skyCloudsFromTexLOD2(mat3(gbufferModelViewInverse) * reflectedVector, colortex4, 0).rgb / 30.0 * Metals;
#endif #endif
#endif #endif
#ifdef SCREENSPACE_REFLECTIONS #ifdef SCREENSPACE_REFLECTIONS
vec3 rtPos = rayTrace(reflectedVector, viewPos.xyz, interleaved_gradientNoise_temporal(), fresnel, isEyeInWater == 1); float reflectLength = 0.0;
if (rtPos.z < 1.){ vec3 rtPos = rayTrace(reflectedVector, viewPos.xyz, interleaved_gradientNoise_temporal(), fresnel, isEyeInWater == 1,reflectLength);
if (rtPos.z < 1.0){
vec3 previousPosition = mat3(gbufferModelViewInverse) * toScreenSpace(rtPos) + gbufferModelViewInverse[3].xyz + cameraPosition-previousCameraPosition; vec3 previousPosition = mat3(gbufferModelViewInverse) * toScreenSpace(rtPos) + gbufferModelViewInverse[3].xyz + cameraPosition-previousCameraPosition;
previousPosition = mat3(gbufferPreviousModelView) * previousPosition + gbufferPreviousModelView[3].xyz; previousPosition = mat3(gbufferPreviousModelView) * previousPosition + gbufferPreviousModelView[3].xyz;
previousPosition.xy = projMAD(gbufferPreviousProjection, previousPosition).xy / -previousPosition.z * 0.5 + 0.5; previousPosition.xy = projMAD(gbufferPreviousProjection, previousPosition).xy / -previousPosition.z * 0.5 + 0.5;
if (previousPosition.x > 0.0 && previousPosition.y > 0.0 && previousPosition.x < 1.0 && previousPosition.x < 1.0) { if (previousPosition.x > 0.0 && previousPosition.y > 0.0 && previousPosition.x < 1.0 && previousPosition.x < 1.0) {
Reflections.a = 1.0; Reflections.a = 1.0;
Reflections.rgb = texture2D(colortex5,previousPosition.xy).rgb * Metals; Reflections.rgb = texture2D(colortex5, previousPosition.xy).rgb * Metals;
} }
} }
#endif #endif
@ -759,6 +854,10 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
#else #else
gl_FragData[0].rgb = FinalColor*0.1; gl_FragData[0].rgb = FinalColor*0.1;
#endif #endif
#if EMISSIVE_TYPE == 2 || EMISSIVE_TYPE == 3
Emission(gl_FragData[0].rgb, Albedo, SpecularTex.b, exposure);
#endif
#if defined DISTANT_HORIZONS && defined DH_OVERDRAW_PREVENTION && !defined HAND #if defined DISTANT_HORIZONS && defined DH_OVERDRAW_PREVENTION && !defined HAND
bool WATER = texture2D(colortex7, gl_FragCoord.xy*texelSize).a > 0.0 && length(feetPlayerPos) > far-16*4 && texture2D(depthtex1, gl_FragCoord.xy*texelSize).x >= 1.0; bool WATER = texture2D(colortex7, gl_FragCoord.xy*texelSize).a > 0.0 && length(feetPlayerPos) > far-16*4 && texture2D(depthtex1, gl_FragCoord.xy*texelSize).x >= 1.0;
@ -774,7 +873,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
if(gl_FragCoord.x*texelSize.x < 0.47) gl_FragData[0] = vec4(0.0); if(gl_FragCoord.x*texelSize.x < 0.47) gl_FragData[0] = vec4(0.0);
#endif #endif
#if DEBUG_VIEW == debug_NORMALS #if DEBUG_VIEW == debug_NORMALS
gl_FragData[0].rgb = normal.xyz * 0.1 * vec3(0,0,1); gl_FragData[0].rgb = normalize(normal.xyz) * 0.1;
#endif #endif
#if DEBUG_VIEW == debug_INDIRECT #if DEBUG_VIEW == debug_INDIRECT
gl_FragData[0].rgb = Indirect_lighting* 0.1; gl_FragData[0].rgb = Indirect_lighting* 0.1;
@ -784,5 +883,6 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
#endif #endif
gl_FragData[3].a = encodeVec2(lightmap); gl_FragData[3].a = encodeVec2(lightmap);
} }
} }

View File

@ -58,7 +58,7 @@ vec3 viewToWorld(vec3 viewPos) {
void main() { void main() {
vec4 Albedo = texture2D(texture, texcoord); vec4 Albedo = texture2D(texture, texcoord);
Albedo.rgb = toLinear(Albedo.rgb); Albedo.rgb = toLinear(Albedo.rgb * color.rgb);
#if defined SPIDER_EYES || defined BEACON_BEAM || defined GLOWING #if defined SPIDER_EYES || defined BEACON_BEAM || defined GLOWING
@ -72,7 +72,12 @@ void main() {
float autoBrightnessAdjust = mix(minimumBrightness, 100.0, clamp(exp(-10.0*exposure),0.0,1.0)); float autoBrightnessAdjust = mix(minimumBrightness, 100.0, clamp(exp(-10.0*exposure),0.0,1.0));
vec3 emissiveColor = Albedo.rgb * color.a * autoBrightnessAdjust; #ifdef DISABLE_VANILLA_EMISSIVES
vec3 emissiveColor = vec3(0.0);
Albedo.a = 0.0;
#else
vec3 emissiveColor = Albedo.rgb * color.a * autoBrightnessAdjust;
#endif
gl_FragData[0] = vec4(emissiveColor*0.1, Albedo.a * sqrt(color.a)); gl_FragData[0] = vec4(emissiveColor*0.1, Albedo.a * sqrt(color.a));
#endif #endif
@ -80,7 +85,16 @@ void main() {
#ifdef ENCHANT_GLINT #ifdef ENCHANT_GLINT
float autoBrightnessAdjust = mix(0.1, 100.0, clamp(exp(-10.0*exposure),0.0,1.0)); float autoBrightnessAdjust = mix(0.1, 100.0, clamp(exp(-10.0*exposure),0.0,1.0));
vec3 GlintColor = Albedo.rgb * autoBrightnessAdjust * Emissive_Brightness; Albedo.rgb = clamp(Albedo.rgb ,0.0,1.0); // for safety
#ifdef DISABLE_ENCHANT_GLINT
vec3 GlintColor = vec3(0.0);
Albedo.a = 0.0;
#else
vec3 GlintColor = Albedo.rgb * autoBrightnessAdjust * Emissive_Brightness;
#endif
gl_FragData[0] = vec4(GlintColor*0.1, dot(Albedo.rgb,vec3(0.333)) * Albedo.a ); gl_FragData[0] = vec4(GlintColor*0.1, dot(Albedo.rgb,vec3(0.333)) * Albedo.a );
#endif #endif

View File

@ -126,15 +126,12 @@ float interleaved_gradientNoise(){
return noise; return noise;
} }
// float interleaved_gradientNoise(){
// return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y)+ 1.0/1.6180339887 * frameCounter);
// }
float R2_dither(){ float R2_dither(){
// #ifdef TAA #ifdef TAA
vec2 coord = gl_FragCoord.xy + (frameCounter%40000) * 2.0; vec2 coord = gl_FragCoord.xy + (frameCounter%40000) * 2.0;
// #else #else
// vec2 coord = gl_FragCoord.xy; vec2 coord = gl_FragCoord.xy;
// #endif #endif
vec2 alpha = vec2(0.75487765, 0.56984026); vec2 alpha = vec2(0.75487765, 0.56984026);
return fract(alpha.x * coord.x + alpha.y * coord.y ) ; return fract(alpha.x * coord.x + alpha.y * coord.y ) ;
} }
@ -144,11 +141,18 @@ float blueNoise(){
vec4 blueNoise(vec2 coord){ vec4 blueNoise(vec2 coord){
return texelFetch2D(colortex6, ivec2(coord )%512 , 0); return texelFetch2D(colortex6, ivec2(coord )%512 , 0);
} }
vec2 R2_samples(int n){ vec2 R2_samples(int n){
vec2 alpha = vec2(0.75487765, 0.56984026); vec2 alpha = vec2(0.75487765, 0.56984026);
return fract(alpha * n); return fract(alpha * n);
} }
vec3 viewToWorld(vec3 viewPos) { vec3 viewToWorld(vec3 viewPos) {
vec4 pos; vec4 pos;
pos.xyz = viewPos; pos.xyz = viewPos;
@ -161,18 +165,6 @@ vec3 viewToWorld(vec3 viewPos) {
const float PI = 3.141592653589793238462643383279502884197169; const float PI = 3.141592653589793238462643383279502884197169;
vec2 tapLocation_simple(
int samples, int totalSamples, float rotation, float rng
){
float alpha = float(samples + rng) * (1.0 / float(totalSamples));
float angle = alpha * (rotation * PI);
float sin_v = sin(angle);
float cos_v = cos(angle);
return vec2(cos_v, sin_v) * sqrt(alpha);
}
vec2 SpiralSample( vec2 SpiralSample(
int samples, int totalSamples, float rotation, float Xi int samples, int totalSamples, float rotation, float Xi
){ ){
@ -188,24 +180,29 @@ vec2 SpiralSample(
return vec2(x, y); return vec2(x, y);
} }
vec2 CleanSample(
int samples, float totalSamples, float noise
){
vec3 cosineHemisphereSample(vec2 Xi){ // this will be used to make 1 full rotation of the spiral. the mulitplication is so it does nearly a single rotation, instead of going past where it started
float theta = 2.0 * 3.14159265359 * Xi.y; float variance = noise * 0.897;
float r = sqrt(Xi.x); // for every sample input, it will have variance applied to it.
float x = r * cos(theta); float variedSamples = float(samples) + variance;
float y = r * sin(theta);
// for every sample, the sample position must change its distance from the origin.
// otherwise, you will just have a circle.
float spiralShape = variedSamples / (totalSamples + variance);
return vec3(x, y, sqrt(clamp(1.0 - Xi.x,0.,1.))); float shape = 2.26;
float theta = variedSamples * (PI * shape);
float x = cos(theta) * spiralShape;
float y = sin(theta) * spiralShape;
return vec2(x, y);
} }
vec3 rodSample(vec2 Xi)
{
float r = sqrt(Xi.x);
float phi = 2 * 3.14159265359 * Xi.y;
return normalize(vec3(cos(phi) * r, sin(phi) * r, sqrt(clamp(1.0 - Xi.x,0.,1.)))).xzy;
}
#include "/lib/DistantHorizons_projections.glsl" #include "/lib/DistantHorizons_projections.glsl"
@ -248,20 +245,25 @@ vec2 SSAO(
float maxR2 = viewPos.z*viewPos.z*mulfov2*2.0 * 5.0 / mix(4.0, 50.0, clamp(viewPos.z*viewPos.z - 0.1,0,1)); float maxR2 = viewPos.z*viewPos.z*mulfov2*2.0 * 5.0 / mix(4.0, 50.0, clamp(viewPos.z*viewPos.z - 0.1,0,1));
#ifdef Ambient_SSS #ifdef Ambient_SSS
float maxR2_2 = viewPos.z*viewPos.z*mulfov2*2.*2./50.0; float maxR2_2 = viewPos.z;//*viewPos.z*mulfov2*2.*2./4.0;
float dist3 = clamp(1-exp( viewPos.z*viewPos.z / -50),0,1); float dist3 = clamp(1-exp( viewPos.z*viewPos.z / -50),0,1);
if(leaves) maxR2_2 = mix(10, maxR2_2, dist3); // if(leaves) maxR2_2 = 0.1;
// if(leaves) maxR2_2 = mix(10, maxR2_2, dist3);
#endif #endif
vec2 acc = -(TAA_Offset*(texelSize/2.0))*RENDER_SCALE ; vec2 acc = -(TAA_Offset*(texelSize/2.0))*RENDER_SCALE ;
vec2 BLUENOISE = blueNoise(gl_FragCoord.xy).rg; // vec2 BLUENOISE = blueNoise(gl_FragCoord.xy).rg;
int n = 0; int n = 0;
float leaf = leaves ? -0.5 : 0.0;
for (int i = 0; i < samples; i++) { for (int i = 0; i < samples; i++) {
vec2 sampleOffset = SpiralSample(i, 7, 8, noise) * mulfov2 * clamp(0.05 + i*0.095, 0.0,0.3) ; // vec2 sampleOffset = (SpiralSample(i, 7, 8 , noise)) * mulfov2 * clamp(0.05 + i*0.095, 0.0,0.3) ;
vec2 sampleOffset = CleanSample(i, samples - 1, noise) * mulfov2 * 0.3 ;
ivec2 offset = ivec2(gl_FragCoord.xy + sampleOffset*vec2(viewWidth,viewHeight*aspectRatio)*RENDER_SCALE); ivec2 offset = ivec2(gl_FragCoord.xy + sampleOffset*vec2(viewWidth,viewHeight*aspectRatio)*RENDER_SCALE);
@ -278,16 +280,14 @@ vec2 SSAO(
float dsquared = dot(vec, vec); float dsquared = dot(vec, vec);
if (dsquared > 1e-5){ if (dsquared > 1e-5){
if (dsquared < maxR2){
if( dsquared < maxR2){
float NdotV = clamp(dot(vec*inversesqrt(dsquared), normalize(normal)),0.,1.); float NdotV = clamp(dot(vec*inversesqrt(dsquared), normalize(normal)),0.,1.);
occlusion += NdotV * clamp(1.0-dsquared/maxR2,0.0,1.0); occlusion += NdotV * clamp(1.0-dsquared/maxR2,0.0,1.0);
} }
#ifdef Ambient_SSS #ifdef Ambient_SSS
if(dsquared > maxR2_2){ sss += clamp(leaf - dot(vec, normalize(normal)),0.0,1.0);
float NdotV = 1.0 - clamp(dot(vec*dsquared, normalize(normal)),0.,1.);
sss += max((NdotV - (1.0-NdotV)) * clamp(1.0-maxR2_2/dsquared,0.0,1.0) ,0.0);
}
#endif #endif
n += 1; n += 1;
@ -372,12 +372,13 @@ void main() {
vec2 texcoord = gl_FragCoord.xy*texelSize; vec2 texcoord = gl_FragCoord.xy*texelSize;
float z = texture2D(depthtex1,texcoord).x; float z = texture2D(depthtex1,texcoord).x;
#ifdef DISTANT_HORIZONS #ifdef DISTANT_HORIZONS
float DH_depth1 = texture2D(dhDepthTex1,texcoord).x; float DH_depth1 = texture2D(dhDepthTex1,texcoord).x;
float swappedDepth = z >= 1.0 ? DH_depth1 : z; float swappedDepth = z >= 1.0 ? DH_depth1 : z;
#else #else
float DH_depth1 = 1.0; float DH_depth1 = 1.0;
float swappedDepth = z; float swappedDepth = z;
#endif #endif
@ -390,7 +391,7 @@ void main() {
vec2 lightmap = dataUnpacked1.yz; vec2 lightmap = dataUnpacked1.yz;
gl_FragData[1] = vec4(0.0,0.0,0.0, texture2D(colortex14,texcoord).a ); gl_FragData[1] = vec4(0.0,0.0,0.0, texture2D(colortex14,floor(gl_FragCoord.xy)/VL_RENDER_RESOLUTION*texelSize+0.5*texelSize).a);
// bool lightningBolt = abs(dataUnpacked1.w-0.5) <0.01; // bool lightningBolt = abs(dataUnpacked1.w-0.5) <0.01;
@ -502,10 +503,11 @@ void main() {
float diffthreshM = diffthresh*mult*d0*k/20.; float diffthreshM = diffthresh*mult*d0*k/20.;
float avgDepth = 0.0; float avgDepth = 0.0;
vec2 BLUENOISE = blueNoise(gl_FragCoord.xy).rg;
for(int i = 0; i < VPS_Search_Samples; i++){ for(int i = 0; i < VPS_Search_Samples; i++){
vec2 offsetS = SpiralSample(i, 7, 8, noise) * 0.5; vec2 offsetS = SpiralSample(i, 7, 8, noise) * 0.5;
// vec2 offsetS = CleanSample(i, VPS_Search_Samples - 1, noise) * 0.5;
float weight = 3.0 + (i+noise) *rdMul/SHADOW_FILTER_SAMPLE_COUNT*shadowMapResolution*distortFactor/2.7; float weight = 3.0 + (i+noise) *rdMul/SHADOW_FILTER_SAMPLE_COUNT*shadowMapResolution*distortFactor/2.7;
float d = texelFetch2D(shadow, ivec2((projectedShadowPosition.xy+offsetS*rdMul)*shadowMapResolution),0).x; float d = texelFetch2D(shadow, ivec2((projectedShadowPosition.xy+offsetS*rdMul)*shadowMapResolution),0).x;

View File

@ -1,5 +1,9 @@
#include "/lib/settings.glsl" #include "/lib/settings.glsl"
// #if defined END_SHADER || defined NETHER_SHADER
// #undef IS_LPV_ENABLED
// #endifs
#ifdef IS_LPV_ENABLED #ifdef IS_LPV_ENABLED
#extension GL_ARB_shader_image_load_store: enable #extension GL_ARB_shader_image_load_store: enable
#extension GL_ARB_shading_language_packing: enable #extension GL_ARB_shading_language_packing: enable
@ -321,6 +325,28 @@ vec2 tapLocation_simple(
return vec2(cos_v, sin_v) * sqrt(alpha); return vec2(cos_v, sin_v) * sqrt(alpha);
} }
vec2 CleanSample(
int samples, float totalSamples, float noise
){
// this will be used to make 1 full rotation of the spiral. the mulitplication is so it does nearly a single rotation, instead of going past where it started
float variance = noise * 0.897;
// for every sample input, it will have variance applied to it.
float variedSamples = float(samples) + variance;
// for every sample, the sample position must change its distance from the origin.
// otherwise, you will just have a circle.
float spiralShape = pow(variedSamples / (totalSamples + variance),0.5);
float shape = 2.26; // this is very important. 2.26 is very specific
float theta = variedSamples * (PI * shape);
float x = cos(theta) * spiralShape;
float y = sin(theta) * spiralShape;
return vec2(x, y);
}
vec3 viewToWorld(vec3 viewPos) { vec3 viewToWorld(vec3 viewPos) {
vec4 pos; vec4 pos;
pos.xyz = viewPos; pos.xyz = viewPos;
@ -671,7 +697,8 @@ float ComputeShadowMap(in vec3 projectedShadowPosition, float distortFactor, flo
float rdMul = shadowBlockerDepth*distortFactor*d0*k/shadowMapResolution; float rdMul = shadowBlockerDepth*distortFactor*d0*k/shadowMapResolution;
for(int i = 0; i < samples; i++){ for(int i = 0; i < samples; i++){
vec2 offsetS = tapLocation_simple(i, 7, 9, noise) * 0.5; // vec2 offsetS = tapLocation_simple(i, 7, 9, noise) * 0.5;
vec2 offsetS = CleanSample(i, samples - 1, noise) * 0.3;
projectedShadowPosition.xy += rdMul*offsetS; projectedShadowPosition.xy += rdMul*offsetS;
#else #else
int samples = 1; int samples = 1;
@ -731,22 +758,21 @@ vec3 SubsurfaceScattering_sun(vec3 albedo, float Scattering, float Density, floa
Scattering *= sss_density_multiplier; Scattering *= sss_density_multiplier;
float density = 0.0001 + Density*1.5; float density = 0.0001 + Density*2.0;
density = 1.0;
float scatterDepth = max(1.0 - Scattering/density,0.0); float scatterDepth = max(1.0 - Scattering/density,0.0);
scatterDepth = exp((1.0-scatterDepth) * -7.0); scatterDepth = exp((1.0-scatterDepth) * -7.0);
// this is for SSS when there is no shadow blocker depth // this is for SSS when there is no shadow blocker depth
#if defined BASIC_SHADOW_FILTER && defined Variable_Penumbra_Shadows #if defined BASIC_SHADOW_FILTER && defined Variable_Penumbra_Shadows
scatterDepth = max(scatterDepth, shadows * min(2.0-sss_density_multiplier,1.0)); scatterDepth = max(scatterDepth, pow(shadows, 0.5 + (1.0-Density) * 2.0) );
#else #else
scatterDepth = exp(-7.0 * pow(1.0-shadows,3.0))*min(2.0-sss_density_multiplier,1.0); scatterDepth = exp(-7.0 * pow(1.0-shadows,3.0))*min(2.0-sss_density_multiplier,1.0);
#endif #endif
// PBR at its finest :clueless: // PBR at its finest :clueless:
vec3 absorbColor = exp(max(luma(albedo) - albedo, 0.0) * -(20.0 - 19*scatterDepth) * sss_absorbance_multiplier); vec3 absorbColor = exp(max(luma(albedo) - albedo*vec3(1.0,1.1,1.2), 0.0) * -(20.0 - 19*scatterDepth) * sss_absorbance_multiplier);
vec3 scatter = scatterDepth * absorbColor * pow(Density, LabSSS_Curve); vec3 scatter = scatterDepth * absorbColor * pow(Density, LabSSS_Curve);
@ -757,13 +783,14 @@ vec3 SubsurfaceScattering_sun(vec3 albedo, float Scattering, float Density, floa
vec3 SubsurfaceScattering_sky(vec3 albedo, float Scattering, float Density){ vec3 SubsurfaceScattering_sky(vec3 albedo, float Scattering, float Density){
float labcurve = clamp(1.0 - exp(Density * -10.0),0.0,1.0); Scattering *= sss_density_multiplier;
float density = sqrt(Density) * 4.0 + 1.0;
float scatterDepth = exp(pow(Scattering, 5) * -5.0); float scatterDepth = 1.0 - pow(Scattering, 0.5 + Density * 2.5);
vec3 absorbColor = exp(max(luma(albedo)-albedo, 0.0) * -(20.0 - 19.0*scatterDepth) * sss_absorbance_multiplier); // PBR at its finest :clueless:
vec3 absorbColor = exp(max(luma(albedo) - albedo*vec3(1.0,1.1,1.2), 0.0) * -(15.0 - 10.0*scatterDepth) * sss_absorbance_multiplier);
vec3 scatter = scatterDepth * absorbColor * labcurve;
vec3 scatter = scatterDepth * absorbColor * pow(Density, LabSSS_Curve);
return scatter; return scatter;
} }
@ -1222,7 +1249,7 @@ void main() {
SkySSS = SSAO_SSS.y; SkySSS = SSAO_SSS.y;
float vanillaAO_curve = pow(1.0 - vanilla_AO*vanilla_AO,5.0); float vanillaAO_curve = pow(1.0 - vanilla_AO*vanilla_AO,5.0);
float SSAO_curve = pow(SSAO_SSS.x,6); float SSAO_curve = pow(SSAO_SSS.x,6.0);
// use the min of vanilla ao so they dont overdarken eachother // use the min of vanilla ao so they dont overdarken eachother
AO = vec3( min(vanillaAO_curve, SSAO_curve) ); AO = vec3( min(vanillaAO_curve, SSAO_curve) );
@ -1257,7 +1284,7 @@ void main() {
///////////////////////////// SKY SSS ///////////////////////////// ///////////////////////////// SKY SSS /////////////////////////////
#if defined Ambient_SSS && defined OVERWORLD_SHADER && indirect_effect == 1 #if defined Ambient_SSS && defined OVERWORLD_SHADER && indirect_effect == 1
if (!hand){ if (!hand){
vec3 ambientColor = (AmbientLightColor*2.5) * ambient_brightness * 0.7; // x2.5 to match the brightness of upfacing skylight vec3 ambientColor = (AmbientLightColor*2.5) * ambient_brightness; // x2.5 to match the brightness of upfacing skylight
Indirect_SSS = SubsurfaceScattering_sky(albedo, SkySSS, LabSSS); Indirect_SSS = SubsurfaceScattering_sky(albedo, SkySSS, LabSSS);
Indirect_SSS *= lightmap.y*lightmap.y*lightmap.y; Indirect_SSS *= lightmap.y*lightmap.y*lightmap.y;
@ -1265,7 +1292,7 @@ void main() {
// apply to ambient light. // apply to ambient light.
// if(texcoord.x>0.5) // if(texcoord.x>0.5)
Indirect_lighting = max(Indirect_lighting, ambientColor * Indirect_SSS * ambientsss_brightness); Indirect_lighting = max(Indirect_lighting, Indirect_SSS * ambientColor * ambientsss_brightness);
// #ifdef OVERWORLD_SHADER // #ifdef OVERWORLD_SHADER
// if(LabSSS > 0.0) Indirect_lighting += (1.0-SkySSS) * LightningPhase * lightningEffect * pow(lightmap.y,10); // if(LabSSS > 0.0) Indirect_lighting += (1.0-SkySSS) * LightningPhase * lightningEffect * pow(lightmap.y,10);
@ -1298,7 +1325,7 @@ void main() {
#endif #endif
Direct_SSS = SubsurfaceScattering_sun(albedo, ShadowBlockerDepth, sunSSS_density, clamp(dot(feetPlayerPos_normalized, WsunVec),0.0,1.0), SSS_shadow); Direct_SSS = SubsurfaceScattering_sun(albedo, ShadowBlockerDepth, sunSSS_density, clamp(dot(feetPlayerPos_normalized, WsunVec),0.0,1.0), SSS_shadow);
// Direct_SSS *= mix(LM_shadowMapFallback, 1.0, shadowMapFalloff2); Direct_SSS *= mix(LM_shadowMapFallback, 1.0, shadowMapFalloff2);
if (isEyeInWater == 0) Direct_SSS *= lightLeakFix; if (isEyeInWater == 0) Direct_SSS *= lightLeakFix;
#ifndef SCREENSPACE_CONTACT_SHADOWS #ifndef SCREENSPACE_CONTACT_SHADOWS
@ -1362,7 +1389,7 @@ void main() {
// #endif // #endif
#if DEBUG_VIEW == debug_NORMALS #if DEBUG_VIEW == debug_NORMALS
if(swappedDepth >= 1.0) Direct_lighting = vec3(1.0); if(swappedDepth >= 1.0) Direct_lighting = vec3(1.0);
gl_FragData[0].rgb = worldToView(normal); gl_FragData[0].rgb = normalize(worldToView(normal));
#endif #endif
#if DEBUG_VIEW == debug_SPECULAR #if DEBUG_VIEW == debug_SPECULAR
if(swappedDepth >= 1.0) Direct_lighting = vec3(1.0); if(swappedDepth >= 1.0) Direct_lighting = vec3(1.0);
@ -1374,41 +1401,22 @@ void main() {
#endif #endif
#if DEBUG_VIEW == debug_DIRECT #if DEBUG_VIEW == debug_DIRECT
if(swappedDepth >= 1.0) Direct_lighting = vec3(15.0); if(swappedDepth >= 1.0) Direct_lighting = vec3(15.0);
gl_FragData[0].rgb = Direct_lighting; gl_FragData[0].rgb = Direct_lighting + 0.5;
#endif #endif
#if DEBUG_VIEW == debug_VIEW_POSITION #if DEBUG_VIEW == debug_VIEW_POSITION
gl_FragData[0].rgb = viewPos * 0.001; gl_FragData[0].rgb = viewPos * 0.001;
#endif #endif
#if DEBUG_VIEW == debug_FILTERED_STUFF #if DEBUG_VIEW == debug_FILTERED_STUFF
vec3 FilteredDebug = vec3(15.0) * exp(-7.0 * vec3(1.0,0.5,1.0) * filteredShadow.y); if(hideGUI == 1) gl_FragData[0].rgb = vec3(1) * (1.0 - SSAO_SSS.y);
FilteredDebug += vec3(15.0) * exp(-7.0 * vec3(1.0,1.0,0.5) * pow(SSAO_SSS.x,2)); if(hideGUI == 0) gl_FragData[0].rgb = vec3(1) * (1.0 - SSAO_SSS.x);
FilteredDebug += vec3(15.0) * exp(-7.0 * vec3(0.5,1.0,1.0) * pow(SSAO_SSS.y,2)); // if(hideGUI == 0) gl_FragData[0].rgb = vec3(1) * filteredShadow.z;//exp(-7*(1-clamp(1.0 - filteredShadow.x,0.0,1.0)));
gl_FragData[0].rgb = FilteredDebug;
#endif
#if DEBUG_VIEW == debug_TEMPORAL_REPROJECTION
vec3 color = vec3(1.0);
// vec4 reprojectedBuffer0 = texture2D(colortex12, texcoord);
vec4 reprojectedBuffer = texture2D(colortex14, texcoord);
vec3 Indirect = vec3(1.0) * pow(reprojectedBuffer.x,6.0) + vec3(0,25,0) * ( 1.0 - reprojectedBuffer.y );
// vec3 Direct = vec3(15.0) * exp(-3*reprojectedBuffer1.y);
color += Indirect;
// color += Direct;
// color *= albedo;
// color *= dot(vec3(reprojectedBuffer.a)*2-1, worldToView(normal));
color *= reprojectedBuffer.a;
if(swappedDepth >= 1.0) color = vec3(1.0);
gl_FragData[0].rgb = color;
#endif #endif
// float shadew = clamp(1.0 - filteredShadow.y/1,0.0,1.0); // float shadew = clamp(1.0 - filteredShadow.y/1,0.0,1.0);
// gl_FragData[0].rgb = vec3(1) * exp( (1-shadew) * -7); // // if(hideGUI == 1)
#ifdef CLOUDS_INFRONT_OF_WORLD #ifdef CLOUDS_INFRONT_OF_WORLD
gl_FragData[1] = texture2D(colortex2, texcoord); gl_FragData[1] = texture2D(colortex2, texcoord);

View File

@ -452,6 +452,7 @@ void main() {
gl_FragData[0].r = bloomyFogMult; // pass fog alpha so bloom can do bloomy fog gl_FragData[0].r = bloomyFogMult; // pass fog alpha so bloom can do bloomy fog
gl_FragData[1].rgb = clamp(color.rgb, 0.0,68000.0); gl_FragData[1].rgb = clamp(color.rgb, 0.0,68000.0);
// gl_FragData[1].rgb = vec3(tangentNormals.xy,0.0) ;
// gl_FragData[1].rgb = vec3(1.0) * ld( (data.a > 0.0 ? data.a : texture2D(depthtex0, texcoord).x ) ) ; // gl_FragData[1].rgb = vec3(1.0) * ld( (data.a > 0.0 ? data.a : texture2D(depthtex0, texcoord).x ) ) ;
// gl_FragData[1].rgb = gl_FragData[1].rgb * (1.0-TranslucentShader.a) + TranslucentShader.rgb*10.0; // gl_FragData[1].rgb = gl_FragData[1].rgb * (1.0-TranslucentShader.a) + TranslucentShader.rgb*10.0;
// gl_FragData[1].rgb = 1-(texcoord.x > 0.5 ? vec3(TranslucentShader.a) : vec3(data.a)); // gl_FragData[1].rgb = 1-(texcoord.x > 0.5 ? vec3(TranslucentShader.a) : vec3(data.a));

View File

@ -42,12 +42,11 @@ void main() {
float newTex = texelFetch2D(depthtex1, ivec2(gl_FragCoord.xy*4), 0).x; float newTex = texelFetch2D(depthtex1, ivec2(gl_FragCoord.xy*4), 0).x;
#ifdef DISTANT_HORIZONS #ifdef DISTANT_HORIZONS
float QuarterResDepth = texelFetch2D(dhDepthTex, ivec2(gl_FragCoord.xy*4), 0).x; float QuarterResDepth = texelFetch2D(dhDepthTex, ivec2(gl_FragCoord.xy*4), 0).x;
if(newTex >= 1.0) newTex = sqrt(QuarterResDepth);// + 0.0001; if(newTex >= 1.0) newTex = sqrt(QuarterResDepth);
gl_FragData[1].a = DH_ld(QuarterResDepth)*DH_ld(QuarterResDepth)*65000.0; gl_FragData[1].a = (DH_ld(QuarterResDepth)*DH_ld(QuarterResDepth))*65000.0;
#endif #endif
if (newTex < 1.0) if (newTex < 1.0)
@ -55,27 +54,4 @@ void main() {
else else
gl_FragData[0] = vec4(oldTex, 2.0); gl_FragData[0] = vec4(oldTex, 2.0);
// float depth = texelFetch2D(depthtex1, ivec2(gl_FragCoord.xy*4), 0).x;
// #ifdef DISTANT_HORIZONS
// float _near = near;
// float _far = far*4.0;
// if (depth >= 1.0) {
// depth = texelFetch2D(dhDepthTex1, ivec2(gl_FragCoord.xy*4), 0).x;
// _near = dhNearPlane;
// _far = dhFarPlane;
// }
// depth = linearizeDepthFast(depth, _near, _far);
// depth = depth / dhFarPlane;
// #endif
// if(depth < 1.0)
// gl_FragData[1] = vec4(vec3(0.0), depth * depth * 65000.0);
// else
// gl_FragData[1] = vec4(vec3(0.0), 65000.0);
} }

View File

@ -103,9 +103,7 @@ vec3 normVec (vec3 vec){
void main() { void main() {
/* DRAWBUFFERS:0 */ /* DRAWBUFFERS:0 */
#if defined OVERWORLD_SHADER && defined VOLUMETRIC_CLOUDS
#ifdef OVERWORLD_SHADER
#ifdef VOLUMETRIC_CLOUDS
vec2 halfResTC = vec2(floor(gl_FragCoord.xy)/CLOUDS_QUALITY/RENDER_SCALE+0.5+offsets[framemod8]*CLOUDS_QUALITY*RENDER_SCALE*0.5); vec2 halfResTC = vec2(floor(gl_FragCoord.xy)/CLOUDS_QUALITY/RENDER_SCALE+0.5+offsets[framemod8]*CLOUDS_QUALITY*RENDER_SCALE*0.5);
vec3 viewPos = toScreenSpace(vec3(halfResTC*texelSize,1.0)); vec3 viewPos = toScreenSpace(vec3(halfResTC*texelSize,1.0));
@ -117,7 +115,4 @@ void main() {
#else #else
gl_FragData[0] = vec4(0.0,0.0,0.0,1.0); gl_FragData[0] = vec4(0.0,0.0,0.0,1.0);
#endif #endif
#else
gl_FragData[0] = vec4(0.0,0.0,0.0,1.0);
#endif
} }

View File

@ -1,4 +1,10 @@
#include "/lib/settings.glsl" #include "/lib/settings.glsl"
// #if defined END_SHADER || defined NETHER_SHADER
#undef IS_LPV_ENABLED
// #endif
#ifndef OVERWORLD_SHADER
uniform float nightVision;
#endif
flat varying vec4 lightCol; flat varying vec4 lightCol;
flat varying vec3 averageSkyCol; flat varying vec3 averageSkyCol;
@ -76,6 +82,7 @@ float linearizeDepthFast(const in float depth, const in float near, const in flo
uniform sampler2DShadow shadowtex0; uniform sampler2DShadow shadowtex0;
uniform sampler2DShadow shadowtex1; uniform sampler2DShadow shadowtex1;
#endif #endif
flat varying vec3 refractedSunVec; flat varying vec3 refractedSunVec;
@ -94,6 +101,8 @@ float linearizeDepthFast(const in float depth, const in float near, const in flo
#include "/lib/end_fog.glsl" #include "/lib/end_fog.glsl"
#endif #endif
#include "/lib/diffuse_lighting.glsl"
#define fsign(a) (clamp((a)*1e35,0.,1.)*2.-1.) #define fsign(a) (clamp((a)*1e35,0.,1.)*2.-1.)
float interleaved_gradientNoise(){ float interleaved_gradientNoise(){
@ -247,7 +256,7 @@ vec4 waterVolumetrics_test( vec3 rayStart, vec3 rayEnd, float estEndDepth, float
vec3 ambientMul = exp(-estEndDepth * d * waterCoefs ); vec3 ambientMul = exp(-estEndDepth * d * waterCoefs );
vec3 Directlight = ((lightSource * sh) * phase * sunMul) ; vec3 Directlight = ((lightSource * sh) * phase * sunMul) ;
vec3 Indirectlight = max(ambient * ambientMul, vec3(0.01,0.2,0.4) * ambientMul * 0.03) ; vec3 Indirectlight = max(ambient * ambientMul, vec3(0.01,0.2,0.4) * ambientMul * MIN_LIGHT_AMOUNT * 0.03) ;
vec3 light = (Indirectlight + Directlight) * scatterCoef; vec3 light = (Indirectlight + Directlight) * scatterCoef;
@ -292,7 +301,7 @@ void main() {
float z = texture2D(depthtex1,tc).x; float z = texture2D(depthtex1,tc).x;
#ifdef DISTANT_HORIZONS #ifdef DISTANT_HORIZONS
float DH_z = texture2D(dhDepthTex1,tc).x; float DH_z = texture2D(dhDepthTex1,tc).x;
#else #else
float DH_z = 0.0; float DH_z = 0.0;
#endif #endif
@ -323,22 +332,28 @@ void main() {
#ifdef OVERWORLD_SHADER #ifdef OVERWORLD_SHADER
vec2 lightmap = decodeVec2(texture2D(colortex14, tc).a); vec2 lightmap = decodeVec2(texture2D(colortex14, tc).a);
if(z >= 1.0) lightmap.y = 0.99;
#ifdef DISTANT_HORIZONS
if(z >= 1.0) lightmap.y = 0.99;
#endif
#else #else
vec2 lightmap = decodeVec2(texture2D(colortex14, tc).a); vec2 lightmap = decodeVec2(texture2D(colortex14, tc).a);
lightmap.y = 1.0; lightmap.y = 1.0;
#endif #endif
indirectLightColor_dynamic = indirectLightColor_dynamic * ambient_brightness * pow(1.0-pow(1.0-lightmap.y,0.5),3.0) ;
float TorchBrightness_autoAdjust = mix(1.0, 30.0, clamp(exp(-10.0*exposure),0.0,1.0)) ;
// indirectLightColor_dynamic += vec3(TORCH_R,TORCH_G,TORCH_B) * TorchBrightness_autoAdjust * pow(1.0-sqrt(1.0-clamp(lightmap.x,0.0,1.0)),2.0) * 2.0;
float Vdiff = distance(viewPos1, viewPos0) * 2.0; float Vdiff = distance(viewPos1, viewPos0) * 2.0;
float VdotU = playerPos.y; float VdotU = playerPos.y;
float estimatedDepth = Vdiff * abs(VdotU) ; //assuming water plane float estimatedDepth = Vdiff * abs(VdotU) ; //assuming water plane
float estimatedSunDepth = estimatedDepth / abs(WsunVec.y); //assuming water plane float estimatedSunDepth = estimatedDepth / abs(WsunVec.y); //assuming water plane
indirectLightColor_dynamic *= ambient_brightness * pow(1.0-pow(1.0-lightmap.y,0.5),3.0) ;
float TorchBrightness_autoAdjust = mix(1.0, 30.0, clamp(exp(-10.0*exposure),0.0,1.0)) ;
indirectLightColor_dynamic += vec3(TORCH_R,TORCH_G,TORCH_B) * TorchBrightness_autoAdjust * pow(1.0-sqrt(1.0-clamp(lightmap.x,0.0,1.0)),2.0) * 2.0;
vec4 VolumetricFog2 = vec4(0,0,0,1); vec4 VolumetricFog2 = vec4(0,0,0,1);
#ifdef OVERWORLD_SHADER #ifdef OVERWORLD_SHADER
if(!iswater) VolumetricFog2 = GetVolumetricFog(viewPos1, vec2(noise_1, noise_2), directLightColor, indirectLightColor); if(!iswater) VolumetricFog2 = GetVolumetricFog(viewPos1, vec2(noise_1, noise_2), directLightColor, indirectLightColor);

View File

@ -26,10 +26,13 @@ screen.Waving_Stuff = 摇晃相关
screen.Direct_Light = 直接照明 screen.Direct_Light = 直接照明
screen.Shadows = 阴影 screen.Shadows = 阴影
option.SCREENSPACE_CONTACT_SHADOWS = 屏幕空间接触阴影 option.TRANSLUCENT_COLORED_SHADOWS = 半透明彩色阴影
option.SCREENSPACE_CONTACT_SHADOWS = 屏幕空间阴影
option.RENDER_ENTITY_SHADOWS = 实体阴影 option.RENDER_ENTITY_SHADOWS = 实体阴影
option.shadowMapResolution = 阴影分辨率 option.shadowMapResolution = 阴影分辨率
option.shadowDistance = 阴影距离 option.shadowDistance = 阴影距离
value.shadowDistance.32.0 = 2 区块
value.shadowDistance.48.0 = 3 区块
value.shadowDistance.64.0 = 4 区块 value.shadowDistance.64.0 = 4 区块
value.shadowDistance.80.0 = 5 区块 value.shadowDistance.80.0 = 5 区块
value.shadowDistance.96.0 = 6 区块 value.shadowDistance.96.0 = 6 区块
@ -51,18 +54,34 @@ screen.Direct_Light = 直接照明
value.shadowDistance.352.0 = 22 区块 value.shadowDistance.352.0 = 22 区块
value.shadowDistance.368.0 = 23 区块 value.shadowDistance.368.0 = 23 区块
value.shadowDistance.384.0 = 24 区块 value.shadowDistance.384.0 = 24 区块
value.shadowDistance.400.0 = 25 区块
value.shadowDistance.416.0 = 26 区块
value.shadowDistance.432.0 = 27 区块
value.shadowDistance.448.0 = 28 区块
value.shadowDistance.464.0 = 29 区块
value.shadowDistance.480.0 = 30 区块
value.shadowDistance.496.0 = 31 区块
value.shadowDistance.512.0 = 32 区块 value.shadowDistance.512.0 = 32 区块
value.shadowDistance.768.0 = 48 区块
value.shadowDistance.1024.0 = 64 区块
value.shadowDistance.1536.0 = 96 区块
value.shadowDistance.2048.0 = 128 区块
value.shadowDistance.4096.0 = 256 区块
value.shadowDistance.8192.0 = 512 区块
option.OPTIMIZED_SHADOW_DISTANCE = 最大阴影边界 option.OPTIMIZED_SHADOW_DISTANCE = 最大阴影边界
value.OPTIMIZED_SHADOW_DISTANCE.-1.0 = 无优化 value.OPTIMIZED_SHADOW_DISTANCE.-1.0 = 无优化
value.OPTIMIZED_SHADOW_DISTANCE.1.0 = 优化 value.OPTIMIZED_SHADOW_DISTANCE.1.0 = 优化
option.entityShadowDistanceMul = 实体阴影距离 option.entityShadowDistanceMul = 实体阴影距离
value.entityShadowDistanceMul.0.01 = 阴影距离的 1%
value.entityShadowDistanceMul.0.02 = 阴影距离的 2%
value.entityShadowDistanceMul.0.03 = 阴影距离的 3%
value.entityShadowDistanceMul.0.04 = 阴影距离的 4%
value.entityShadowDistanceMul.0.05 = 阴影距离的 5%
value.entityShadowDistanceMul.0.10 = 阴影距离的 10%
value.entityShadowDistanceMul.0.15 = 阴影距离的 15%
value.entityShadowDistanceMul.0.20 = 阴影距离的 20%
value.entityShadowDistanceMul.0.25 = 阴影距离的 25%
value.entityShadowDistanceMul.0.30 = 阴影距离的 30%
value.entityShadowDistanceMul.0.35 = 阴影距离的 35%
value.entityShadowDistanceMul.0.40 = 阴影距离的 40%
value.entityShadowDistanceMul.0.45 = 阴影距离的 45%
value.entityShadowDistanceMul.0.50 = 阴影距离的 50%
value.entityShadowDistanceMul.0.75 = 阴影距离的 75%
value.entityShadowDistanceMul.1.00 = 阴影距离的 100%
screen.Filtering = 阴影过滤设置 screen.Filtering = 阴影过滤设置
option.SHADOW_FILTER_SAMPLE_COUNT = 阴影过滤采样数 option.SHADOW_FILTER_SAMPLE_COUNT = 阴影过滤采样数
@ -72,6 +91,16 @@ screen.Direct_Light = 直接照明
option.Max_Shadow_Filter_Radius = 最大阴影过滤半径 option.Max_Shadow_Filter_Radius = 最大阴影过滤半径
option.Max_Filter_Depth = 最大过滤深度 option.Max_Filter_Depth = 最大过滤深度
screen.LPV = FloodFill
option.LPV_ENABLED = FloodFill
option.LPV_SIZE = LPV 规模
value.LPV_SIZE.6 = 小 [64]
value.LPV_SIZE.7 = 中 [128]
value.LPV_SIZE.8 = 大 [256]
option.LPV_NORMAL_OFFSET = 法线偏移 (Normal-Offset)
option.LPV_ENTITY_LIGHTS = 实体光源
option.LPV_REDSTONE_LIGHTS = 红石光源
option.LPV_COLORED_CANDLES = 彩色蜡烛
screen.Subsurface_Scattering = 次表面散射 (SSS) screen.Subsurface_Scattering = 次表面散射 (SSS)
option.LabSSS_Curve = LabSSS 曲线 option.LabSSS_Curve = LabSSS 曲线
@ -129,12 +158,12 @@ screen.Fog = 雾气设置
screen.TOD_fog = 全天雾气 screen.TOD_fog = 全天雾气
option.TOD_Fog_mult = 雾气密度倍率 option.TOD_Fog_mult = 雾气密度倍率
option.Morning_Uniform_Fog = 清晨 - 雾气密度 option.Morning_Uniform_Fog = 清晨 - 雾气密度
option.Morning_Cloudy_Fog = 清晨 - 云雾密度
option.Noon_Uniform_Fog = 正午 - 雾气密度 option.Noon_Uniform_Fog = 正午 - 雾气密度
option.Noon_Cloudy_Fog = 正午 - 云雾密度
option.Evening_Uniform_Fog = 傍晚 - 雾气密度 option.Evening_Uniform_Fog = 傍晚 - 雾气密度
option.Evening_Cloudy_Fog = 傍晚 - 云雾密度
option.Night_Uniform_Fog = 夜晚 - 雾气密度 option.Night_Uniform_Fog = 夜晚 - 雾气密度
option.Morning_Cloudy_Fog = 清晨 - 云雾密度
option.Noon_Cloudy_Fog = 正午 - 云雾密度
option.Evening_Cloudy_Fog = 傍晚 - 云雾密度
option.Night_Cloudy_Fog =夜 晚 - 云雾密度 option.Night_Cloudy_Fog =夜 晚 - 云雾密度
option.PER_BIOME_ENVIRONMENT = 群系特色环境 option.PER_BIOME_ENVIRONMENT = 群系特色环境
@ -378,6 +407,23 @@ screen.Post_Processing = 后期处理
option.BLEND_FACTOR = 混合比重 option.BLEND_FACTOR = 混合比重
option.TAA_UPSCALING = TAA 升采样 option.TAA_UPSCALING = TAA 升采样
option.SCALE_FACTOR = 放大倍率 option.SCALE_FACTOR = 放大倍率
screen.COLOR_GRADING = 颜色分级
option.TONE_CURVE = 色调曲线
option.LOWER_CURVE = 下部曲线
option.UPPER_CURVE = 上部曲线
option.COLOR_GRADING_ENABLED = 颜色分级
option.SHADOWS_GRADE_R = 暗部 - §c红色
option.SHADOWS_GRADE_G = 暗部 - §a绿色
option.SHADOWS_GRADE_B = 暗部 - §9蓝色
option.SHADOWS_GRADE_MUL = 暗部 - 亮度
option.MIDS_GRADE_R = 中性色 - §c红色
option.MIDS_GRADE_G = 中性色 - §a绿色
option.MIDS_GRADE_B = 中性色 - §9蓝色
option.MIDS_GRADE_MUL = 中性色 - 亮度
option.HIGHLIGHTS_GRADE_R = 亮部 - §c红色
option.HIGHLIGHTS_GRADE_G = 亮部 - §a绿色
option.HIGHLIGHTS_GRADE_B = 亮部 - §9蓝色
option.HIGHLIGHTS_GRADE_MUL = 亮部 - 亮度
screen.LabPBR = Lab PBR screen.LabPBR = Lab PBR
@ -430,12 +476,16 @@ option.DOF_QUALITY=景深 (DOF)
option.DOF_ANAMORPHIC_RATIO=景深变形比 option.DOF_ANAMORPHIC_RATIO=景深变形比
value.MANUAL_FOCUS.-2=自动对焦 value.MANUAL_FOCUS.-2=自动对焦
value.MANUAL_FOCUS.-1=亮度滑块 value.MANUAL_FOCUS.-1=亮度滑块
value.FOCUS_LASER_COLOR.0=红
value.FOCUS_LASER_COLOR.1=绿 screen.JITTER_DOF=抖动景深设置
value.FOCUS_LASER_COLOR.2=蓝 option.JITTER_STRENGTH=抖动强度
value.FOCUS_LASER_COLOR.3=粉 option.FOCUS_LASER_COLOR=聚焦点
value.FOCUS_LASER_COLOR.4=黄 value.FOCUS_LASER_COLOR.0=红
value.FOCUS_LASER_COLOR.5=白 value.FOCUS_LASER_COLOR.1=绿
value.FOCUS_LASER_COLOR.2=蓝
value.FOCUS_LASER_COLOR.3=粉
value.FOCUS_LASER_COLOR.4=黄
value.FOCUS_LASER_COLOR.5=白
option.AEROCHROME_MODE=Aerochrome 模式 option.AEROCHROME_MODE=Aerochrome 模式
option.AEROCHROME_PINKNESS=Aerochrome 模式 红色: 粉色 比例 option.AEROCHROME_PINKNESS=Aerochrome 模式 红色: 粉色 比例
@ -458,7 +508,7 @@ option.moon_illuminance.comment = 配置月亮的亮度.
screen.Direct_Light.comment = 配置和阳光或阴影相关的设置. screen.Direct_Light.comment = 配置和阳光或阴影相关的设置.
screen.Shadows.comment = 根据喜好配置阳光的阴影. screen.Shadows.comment = 根据喜好配置阳光的阴影.
option.SCREENSPACE_CONTACT_SHADOWS.comment = 屏幕空间接触阴影. §b这啥?§r 这是给远处事物的小部分阴影区域补充, 以及对近处小部分阴影区域添加细节. §a性能消耗水平:§r 低偏中; 在更高分辨率下会消耗更多性能. option.SCREENSPACE_CONTACT_SHADOWS.comment = §b这啥?§r 这是给远处事物的小部分阴影区域补充, 以及对近处小部分阴影区域添加细节. §a性能消耗水平:§r 低偏中; 在更高分辨率下会消耗更多性能.
option.RENDER_ENTITY_SHADOWS.comment = §b这啥?§r 所有类型实体的阴影, 例如怪物, 箱子, 旗帜, 或者告示牌. §a性能消耗水平:§r 低偏中; 在近处有特别多实体的时候消耗的性能会非常的恐怖. option.RENDER_ENTITY_SHADOWS.comment = §b这啥?§r 所有类型实体的阴影, 例如怪物, 箱子, 旗帜, 或者告示牌. §a性能消耗水平:§r 低偏中; 在近处有特别多实体的时候消耗的性能会非常的恐怖.
option.shadowMapResolution.comment = 在太阳照射下从世界上的事物投射出来阴影的质量. §a性能消耗水平:§r 中或更高; 阴影需要从太阳的角度进行第二次 3D 世界的渲染, 这就是为什么它会使性能减半. option.shadowMapResolution.comment = 在太阳照射下从世界上的事物投射出来阴影的质量. §a性能消耗水平:§r 中或更高; 阴影需要从太阳的角度进行第二次 3D 世界的渲染, 这就是为什么它会使性能减半.
option.shadowDistance.comment = 阴影可渲染的最大距离 (这不是线性距离). 推荐保持默认, 因为接触阴影能解决远处阴影的渲染需求. §a性能消耗水平:§r 中或更高; 如果渲染距离非常大, 阴影的性能开销会很恐怖. option.shadowDistance.comment = 阴影可渲染的最大距离 (这不是线性距离). 推荐保持默认, 因为接触阴影能解决远处阴影的渲染需求. §a性能消耗水平:§r 中或更高; 如果渲染距离非常大, 阴影的性能开销会很恐怖.
@ -600,6 +650,9 @@ screen.Post_Processing.comment = 配置所有后处理效果设置, 从抗锯齿
option.BLEND_FACTOR.comment = 配置历史帧使用比重. 更高的数值意味着依赖更少的历史帧, 所以可能会看起来很闪烁和多噪点. 较低的数值意味着以来更多的历史帧, 所以可能会看起来更少噪点但是更多拖影和显得有点脏. option.BLEND_FACTOR.comment = 配置历史帧使用比重. 更高的数值意味着依赖更少的历史帧, 所以可能会看起来很闪烁和多噪点. 较低的数值意味着以来更多的历史帧, 所以可能会看起来更少噪点但是更多拖影和显得有点脏.
option.TAA_UPSCALING.comment = 时间性升分辨率. 升分辨率时, 可以从低分辨率的图像中保留大多数质量. 因此与常规升分辨率相比, 可以开启一个看起来很高的分辨率的同时也能有更好的性能. option.TAA_UPSCALING.comment = 时间性升分辨率. 升分辨率时, 可以从低分辨率的图像中保留大多数质量. 因此与常规升分辨率相比, 可以开启一个看起来很高的分辨率的同时也能有更好的性能.
option.SCALE_FACTOR.comment = 配置以原有分辨率的多大一部分来开始升分辨率. 不推荐低于0.5, 只把它作为一个选项, 因为它很有趣. :P option.SCALE_FACTOR.comment = 配置以原有分辨率的多大一部分来开始升分辨率. 不推荐低于0.5, 只把它作为一个选项, 因为它很有趣. :P
screen.COLOR_GRADING.comment = 高级调色选项.
option.TONE_CURVE.comment = 启用色调曲线. 独立于颜色分级且首先应用.
option.COLOR_GRADING_ENABLED.comment = 启用颜色分级. RGB 滑块不会影响亮度. 在色调曲线之后应用.
option.RESOURCEPACK_SKY.comment = 开关资源包天空支持. 配置设置来使用完整的资源包天空, 或保持光影的日月. §a性能消耗水平:§r 非常低. option.RESOURCEPACK_SKY.comment = 开关资源包天空支持. 配置设置来使用完整的资源包天空, 或保持光影的日月. §a性能消耗水平:§r 非常低.
option.SKY_GROUND = 地天 option.SKY_GROUND = 地天
@ -608,7 +661,6 @@ option.MATERIAL_AO.comment = 开关基于资源包提供的内容应用环境光
option.WATER_WAVE_STRENGTH.comment = 配置出现的水波强度. option.WATER_WAVE_STRENGTH.comment = 配置出现的水波强度.
option.MOONPHASE_BASED_MOONLIGHT.comment = §b这啥?§r 每晚月亮有不同的照度. 此选项根据月相来调整发出的月光亮度. §a性能消耗水平:§r 近乎于无. option.MOONPHASE_BASED_MOONLIGHT.comment = §b这啥?§r 每晚月亮有不同的照度. 此选项根据月相来调整发出的月光亮度. §a性能消耗水平:§r 近乎于无.
option.END_STORM_DENSTIY.comment = §b这啥?§r 这是末地的一层暗色云雾. 配置末地风暴的密度. option.END_STORM_DENSTIY.comment = §b这啥?§r 这是末地的一层暗色云雾. 配置末地风暴的密度.
option.NETHER_PLUME_DENSITY.comment = §b这啥?§r 这是下界中那些浓密的发光烟柱. 配置下界烟柱的密度. option.NETHER_PLUME_DENSITY.comment = §b这啥?§r 这是下界中那些浓密的发光烟柱. 配置下界烟柱的密度.
@ -642,6 +694,8 @@ option.DISTANT_HORIZONS_SHADOWMAP.comment = §c此选项会降低性能, 会使
option.TOGGLE_VL_FOG = 体积雾 option.TOGGLE_VL_FOG = 体积雾
option.TOGGLE_VL_FOG.comment = 一个快速关闭所有雾气的开关. option.TOGGLE_VL_FOG.comment = 一个快速关闭所有雾气的开关.
option.TRANSLUCENT_COLORED_SHADOWS.comment = §b这啥?§r 本选项的效果可以使像染色玻璃这样的半透明方块对穿过的光线染色. §a性能消耗水平:§r 中.
#Additional Options / 附加选项 #Additional Options / 附加选项
#Direct Light #Direct Light
option.BASIC_SHADOW_FILTER=基础阴影过滤 option.BASIC_SHADOW_FILTER=基础阴影过滤
@ -693,11 +747,6 @@ option.TOGGLE_VL_FOG.comment = 一个快速关闭所有雾气的开关.
option.Exposure_Speed=曝光速度 option.Exposure_Speed=曝光速度
option.Manual_exposure_value=手动曝光值 option.Manual_exposure_value=手动曝光值
screen.JITTER_DOF=抖动景深
option.JITTER_STRENGTH=抖动强度
option.FOCUS_LASER_COLOR=聚焦激光颜色
option.FOCUS_LASER_COLOR.comment=红, 绿, 蓝, 粉, 黄, 白.
option.AUTOFOCUS=自动对焦 option.AUTOFOCUS=自动对焦
option.focal=焦距 option.focal=焦距
option.aperture=光圈 option.aperture=光圈
@ -710,15 +759,24 @@ option.TOGGLE_VL_FOG.comment = 一个快速关闭所有雾气的开关.
option.Purkinje_B=柏金赫 - 蓝色 option.Purkinje_B=柏金赫 - 蓝色
option.Purkinje_Multiplier=柏金赫现象倍率 option.Purkinje_Multiplier=柏金赫现象倍率
option.CONTRAST=对比度 screen.GAMEPLAY_EFFECTS=游玩效果设置
option.TONE_CURVE=颜色曲线 option.MOTION_AMOUNT=Motion Amount
option.UPPER_CURVE=上部曲线 option.DAMAGE_TAKEN_EFFECT=受伤效果
option.LOWER_CURVE=下部曲线 option.LOW_HEALTH_EFFECT=低生命值效果
#Clouds #Clouds
option.CLOUD_SHADOW_STRENGTH=云影强度 option.CLOUD_SHADOW_STRENGTH=云影强度
#LabPBR
option.sss_density_multiplier=次表面散射强度倍率
option.sss_absorbance_multiplier=次表面散射吸光倍率
#Climate Settings
#Misc Settings #Misc Settings
screen.the_orb=末地球形天体 screen.the_orb=末地球形天体
option.THE_ORB=球形天体 option.THE_ORB=球形天体
@ -765,6 +823,7 @@ option.CLOUD_SHADOW_STRENGTH=云影强度
option.DENOISE_SSS_AND_SSAO=对 SSS和 SSAOO 降噪 option.DENOISE_SSS_AND_SSAO=对 SSS和 SSAOO 降噪
option.WATER_CAUSTICS_BRIGHTNESS=水体焦散线亮度 option.WATER_CAUSTICS_BRIGHTNESS=水体焦散线亮度
option.HYPER_DETAILED_WAVES=超细节水波 option.HYPER_DETAILED_WAVES=超细节水波
option.OLD_BLOOM=旧版泛光
#Climate #Climate

View File

@ -269,9 +269,8 @@ vec3 ToneMap_AgX( vec3 color ) {
color = AgXInsetMatrix * color; color = AgXInsetMatrix * color;
// Log2 encoding // Log2 encoding
color = max( color, 1e-10 ); // avoid 0 or negative numbers for log2 color = clamp(log2(color), AgxMinEv, AgxMaxEv);
color = log2( color ); color = (color - AgxMinEv) / (AgxMaxEv - AgxMinEv);
color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
// Apply sigmoid // Apply sigmoid
color = agxDefaultContrastApprox( color ); color = agxDefaultContrastApprox( color );
@ -282,7 +281,7 @@ vec3 ToneMap_AgX( vec3 color ) {
color = AgXOutsetMatrix * color; color = AgXOutsetMatrix * color;
// Linearize // Linearize
color = pow(color, vec3(2.2)); color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
// Gamut mapping. Simple clamp for now. // Gamut mapping. Simple clamp for now.
color = clamp( color, 0.0, 1.0 ); color = clamp( color, 0.0, 1.0 );
@ -310,9 +309,8 @@ vec3 ToneMap_AgX_minimal( vec3 color ) {
color = AgXInsetMatrix * color; color = AgXInsetMatrix * color;
// Log2 encoding // Log2 encoding
color = max( color, 1e-10 ); // avoid 0 or negative numbers for log2 color = clamp(log2(color), AgxMinEv, AgxMaxEv);
color = log2( color ); color = (color - AgxMinEv) / (AgxMaxEv - AgxMinEv);
color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
// Apply sigmoid // Apply sigmoid
color = agxDefaultContrastApprox( color ); color = agxDefaultContrastApprox( color );

View File

@ -50,7 +50,7 @@ vec3 DoAmbientLightColor(
// i gotchu // i gotchu
float fadeLength = 10.0; // in blocks float fadeLength = 10.0; // in blocks
vec3 cubicRadius = clamp( min(((LpvSize3-1.0) - lpvPos)/fadeLength, lpvPos/fadeLength) ,0.0,1.0); vec3 cubicRadius = clamp( min(((LpvSize3-1.0) - lpvPos)/fadeLength, lpvPos/fadeLength) ,0.0,1.0);
float LpvFadeF = cubicRadius.x*cubicRadius.y*cubicRadius.z; float LpvFadeF = cubicRadius.x*cubicRadius.y*cubicRadius.z;
LpvFadeF = 1.0 - pow(1.0-pow(LpvFadeF,1.5),3.0); // make it nice and soft :) LpvFadeF = 1.0 - pow(1.0-pow(LpvFadeF,1.5),3.0); // make it nice and soft :)

View File

@ -4,13 +4,18 @@ const float LpvBlockPower = 4.0;
// LPV block brightness scale // LPV block brightness scale
const float LpvBlockBrightness = 2.0; const float LpvBlockBrightness = 2.0;
float lpvCurve(float values){
// return pow(values, LpvBlockPower) ;
return pow(1.0-sqrt(1.0-values),2.0);
// return values;
}
vec4 SampleLpvNearest(const in ivec3 lpvPos) { vec4 SampleLpvNearest(const in ivec3 lpvPos) {
vec4 lpvSample = (frameCounter % 2) == 0 vec4 lpvSample = (frameCounter % 2) == 0
? texelFetch(texLpv1, lpvPos, 0) ? texelFetch(texLpv1, lpvPos, 0)
: texelFetch(texLpv2, lpvPos, 0); : texelFetch(texLpv2, lpvPos, 0);
lpvSample.b = pow(lpvSample.b, LpvBlockPower) * LpvBlockSkyRange.x; lpvSample.b = lpvCurve(lpvSample.b) * LpvBlockSkyRange.x;
lpvSample.rgb = HsvToRgb(lpvSample.rgb); lpvSample.rgb = HsvToRgb(lpvSample.rgb);
return lpvSample; return lpvSample;

View File

@ -125,7 +125,7 @@ const float sunPathRotation = -35; //[-90 -89 -88 -87 -86 -85 -84 -83 -82 -81 -8
const int shadowMapResolution = 2048; // [512 768 1024 1536 2048 3172 4096 8192] const int shadowMapResolution = 2048; // [512 768 1024 1536 2048 3172 4096 8192]
const float shadowDistance = 128.0; // [32.0 48.0 64.0 80.0 96.0 112.0 128.0 144.0 160.0 176.0 192.0 208.0 224.0 240.0 256.0 272.0 288.0 304.0 320.0 336.0 352.0 368.0 384.0 512.0 768.0 1024.0 1536.0 2048.0 4096.0 8192.0] const float shadowDistance = 128.0; // [32.0 48.0 64.0 80.0 96.0 112.0 128.0 144.0 160.0 176.0 192.0 208.0 224.0 240.0 256.0 272.0 288.0 304.0 320.0 336.0 352.0 368.0 384.0 512.0 768.0 1024.0 1536.0 2048.0 4096.0 8192.0]
#define OPTIMIZED_SHADOW_DISTANCE -1.0 // [-1.0 1.0] #define OPTIMIZED_SHADOW_DISTANCE 1.0 // [-1.0 1.0]
const float shadowDistanceRenderMul = OPTIMIZED_SHADOW_DISTANCE; const float shadowDistanceRenderMul = OPTIMIZED_SHADOW_DISTANCE;
const float entityShadowDistanceMul = 0.25; // [0.01 0.02 0.03 0.04 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.75 1.00] const float entityShadowDistanceMul = 0.25; // [0.01 0.02 0.03 0.04 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.75 1.00]
@ -655,6 +655,12 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
#define DENOISE_SSS_AND_SSAO #define DENOISE_SSS_AND_SSAO
// #define HYPER_DETAILED_WAVES // #define HYPER_DETAILED_WAVES
// #define DISABLE_ENCHANT_GLINT
// #define DISABLE_VANILLA_EMISSIVES
#define PARTICLE_RENDERING_FIX
/////////////////////////////////////////// ///////////////////////////////////////////
// ----- DISTANT HORIZONS SETTINGS ----- // // ----- DISTANT HORIZONS SETTINGS ----- //
/////////////////////////////////////////// ///////////////////////////////////////////
@ -739,3 +745,5 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
#endif #endif
#if DH_KNOWN_ISSUES == 0 #if DH_KNOWN_ISSUES == 0
#endif #endif
#ifdef PARTICLE_RENDERING_FIX
#endif

View File

@ -320,7 +320,7 @@ BLISS_SHADERS <empty> \
######## MISC SETTINGS ######## MISC SETTINGS
screen.Misc_Settings = DEBUG_VIEW [the_orb] display_LUT WhiteWorld SSS_view ambientLight_only LIGHTNING_FLASH LIT_PARTICLE_BRIGHTNESS PLANET_GROUND_BRIGHTNESS BLOOMY_PARTICLES ORIGINAL_CHOCAPIC_SKY BIOME_TINT_WATER CLOUDS_INFRONT_OF_WORLD SELECT_BOX DENOISE_SSS_AND_SSAO WATER_CAUSTICS_BRIGHTNESS HYPER_DETAILED_WAVES OLD_BLOOM screen.Misc_Settings = DEBUG_VIEW [the_orb] display_LUT WhiteWorld SSS_view ambientLight_only LIGHTNING_FLASH LIT_PARTICLE_BRIGHTNESS PLANET_GROUND_BRIGHTNESS BLOOMY_PARTICLES ORIGINAL_CHOCAPIC_SKY BIOME_TINT_WATER CLOUDS_INFRONT_OF_WORLD SELECT_BOX DENOISE_SSS_AND_SSAO WATER_CAUSTICS_BRIGHTNESS HYPER_DETAILED_WAVES OLD_BLOOM DISABLE_ENCHANT_GLINT DISABLE_VANILLA_EMISSIVES PARTICLE_RENDERING_FIX
screen.the_orb.columns = 1 screen.the_orb.columns = 1
screen.the_orb = THE_ORB ORB_X ORB_Y ORB_Z ORB_ColMult ORB_R ORB_G ORB_B screen.the_orb = THE_ORB ORB_X ORB_Y ORB_Z ORB_ColMult ORB_R ORB_G ORB_B
@ -497,7 +497,7 @@ texture.composite.colortex6 = texture/blueNoise.png
variable.float.texelSizeX = 1.0/viewWidth variable.float.texelSizeX = 1.0/viewWidth
variable.float.texelSizeY = 1.0/viewHeight variable.float.texelSizeY = 1.0/viewHeight
uniform.vec2.texelSize=vec2(texelSizeX,texelSizeY) uniform.vec2.texelSize = vec2(texelSizeX,texelSizeY)
uniform.int.framemod8 = frameCounter%8 uniform.int.framemod8 = frameCounter%8