mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2025-06-22 00:37:35 +08:00
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:
@ -84,6 +84,13 @@ vec3 DH_toScreenSpace(vec3 p) {
|
||||
vec3 DH_toClipSpace3(vec3 viewSpacePosition) {
|
||||
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) {
|
||||
// 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(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){
|
||||
|
||||
float quality = mix(15,SSR_STEPS,fresnel);
|
||||
vec3 clipPosition = DH_toClipSpace3(position);
|
||||
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
|
||||
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++) {
|
||||
|
||||
float sp = 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/65000.0));
|
||||
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);
|
||||
|
||||
@ -221,12 +242,6 @@ float encodeVec2(vec2 a){
|
||||
float encodeVec2(float x,float 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){
|
||||
float bumpmult = puddle_values;
|
||||
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);
|
||||
AmbientLightColor *= skylight;
|
||||
#endif
|
||||
|
||||
#ifndef OVERWORLD_SHADER
|
||||
vec3 AmbientLightColor = vec3(0.5);
|
||||
#endif
|
||||
|
||||
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 f0 = 0.02;
|
||||
// float f0 = 0.9;
|
||||
// f0 = 0.9;
|
||||
|
||||
vec3 reflectedVector = reflect(normalize(viewPos), normals);
|
||||
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);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef SCREENSPACE_REFLECTIONS
|
||||
vec3 rtPos = rayTrace(reflectedVector, viewPos, interleaved_gradientNoise(), fresnel, false);
|
||||
if (rtPos.z < 1.){
|
||||
@ -380,11 +398,12 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WATER_BACKGROUND_SPECULAR
|
||||
BackgroundReflection = skyCloudsFromTex(mat3(gbufferModelViewInverse) * reflectedVector, colortex4).rgb / 30.0;
|
||||
#endif
|
||||
#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
|
||||
Reflections_Final = mix(BackgroundReflection, Reflections.rgb, Reflections.a) * fresnel;
|
||||
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;
|
||||
material = 0.0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if DEBUG_VIEW == debug_DH_WATER_BLENDING
|
||||
|
@ -1,5 +1,9 @@
|
||||
#include "/lib/settings.glsl"
|
||||
|
||||
// #if defined END_SHADER || defined NETHER_SHADER
|
||||
// #undef IS_LPV_ENABLED
|
||||
// #endif
|
||||
|
||||
#ifdef IS_LPV_ENABLED
|
||||
#extension GL_EXT_shader_image_load_store: enable
|
||||
#extension GL_ARB_shading_language_packing: enable
|
||||
@ -387,7 +391,7 @@ void main() {
|
||||
vec3 MinimumLightColor = vec3(1.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
|
||||
directLightColor = lightCol.rgb/80.0;
|
||||
|
@ -82,7 +82,7 @@ void main() {
|
||||
WsunVec2 = (float(sunElevation > 1e-5)*2.0 - 1.0)*normalize(mat3(gbufferModelViewInverse) * sunPosition);
|
||||
#endif
|
||||
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;
|
||||
|
||||
#ifdef DAMAGE_BLOCK_EFFECT
|
||||
|
@ -280,10 +280,10 @@ vec4 texture2D_POMSwitch(
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
|
||||
#if defined HAND || defined ENTITIES
|
||||
/* RENDERTARGETS:1,7,8,15,2 */
|
||||
#if defined HAND || defined ENTITIES || defined BLOCKENTITIES
|
||||
/* RENDERTARGETS:1,8,15,2 */
|
||||
#else
|
||||
/* RENDERTARGETS:1,7,8,15 */
|
||||
/* RENDERTARGETS:1,8,15 */
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
@ -446,14 +446,14 @@ void main() {
|
||||
#ifdef HAND
|
||||
if (Albedo.a > 0.1){
|
||||
Albedo.a = 0.75;
|
||||
gl_FragData[4].a = 0.0;
|
||||
gl_FragData[3].a = 0.0;
|
||||
} else {
|
||||
Albedo.a = 1.0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENTITIES
|
||||
gl_FragData[4].a = 0.0;
|
||||
#if defined PARTICLE_RENDERING_FIX && (defined ENTITIES || defined BLOCKENTITIES)
|
||||
gl_FragData[3].a = 0.0;
|
||||
#endif
|
||||
|
||||
//////////////////////////////// ////////////////////////////////
|
||||
@ -494,40 +494,40 @@ void main() {
|
||||
SpecularTex.r = max(SpecularTex.r, Puddle_shape);
|
||||
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
|
||||
gl_FragData[2].a = 0.0;
|
||||
gl_FragData[1].a = 0.0;
|
||||
#endif
|
||||
|
||||
#if EMISSIVE_TYPE == 1
|
||||
gl_FragData[2].a = EMISSIVE;
|
||||
gl_FragData[1].a = EMISSIVE;
|
||||
#endif
|
||||
|
||||
#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;
|
||||
#endif
|
||||
|
||||
#if EMISSIVE_TYPE == 3
|
||||
gl_FragData[2].a = SpecularTex.a;
|
||||
gl_FragData[1].a = SpecularTex.a;
|
||||
#endif
|
||||
|
||||
#if SSS_TYPE == 0
|
||||
gl_FragData[2].b = 0.0;
|
||||
gl_FragData[1].b = 0.0;
|
||||
#endif
|
||||
|
||||
#if SSS_TYPE == 1
|
||||
gl_FragData[2].b = SSSAMOUNT;
|
||||
gl_FragData[1].b = SSSAMOUNT;
|
||||
#endif
|
||||
|
||||
#if SSS_TYPE == 2
|
||||
gl_FragData[2].b = SpecularTex.b;
|
||||
if(SpecularTex.b < 65.0/255.0) gl_FragData[2].b = SSSAMOUNT;
|
||||
gl_FragData[1].b = SpecularTex.b;
|
||||
if(SpecularTex.b < 65.0/255.0) gl_FragData[1].b = SSSAMOUNT;
|
||||
#endif
|
||||
|
||||
#if SSS_TYPE == 3
|
||||
gl_FragData[2].b = SpecularTex.b;
|
||||
gl_FragData[1].b = SpecularTex.b;
|
||||
#endif
|
||||
|
||||
// #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[3] = vec4(FlatNormals * 0.5 + 0.5, VanillaAO);
|
||||
|
||||
gl_FragData[2] = vec4(FlatNormals * 0.5 + 0.5, VanillaAO);
|
||||
#endif
|
||||
|
||||
gl_FragData[1].a = 0.0;
|
||||
}
|
@ -1,5 +1,9 @@
|
||||
#include "/lib/settings.glsl"
|
||||
|
||||
// #if defined END_SHADER || defined NETHER_SHADER
|
||||
// #undef IS_LPV_ENABLED
|
||||
// #endif
|
||||
|
||||
#ifdef IS_LPV_ENABLED
|
||||
#extension GL_EXT_shader_image_load_store: enable
|
||||
#extension GL_ARB_shading_language_packing: enable
|
||||
@ -43,6 +47,7 @@ uniform sampler2D colortex7;
|
||||
uniform sampler2D colortex12;
|
||||
uniform sampler2D colortex14;
|
||||
uniform sampler2D colortex5;
|
||||
uniform sampler2D colortex3;
|
||||
uniform sampler2D colortex6;
|
||||
|
||||
uniform sampler2D texture;
|
||||
@ -122,6 +127,9 @@ uniform vec3 nsunColor;
|
||||
float blueNoise(){
|
||||
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(){
|
||||
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));
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
// quality = SSR_STEPS;
|
||||
|
||||
vec3 clipPosition = toClipSpace3(position);
|
||||
float rayLength = ((position.z + dir.z * far*sqrt(3.)) > -near) ?
|
||||
(-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);
|
||||
|
||||
|
||||
|
||||
|
||||
spos += stepv;
|
||||
//small bias
|
||||
if(inwater) {
|
||||
minZ = maxZ-0.000035/ld(spos.z);
|
||||
minZ = maxZ-0.00035/ld(spos.z);
|
||||
}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;
|
||||
|
||||
|
||||
reflectLength += 1.0 / quality; // for shit
|
||||
}
|
||||
|
||||
return vec3(1.1);
|
||||
@ -405,6 +421,75 @@ void convertHandDepth(inout float depth) {
|
||||
ndcDepth /= MC_HAND_DEPTH;
|
||||
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//////////////////////////////
|
||||
@ -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);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////// SPECULARS /////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
vec3 SpecularTex = texture2D(specular, lmtexcoord.xy, Texture_MipMap_Bias).rga;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////// 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;
|
||||
|
||||
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));
|
||||
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
|
||||
|
||||
#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
|
||||
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);
|
||||
|
||||
// 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 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);
|
||||
#endif
|
||||
|
||||
// specularValues = SpecularTex;
|
||||
// f0 = SpecularTex.g;
|
||||
// roughness = pow(1.0-specularValues.r,2.0);
|
||||
// f0 = 0.9;
|
||||
// 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);
|
||||
|
||||
// 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){
|
||||
@ -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);
|
||||
|
||||
/*
|
||||
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
|
||||
// snells window looking thing
|
||||
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;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef SCREENSPACE_REFLECTIONS
|
||||
vec3 rtPos = rayTrace(reflectedVector, viewPos.xyz, interleaved_gradientNoise_temporal(), fresnel, isEyeInWater == 1);
|
||||
if (rtPos.z < 1.){
|
||||
float reflectLength = 0.0;
|
||||
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;
|
||||
previousPosition = mat3(gbufferPreviousModelView) * previousPosition + gbufferPreviousModelView[3].xyz;
|
||||
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) {
|
||||
Reflections.a = 1.0;
|
||||
Reflections.rgb = texture2D(colortex5,previousPosition.xy).rgb * Metals;
|
||||
Reflections.rgb = texture2D(colortex5, previousPosition.xy).rgb * Metals;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -759,6 +854,10 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
#else
|
||||
gl_FragData[0].rgb = FinalColor*0.1;
|
||||
#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
|
||||
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);
|
||||
#endif
|
||||
#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
|
||||
#if DEBUG_VIEW == debug_INDIRECT
|
||||
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
|
||||
|
||||
gl_FragData[3].a = encodeVec2(lightmap);
|
||||
|
||||
}
|
||||
}
|
@ -58,7 +58,7 @@ vec3 viewToWorld(vec3 viewPos) {
|
||||
void main() {
|
||||
|
||||
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
|
||||
|
||||
@ -72,7 +72,12 @@ void main() {
|
||||
|
||||
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));
|
||||
#endif
|
||||
@ -80,7 +85,16 @@ void main() {
|
||||
#ifdef ENCHANT_GLINT
|
||||
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 );
|
||||
#endif
|
||||
|
@ -126,15 +126,12 @@ float interleaved_gradientNoise(){
|
||||
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(){
|
||||
// #ifdef TAA
|
||||
#ifdef TAA
|
||||
vec2 coord = gl_FragCoord.xy + (frameCounter%40000) * 2.0;
|
||||
// #else
|
||||
// vec2 coord = gl_FragCoord.xy;
|
||||
// #endif
|
||||
#else
|
||||
vec2 coord = gl_FragCoord.xy;
|
||||
#endif
|
||||
vec2 alpha = vec2(0.75487765, 0.56984026);
|
||||
return fract(alpha.x * coord.x + alpha.y * coord.y ) ;
|
||||
}
|
||||
@ -144,11 +141,18 @@ float blueNoise(){
|
||||
vec4 blueNoise(vec2 coord){
|
||||
return texelFetch2D(colortex6, ivec2(coord )%512 , 0);
|
||||
}
|
||||
|
||||
vec2 R2_samples(int n){
|
||||
vec2 alpha = vec2(0.75487765, 0.56984026);
|
||||
return fract(alpha * n);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
vec3 viewToWorld(vec3 viewPos) {
|
||||
vec4 pos;
|
||||
pos.xyz = viewPos;
|
||||
@ -161,18 +165,6 @@ vec3 viewToWorld(vec3 viewPos) {
|
||||
|
||||
|
||||
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(
|
||||
int samples, int totalSamples, float rotation, float Xi
|
||||
){
|
||||
@ -188,24 +180,29 @@ vec2 SpiralSample(
|
||||
|
||||
return vec2(x, y);
|
||||
}
|
||||
vec2 CleanSample(
|
||||
int samples, float totalSamples, float noise
|
||||
){
|
||||
|
||||
vec3 cosineHemisphereSample(vec2 Xi){
|
||||
float theta = 2.0 * 3.14159265359 * Xi.y;
|
||||
// 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;
|
||||
|
||||
float r = sqrt(Xi.x);
|
||||
float x = r * cos(theta);
|
||||
float y = r * sin(theta);
|
||||
// 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 = 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"
|
||||
@ -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));
|
||||
|
||||
#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);
|
||||
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
|
||||
|
||||
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;
|
||||
|
||||
float leaf = leaves ? -0.5 : 0.0;
|
||||
|
||||
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);
|
||||
|
||||
@ -278,16 +280,14 @@ vec2 SSAO(
|
||||
float dsquared = dot(vec, vec);
|
||||
|
||||
if (dsquared > 1e-5){
|
||||
if (dsquared < maxR2){
|
||||
|
||||
if( dsquared < maxR2){
|
||||
float NdotV = clamp(dot(vec*inversesqrt(dsquared), normalize(normal)),0.,1.);
|
||||
occlusion += NdotV * clamp(1.0-dsquared/maxR2,0.0,1.0);
|
||||
}
|
||||
|
||||
#ifdef Ambient_SSS
|
||||
if(dsquared > maxR2_2){
|
||||
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);
|
||||
}
|
||||
sss += clamp(leaf - dot(vec, normalize(normal)),0.0,1.0);
|
||||
#endif
|
||||
|
||||
n += 1;
|
||||
@ -372,12 +372,13 @@ void main() {
|
||||
vec2 texcoord = gl_FragCoord.xy*texelSize;
|
||||
|
||||
float z = texture2D(depthtex1,texcoord).x;
|
||||
|
||||
#ifdef DISTANT_HORIZONS
|
||||
float DH_depth1 = texture2D(dhDepthTex1,texcoord).x;
|
||||
float swappedDepth = z >= 1.0 ? DH_depth1 : z;
|
||||
float DH_depth1 = texture2D(dhDepthTex1,texcoord).x;
|
||||
float swappedDepth = z >= 1.0 ? DH_depth1 : z;
|
||||
#else
|
||||
float DH_depth1 = 1.0;
|
||||
float swappedDepth = z;
|
||||
float DH_depth1 = 1.0;
|
||||
float swappedDepth = z;
|
||||
#endif
|
||||
|
||||
|
||||
@ -390,7 +391,7 @@ void main() {
|
||||
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;
|
||||
@ -502,10 +503,11 @@ void main() {
|
||||
float diffthreshM = diffthresh*mult*d0*k/20.;
|
||||
float avgDepth = 0.0;
|
||||
|
||||
vec2 BLUENOISE = blueNoise(gl_FragCoord.xy).rg;
|
||||
for(int i = 0; i < VPS_Search_Samples; i++){
|
||||
|
||||
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 d = texelFetch2D(shadow, ivec2((projectedShadowPosition.xy+offsetS*rdMul)*shadowMapResolution),0).x;
|
||||
|
@ -1,5 +1,9 @@
|
||||
#include "/lib/settings.glsl"
|
||||
|
||||
// #if defined END_SHADER || defined NETHER_SHADER
|
||||
// #undef IS_LPV_ENABLED
|
||||
// #endifs
|
||||
|
||||
#ifdef IS_LPV_ENABLED
|
||||
#extension GL_ARB_shader_image_load_store: enable
|
||||
#extension GL_ARB_shading_language_packing: enable
|
||||
@ -321,6 +325,28 @@ vec2 tapLocation_simple(
|
||||
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) {
|
||||
vec4 pos;
|
||||
pos.xyz = viewPos;
|
||||
@ -671,7 +697,8 @@ float ComputeShadowMap(in vec3 projectedShadowPosition, float distortFactor, flo
|
||||
float rdMul = shadowBlockerDepth*distortFactor*d0*k/shadowMapResolution;
|
||||
|
||||
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;
|
||||
#else
|
||||
int samples = 1;
|
||||
@ -731,22 +758,21 @@ vec3 SubsurfaceScattering_sun(vec3 albedo, float Scattering, float Density, floa
|
||||
|
||||
Scattering *= sss_density_multiplier;
|
||||
|
||||
float density = 0.0001 + Density*1.5;
|
||||
|
||||
density = 1.0;
|
||||
float density = 0.0001 + Density*2.0;
|
||||
|
||||
float scatterDepth = max(1.0 - Scattering/density,0.0);
|
||||
scatterDepth = exp((1.0-scatterDepth) * -7.0);
|
||||
|
||||
// this is for SSS when there is no shadow blocker depth
|
||||
#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
|
||||
scatterDepth = exp(-7.0 * pow(1.0-shadows,3.0))*min(2.0-sss_density_multiplier,1.0);
|
||||
#endif
|
||||
|
||||
|
||||
// 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);
|
||||
|
||||
@ -757,13 +783,14 @@ vec3 SubsurfaceScattering_sun(vec3 albedo, float Scattering, float Density, floa
|
||||
|
||||
vec3 SubsurfaceScattering_sky(vec3 albedo, float Scattering, float Density){
|
||||
|
||||
float labcurve = clamp(1.0 - exp(Density * -10.0),0.0,1.0);
|
||||
float density = sqrt(Density) * 4.0 + 1.0;
|
||||
float scatterDepth = exp(pow(Scattering, 5) * -5.0);
|
||||
Scattering *= sss_density_multiplier;
|
||||
|
||||
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);
|
||||
|
||||
vec3 scatter = scatterDepth * absorbColor * labcurve;
|
||||
// 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 * pow(Density, LabSSS_Curve);
|
||||
|
||||
return scatter;
|
||||
}
|
||||
@ -1222,7 +1249,7 @@ void main() {
|
||||
SkySSS = SSAO_SSS.y;
|
||||
|
||||
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
|
||||
AO = vec3( min(vanillaAO_curve, SSAO_curve) );
|
||||
@ -1257,7 +1284,7 @@ void main() {
|
||||
///////////////////////////// SKY SSS /////////////////////////////
|
||||
#if defined Ambient_SSS && defined OVERWORLD_SHADER && indirect_effect == 1
|
||||
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 *= lightmap.y*lightmap.y*lightmap.y;
|
||||
@ -1265,7 +1292,7 @@ void main() {
|
||||
|
||||
// apply to ambient light.
|
||||
// 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
|
||||
// if(LabSSS > 0.0) Indirect_lighting += (1.0-SkySSS) * LightningPhase * lightningEffect * pow(lightmap.y,10);
|
||||
@ -1298,7 +1325,7 @@ void main() {
|
||||
#endif
|
||||
|
||||
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;
|
||||
|
||||
#ifndef SCREENSPACE_CONTACT_SHADOWS
|
||||
@ -1362,7 +1389,7 @@ void main() {
|
||||
// #endif
|
||||
#if DEBUG_VIEW == debug_NORMALS
|
||||
if(swappedDepth >= 1.0) Direct_lighting = vec3(1.0);
|
||||
gl_FragData[0].rgb = worldToView(normal);
|
||||
gl_FragData[0].rgb = normalize(worldToView(normal));
|
||||
#endif
|
||||
#if DEBUG_VIEW == debug_SPECULAR
|
||||
if(swappedDepth >= 1.0) Direct_lighting = vec3(1.0);
|
||||
@ -1374,41 +1401,22 @@ void main() {
|
||||
#endif
|
||||
#if DEBUG_VIEW == debug_DIRECT
|
||||
if(swappedDepth >= 1.0) Direct_lighting = vec3(15.0);
|
||||
gl_FragData[0].rgb = Direct_lighting;
|
||||
gl_FragData[0].rgb = Direct_lighting + 0.5;
|
||||
#endif
|
||||
#if DEBUG_VIEW == debug_VIEW_POSITION
|
||||
gl_FragData[0].rgb = viewPos * 0.001;
|
||||
#endif
|
||||
#if DEBUG_VIEW == debug_FILTERED_STUFF
|
||||
vec3 FilteredDebug = vec3(15.0) * exp(-7.0 * vec3(1.0,0.5,1.0) * filteredShadow.y);
|
||||
FilteredDebug += vec3(15.0) * exp(-7.0 * vec3(1.0,1.0,0.5) * pow(SSAO_SSS.x,2));
|
||||
FilteredDebug += vec3(15.0) * exp(-7.0 * vec3(0.5,1.0,1.0) * pow(SSAO_SSS.y,2));
|
||||
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;
|
||||
if(hideGUI == 1) gl_FragData[0].rgb = vec3(1) * (1.0 - SSAO_SSS.y);
|
||||
if(hideGUI == 0) gl_FragData[0].rgb = vec3(1) * (1.0 - SSAO_SSS.x);
|
||||
// if(hideGUI == 0) gl_FragData[0].rgb = vec3(1) * filteredShadow.z;//exp(-7*(1-clamp(1.0 - filteredShadow.x,0.0,1.0)));
|
||||
#endif
|
||||
|
||||
|
||||
// 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
|
||||
gl_FragData[1] = texture2D(colortex2, texcoord);
|
||||
|
@ -452,6 +452,7 @@ void main() {
|
||||
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 = 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 = 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));
|
||||
|
@ -42,12 +42,11 @@ void main() {
|
||||
|
||||
float newTex = texelFetch2D(depthtex1, ivec2(gl_FragCoord.xy*4), 0).x;
|
||||
|
||||
|
||||
#ifdef DISTANT_HORIZONS
|
||||
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
|
||||
|
||||
if (newTex < 1.0)
|
||||
@ -55,27 +54,4 @@ void main() {
|
||||
else
|
||||
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);
|
||||
|
||||
|
||||
}
|
@ -103,9 +103,7 @@ vec3 normVec (vec3 vec){
|
||||
|
||||
void main() {
|
||||
/* DRAWBUFFERS:0 */
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
#ifdef VOLUMETRIC_CLOUDS
|
||||
#if defined OVERWORLD_SHADER && defined VOLUMETRIC_CLOUDS
|
||||
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));
|
||||
@ -117,7 +115,4 @@ void main() {
|
||||
#else
|
||||
gl_FragData[0] = vec4(0.0,0.0,0.0,1.0);
|
||||
#endif
|
||||
#else
|
||||
gl_FragData[0] = vec4(0.0,0.0,0.0,1.0);
|
||||
#endif
|
||||
}
|
@ -1,4 +1,10 @@
|
||||
#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 vec3 averageSkyCol;
|
||||
@ -76,6 +82,7 @@ float linearizeDepthFast(const in float depth, const in float near, const in flo
|
||||
uniform sampler2DShadow shadowtex0;
|
||||
uniform sampler2DShadow shadowtex1;
|
||||
#endif
|
||||
|
||||
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"
|
||||
#endif
|
||||
|
||||
#include "/lib/diffuse_lighting.glsl"
|
||||
|
||||
#define fsign(a) (clamp((a)*1e35,0.,1.)*2.-1.)
|
||||
|
||||
float interleaved_gradientNoise(){
|
||||
@ -247,7 +256,7 @@ vec4 waterVolumetrics_test( vec3 rayStart, vec3 rayEnd, float estEndDepth, float
|
||||
vec3 ambientMul = exp(-estEndDepth * d * waterCoefs );
|
||||
|
||||
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;
|
||||
|
||||
@ -292,7 +301,7 @@ void main() {
|
||||
float z = texture2D(depthtex1,tc).x;
|
||||
|
||||
#ifdef DISTANT_HORIZONS
|
||||
float DH_z = texture2D(dhDepthTex1,tc).x;
|
||||
float DH_z = texture2D(dhDepthTex1,tc).x;
|
||||
#else
|
||||
float DH_z = 0.0;
|
||||
#endif
|
||||
@ -323,22 +332,28 @@ void main() {
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
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
|
||||
vec2 lightmap = decodeVec2(texture2D(colortex14, tc).a);
|
||||
lightmap.y = 1.0;
|
||||
#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 VdotU = playerPos.y;
|
||||
float estimatedDepth = Vdiff * abs(VdotU) ; //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);
|
||||
#ifdef OVERWORLD_SHADER
|
||||
if(!iswater) VolumetricFog2 = GetVolumetricFog(viewPos1, vec2(noise_1, noise_2), directLightColor, indirectLightColor);
|
||||
|
Reference in New Issue
Block a user