mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2024-12-23 01:59:39 +08:00
Shadow and SSS fixes and tweaks. tiny lightmap tweaks. add toggle for basic shadow filter.
This commit is contained in:
parent
35f8b6373b
commit
ca1b9eb85e
@ -180,34 +180,31 @@ void main() {
|
|||||||
float minshadowfilt = Min_Shadow_Filter_Radius;
|
float minshadowfilt = Min_Shadow_Filter_Radius;
|
||||||
float maxshadowfilt = Max_Shadow_Filter_Radius;
|
float maxshadowfilt = Max_Shadow_Filter_Radius;
|
||||||
|
|
||||||
|
float NdotL = clamp(dot(normal,WsunVec),0.0,1.0);
|
||||||
|
|
||||||
float vanillAO = clamp(texture2D(colortex15,texcoord).a,0.0,1.0) ;
|
float vanillAO = clamp(texture2D(colortex15,texcoord).a,0.0,1.0) ;
|
||||||
|
|
||||||
if(lightmap.y < 0.1 && !entities){
|
if(lightmap.y < 0.1 && !entities){
|
||||||
// minshadowfilt *= vanillAO;
|
// minshadowfilt *= vanillAO;
|
||||||
maxshadowfilt = mix(minshadowfilt ,maxshadowfilt, vanillAO);
|
maxshadowfilt = mix(minshadowfilt, maxshadowfilt, vanillAO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float SpecularTex = texture2D(colortex8,texcoord).z;
|
float SpecularTex = texture2D(colortex8,texcoord).z;
|
||||||
float LabSSS = clamp((-65.0 + SpecularTex * 255.0) / 190.0 ,0.0,1.0);
|
float LabSSS = clamp((-65.0 + SpecularTex * 255.0) / 190.0 ,0.0,1.0);
|
||||||
|
|
||||||
|
|
||||||
#ifndef Variable_Penumbra_Shadows
|
#ifndef Variable_Penumbra_Shadows
|
||||||
if (translucent && !hand) minshadowfilt += 25;
|
if (LabSSS > 0.0 && !hand && NdotL < 0.001) minshadowfilt += 50;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
gl_FragData[0] = vec4(minshadowfilt, 0.1, 0.0, 0.0);
|
gl_FragData[0] = vec4(minshadowfilt, 0.1, 0.0, 0.0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (z < 1.0){
|
if (z < 1.0){
|
||||||
|
|
||||||
// if( translucent || translucent2)
|
// if( translucent || translucent2)
|
||||||
|
|
||||||
if (!hand){
|
if (!hand){
|
||||||
|
|
||||||
float NdotL = clamp(dot(normal,WsunVec),0.0,1.0);
|
|
||||||
|
|
||||||
vec3 fragpos = toScreenSpace(vec3(texcoord/RENDER_SCALE-vec2(tempOffset)*texelSize*0.5,z));
|
vec3 fragpos = toScreenSpace(vec3(texcoord/RENDER_SCALE-vec2(tempOffset)*texelSize*0.5,z));
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@ flat varying vec4 lightCol;
|
|||||||
|
|
||||||
flat varying vec3 WsunVec;
|
flat varying vec3 WsunVec;
|
||||||
flat varying vec2 TAA_Offset;
|
flat varying vec2 TAA_Offset;
|
||||||
flat varying float tempOffsets;
|
|
||||||
|
|
||||||
|
|
||||||
uniform float eyeAltitude;
|
uniform float eyeAltitude;
|
||||||
@ -595,13 +594,11 @@ void rtGI(inout vec3 lighting, vec3 normal,vec2 noise,vec3 fragpos, float lightm
|
|||||||
|
|
||||||
vec3 SubsurfaceScattering_sun(vec3 albedo, float Scattering, float Density, float lightPos){
|
vec3 SubsurfaceScattering_sun(vec3 albedo, float Scattering, float Density, float lightPos){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
float labcurve = pow(Density,LabSSS_Curve);
|
float labcurve = pow(Density,LabSSS_Curve);
|
||||||
float density = sqrt(30 - labcurve*15);
|
float density = sqrt(30 - labcurve*15);
|
||||||
|
|
||||||
vec3 absorbed = max(1.0 - albedo,0.0) * density;
|
vec3 absorbed = max(1.0 - albedo,0.0);
|
||||||
vec3 scatter = exp(-sqrt(Scattering * absorbed)) * exp(Scattering * -density);
|
vec3 scatter = exp(absorbed * -sqrt(Scattering * 5)) * exp(Scattering * -density);
|
||||||
|
|
||||||
scatter *= labcurve;
|
scatter *= labcurve;
|
||||||
scatter *= 0.5 + CustomPhase(lightPos, 1.0,30.0)*20;
|
scatter *= 0.5 + CustomPhase(lightPos, 1.0,30.0)*20;
|
||||||
@ -612,9 +609,8 @@ 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){
|
||||||
|
|
||||||
vec3 absorbed = max(luma(albedo) - albedo,0.0);
|
vec3 absorbed = max(luma(albedo) - albedo,0.0);
|
||||||
|
vec3 scatter = sqrt(exp(-(absorbed * Scattering * 15)) * (1.0 - Scattering));
|
||||||
|
|
||||||
// vec3 scatter = exp(-sqrt(max(Scattering+0.05,0.0) * absorbed * 25)) * exp(Scattering * -5);
|
|
||||||
vec3 scatter = exp(-sqrt(Scattering * absorbed * 5)) * pow((-Scattering+1.0)*1.25,2.0);
|
|
||||||
scatter *= pow(Density,LabSSS_Curve);
|
scatter *= pow(Density,LabSSS_Curve);
|
||||||
|
|
||||||
return scatter;
|
return scatter;
|
||||||
@ -687,18 +683,21 @@ void GriAndEminShadowFix(
|
|||||||
float SkyLightmap,
|
float SkyLightmap,
|
||||||
bool Entities
|
bool Entities
|
||||||
){
|
){
|
||||||
|
|
||||||
float DistanceOffset = clamp(0.1 + length(WorldPos) / (shadowMapResolution*0.20), 0.0,1.0) ;
|
float DistanceOffset = clamp(0.1 + length(WorldPos) / (shadowMapResolution*0.20), 0.0,1.0) ;
|
||||||
vec3 Bias = FlatNormal * DistanceOffset; // adjust the bias thingy's strength as it gets farther away.
|
vec3 Bias = FlatNormal * DistanceOffset; // adjust the bias thingy's strength as it gets farther away.
|
||||||
|
|
||||||
|
vec3 finalBias = Bias;
|
||||||
|
|
||||||
// stop lightleaking
|
// stop lightleaking
|
||||||
if(SkyLightmap < 0.1 && !Entities) {
|
vec2 scale = vec2(0.5); scale.y *= 0.5;
|
||||||
WorldPos += mix(Bias, 0.5 * (0.5 - fract(WorldPos + cameraPosition + FlatNormal*0.01 ) ), VanillaAO) ;
|
vec3 zoomShadow = scale.y - scale.x * fract(WorldPos + cameraPosition + Bias*scale.y);
|
||||||
}else{
|
if(SkyLightmap < 0.1 && !Entities) finalBias = mix(Bias, zoomShadow, clamp(VanillaAO*5,0,1));
|
||||||
WorldPos += Bias;
|
|
||||||
}
|
WorldPos += finalBias;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LabEmission(
|
void Emission(
|
||||||
inout vec3 Lighting,
|
inout vec3 Lighting,
|
||||||
vec3 Albedo,
|
vec3 Albedo,
|
||||||
float Emission
|
float Emission
|
||||||
@ -750,10 +749,10 @@ void main() {
|
|||||||
|
|
||||||
float z0 = texture2D(depthtex0,texcoord).x;
|
float z0 = texture2D(depthtex0,texcoord).x;
|
||||||
float z = texture2D(depthtex1,texcoord).x;
|
float z = texture2D(depthtex1,texcoord).x;
|
||||||
float TranslucentDepth = clamp( ld(z0)-ld(z0) ,0.0,1.0);
|
float TranslucentDepth = clamp( ld(z0)-ld(z0),0.0,1.0);
|
||||||
|
|
||||||
vec2 tempOffset=TAA_Offset;
|
vec2 tempOffset=TAA_Offset;
|
||||||
vec3 fragpos = toScreenSpace(vec3(texcoord/RENDER_SCALE-vec2(tempOffset)*texelSize*0.5,z));
|
vec3 fragpos = toScreenSpace(vec3(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5,z));
|
||||||
vec3 fragpos_rtshadow = toScreenSpace(vec3(texcoord/RENDER_SCALE,z));
|
vec3 fragpos_rtshadow = toScreenSpace(vec3(texcoord/RENDER_SCALE,z));
|
||||||
vec3 fragpos_handfix = fragpos;
|
vec3 fragpos_handfix = fragpos;
|
||||||
|
|
||||||
@ -778,8 +777,8 @@ void main() {
|
|||||||
scatterCoef *= 0.1;
|
scatterCoef *= 0.1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
float noise = blueNoise();
|
|
||||||
|
|
||||||
|
float noise = blueNoise();
|
||||||
|
|
||||||
float iswaterstuff = texture2D(colortex7,texcoord).a ;
|
float iswaterstuff = texture2D(colortex7,texcoord).a ;
|
||||||
bool iswater = iswaterstuff > 0.99;
|
bool iswater = iswaterstuff > 0.99;
|
||||||
@ -816,10 +815,6 @@ void main() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
float vanilla_AO = normalAndAO.a;
|
float vanilla_AO = normalAndAO.a;
|
||||||
normalAndAO.a = clamp(pow(normalAndAO.a*5,4),0,1);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool lightningBolt = abs(dataUnpacked1.w-0.5) <0.01;
|
bool lightningBolt = abs(dataUnpacked1.w-0.5) <0.01;
|
||||||
bool isLeaf = abs(dataUnpacked1.w-0.55) <0.01;
|
bool isLeaf = abs(dataUnpacked1.w-0.55) <0.01;
|
||||||
@ -837,7 +832,6 @@ void main() {
|
|||||||
|
|
||||||
|
|
||||||
vec3 ambientCoefs = normal/dot(abs(normal),vec3(1.));
|
vec3 ambientCoefs = normal/dot(abs(normal),vec3(1.));
|
||||||
|
|
||||||
float lightleakfix = clamp(pow(eyeBrightnessSmooth.y/240. + lightmap.y,2) ,0.0,1.0);
|
float lightleakfix = clamp(pow(eyeBrightnessSmooth.y/240. + lightmap.y,2) ,0.0,1.0);
|
||||||
|
|
||||||
vec3 DirectLightColor = (lightCol.rgb/80.0);
|
vec3 DirectLightColor = (lightCol.rgb/80.0);
|
||||||
@ -849,13 +843,21 @@ void main() {
|
|||||||
vec3 AmbientLightColor = averageSkyCol_Clouds;
|
vec3 AmbientLightColor = averageSkyCol_Clouds;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int shadowmapindicator = 0;
|
||||||
float cloudShadow = 1.0;
|
float cloudShadow = 1.0;
|
||||||
|
|
||||||
if ( z >= 1.) { //sky
|
if ( z >= 1.) {//sky
|
||||||
#ifdef Compositing_Sky
|
|
||||||
gl_FragData[0].rgb = vec3(CompSky_R, CompSky_G, CompSky_B);
|
//////////////////////////////// ////////////////////////////////
|
||||||
#else
|
//////////////////////////////// SKY STUFF ////////////////////////////////
|
||||||
|
//////////////////////////////// ////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef Compositing_Sky
|
||||||
|
|
||||||
|
gl_FragData[0].rgb = vec3(CompSky_R, CompSky_G, CompSky_B);
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
vec3 background = vec3(0.0);
|
vec3 background = vec3(0.0);
|
||||||
vec3 orbitstar = vec3(np3.x,abs(np3.y),np3.z);
|
vec3 orbitstar = vec3(np3.x,abs(np3.y),np3.z);
|
||||||
@ -872,102 +874,113 @@ void main() {
|
|||||||
|
|
||||||
vec3 skyTEX = skyFromTex(np3,colortex4)/150.0 * 5.0;
|
vec3 skyTEX = skyFromTex(np3,colortex4)/150.0 * 5.0;
|
||||||
background += skyTEX;
|
background += skyTEX;
|
||||||
// eclipse
|
|
||||||
// color *=max(1.0 - drawSun(dot(lightCol.a * WsunVec, (np3-0.0002)*1.001),0, vec3(1),vec3(0.0)),0.0);
|
|
||||||
|
|
||||||
|
|
||||||
vec4 cloud = texture2D_bicubic(colortex0,texcoord*CLOUDS_QUALITY);
|
vec4 cloud = texture2D_bicubic(colortex0,texcoord*CLOUDS_QUALITY);
|
||||||
if(eyeAltitude < 25000) background = background*cloud.a + cloud.rgb;
|
if(eyeAltitude < 25000) background = background*cloud.a + cloud.rgb;
|
||||||
|
|
||||||
gl_FragData[0].rgb = clamp(fp10Dither(background ,triangularize(noise)),0.0,65000.);
|
gl_FragData[0].rgb = clamp(fp10Dither(background ,triangularize(noise)),0.0,65000.);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}else{//land
|
}else{//land
|
||||||
|
|
||||||
////// ----- direct ----- //////
|
//////////////////////////////// ////////////////////////////////
|
||||||
|
//////////////////////////////// DIRECT LIGHTING ////////////////////////////////
|
||||||
|
//////////////////////////////// ////////////////////////////////
|
||||||
|
|
||||||
vec3 Direct_lighting = vec3(1.0);
|
vec3 Direct_lighting = vec3(1.0);
|
||||||
|
|
||||||
float Shadows = clamp(1.0 - filtered.b,0.0,1.0);
|
float Shadows = clamp(1.0 - filtered.b,0.0,1.0);
|
||||||
|
float SHADOWBLOCKERDEPTBH = filtered.y;
|
||||||
|
|
||||||
float NdotL = dot(slopednormal,WsunVec);
|
float NdotL = dot(slopednormal,WsunVec);
|
||||||
NdotL = clamp((-15 + NdotL*255.0) / 240.0 ,0.0,1.0);
|
NdotL = clamp((-15 + NdotL*255.0) / 240.0 ,0.0,1.0);
|
||||||
|
|
||||||
if (abs(filtered.y-0.1) < 0.0004 && !iswater) Shadows = clamp((lightmap.y-0.85)*25,0,1);
|
|
||||||
float SHADOWBLOCKERDEPTBH = filtered.y;
|
float shadowNDOTL = NdotL;
|
||||||
//if (abs(filtered.y-0.1) < 0.0004 && !iswater) SHADOWBLOCKERDEPTBH = 1.0-clamp((lightmap.y-0.85)*25,0,1);
|
#ifndef Variable_Penumbra_Shadows
|
||||||
|
shadowNDOTL += LabSSS;
|
||||||
|
#endif
|
||||||
|
|
||||||
vec3 SSS = vec3(0.0);
|
vec3 p3_shadow = mat3(gbufferModelViewInverse) * fragpos_handfix + gbufferModelViewInverse[3].xyz;
|
||||||
|
|
||||||
if (NdotL > 0.001) {
|
if(!hand) GriAndEminShadowFix(p3_shadow, viewToWorld(FlatNormals), vanilla_AO, lightmap.y, entities);
|
||||||
|
|
||||||
vec3 p3_shadow = mat3(gbufferModelViewInverse) * fragpos_handfix + gbufferModelViewInverse[3].xyz;
|
|
||||||
|
|
||||||
GriAndEminShadowFix(p3_shadow, viewToWorld(FlatNormals), normalAndAO.a, lightmap.y, entities);
|
|
||||||
|
|
||||||
|
|
||||||
vec3 projectedShadowPosition = mat3(shadowModelView) * p3_shadow + shadowModelView[3].xyz;
|
|
||||||
projectedShadowPosition = diagonal3(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz;
|
|
||||||
|
|
||||||
//apply distortion
|
|
||||||
float distortFactor = calcDistort(projectedShadowPosition.xy);
|
|
||||||
projectedShadowPosition.xy *= distortFactor;
|
|
||||||
// Shadows = 0.0;
|
|
||||||
vec3 shadew = projectedShadowPosition.xyz;
|
|
||||||
//do shadows only if on shadow map
|
|
||||||
if (abs(shadew.x) < 1.0-1.5/shadowMapResolution && abs(shadew.y) < 1.0-1.5/shadowMapResolution && abs(shadew.z) < 6.0){
|
|
||||||
|
|
||||||
float diffthresh = 0.0;
|
vec3 projectedShadowPosition = mat3(shadowModelView) * p3_shadow + shadowModelView[3].xyz;
|
||||||
// if(hand && eyeBrightness.y/240. > 0.0) diffthresh = 0.0003;
|
projectedShadowPosition = diagonal3(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz;
|
||||||
|
|
||||||
projectedShadowPosition = projectedShadowPosition * vec3(0.5,0.5,0.5/6.0) + vec3(0.5);
|
//apply distortion
|
||||||
|
float distortFactor = calcDistort(projectedShadowPosition.xy);
|
||||||
|
projectedShadowPosition.xy *= distortFactor;
|
||||||
|
|
||||||
|
//do shadows only if on shadow map
|
||||||
|
if (abs(projectedShadowPosition.x) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.y) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.z) < 6.0){
|
||||||
|
if (shadowNDOTL > 0.001){
|
||||||
Shadows = 0.0;
|
Shadows = 0.0;
|
||||||
float rdMul = filtered.x*distortFactor*d0*k/shadowMapResolution;
|
projectedShadowPosition = projectedShadowPosition * vec3(0.5,0.5,0.5/6.0) + vec3(0.5);
|
||||||
|
|
||||||
for(int i = 0; i < SHADOW_FILTER_SAMPLE_COUNT; i++){
|
#ifdef BASIC_SHADOW_FILTER
|
||||||
// if(hand) noise = 0.0;
|
float rdMul = filtered.x*distortFactor*d0*k/shadowMapResolution;
|
||||||
vec2 offsetS = tapLocation(i,SHADOW_FILTER_SAMPLE_COUNT,1.618,noise,0.0);
|
|
||||||
float weight = 1.0+(i+noise)*rdMul/SHADOW_FILTER_SAMPLE_COUNT*shadowMapResolution;
|
for(int i = 0; i < SHADOW_FILTER_SAMPLE_COUNT; i++){
|
||||||
float isShadow = shadow2D(shadow,vec3(projectedShadowPosition + vec3(rdMul*offsetS,-diffthresh*weight))).x;
|
vec2 offsetS = tapLocation(i,SHADOW_FILTER_SAMPLE_COUNT,1.618,noise,0.0);
|
||||||
Shadows += isShadow/SHADOW_FILTER_SAMPLE_COUNT;
|
|
||||||
}
|
float isShadow = shadow2D(shadow,projectedShadowPosition + vec3(rdMul*offsetS, 0.0) ).x;
|
||||||
|
Shadows += isShadow/SHADOW_FILTER_SAMPLE_COUNT;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
Shadows = shadow2D(shadow, projectedShadowPosition).x;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
shadowmapindicator = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Variable_Penumbra_Shadows
|
bool outsideShadowMap = shadowmapindicator < 1;
|
||||||
|
|
||||||
|
if(outsideShadowMap && !iswater) Shadows = clamp((lightmap.y-0.8) * 5,0,1);
|
||||||
|
|
||||||
float sunSSS_density = LabSSS;
|
|
||||||
|
|
||||||
#ifndef RENDER_ENTITY_SHADOWS
|
|
||||||
if(entities) sunSSS_density = 0.0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
//////////////////////////////// SUN SSS ////////////////////////////////
|
||||||
|
vec3 SSS = vec3(0.0);
|
||||||
|
|
||||||
SSS = SubsurfaceScattering_sun(albedo, SHADOWBLOCKERDEPTBH, sunSSS_density, clamp(dot(np3, WsunVec),0.0,1.0)) ;
|
#ifndef Variable_Penumbra_Shadows
|
||||||
SSS *= DirectLightColor;
|
if(LabSSS > 0 ) {
|
||||||
if (isEyeInWater == 0) SSS *= lightleakfix; // light leak fix
|
SHADOWBLOCKERDEPTBH = pow(1.0 - Shadows,2);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!hand){
|
|
||||||
|
|
||||||
if (abs(filtered.y-0.1) < 0.0004 && LabSSS < 0.0 ) SSS = vec3(0.0);
|
|
||||||
|
|
||||||
#ifdef SCREENSPACE_CONTACT_SHADOWS
|
|
||||||
|
|
||||||
vec3 vec = lightCol.a*sunVec;
|
|
||||||
float screenShadow = rayTraceShadow(vec, fragpos_rtshadow, interleaved_gradientNoise());
|
|
||||||
screenShadow *= screenShadow ;
|
|
||||||
|
|
||||||
#ifdef Variable_Penumbra_Shadows
|
|
||||||
Shadows = min(screenShadow, Shadows + luma(SSS));
|
|
||||||
if (abs(filtered.y-0.1) < 0.0004 ) SSS *= vec3(Shadows);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef Variable_Penumbra_Shadows
|
#if SSS_TYPE != 0
|
||||||
SSS *= 1.0-NdotL*Shadows;
|
|
||||||
|
if (outsideShadowMap) SHADOWBLOCKERDEPTBH = 0.0;
|
||||||
|
|
||||||
|
float sunSSS_density = LabSSS;
|
||||||
|
|
||||||
|
#ifndef RENDER_ENTITY_SHADOWS
|
||||||
|
if(entities) sunSSS_density = 0.0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
SSS = SubsurfaceScattering_sun(albedo, SHADOWBLOCKERDEPTBH, sunSSS_density, clamp(dot(np3, WsunVec),0.0,1.0)) ;
|
||||||
|
SSS *= DirectLightColor;
|
||||||
|
|
||||||
|
if (isEyeInWater == 0) SSS *= lightleakfix; // light leak fix
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!hand){
|
||||||
|
#ifdef SCREENSPACE_CONTACT_SHADOWS
|
||||||
|
float screenShadow = rayTraceShadow(lightCol.a*sunVec, fragpos_rtshadow, interleaved_gradientNoise());
|
||||||
|
screenShadow *= screenShadow;
|
||||||
|
|
||||||
|
Shadows = min(screenShadow, Shadows);
|
||||||
|
|
||||||
|
if (outsideShadowMap) SSS *= Shadows;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#if SSS_TYPE != 0
|
||||||
|
SSS *= 1.0-clamp(NdotL*Shadows,0,1);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef VOLUMETRIC_CLOUDS
|
#ifdef VOLUMETRIC_CLOUDS
|
||||||
#ifdef CLOUDS_SHADOWS
|
#ifdef CLOUDS_SHADOWS
|
||||||
cloudShadow = GetCloudShadow(p3);
|
cloudShadow = GetCloudShadow(p3);
|
||||||
@ -976,14 +989,14 @@ void main() {
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
////// ----- indirect ----- //////
|
//////////////////////////////// ////////////////////////////////
|
||||||
|
//////////////////////////////// INDIRECT LIGHTING ////////////////////////////////
|
||||||
|
//////////////////////////////// ////////////////////////////////
|
||||||
|
|
||||||
vec3 Indirect_lighting = vec3(1.0);
|
vec3 Indirect_lighting = vec3(1.0);
|
||||||
|
|
||||||
// float cloudOcclusion = GetCloudShadow_occluson(p3 + cameraPosition);
|
// float skylight = clamp(abs(ambientCoefs.y + 1.0),0.35,2.0);
|
||||||
// AmbientLightColor *= cloudOcclusion*0.5+.5;
|
float skylight = clamp(ambientCoefs.y + 0.5,0.25,2.0);
|
||||||
|
|
||||||
float skylight = clamp(abs(ambientCoefs.y + 1.0),0.35,2.0);
|
|
||||||
|
|
||||||
#if indirect_effect == 2 || indirect_effect == 3 || indirect_effect == 4
|
#if indirect_effect == 2 || indirect_effect == 3 || indirect_effect == 4
|
||||||
if (!hand) skylight = 1.0;
|
if (!hand) skylight = 1.0;
|
||||||
@ -991,39 +1004,31 @@ void main() {
|
|||||||
|
|
||||||
// do this to make underwater shading easier.
|
// do this to make underwater shading easier.
|
||||||
vec2 newLightmap = lightmap.xy;
|
vec2 newLightmap = lightmap.xy;
|
||||||
|
|
||||||
if((isEyeInWater == 0 && iswater) || (isEyeInWater == 1 && !iswater)) newLightmap.y = clamp(newLightmap.y,0,1);
|
if((isEyeInWater == 0 && iswater) || (isEyeInWater == 1 && !iswater)) newLightmap.y = clamp(newLightmap.y,0,1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef ambientSSS_view
|
#ifndef ambientSSS_view
|
||||||
Indirect_lighting = DoAmbientLighting(AmbientLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), newLightmap.xy, skylight);
|
Indirect_lighting = DoAmbientLighting(AmbientLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), newLightmap.xy, skylight);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
vec3 AO = vec3(1.0);
|
vec3 AO = vec3(1.0);
|
||||||
vec3 debug = vec3(0.0);
|
vec3 debug = vec3(0.0);
|
||||||
|
|
||||||
// vanilla AO
|
// vanilla AO
|
||||||
#if indirect_effect == 0
|
#if indirect_effect == 0
|
||||||
// AO = vec3(mix(1.0 - exp2(-5 * pow(1-vanilla_AO,3)), 1.0, pow(newLightmap.x,4))) ;
|
|
||||||
AO = vec3( exp( (vanilla_AO*vanilla_AO) * -5) ) ;
|
AO = vec3( exp( (vanilla_AO*vanilla_AO) * -5) ) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// SSAO + vanilla AO
|
// SSAO + vanilla AO
|
||||||
#if indirect_effect == 1
|
#if indirect_effect == 1
|
||||||
// AO *= mix(1.0 - exp2(-5 * pow(1-vanilla_AO,3)),1.0, pow(newLightmap.x,4));
|
|
||||||
|
|
||||||
AO = vec3( exp( (vanilla_AO*vanilla_AO) * -3) ) ;
|
AO = vec3( exp( (vanilla_AO*vanilla_AO) * -3) ) ;
|
||||||
if (!hand) ssAO(AO, SkySSS, fragpos, 1.0, blueNoise(gl_FragCoord.xy).rg, FlatNormals , texcoord, ambientCoefs, newLightmap.xy, isLeaf);
|
if (!hand) ssAO(AO, SkySSS, fragpos, 1.0, blueNoise(gl_FragCoord.xy).rg, FlatNormals , texcoord, ambientCoefs, newLightmap.xy, isLeaf);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// GTAO
|
// GTAO
|
||||||
#if indirect_effect == 2
|
#if indirect_effect == 2
|
||||||
int seed = (frameCounter%40000);
|
int seed = (frameCounter%40000);
|
||||||
vec2 r2 = fract(R2_samples(seed) + blueNoise(gl_FragCoord.xy).rg);
|
vec2 r2 = fract(R2_samples(seed) + blueNoise(gl_FragCoord.xy).rg);
|
||||||
if (!hand) AO = ambient_occlusion(vec3(texcoord/RENDER_SCALE-vec2(tempOffset)*texelSize*0.5,z), fragpos, worldToView(slopednormal), r2, debug) * vec3(1.0);
|
if (!hand) AO = ambient_occlusion(vec3(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5,z), fragpos, worldToView(slopednormal), r2, debug) * vec3(1.0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// RTAO
|
// RTAO
|
||||||
@ -1040,36 +1045,47 @@ void main() {
|
|||||||
AO = mix(AO,vec3(1.0), min(NdotL*Shadows,1.0));
|
AO = mix(AO,vec3(1.0), min(NdotL*Shadows,1.0));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Indirect_lighting *= AO;
|
//////////////////////////////// SKY SSS ////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
vec3 SSS_forSky = vec3(0.0);
|
|
||||||
|
|
||||||
#ifdef Ambient_SSS
|
#ifdef Ambient_SSS
|
||||||
if (!hand){
|
if (!hand){
|
||||||
|
vec3 SSS_forSky = vec3(0.0);
|
||||||
|
|
||||||
#if indirect_effect != 1
|
#if indirect_effect != 1
|
||||||
ScreenSpace_SSS(SkySSS, fragpos, blueNoise(gl_FragCoord.xy).rg, FlatNormals, isLeaf);
|
ScreenSpace_SSS(SkySSS, fragpos, blueNoise(gl_FragCoord.xy).rg, FlatNormals, isLeaf);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
vec3 ambientColor = ((AmbientLightColor * 2.0 * ambient_brightness) * 8./150./3.) * 1.25;
|
||||||
|
float lightmap = pow(newLightmap.y,3);
|
||||||
|
float uplimit = clamp(1.0-pow(clamp(ambientCoefs.y + 0.5,0.0,1.0),2),0,1);
|
||||||
|
|
||||||
SSS_forSky = SubsurfaceScattering_sky(albedo, SkySSS, LabSSS);
|
SSS_forSky = SubsurfaceScattering_sky(albedo, SkySSS, LabSSS);
|
||||||
SSS_forSky *= (AmbientLightColor* 2.0 * ambient_brightness) * 8./150.;
|
SSS_forSky *= ambientColor;
|
||||||
SSS_forSky *= pow(newLightmap.y,3);
|
SSS_forSky *= lightmap;
|
||||||
// SSS_forSky *= pow(1.0-clamp(abs(ambientCoefs.y+0.5),0.0,1.0),0.1);
|
SSS_forSky *= uplimit;
|
||||||
|
|
||||||
SSS += SSS_forSky * pow(1.0-clamp(abs(ambientCoefs.y+0.5),0.0,1.0),0.1); // Indirect_lighting += SubsurfaceScattering_sky(albedo, SkySSS, LabSSS) * ((AmbientLightColor* 2.0 * ambient_brightness)* 8./150.) * pow(newLightmap.y,3);
|
// Combine with the other SSS
|
||||||
|
SSS += SSS_forSky;
|
||||||
|
|
||||||
|
SSS_forSky = vec3((1.0 - SkySSS) * LabSSS);
|
||||||
|
SSS_forSky *= ambientColor;
|
||||||
|
SSS_forSky *= lightmap;
|
||||||
|
|
||||||
|
////light up dark parts so its more visible
|
||||||
|
Indirect_lighting = max(Indirect_lighting, SSS_forSky);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Indirect_lighting = max(Indirect_lighting, SSS_forSky);
|
Indirect_lighting *= AO;
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////// ////////////////////////////////
|
||||||
|
//////////////////////////////// UNDER WATER SHADING ////////////////////////////////
|
||||||
////// ----- Under Water Shading ----- //////
|
//////////////////////////////// ////////////////////////////////
|
||||||
|
|
||||||
vec3 waterabsorb_speculars = vec3(1);
|
vec3 waterabsorb_speculars = vec3(1);
|
||||||
if ((isEyeInWater == 0 && iswater) || (isEyeInWater == 1 && !iswater)){
|
if ((isEyeInWater == 0 && iswater) || (isEyeInWater == 1 && !iswater)){
|
||||||
|
|
||||||
vec3 fragpos0 = toScreenSpace(vec3(texcoord/RENDER_SCALE-vec2(tempOffset)*texelSize*0.5,z0));
|
vec3 fragpos0 = toScreenSpace(vec3(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5,z0));
|
||||||
float Vdiff = distance(fragpos,fragpos0);
|
float Vdiff = distance(fragpos,fragpos0);
|
||||||
float VdotU = np3.y;
|
float VdotU = np3.y;
|
||||||
float estimatedDepth = Vdiff * abs(VdotU); //assuming water plane
|
float estimatedDepth = Vdiff * abs(VdotU); //assuming water plane
|
||||||
@ -1101,8 +1117,9 @@ void main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////// ////////////////////////////////
|
||||||
////// ----- Finalize ----- //////
|
//////////////////////////////// FINALIZE ////////////////////////////////
|
||||||
|
//////////////////////////////// ////////////////////////////////
|
||||||
|
|
||||||
#ifdef Seasons
|
#ifdef Seasons
|
||||||
#ifdef Snowy_Winter
|
#ifdef Snowy_Winter
|
||||||
@ -1131,8 +1148,7 @@ void main() {
|
|||||||
|
|
||||||
|
|
||||||
Direct_lighting = DoDirectLighting(DirectLightColor, Shadows, NdotL, 0.0);
|
Direct_lighting = DoDirectLighting(DirectLightColor, Shadows, NdotL, 0.0);
|
||||||
|
|
||||||
//combine all light sources
|
|
||||||
vec3 FINAL_COLOR = Indirect_lighting + Direct_lighting + SSS;
|
vec3 FINAL_COLOR = Indirect_lighting + Direct_lighting + SSS;
|
||||||
|
|
||||||
#ifndef ambientSSS_view
|
#ifndef ambientSSS_view
|
||||||
@ -1143,29 +1159,29 @@ void main() {
|
|||||||
MaterialReflections(FINAL_COLOR, SpecularTex.r, SpecularTex.ggg, albedo, WsunVec, (Shadows*NdotL)*DirectLightColor, lightmap.y, slopednormal, np3, fragpos, vec3(blueNoise(gl_FragCoord.xy).rg, interleaved_gradientNoise()), hand, entities);
|
MaterialReflections(FINAL_COLOR, SpecularTex.r, SpecularTex.ggg, albedo, WsunVec, (Shadows*NdotL)*DirectLightColor, lightmap.y, slopednormal, np3, fragpos, vec3(blueNoise(gl_FragCoord.xy).rg, interleaved_gradientNoise()), hand, entities);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LabEmission(FINAL_COLOR, albedo, SpecularTex.a);
|
Emission(FINAL_COLOR, albedo, SpecularTex.a);
|
||||||
|
|
||||||
|
|
||||||
if(lightningBolt) FINAL_COLOR.rgb += vec3(Lightning_R,Lightning_G,Lightning_B) * 255.0;
|
if(lightningBolt) FINAL_COLOR.rgb += vec3(Lightning_R,Lightning_G,Lightning_B) * 255.0;
|
||||||
|
|
||||||
|
gl_FragData[0].rgb = FINAL_COLOR;
|
||||||
|
|
||||||
gl_FragData[0].rgb = FINAL_COLOR ;
|
|
||||||
// if(LabSSS > 0.0) gl_FragData[0].rgb = vec3(0,25,0);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
////// ----- Under Water Fog ----- //////
|
|
||||||
|
//////////////////////////////// ////////////////////////////////
|
||||||
|
//////////////////////////////// UNDERWATER FOG ////////////////////////////////
|
||||||
|
//////////////////////////////// ////////////////////////////////
|
||||||
|
|
||||||
if (iswater){
|
if (iswater){
|
||||||
vec3 fragpos0 = toScreenSpace(vec3(texcoord/RENDER_SCALE-vec2(tempOffset)*texelSize*0.5,z0));
|
vec3 fragpos0 = toScreenSpace(vec3(texcoord/RENDER_SCALE-TAA_Offset*texelSize*0.5,z0));
|
||||||
float Vdiff = distance(fragpos,fragpos0);
|
float Vdiff = distance(fragpos,fragpos0);
|
||||||
float VdotU = np3.y;
|
float VdotU = np3.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
|
||||||
|
|
||||||
float custom_lightmap_T = pow(texture2D(colortex14, texcoord).a,1.5);
|
float custom_lightmap_T = pow(texture2D(colortex14, texcoord).a,3.0);
|
||||||
|
|
||||||
vec3 ambientColVol = (averageSkyCol_Clouds*8./150./1.5) * max(custom_lightmap_T,MIN_LIGHT_AMOUNT*0.0015);
|
vec3 ambientColVol = (averageSkyCol_Clouds*8./150./2.) * max(custom_lightmap_T,MIN_LIGHT_AMOUNT*0.0015);
|
||||||
vec3 lightColVol = (lightCol.rgb / 80.);
|
vec3 lightColVol = DirectLightColor;
|
||||||
|
|
||||||
if (isEyeInWater == 0) waterVolumetrics(gl_FragData[0].rgb, fragpos0, fragpos, estimatedDepth , estimatedSunDepth, Vdiff, noise, totEpsilon, scatterCoef, ambientColVol, lightColVol, dot(np3, WsunVec));
|
if (isEyeInWater == 0) waterVolumetrics(gl_FragData[0].rgb, fragpos0, fragpos, estimatedDepth , estimatedSunDepth, Vdiff, noise, totEpsilon, scatterCoef, ambientColVol, lightColVol, dot(np3, WsunVec));
|
||||||
}
|
}
|
||||||
|
@ -54,15 +54,7 @@ flat varying float WinterTimeForSnow;
|
|||||||
void main() {
|
void main() {
|
||||||
gl_Position = ftransform();
|
gl_Position = ftransform();
|
||||||
|
|
||||||
#ifdef TAA_UPSCALING
|
|
||||||
gl_Position.xy = (gl_Position.xy*0.5+0.5)*RENDER_SCALE*2.0-1.0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
tempOffsets = HaltonSeq2(frameCounter%10000);
|
|
||||||
TAA_Offset = offsets[frameCounter%8];
|
|
||||||
#ifndef TAA
|
|
||||||
TAA_Offset = vec2(0.0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(0,37),0).rgb;
|
averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(0,37),0).rgb;
|
||||||
// averageSkyCol = texelFetch2D(colortex4,ivec2(1,37),0).rgb;
|
// averageSkyCol = texelFetch2D(colortex4,ivec2(1,37),0).rgb;
|
||||||
@ -87,4 +79,18 @@ void main() {
|
|||||||
YearCycleColor(color1, color2, WinterTimeForSnow);
|
YearCycleColor(color1, color2, WinterTimeForSnow);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TAA_Offset = offsets[frameCounter%8];
|
||||||
|
|
||||||
|
#ifndef TAA
|
||||||
|
TAA_Offset = vec2(0.0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef TAA_UPSCALING
|
||||||
|
gl_Position.xy = (gl_Position.xy*0.5+0.5)*RENDER_SCALE*2.0-1.0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@ uniform sampler2D colortex5;
|
|||||||
uniform sampler2D colortex3;
|
uniform sampler2D colortex3;
|
||||||
// uniform sampler2D colortex6;
|
// uniform sampler2D colortex6;
|
||||||
uniform sampler2D colortex7;
|
uniform sampler2D colortex7;
|
||||||
// uniform sampler2D colortex10;
|
|
||||||
// uniform sampler2D colortex8; // specular
|
// uniform sampler2D colortex8; // specular
|
||||||
// uniform sampler2D colortex9; // specular
|
// uniform sampler2D colortex9; // specular
|
||||||
uniform sampler2D depthtex0;
|
uniform sampler2D depthtex0;
|
||||||
@ -67,10 +66,6 @@ float ld(float depth) {
|
|||||||
return (2.0 * near) / (far + near - depth * (far - near)); // (-depth * (far - near)) = (2.0 * near)/ld - far - near
|
return (2.0 * near) / (far + near - depth * (far - near)); // (-depth * (far - near)) = (2.0 * near)/ld - far - near
|
||||||
}
|
}
|
||||||
|
|
||||||
// blindness fogs
|
|
||||||
uniform float blindness;
|
|
||||||
uniform float darknessFactor;
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
/* DRAWBUFFERS:7 */
|
/* DRAWBUFFERS:7 */
|
||||||
float vignette = (1.5-dot(texcoord-0.5,texcoord-0.5)*2.);
|
float vignette = (1.5-dot(texcoord-0.5,texcoord-0.5)*2.);
|
||||||
@ -127,14 +122,6 @@ void main() {
|
|||||||
float rodCurve = mix(1.0, rodLum/(2.5+rodLum), purkinje);
|
float rodCurve = mix(1.0, rodLum/(2.5+rodLum), purkinje);
|
||||||
col = mix(clamp(lum,0.0,0.05)*Purkinje_Multiplier*vec3(Purkinje_R, Purkinje_G, Purkinje_B)+1.5e-3, col, rodCurve);
|
col = mix(clamp(lum,0.0,0.05)*Purkinje_Multiplier*vec3(Purkinje_R, Purkinje_G, Purkinje_B)+1.5e-3, col, rodCurve);
|
||||||
|
|
||||||
// #ifdef display_LUT
|
|
||||||
// vec2 movedTC = texcoord ;
|
|
||||||
// if(movedTC.x < 0.4 ) col.rgb = texture2D(colortex4,movedTC/2).rgb * 0.001;
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef USE_ACES_COLORSPACE_APPROXIMATION
|
#ifndef USE_ACES_COLORSPACE_APPROXIMATION
|
||||||
col = LinearTosRGB(TONEMAP(col));
|
col = LinearTosRGB(TONEMAP(col));
|
||||||
#else
|
#else
|
||||||
|
@ -310,7 +310,8 @@ void main() {
|
|||||||
float estEyeDepth = clamp((14.0-eyeBrightnessSmooth.y/255.0*16.0)/14.0,0.,1.0);
|
float estEyeDepth = clamp((14.0-eyeBrightnessSmooth.y/255.0*16.0)/14.0,0.,1.0);
|
||||||
estEyeDepth *= estEyeDepth*estEyeDepth*34.0;
|
estEyeDepth *= estEyeDepth*estEyeDepth*34.0;
|
||||||
|
|
||||||
vec3 ambientColVol = averageSkyCol_Clouds*8./150./1.5;
|
|
||||||
|
vec3 ambientColVol = averageSkyCol_Clouds*8./150./2.0;
|
||||||
vec3 lightColVol = (lightCol.rgb / 80.);
|
vec3 lightColVol = (lightCol.rgb / 80.);
|
||||||
estEyeDepth = max(Water_Top_Layer - cameraPosition.y,0.0);
|
estEyeDepth = max(Water_Top_Layer - cameraPosition.y,0.0);
|
||||||
|
|
||||||
|
@ -22,18 +22,19 @@ const int colortex4Format = RGBA16F; //light values and skyboxes (everything)
|
|||||||
|
|
||||||
|
|
||||||
const int colortex6Format = R11F_G11F_B10F; //additionnal buffer for bloom (composite3->final)
|
const int colortex6Format = R11F_G11F_B10F; //additionnal buffer for bloom (composite3->final)
|
||||||
const int colortex7Format = RGBA8; //Final output, transparencies id (gbuffer->composite4)
|
const int colortex7Format = RGBA8; //Final output, transparencies id (gbuffer->composite4)
|
||||||
const int colortex8Format = RGBA16F; //Final output, transparencies id (gbuffer->composite4)
|
const int colortex8Format = RGBA16F; //Final output, transparencies id (gbuffer->composite4)
|
||||||
const int colortex9Format = RGBA8; //Final output, transparencies id (gbuffer->composite4)
|
const int colortex9Format = RGBA8; //Final output, transparencies id (gbuffer->composite4)
|
||||||
const int colortex10Format = RGBA16F; //Final output, transparencies id (gbuffer->composite4)
|
const int colortex10Format = RGBA16F; //FREE BUFFER
|
||||||
|
|
||||||
const int colortex11Format = RGBA16; //Final output, transparencies id (gbuffer->composite4)
|
const int colortex11Format = RGBA16;
|
||||||
const int colortex13Format = RGBA8; //Final output, transparencies id (gbuffer->composite4)
|
const int colortex13Format = RGBA8;
|
||||||
const int colortex14Format = RGBA8; // Final output, transparencies id (gbuffer->composite4)
|
const int colortex14Format = RGBA8;
|
||||||
const int colortex15Format = RGBA8; // flat normals and vanilla AO
|
const int colortex15Format = RGBA8; // flat normals and vanilla AO
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//no need to clear the buffers, saves a few fps
|
//no need to clear the buffers, saves a few fps
|
||||||
|
|
||||||
/*
|
/*
|
||||||
const bool colortex0Clear = false;
|
const bool colortex0Clear = false;
|
||||||
const bool colortex1Clear = false;
|
const bool colortex1Clear = false;
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
### all the different strengths of subsurface scattering and what entities to put them on.
|
### all the different strengths of subsurface scattering and what entities to put them on.
|
||||||
#medium sss (same as strong sss for blocks)
|
#medium sss (same as strong sss for blocks)
|
||||||
entity.1100 = slime giant ender_dragon ghast sheep
|
entity.1100 = slime giant ghast
|
||||||
|
|
||||||
#weak sss (same as weak sss for blocks)
|
#weak sss (same as weak sss for blocks)
|
||||||
entity.1200 = player frog chicken snow_golem polar_bear zombie_horse armor_stand arrow squid bat cat cod cow donkey fox horse mooshroom mule ocelot parrot pig piglin polar_bear pufferfish rabbit salmon strider tropical_fish turtle villager wandering_trader bee cave_spider dolphin enderman llama panda spider wolf zombified_piglin blaze creeper drowned endermite evoker guardian hoglin husk magma_cube phantom piglin_brute pillager ravager silverfish stray vex vindicator witch zoglin zombie zombie_villager wither trader_llama
|
entity.1200 = ender_dragon player sheep frog chicken snow_golem polar_bear zombie_horse armor_stand arrow squid bat cat cod cow donkey fox horse mooshroom mule ocelot parrot pig piglin polar_bear pufferfish rabbit salmon strider tropical_fish turtle villager wandering_trader bee cave_spider dolphin enderman llama panda spider wolf zombified_piglin blaze creeper drowned endermite evoker guardian hoglin husk magma_cube phantom piglin_brute pillager ravager silverfish stray vex vindicator witch zoglin zombie zombie_villager wither trader_llama
|
||||||
|
|
||||||
|
|
||||||
# various stuff
|
# various stuff
|
||||||
|
@ -128,5 +128,5 @@ void main() {
|
|||||||
|
|
||||||
applyContrast(FINAL_COLOR, CONTRAST); // for fun
|
applyContrast(FINAL_COLOR, CONTRAST); // for fun
|
||||||
|
|
||||||
gl_FragColor.rgb = FINAL_COLOR;
|
gl_FragColor.rgb = FINAL_COLOR ;
|
||||||
}
|
}
|
||||||
|
@ -541,7 +541,16 @@ void main() {
|
|||||||
if(SpecularTex.g < 229.5/255.0) Albedo.rgb = mix(Albedo.rgb, vec3(0), Puddle_shape*porosity);
|
if(SpecularTex.g < 229.5/255.0) Albedo.rgb = mix(Albedo.rgb, vec3(0), Puddle_shape*porosity);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
vec4 data1 = clamp( encode(viewToWorld(normal), (blueNoise()*vec2(torchlightmap,lmtexcoord.w) / (30.0 * (1+ (1-RENDER_SCALE.x))) ) + vec2(torchlightmap,lmtexcoord.w)), 0.0, 1.0);
|
// apply noise to lightmaps to reduce banding.
|
||||||
|
vec2 PackLightmaps = vec2(torchlightmap,lmtexcoord.w);
|
||||||
|
|
||||||
|
#ifndef ENTITIES
|
||||||
|
#ifndef HAND
|
||||||
|
PackLightmaps = max(PackLightmaps*blueNoise()*0.05 + PackLightmaps,0.0);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
vec4 data1 = clamp( encode(viewToWorld(normal),PackLightmaps), 0.0, 1.0);
|
||||||
|
|
||||||
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));
|
||||||
|
|
||||||
@ -556,6 +565,6 @@ void main() {
|
|||||||
// gl_FragData[5].xyz = velocity *0.5+0.5;
|
// gl_FragData[5].xyz = velocity *0.5+0.5;
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
gl_FragData[3] = vec4(FlatNormals * 0.5 + 0.5,VanillaAO);
|
gl_FragData[3] = vec4(FlatNormals * 0.5 + 0.5, VanillaAO);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
@ -86,6 +86,7 @@ const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.),
|
|||||||
vec2(-7.,-1.)/8.,
|
vec2(-7.,-1.)/8.,
|
||||||
vec2(3,7.)/8.,
|
vec2(3,7.)/8.,
|
||||||
vec2(7.,-7.)/8.);
|
vec2(7.,-7.)/8.);
|
||||||
|
|
||||||
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
|
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
|
||||||
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
|
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
|
||||||
vec4 toClipSpace3(vec3 viewSpacePosition) {
|
vec4 toClipSpace3(vec3 viewSpacePosition) {
|
||||||
|
@ -505,6 +505,6 @@ if (gl_FragCoord.x * texelSize.x < RENDER_SCALE.x && gl_FragCoord.y * texelSize
|
|||||||
gl_FragData[1] = vec4(Albedo,iswater);
|
gl_FragData[1] = vec4(Albedo,iswater);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gl_FragData[3].a = lmtexcoord.w;
|
gl_FragData[3].a = max(lmtexcoord.w*blueNoise()*0.05 + lmtexcoord.w,0.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -120,6 +120,7 @@ const float shadowDistanceRenderMul = -1.0; // [-1.0 1.0]
|
|||||||
#define Max_Shadow_Filter_Radius 30.0 // [0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0 42.0 43.0 44.0 45.0 46.0 47.0 48.0 49.0 50.0 51.0 52.0 53.0 54.0 55.0 56.0 57.0 58.0 59.0 60.0 61.0 62.0 63.0 64.0 65.0 66.0 67.0 68.0 69.0 70.0 71.0 72.0 73.0 74.0 75.0 76.0 77.0 78.0 79.0 80.0 81.0 82.0 83.0 84.0 85.0 86.0 87.0 88.0 89.0 90.0 91.0 92.0 93.0 94.0 95.0 96.0 97.0 98.0 99.0 100.0 101.0 102.0 103.0 104.0 105.0 106.0 107.0 108.0 109.0 110.0 111.0 112.0 113.0 114.0 115.0 116.0 117.0 118.0 119.0 ]
|
#define Max_Shadow_Filter_Radius 30.0 // [0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0 42.0 43.0 44.0 45.0 46.0 47.0 48.0 49.0 50.0 51.0 52.0 53.0 54.0 55.0 56.0 57.0 58.0 59.0 60.0 61.0 62.0 63.0 64.0 65.0 66.0 67.0 68.0 69.0 70.0 71.0 72.0 73.0 74.0 75.0 76.0 77.0 78.0 79.0 80.0 81.0 82.0 83.0 84.0 85.0 86.0 87.0 88.0 89.0 90.0 91.0 92.0 93.0 94.0 95.0 96.0 97.0 98.0 99.0 100.0 101.0 102.0 103.0 104.0 105.0 106.0 107.0 108.0 109.0 110.0 111.0 112.0 113.0 114.0 115.0 116.0 117.0 118.0 119.0 ]
|
||||||
#define Max_Filter_Depth 20.0 // [0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0 42.0 43.0 44.0 45.0 46.0 47.0 48.0 49.0 50.0 51.0 52.0 53.0 54.0 55.0 56.0 57.0 58.0 59.0 60.0 61.0 62.0 63.0 64.0 65.0 66.0 67.0 68.0 69.0 70.0 71.0 72.0 73.0 74.0 75.0 76.0 77.0 78.0 79.0 80.0 81.0 82.0 83.0 84.0 85.0 86.0 87.0 88.0 89.0 90.0 91.0 92.0 93.0 94.0 95.0 96.0 97.0 98.0 99.0 100.0 101.0 102.0 103.0 104.0 105.0 106.0 107.0 108.0 109.0 110.0 111.0 112.0 113.0 114.0 115.0 116.0 117.0 118.0 119.0 ]
|
#define Max_Filter_Depth 20.0 // [0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0 32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0 42.0 43.0 44.0 45.0 46.0 47.0 48.0 49.0 50.0 51.0 52.0 53.0 54.0 55.0 56.0 57.0 58.0 59.0 60.0 61.0 62.0 63.0 64.0 65.0 66.0 67.0 68.0 69.0 70.0 71.0 72.0 73.0 74.0 75.0 76.0 77.0 78.0 79.0 80.0 81.0 82.0 83.0 84.0 85.0 86.0 87.0 88.0 89.0 90.0 91.0 92.0 93.0 94.0 95.0 96.0 97.0 98.0 99.0 100.0 101.0 102.0 103.0 104.0 105.0 106.0 107.0 108.0 109.0 110.0 111.0 112.0 113.0 114.0 115.0 116.0 117.0 118.0 119.0 ]
|
||||||
|
|
||||||
|
#define BASIC_SHADOW_FILTER
|
||||||
#define SHADOW_FILTER_SAMPLE_COUNT 13 // [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 ]
|
#define SHADOW_FILTER_SAMPLE_COUNT 13 // [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 ]
|
||||||
#define SHADOW_DISABLE_ALPHA_MIPMAPS
|
#define SHADOW_DISABLE_ALPHA_MIPMAPS
|
||||||
#define Stochastic_Transparent_Shadows
|
#define Stochastic_Transparent_Shadows
|
||||||
|
@ -192,6 +192,7 @@ vec3 SampleVNDFGGX(
|
|||||||
// This gives the normal on the hemisphere
|
// This gives the normal on the hemisphere
|
||||||
// xonk note, i added those magic numbers huhuhuh
|
// xonk note, i added those magic numbers huhuhuh
|
||||||
vec3 halfway = reflected*0.5 + viewerDirection*1.5;
|
vec3 halfway = reflected*0.5 + viewerDirection*1.5;
|
||||||
|
// vec3 halfway = reflected + viewerDirection;
|
||||||
|
|
||||||
// Transform the halfway direction back to hemiellispoid configuation
|
// Transform the halfway direction back to hemiellispoid configuation
|
||||||
// This gives the final sampled normal
|
// This gives the final sampled normal
|
||||||
|
@ -69,7 +69,7 @@ screen = [Direct_Light] [World] [Ambient_light] [Fog] [Post_Processing] [Clouds]
|
|||||||
screen.Subsurface_Scattering = SSS_TYPE LabSSS_Curve <empty> MISC_BLOCK_SSS MOB_SSS <empty> Ambient_SSS ambientsss_brightness
|
screen.Subsurface_Scattering = SSS_TYPE LabSSS_Curve <empty> MISC_BLOCK_SSS MOB_SSS <empty> Ambient_SSS ambientsss_brightness
|
||||||
|
|
||||||
screen.Filtering.columns=1
|
screen.Filtering.columns=1
|
||||||
screen.Filtering = SHADOW_FILTER_SAMPLE_COUNT Min_Shadow_Filter_Radius <empty> Variable_Penumbra_Shadows VPS_Search_Samples Max_Shadow_Filter_Radius Max_Filter_Depth
|
screen.Filtering = BASIC_SHADOW_FILTER SHADOW_FILTER_SAMPLE_COUNT Min_Shadow_Filter_Radius <empty> Variable_Penumbra_Shadows VPS_Search_Samples Max_Shadow_Filter_Radius Max_Filter_Depth
|
||||||
|
|
||||||
### AMBIENT LIGHT
|
### AMBIENT LIGHT
|
||||||
screen.Ambient_light.columns=1
|
screen.Ambient_light.columns=1
|
||||||
|
@ -26,16 +26,20 @@ uniform float frameTimeCounter;
|
|||||||
uniform vec3 sunVec;
|
uniform vec3 sunVec;
|
||||||
uniform float aspectRatio;
|
uniform float aspectRatio;
|
||||||
uniform float sunElevation;
|
uniform float sunElevation;
|
||||||
|
uniform vec3 sunPosition;
|
||||||
uniform float lightSign;
|
uniform float lightSign;
|
||||||
uniform float cosFov;
|
uniform float cosFov;
|
||||||
uniform vec3 shadowViewDir;
|
uniform vec3 shadowViewDir;
|
||||||
uniform vec3 shadowCamera;
|
uniform vec3 shadowCamera;
|
||||||
uniform vec3 shadowLightVec;
|
uniform vec3 shadowLightVec;
|
||||||
uniform float shadowMaxProj;
|
uniform float shadowMaxProj;
|
||||||
attribute vec4 mc_Entity;
|
|
||||||
attribute vec4 mc_midTexCoord;
|
attribute vec4 mc_midTexCoord;
|
||||||
varying vec4 glcolor;
|
varying vec4 glcolor;
|
||||||
|
|
||||||
|
attribute vec4 mc_Entity;
|
||||||
|
uniform int blockEntityId;
|
||||||
|
uniform int entityId;
|
||||||
|
|
||||||
const float PI48 = 150.796447372*WAVY_SPEED;
|
const float PI48 = 150.796447372*WAVY_SPEED;
|
||||||
float pi2wt = PI48*frameTimeCounter;
|
float pi2wt = PI48*frameTimeCounter;
|
||||||
|
|
||||||
@ -91,47 +95,39 @@ vec4 toClipSpace3(vec3 viewSpacePosition) {
|
|||||||
}
|
}
|
||||||
void main() {
|
void main() {
|
||||||
|
|
||||||
|
|
||||||
vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
|
vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
|
||||||
|
|
||||||
|
#ifdef WAVY_PLANTS
|
||||||
//Check if the vertice is going to cast shadows
|
bool istopv = gl_MultiTexCoord0.t < mc_midTexCoord.t;
|
||||||
// #ifdef SHADOW_FRUSTRUM_CULLING
|
if ((mc_Entity.x == 10001&&istopv) && length(position.xy) < 24.0) {
|
||||||
// if (intersectCone(cosFov, shadowCamera, shadowViewDir, position, -shadowLightVec, shadowMaxProj)) {
|
vec3 worldpos = mat3(shadowModelViewInverse) * position + shadowModelViewInverse[3].xyz;
|
||||||
// #endif
|
worldpos.xyz += calcMovePlants(worldpos.xyz + cameraPosition)*gl_MultiTexCoord1.y;
|
||||||
// #ifdef WAVY_PLANTS
|
position = mat3(shadowModelView) * worldpos + shadowModelView[3].xyz ;
|
||||||
// bool istopv = gl_MultiTexCoord0.t < mc_midTexCoord.t;
|
}
|
||||||
// if ((mc_Entity.x == 10001&&istopv) && length(position.xy) < 24.0) {
|
|
||||||
// vec3 worldpos = mat3(shadowModelViewInverse) * position + shadowModelViewInverse[3].xyz;
|
|
||||||
// worldpos.xyz += calcMovePlants(worldpos.xyz + cameraPosition)*gl_MultiTexCoord1.y;
|
|
||||||
// position = mat3(shadowModelView) * worldpos + shadowModelView[3].xyz ;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if ((mc_Entity.x == 10003) && length(position.xy) < 24.0) {
|
if ((mc_Entity.x == 10003) && length(position.xy) < 24.0) {
|
||||||
// vec3 worldpos = mat3(shadowModelViewInverse) * position + shadowModelViewInverse[3].xyz;
|
vec3 worldpos = mat3(shadowModelViewInverse) * position + shadowModelViewInverse[3].xyz;
|
||||||
// worldpos.xyz += calcMoveLeaves(worldpos.xyz + cameraPosition, 0.0040, 0.0064, 0.0043, 0.0035, 0.0037, 0.0041, vec3(1.0,0.2,1.0), vec3(0.5,0.1,0.5))*gl_MultiTexCoord1.y;
|
worldpos.xyz += calcMoveLeaves(worldpos.xyz + cameraPosition, 0.0040, 0.0064, 0.0043, 0.0035, 0.0037, 0.0041, vec3(1.0,0.2,1.0), vec3(0.5,0.1,0.5))*gl_MultiTexCoord1.y;
|
||||||
// position = mat3(shadowModelView) * worldpos + shadowModelView[3].xyz ;
|
position = mat3(shadowModelView) * worldpos + shadowModelView[3].xyz ;
|
||||||
// }
|
}
|
||||||
// #endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// gl_Position = BiasShadowProjection_altered(toClipSpace3(position),mat3(shadowProjection),mat3(shadowModelView), gl_NormalMatrix * gl_Normal);
|
// gl_Position = BiasShadowProjection_altered(toClipSpace3(position),mat3(shadowProjection),mat3(shadowModelView), gl_NormalMatrix * gl_Normal);
|
||||||
|
|
||||||
gl_Position = BiasShadowProjection(toClipSpace3(position));
|
gl_Position = BiasShadowProjection(toClipSpace3(position));
|
||||||
|
|
||||||
gl_Position.z /= 6.0;
|
|
||||||
|
|
||||||
|
float bias = 6.0;
|
||||||
|
|
||||||
|
vec3 FlatNormals = normalize(gl_NormalMatrix *gl_Normal);
|
||||||
|
vec3 WsunVec = (float(sunElevation > 1e-5)*2-1.)*normalize(mat3(shadowModelViewInverse) * sunPosition);
|
||||||
|
if(entityId == 1100) bias = 6.0 + (1-clamp(dot(WsunVec,FlatNormals),0,1))*0.3;
|
||||||
|
|
||||||
|
gl_Position.z /= bias;
|
||||||
|
|
||||||
texcoord.xy = gl_MultiTexCoord0.xy;
|
texcoord.xy = gl_MultiTexCoord0.xy;
|
||||||
|
|
||||||
|
|
||||||
if(mc_Entity.x == 8 || mc_Entity.x == 9) gl_Position.w = -1.0;
|
if(mc_Entity.x == 8 || mc_Entity.x == 9) gl_Position.w = -1.0;
|
||||||
|
|
||||||
|
|
||||||
#ifdef SHADOW_FRUSTRUM_CULLING
|
|
||||||
}
|
|
||||||
else
|
|
||||||
gl_Position.xyzw = vec4(0.0,0.0,1e30,0.0); //Degenerates the triangle
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
@ -305,7 +305,7 @@ vec4 blueNoise(vec2 coord){
|
|||||||
return texelFetch2D(colortex6, ivec2(coord )%512 , 0);
|
return texelFetch2D(colortex6, ivec2(coord )%512 , 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LabEmission(
|
void Emission(
|
||||||
inout vec3 Lighting,
|
inout vec3 Lighting,
|
||||||
vec3 Albedo,
|
vec3 Albedo,
|
||||||
float Emission
|
float Emission
|
||||||
@ -467,7 +467,7 @@ void main() {
|
|||||||
MaterialReflections_N(gl_FragData[0].rgb, SpecularTex.r, SpecularTex.ggg, albedo, normal, np3, fragpos, vec3(blueNoise(gl_FragCoord.xy).rg,noise), hand);
|
MaterialReflections_N(gl_FragData[0].rgb, SpecularTex.r, SpecularTex.ggg, albedo, normal, np3, fragpos, vec3(blueNoise(gl_FragCoord.xy).rg,noise), hand);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LabEmission(gl_FragData[0].rgb, albedo, SpecularTex.a);
|
Emission(gl_FragData[0].rgb, albedo, SpecularTex.a);
|
||||||
|
|
||||||
if(lightningBolt) gl_FragData[0].rgb += vec3(Lightning_R,Lightning_G,Lightning_B) ;
|
if(lightningBolt) gl_FragData[0].rgb += vec3(Lightning_R,Lightning_G,Lightning_B) ;
|
||||||
|
|
||||||
|
@ -303,7 +303,7 @@ vec4 blueNoise(vec2 coord){
|
|||||||
return texelFetch2D(colortex6, ivec2(coord )%512 , 0);
|
return texelFetch2D(colortex6, ivec2(coord )%512 , 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LabEmission(
|
void Emission(
|
||||||
inout vec3 Lighting,
|
inout vec3 Lighting,
|
||||||
vec3 Albedo,
|
vec3 Albedo,
|
||||||
float Emission
|
float Emission
|
||||||
@ -459,7 +459,7 @@ void main() {
|
|||||||
|
|
||||||
if(!hand) gl_FragData[0].rgb *= ssao(fragpos,noise,FlatNormals) * AO;
|
if(!hand) gl_FragData[0].rgb *= ssao(fragpos,noise,FlatNormals) * AO;
|
||||||
|
|
||||||
LabEmission(gl_FragData[0].rgb, albedo, SpecularTex.a);
|
Emission(gl_FragData[0].rgb, albedo, SpecularTex.a);
|
||||||
|
|
||||||
if(lightningBolt) gl_FragData[0].rgb = LightColor * 10 ;
|
if(lightningBolt) gl_FragData[0].rgb = LightColor * 10 ;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user