fix DH water rendering over the player. fix DH shadowmap SSS blending. make floodfill work when SSGI/RTAO are enabled.. add player shadow toggle.

This commit is contained in:
Xonk 2024-05-09 19:14:41 -04:00
parent e1787e4355
commit 56389b9eef
8 changed files with 57 additions and 28 deletions

View File

@ -424,7 +424,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
#ifdef DH_OVERDRAW_PREVENTION
float distancefade = min(max(1.0 - length(playerPos)/max(far-16*4,16),0.0)*5,1.0);
if(texture2D(depthtex1, gl_FragCoord.xy*texelSize).x < 1.0 || distancefade > 0.0){
if(texture2D(depthtex0, gl_FragCoord.xy*texelSize).x < 1.0 || distancefade > 0.0){
gl_FragData[0].a = 0.0;
material = 0.0;
}

View File

@ -753,7 +753,6 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
float roughness = pow(1.0-specularValues.r,2.0);
float f0 = isReflective ? max(specularValues.g, 0.02) : specularValues.g;
#ifdef HAND
f0 = max(specularValues.g, 0.02);
#endif
@ -766,8 +765,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
vec3 Metals = f0 > 229.5/255.0 ? normalize(Albedo+1e-7) * (dot(Albedo,vec3(0.21, 0.72, 0.07)) * 0.7 + 0.3) : vec3(1.0);
// make sure zero alpha is not forced to be full alpha by fresnel on items with funny normal padding
// if(UnchangedAlpha <= 0.0 && !isReflective) f0 = 0.0;
if(UnchangedAlpha <= 0.0 && !isReflective) f0 = 0.0;
if (f0 > 0.0){

View File

@ -954,15 +954,6 @@ void main() {
float NdotL = 1.0;
float lightLeakFix = clamp(pow(eyeBrightnessSmooth.y/240. + lightmap.y,2.0) ,0.0,1.0);
// #ifdef DISTANT_HORIZONS_SHADOWMAP
// float shadowMapFalloff = pow(1.0-pow(1.0-min(max(1.0 - length(vec3(feetPlayerPos.x,feetPlayerPos.y/1.5,feetPlayerPos.z)) / min(shadowDistance, dhFarPlane),0.0)*5.0,1.0),2.0),2.0);
// #else
// float shadowMapFalloff = pow(1.0-pow(1.0-min(max(1.0 - length(vec3(feetPlayerPos.x,feetPlayerPos.y/1.5,feetPlayerPos.z)) / shadowDistance,0.0)*5.0,1.0),2.0),2.0);
// #endif
// float shadowMapFalloff2 = pow(1.0-pow(1.0-min(max(1.0 - length(vec3(feetPlayerPos.x,feetPlayerPos.y/1.5,feetPlayerPos.z)) / min(shadowDistance,far),0.0)*5.0,1.0),2.0),2.0);
#ifdef OVERWORLD_SHADER
DirectLightColor = lightCol.rgb / 80.0;
AmbientLightColor = averageSkyCol_Clouds / 30.0;
@ -1270,7 +1261,7 @@ void main() {
// RTAO and/or SSGI
#if indirect_effect == 3 || indirect_effect == 4
Indirect_lighting = AmbientLightColor;
ApplySSRT(Indirect_lighting, viewPos, normal, vec3(bnoise, noise_2), lightmap.xy, AmbientLightColor*2.5, vec3(TORCH_R,TORCH_G,TORCH_B), isGrass, hand);
ApplySSRT(Indirect_lighting, viewPos, normal, vec3(bnoise, noise_2), feetPlayerPos, lpvPos, exposure, lightmap.xy, AmbientLightColor*2.5, vec3(TORCH_R,TORCH_G,TORCH_B), isGrass, hand);
#endif
#if defined END_SHADER
@ -1291,7 +1282,6 @@ void main() {
Indirect_SSS *= AO;
// apply to ambient light.
// if(texcoord.x>0.5)
Indirect_lighting = max(Indirect_lighting, Indirect_SSS * ambientColor * ambientsss_brightness);
// #ifdef OVERWORLD_SHADER
@ -1305,9 +1295,10 @@ void main() {
float sunSSS_density = LabSSS;
float SSS_shadow = ShadowAlpha * Shadows;
// #ifdef DISTANT_HORIZONS_SHADOWMAP
// shadowMapFalloff2 = smoothstep(0.0, 1.0, min(max(1.0 - length(feetPlayerPos) / min(shadowDistance,far),0.0)*5.0,1.0));
// #endif
#ifdef DISTANT_HORIZONS_SHADOWMAP
shadowMapFalloff2 = smoothstep(0.0, 1.0, min(max(1.0 - length(feetPlayerPos) / min(shadowDistance, far-16),0.0)*5.0,1.0));
#endif
#ifndef RENDER_ENTITY_SHADOWS
if(entities) sunSSS_density = 0.0;

View File

@ -29,6 +29,7 @@ screen.Direct_Light = Direct Light
option.TRANSLUCENT_COLORED_SHADOWS = Colored Shadows
option.SCREENSPACE_CONTACT_SHADOWS = Screen-space Shadows
option.RENDER_ENTITY_SHADOWS = Shadows for Entities
option.RENDER_PLAYER_SHADOWS = Shadows for the Player
option.shadowMapResolution = Shadow Resolution
option.shadowDistance = Shadow Distance
value.shadowDistance.32.0 = 2 Chunks
@ -696,4 +697,4 @@ option.DISTANT_HORIZONS_SHADOWMAP.comment = §cTHIS SETTING WILL DESTROY PERFOR
option.TOGGLE_VL_FOG = Toggle Volumetric Fog
option.TOGGLE_VL_FOG.comment = one big button to just turn all the fog off.
option.TRANSLUCENT_COLORED_SHADOWS.comment = §bWhat is this?§r This effect allows translucent things like stained glass to color the sunlight as it passes through the it. §aPERFORMANCE COST:§r medium
option.TRANSLUCENT_COLORED_SHADOWS.comment = §bWhat is this?§r This effect allows translucent things like stained glass to color the sunlight as it passes through it. §aPERFORMANCE COST:§r medium

View File

@ -69,15 +69,44 @@ vec3 DoAmbientLightColor(
return IndirectLight + TorchLight * TorchBrightness_autoAdjust;
}
// this is dumb, and i plan to remove it eventually...
vec4 RT_AmbientLight(
vec3 TorchColor,
vec2 Lightmap
vec3 playerPos,
vec3 lpvPos,
float Exposure,
vec2 Lightmap,
vec3 TorchColor
){
float skyLM = (pow(Lightmap.y,15.0)*2.0 + pow(Lightmap.y,2.5))*0.5;
float TorchLM = 10.0 - ( 1.0 / (pow(exp(-0.5*inversesqrt(Lightmap.x)),5.0)+0.1));
TorchLM = pow(TorchLM/4,10) + pow(Lightmap.x,1.5)*0.5;
vec3 TorchLight = TorchColor * TORCH_AMOUNT * TorchLM;
// do torch lighting
float TorchLM = pow(1.0-sqrt(1.0-clamp(Lightmap.x,0.0,1.0)),2.0) * 2.0;
float TorchBrightness_autoAdjust = mix(1.0, 30.0, clamp(exp(-10.0*Exposure),0.0,1.0)) ;
vec3 TorchLight = TorchColor * TorchLM * TORCH_AMOUNT ;
#if defined IS_LPV_ENABLED && defined MC_GL_EXT_shader_image_load_store
vec4 lpvSample = SampleLpvLinear(lpvPos);
vec3 LpvTorchLight = GetLpvBlockLight(lpvSample);
// i gotchu
float fadeLength = 10.0; // in blocks
vec3 cubicRadius = clamp( min(((LpvSize3-1.0) - lpvPos)/fadeLength, lpvPos/fadeLength) ,0.0,1.0);
float LpvFadeF = cubicRadius.x*cubicRadius.y*cubicRadius.z;
LpvFadeF = 1.0 - pow(1.0-pow(LpvFadeF,1.5),3.0); // make it nice and soft :)
TorchLight = mix(TorchLight,LpvTorchLight/5.0, LpvFadeF);
const vec3 normal = vec3(0.0); // TODO
if (heldItemId > 0)
TorchLight += GetHandLight(heldItemId, playerPos, normal);
if (heldItemId2 > 0)
TorchLight += GetHandLight(heldItemId2, playerPos, normal);
#endif
return vec4(TorchLight, skyLM);
}

View File

@ -296,8 +296,12 @@ void ApplySSRT(
vec3 viewPos,
vec3 normal,
vec3 noise,
vec3 playerPos,
vec3 lpvPos,
float Exposure,
vec2 lightmaps,
vec3 skylightcolor,
vec3 torchcolor,
@ -315,7 +319,7 @@ void ApplySSRT(
vec3 skycontribution2 = vec3(0.0);
// rgb = torch color * lightmap. a = sky lightmap.
vec4 Lighting = RT_AmbientLight(torchcolor, lightmaps);
vec4 Lighting = RT_AmbientLight(playerPos, lpvPos, Exposure, lightmaps, torchcolor);
skylightcolor = skylightcolor * ambient_brightness * Lighting.a;
for (int i = 0; i < nrays; i++){

View File

@ -132,6 +132,8 @@ const float entityShadowDistanceMul = 0.25; // [0.01 0.02 0.03 0.04 0.05 0.10 0.
#define RENDER_ENTITY_SHADOWS
#define RENDER_PLAYER_SHADOWS
#define SCREENSPACE_CONTACT_SHADOWS
#define Variable_Penumbra_Shadows
@ -746,4 +748,6 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
#if DH_KNOWN_ISSUES == 0
#endif
#ifdef PARTICLE_RENDERING_FIX
#endif
#ifdef RENDER_PLAYER_SHADOWS
#endif

View File

@ -27,7 +27,9 @@ iris.features.optional = ENTITY_TRANSLUCENT REVERSED_CULLING COMPUTE_SHADERS CUS
#ifndef RENDER_ENTITY_SHADOWS
shadowBlockEntities = false
shadowEntities = false
shadowPlayer = true
#ifdef RENDER_PLAYER_SHADOWS
shadowPlayer = true
#endif
#endif
@ -135,7 +137,7 @@ BLISS_SHADERS <empty> \
screen.Direct_Light = [Shadows] [Subsurface_Scattering] [Sun_and_Moon_Colors] OLD_LIGHTLEAK_FIX sunPathRotation sun_illuminance MOONPHASE_BASED_MOONLIGHT moon_illuminance
screen.Shadows.columns=1
screen.Shadows = TRANSLUCENT_COLORED_SHADOWS SCREENSPACE_CONTACT_SHADOWS RENDER_ENTITY_SHADOWS entityShadowDistanceMul <empty> [Filtering] shadowMapResolution shadowDistance OPTIMIZED_SHADOW_DISTANCE
screen.Shadows = TRANSLUCENT_COLORED_SHADOWS SCREENSPACE_CONTACT_SHADOWS RENDER_ENTITY_SHADOWS RENDER_PLAYER_SHADOWS entityShadowDistanceMul <empty> [Filtering] shadowMapResolution shadowDistance OPTIMIZED_SHADOW_DISTANCE
screen.Subsurface_Scattering.columns=1
screen.Subsurface_Scattering = SSS_TYPE sss_density_multiplier sss_absorbance_multiplier LabSSS_Curve <empty> MISC_BLOCK_SSS MOB_SSS <empty> Ambient_SSS ambientsss_brightness