mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2024-12-23 01:59:39 +08:00
Add back shadowDistanceRenderMul and make it toggle a max shadow bound. fix lightleaking in water, when underground
This commit is contained in:
parent
0b4bf8e7c6
commit
3ee5e1e8e0
@ -340,7 +340,7 @@ float waterCaustics(vec3 wPos, vec3 lightSource) { // water waves
|
||||
}
|
||||
|
||||
|
||||
float rayTraceShadow(vec3 dir,vec3 position,float dither){
|
||||
float rayTraceShadow(vec3 dir,vec3 position,float dither, bool outsideShadowMap){
|
||||
const float quality = 16.;
|
||||
vec3 clipPosition = toClipSpace3(position);
|
||||
//prevents the ray from going behind the camera
|
||||
@ -351,8 +351,14 @@ float rayTraceShadow(vec3 dir,vec3 position,float dither){
|
||||
vec3 stepv = direction * 3.0 * clamp(MC_RENDER_QUALITY,1.,2.0)*vec3(RENDER_SCALE,1.0);
|
||||
|
||||
vec3 spos = clipPosition*vec3(RENDER_SCALE,1.0);
|
||||
// spos.xy += (TAA_Offset*(texelSize/4))*RENDER_SCALE ;
|
||||
spos += stepv*dither ;
|
||||
|
||||
// this is to remove the "peterpanning" on things outside the shadowmap with SSS
|
||||
if(outsideShadowMap){
|
||||
spos += stepv*dither - stepv*0.9;
|
||||
}else{
|
||||
spos += stepv*dither ;
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < int(quality); i++) {
|
||||
spos += stepv;
|
||||
@ -838,10 +844,9 @@ void main() {
|
||||
vec3 filtered = vec3(1.412,1.0,0.0);
|
||||
if (!hand) filtered = texture2D(colortex3,texcoord).rgb;
|
||||
|
||||
|
||||
vec3 ambientCoefs = normal/dot(abs(normal),vec3(1.));
|
||||
|
||||
vec3 DirectLightColor = (lightCol.rgb/80.0);
|
||||
vec3 DirectLightColor = lightCol.rgb/80.0;
|
||||
// DirectLightColor *= clamp(abs(WsunVec.y)*2,0.,1.);
|
||||
#ifdef ambientLight_only
|
||||
DirectLightColor = vec3(0.0);
|
||||
@ -854,6 +859,8 @@ void main() {
|
||||
int shadowmapindicator = 0;
|
||||
float cloudShadow = 1.0;
|
||||
|
||||
vec3 debug = vec3(0.0);
|
||||
|
||||
if ( z >= 1.) {//sky
|
||||
|
||||
//////////////////////////////// ////////////////////////////////
|
||||
@ -920,9 +927,15 @@ void main() {
|
||||
float distortFactor = calcDistort(projectedShadowPosition.xy);
|
||||
projectedShadowPosition.xy *= distortFactor;
|
||||
|
||||
|
||||
bool ShadowBounds = false;
|
||||
if(shadowDistanceRenderMul > 0.0) ShadowBounds = length(p3_shadow) < max(shadowDistance,0);
|
||||
|
||||
if(shadowDistanceRenderMul < 0.0) ShadowBounds = abs(projectedShadowPosition.x) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.y) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.z) < 6.0;
|
||||
|
||||
//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){
|
||||
if(ShadowBounds){
|
||||
if (shadowNDOTL >= -0.001){
|
||||
Shadows = 0.0;
|
||||
projectedShadowPosition = projectedShadowPosition * vec3(0.5,0.5,0.5/6.0) + vec3(0.5);
|
||||
|
||||
@ -944,7 +957,8 @@ void main() {
|
||||
|
||||
bool outsideShadowMap = shadowmapindicator < 1;
|
||||
|
||||
if(outsideShadowMap && !iswater) Shadows = clamp((lightmap.y-0.8) * 5,0,1);
|
||||
if(outsideShadowMap && !iswater) Shadows = min(max(lightmap.y-0.8, 0) * 25,1);
|
||||
|
||||
|
||||
|
||||
//////////////////////////////// SUN SSS ////////////////////////////////
|
||||
@ -957,7 +971,6 @@ void main() {
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if (outsideShadowMap) SHADOWBLOCKERDEPTBH = 0.0;
|
||||
|
||||
float sunSSS_density = LabSSS;
|
||||
@ -975,12 +988,14 @@ void main() {
|
||||
|
||||
if (!hand){
|
||||
#ifdef SCREENSPACE_CONTACT_SHADOWS
|
||||
float screenShadow = rayTraceShadow(lightCol.a*sunVec, fragpos_rtshadow, interleaved_gradientNoise());
|
||||
bool dodistantSSS = outsideShadowMap && LabSSS > 0.0;
|
||||
float screenShadow = rayTraceShadow(lightCol.a*sunVec, fragpos_rtshadow, interleaved_gradientNoise(), dodistantSSS);
|
||||
screenShadow *= screenShadow;
|
||||
|
||||
Shadows = min(screenShadow, Shadows);
|
||||
|
||||
if (outsideShadowMap) SSS *= Shadows;
|
||||
#else
|
||||
if (outsideShadowMap) SSS = vec3(0.0);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1020,10 +1035,11 @@ void main() {
|
||||
|
||||
#ifndef ambientSSS_view
|
||||
Indirect_lighting = DoAmbientLighting(AmbientLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), newLightmap.xy, skylight);
|
||||
#else
|
||||
Indirect_lighting = vec3(0.0);
|
||||
#endif
|
||||
|
||||
vec3 AO = vec3(1.0);
|
||||
vec3 debug = vec3(0.0);
|
||||
|
||||
// vanilla AO
|
||||
#if indirect_effect == 0
|
||||
@ -1063,6 +1079,7 @@ void main() {
|
||||
|
||||
#ifdef Ambient_SSS
|
||||
if (!hand){
|
||||
|
||||
vec3 SSS_forSky = vec3(0.0);
|
||||
|
||||
#if indirect_effect != 1
|
||||
@ -1087,6 +1104,8 @@ void main() {
|
||||
|
||||
////light up dark parts so its more visible
|
||||
Indirect_lighting = max(Indirect_lighting, SSS_forSky);
|
||||
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1126,7 +1145,7 @@ void main() {
|
||||
|
||||
DirectLightColor *= Absorbtion;
|
||||
// Indirect_lighting *= Absorbtion;
|
||||
|
||||
if(isEyeInWater == 0) DirectLightColor *= (max(eyeBrightnessSmooth.y,0)/240.);
|
||||
}
|
||||
|
||||
|
||||
@ -1193,10 +1212,13 @@ void main() {
|
||||
|
||||
float custom_lightmap_T = clamp(pow(texture2D(colortex14, texcoord).a,3.0),0.0,1.0);
|
||||
|
||||
|
||||
vec3 lightningColor = (lightningEffect / 3) * (max(eyeBrightnessSmooth.y,0)/240.);
|
||||
vec3 ambientColVol = max((averageSkyCol_Clouds / 30.) * custom_lightmap_T, vec3(0.2,0.4,1.0) * (MIN_LIGHT_AMOUNT*0.01 + nightVision)) + lightningColor;
|
||||
vec3 lightColVol = DirectLightColor;
|
||||
|
||||
if(shadowmapindicator < 1) lightColVol *= clamp((custom_lightmap_T-0.8) * 15,0,1);
|
||||
|
||||
if (isEyeInWater == 0) waterVolumetrics(gl_FragData[0].rgb, fragpos0, fragpos, estimatedDepth , estimatedSunDepth, Vdiff, noise, totEpsilon, scatterCoef, ambientColVol, lightColVol, dot(np3, WsunVec));
|
||||
}
|
||||
|
||||
@ -1227,5 +1249,8 @@ void main() {
|
||||
if( hideGUI < 1.0) gl_FragData[0].rgb += laserColor * pow( clamp( 1.0-abs(focusDist-abs(fragpos.z)) ,0,1),25) ;
|
||||
#endif
|
||||
|
||||
|
||||
// gl_FragData[0].rgb = debug;
|
||||
|
||||
/* DRAWBUFFERS:3 */
|
||||
}
|
@ -15,6 +15,9 @@ screen.Direct_Light = Direct Light
|
||||
option.RENDER_ENTITY_SHADOWS = Shadows for Entities
|
||||
option.shadowMapResolution = Shadow Resolution
|
||||
option.shadowDistance = Shadow Distance
|
||||
option.shadowDistanceRenderMul = Optimized Shadow Bounds
|
||||
value.shadowDistanceRenderMul.-1.0 = Un-Optimized
|
||||
value.shadowDistanceRenderMul.1.0 = Optimized
|
||||
screen.Filtering = Shadow Filtering Settings
|
||||
option.SHADOW_FILTER_SAMPLE_COUNT = Basic Shadow Filter Samples
|
||||
option.Min_Shadow_Filter_Radius = Minimum Shadow filter Radius
|
||||
@ -276,7 +279,8 @@ screen.Shadows.comment = Configure the shadows from the sun to your liking.
|
||||
option.SCREENSPACE_CONTACT_SHADOWS.comment = Screen-space contact shadows. §bWhat is this?§r These are small shadows for things that are far away, and on small details nearby. §aPERFORMANCE COST:§r low to medium; it is more expensive at higher resolutions.
|
||||
option.RENDER_ENTITY_SHADOWS.comment = §bWhat is this?§r Shadows on all types of entities, like mobs, chests, banners, or signs. §aPERFORMANCE COST:§r low to high; it is very expensive when there are many entities nearby.
|
||||
option.shadowMapResolution.comment = The quality of shadows from the sun casted by things in the world. §aPERFORMANCE COST:§r medium to very high; Shadows must render the 3D world a second time from the perspective of the sun, this is why it cuts performance in half.
|
||||
option.shadowDistance.comment = The maximum distance the shadowmap can render (this is not linear distance). I recommend default shadow distance, because the contact shadows can handle far away shadows. §aPERFORMANCE COST:§r medium to very high; If the chunk render distance is high, the shadows will become more expensive.
|
||||
option.shadowDistance.comment.comment = The maximum distance the shadowmap can render (this is not linear distance). I recommend default shadow distance, because the contact shadows can handle far away shadows. §aPERFORMANCE COST:§r medium to very high; If the chunk render distance is high, the shadows will become more expensive.
|
||||
option.shadowDistanceRenderMul.comment = Render the shadows only in a sphere around you, limited to the shadow distance measured in blocks. un-optimized does not render the shadows in a sphere, and can cover alot more area with the same distance settings. the distance is not measured linearly in blocks when set to un-optimized. §aPERFORMANCE COST:§r low to medium. Optimized is faster, and unoptimized is slower.
|
||||
screen.Filtering.comment = Configure the filtering effects applied to the shadows.
|
||||
option.SHADOW_FILTER_SAMPLE_COUNT.comment = The quality of the basic shadow filter. This filter just softens the shadows. §aPERFORMANCE COST:§r low to medium; Increasing this should reduce some noise at the edge of shadows.
|
||||
option.Min_Shadow_Filter_Radius.comment = The maximum softness of the basic shadow filter.
|
||||
|
@ -109,7 +109,8 @@ const float ambientOcclusionLevel = 1.0; // this controls vanilla minecrafts amb
|
||||
|
||||
const int shadowMapResolution = 2048; // [512 768 1024 1536 2048 3172 4096 8192 16384]
|
||||
const float shadowDistance = 69.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 120.0 121.0 122.0 123.0 124.0 125.0 126.0 127.0 128.0 129.0 130.0 131.0 132.0 133.0 134.0 135.0 136.0 137.0 138.0 139.0 140.0 141.0 142.0 143.0 144.0 145.0 146.0 147.0 148.0 149.0 150.0 151.0 152.0 153.0 154.0 155.0 156.0 157.0 158.0 159.0 160.0 161.0 162.0 163.0 164.0 165.0 166.0 167.0 168.0 169.0 170.0 171.0 172.0 173.0 174.0 175.0 176.0 177.0 178.0 179.0 180.0 181.0 182.0 183.0 184.0 185.0 186.0 187.0 188.0 189.0 190.0 191.0 192.0 193.0 194.0 195.0 196.0 197.0 198.0 199.0 200.0 201.0 202.0 203.0 204.0 205.0 206.0 207.0 208.0 209.0 210.0 211.0 212.0 213.0 214.0 215.0 216.0 217.0 218.0 219.0 220.0 221.0 222.0 223.0 224.0 225.0 226.0 227.0 228.0 229.0 230.0 231.0 232.0 233.0 234.0 235.0 236.0 237.0 238.0 239.0 240.0 241.0 242.0 243.0 244.0 245.0 246.0 247.0 248.0 249.0 250.0 251.0 252.0 253.0 254.0 255.0 256.0]
|
||||
const float shadowDistanceRenderMul = -1.0; // [-1.0 1.0]
|
||||
const float shadowDistanceRenderMul = 1.0; // [-1.0 1.0]
|
||||
|
||||
|
||||
#define RENDER_ENTITY_SHADOWS
|
||||
|
||||
|
@ -47,7 +47,7 @@ alphaTest.gbuffers_skytextured=false
|
||||
alphaTest.gbuffers_hand=true
|
||||
|
||||
|
||||
sliders = R_UPPER_CURVE R_LOWER_CURVE G_UPPER_CURVE G_LOWER_CURVE B_UPPER_CURVE B_LOWER_CURVE UPPER_CURVE LOWER_CURVE CONTRAST EMISSIVE_TYPE Lightning_R Lightning_G Lightning_B SCALE_FACTOR CompSky_R CompSky_G CompSky_B ambientsss_brightness SSS_TYPE Cloud_Speed Cumulus_height Cumulus_coverage Cumulus_density Alto_coverage Alto_density ORB_ColMult ORB_X ORB_Y ORB_Z ORB_R ORB_G ORB_B TOD_Fog_mult Morning_Uniform_Fog Noon_Uniform_Fog Evening_Uniform_Fog Night_Uniform_Fog Morning_Cloudy_Fog Noon_Cloudy_Fog Evening_Cloudy_Fog Night_Cloudy_Fog NetherFog_brightness Summer_Leaf_R Summer_Leaf_G Summer_Leaf_B Fall_Leaf_R Fall_Leaf_G Fall_Leaf_B Winter_Leaf_R Winter_Leaf_G Winter_Leaf_B Spring_Leaf_R Spring_Leaf_G Spring_Leaf_B Summer_R Summer_G Summer_B Fall_R Fall_G Fall_B Winter_R Winter_G Winter_B Spring_R Spring_G Spring_B Season_Length CaveFogFallOff CaveFogColor_R CaveFogColor_G CaveFogColor_B indirect_effect GI_Strength ambient_brightness AmbientLight_R AmbientLight_G AmbientLight_B Rain_coverage Moon_temp Haze_amount RainFog_amount ambient_temp Sun_temp Puddle_Size LabSSS_Curve Emissive_Curve Emissive_Brightness AO_Strength BLOOMY_FOG WAVY_SPEED WAVY_STRENGTH BLOOM_STRENGTH shadowDistance shadowDistanceRenderMul FinalR FinalG FinalB Sky_Brightness fog_coefficientMieR fog_coefficientMieG fog_coefficientMieB sun_illuminance sunColorG sunColorB sunColorR sky_mieg sky_coefficientMieB sky_coefficientMieG sky_coefficientMieR sky_coefficientRayleighB sky_coefficientRayleighG sky_coefficientRayleighR CLOUDS_QUALITY EXPOSURE_MULTIPLIER MIN_LIGHT_AMOUNT TORCH_R TORCH_G TORCH_B TORCH_AMOUNT shadowMapResolution sunPathRotation BLEND_FACTOR VL_SAMPLES Exposure_Speed POM_DEPTH MAX_ITERATIONS MAX_DIST SSR_STEPS ambientOcclusionLevel SEA_LEVEL moon_illuminance moonColorR moonColorG moonColorB fog_coefficientRayleighR fog_coefficientRayleighG SATURATION Manual_exposure_value focal aperture MANUAL_FOCUS SHADOW_FILTER_SAMPLE_COUNT Max_Filter_Depth VPS_Search_Samples Min_Shadow_Filter_Radius Max_Shadow_Filter_Radius Water_Top_Layer fog_coefficientRayleighB SHARPENING rayMarchSampleCount Dirt_Amount Dirt_Scatter_R Dirt_Scatter_G Dirt_Scatter_B Dirt_Absorb_R Dirt_Absorb_G Dirt_Absorb_B Water_Absorb_R Water_Absorb_G Water_Absorb_B Purkinje_strength Purkinje_strength Purkinje_R Purkinje_G Purkinje_B Texture_MipMap_Bias DoF_Adaptation_Speed Purkinje_Multiplier CROSSTALK VL_RENDER_RESOLUTION BLOOM_QUALITY VL_RENDER_RESOLUTION RAY_COUNT STEPS STEP_LENGTH cloud_LevelOfDetail cloud_ShadowLevelOfDetail cloud_LevelOfDetailLQ cloud_ShadowLevelOfDetailLQ minRayMarchSteps maxRayMarchSteps minRayMarchStepsLQ maxRayMarchStepsLQ fbmAmount fbmPower1 fbmPower2 Roughness_Threshold Sun_specular_Strength reflection_quality DOF_QUALITY DOF_ANAMORPHIC_RATIO AEROCHROME_PINKNESS DOF_JITTER_FOCUS JITTER_STRENGTH
|
||||
sliders = R_UPPER_CURVE R_LOWER_CURVE G_UPPER_CURVE G_LOWER_CURVE B_UPPER_CURVE B_LOWER_CURVE UPPER_CURVE LOWER_CURVE CONTRAST EMISSIVE_TYPE Lightning_R Lightning_G Lightning_B SCALE_FACTOR CompSky_R CompSky_G CompSky_B ambientsss_brightness SSS_TYPE Cloud_Speed Cumulus_height Cumulus_coverage Cumulus_density Alto_coverage Alto_density ORB_ColMult ORB_X ORB_Y ORB_Z ORB_R ORB_G ORB_B TOD_Fog_mult Morning_Uniform_Fog Noon_Uniform_Fog Evening_Uniform_Fog Night_Uniform_Fog Morning_Cloudy_Fog Noon_Cloudy_Fog Evening_Cloudy_Fog Night_Cloudy_Fog NetherFog_brightness Summer_Leaf_R Summer_Leaf_G Summer_Leaf_B Fall_Leaf_R Fall_Leaf_G Fall_Leaf_B Winter_Leaf_R Winter_Leaf_G Winter_Leaf_B Spring_Leaf_R Spring_Leaf_G Spring_Leaf_B Summer_R Summer_G Summer_B Fall_R Fall_G Fall_B Winter_R Winter_G Winter_B Spring_R Spring_G Spring_B Season_Length CaveFogFallOff CaveFogColor_R CaveFogColor_G CaveFogColor_B indirect_effect GI_Strength ambient_brightness AmbientLight_R AmbientLight_G AmbientLight_B Rain_coverage Moon_temp Haze_amount RainFog_amount ambient_temp Sun_temp Puddle_Size LabSSS_Curve Emissive_Curve Emissive_Brightness AO_Strength BLOOMY_FOG WAVY_SPEED WAVY_STRENGTH BLOOM_STRENGTH shadowDistance FinalR FinalG FinalB Sky_Brightness fog_coefficientMieR fog_coefficientMieG fog_coefficientMieB sun_illuminance sunColorG sunColorB sunColorR sky_mieg sky_coefficientMieB sky_coefficientMieG sky_coefficientMieR sky_coefficientRayleighB sky_coefficientRayleighG sky_coefficientRayleighR CLOUDS_QUALITY EXPOSURE_MULTIPLIER MIN_LIGHT_AMOUNT TORCH_R TORCH_G TORCH_B TORCH_AMOUNT shadowMapResolution sunPathRotation BLEND_FACTOR VL_SAMPLES Exposure_Speed POM_DEPTH MAX_ITERATIONS MAX_DIST SSR_STEPS ambientOcclusionLevel SEA_LEVEL moon_illuminance moonColorR moonColorG moonColorB fog_coefficientRayleighR fog_coefficientRayleighG SATURATION Manual_exposure_value focal aperture MANUAL_FOCUS SHADOW_FILTER_SAMPLE_COUNT Max_Filter_Depth VPS_Search_Samples Min_Shadow_Filter_Radius Max_Shadow_Filter_Radius Water_Top_Layer fog_coefficientRayleighB SHARPENING rayMarchSampleCount Dirt_Amount Dirt_Scatter_R Dirt_Scatter_G Dirt_Scatter_B Dirt_Absorb_R Dirt_Absorb_G Dirt_Absorb_B Water_Absorb_R Water_Absorb_G Water_Absorb_B Purkinje_strength Purkinje_strength Purkinje_R Purkinje_G Purkinje_B Texture_MipMap_Bias DoF_Adaptation_Speed Purkinje_Multiplier CROSSTALK VL_RENDER_RESOLUTION BLOOM_QUALITY VL_RENDER_RESOLUTION RAY_COUNT STEPS STEP_LENGTH cloud_LevelOfDetail cloud_ShadowLevelOfDetail cloud_LevelOfDetailLQ cloud_ShadowLevelOfDetailLQ minRayMarchSteps maxRayMarchSteps minRayMarchStepsLQ maxRayMarchStepsLQ fbmAmount fbmPower1 fbmPower2 Roughness_Threshold Sun_specular_Strength reflection_quality DOF_QUALITY DOF_ANAMORPHIC_RATIO AEROCHROME_PINKNESS DOF_JITTER_FOCUS JITTER_STRENGTH
|
||||
|
||||
screen.columns=2
|
||||
screen = [Direct_Light] [World] \
|
||||
@ -68,7 +68,7 @@ PhysicsMod_support [LabPBR]
|
||||
screen.Direct_Light = [Shadows] [Subsurface_Scattering] [Sun_and_Moon_Colors] sunPathRotation sun_illuminance moon_illuminance
|
||||
|
||||
screen.Shadows.columns=1
|
||||
screen.Shadows = SCREENSPACE_CONTACT_SHADOWS RENDER_ENTITY_SHADOWS <empty> [Filtering] shadowMapResolution shadowDistance
|
||||
screen.Shadows = SCREENSPACE_CONTACT_SHADOWS RENDER_ENTITY_SHADOWS <empty> [Filtering] shadowMapResolution shadowDistance shadowDistanceRenderMul
|
||||
|
||||
screen.Subsurface_Scattering.columns=1
|
||||
screen.Subsurface_Scattering = SSS_TYPE LabSSS_Curve <empty> MISC_BLOCK_SSS MOB_SSS <empty> Ambient_SSS ambientsss_brightness
|
||||
|
Loading…
Reference in New Issue
Block a user