mirror of
https://github.com/Merlin1809/Eclipse-Shader.git
synced 2026-10-11 01:38:20 +08:00
Merge pull request #6 from X0nk/unstable-development
Unstable development
This commit is contained in:
3 files changed
+34
-42
No files matched your search
@@ -294,15 +294,18 @@ void main() {
|
||||
/////// ----- SSS ON BLOCKS ----- ///////
|
||||
// strong
|
||||
if (
|
||||
mc_Entity.x == BLOCK_GROUND_WAVING || mc_Entity.x == BLOCK_GROUND_WAVING_VERTICAL || mc_Entity.x == BLOCK_AIR_WAVING ||
|
||||
mc_Entity.x == BLOCK_GRASS_SHORT || mc_Entity.x == BLOCK_GRASS_TALL_UPPER || mc_Entity.x == BLOCK_GRASS_TALL_LOWER ||
|
||||
mc_Entity.x == BLOCK_SSS_STRONG || mc_Entity.x == BLOCK_SAPLING
|
||||
/*|| (mc_Entity.x >= 410 && mc_Entity.x <= 415) || (mc_Entity.x >= 402 && mc_Entity.x <= 405) THIS IS FOR MCME NEW TREES.*/
|
||||
mc_Entity.x == BLOCK_SSS_STRONG || mc_Entity.x == BLOCK_SAPLING || mc_Entity.x == BLOCK_AIR_WAVING
|
||||
) {
|
||||
SSSAMOUNT = 1.0;
|
||||
}
|
||||
|
||||
// medium
|
||||
if (
|
||||
mc_Entity.x == BLOCK_GROUND_WAVING || mc_Entity.x == BLOCK_GROUND_WAVING_VERTICAL
|
||||
|| mc_Entity.x == BLOCK_GRASS_SHORT || mc_Entity.x == BLOCK_GRASS_TALL_UPPER || mc_Entity.x == BLOCK_GRASS_TALL_LOWER
|
||||
) {
|
||||
SSSAMOUNT = 0.5;
|
||||
}
|
||||
if (
|
||||
mc_Entity.x == BLOCK_SSS_WEAK || mc_Entity.x == BLOCK_SSS_WEAK_2 ||
|
||||
mc_Entity.x == BLOCK_GLOW_LICHEN || mc_Entity.x == BLOCK_SNOW_LAYERS || mc_Entity.x == BLOCK_CARPET ||
|
||||
@@ -314,7 +317,11 @@ void main() {
|
||||
|
||||
// low
|
||||
#ifdef MISC_BLOCK_SSS
|
||||
if(mc_Entity.x == BLOCK_SSS_WEIRD || mc_Entity.x == BLOCK_GRASS) SSSAMOUNT = 0.4;
|
||||
if(
|
||||
mc_Entity.x == BLOCK_SSS_WEIRD || mc_Entity.x == BLOCK_GRASS
|
||||
){
|
||||
SSSAMOUNT = 0.5;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENTITIES
|
||||
|
||||
@@ -648,7 +648,13 @@ vec3 SubsurfaceScattering_sun(vec3 albedo, float Scattering, float Density, floa
|
||||
|
||||
|
||||
vec3 absorbColor = exp(max(luma(albedo) - albedo*vec3(1.0,1.1,1.2), 0.0) * -20.0 * sss_absorbance_multiplier);
|
||||
vec3 scatter = scatterDepth * mix(absorbColor, vec3(1.0), scatterDepth) * pow(Density, LabSSS_Curve);//* (1-min(max((1-Density)-0.9, 0.0)/(1.0-0.9),1.0));
|
||||
vec3 scatter = scatterDepth * mix(absorbColor, vec3(1.0), scatterDepth);
|
||||
|
||||
#if SSS_TYPE == 3
|
||||
scatter *= pow(Density, LabSSS_Curve);
|
||||
#else
|
||||
if(Density < 0.01) scatter = vec3(0.0);
|
||||
#endif
|
||||
|
||||
scatter *= 1.0 + CustomPhase(lightPos)*6.0; // ~10x brighter at the peak
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@ float getCloudScattering(
|
||||
|
||||
// float fadeddensity = density * pow(clamp((shadowRayPosition.y - minHeight)/(max(maxHeight-minHeight,1.0)*0.25),0.0,1.0),2.0);
|
||||
|
||||
shadow += getCloudShape(LayerIndex, LOD, shadowRayPosition, minHeight, maxHeight) * density;
|
||||
shadow += getCloudShape(LayerIndex, LOD, shadowRayPosition, minHeight, maxHeight) * density;
|
||||
}
|
||||
|
||||
return shadow;
|
||||
@@ -209,15 +209,13 @@ vec3 getCloudLighting(
|
||||
vec3 directLightCol_multi,
|
||||
|
||||
float indirectShadowMask,
|
||||
vec3 indirectLightCol,
|
||||
|
||||
float distanceFade
|
||||
vec3 indirectLightCol
|
||||
){
|
||||
float powderEffect = 1.0 - exp(-3.0*shapeFaded);
|
||||
|
||||
vec3 directScattering = directLightCol * exp(-10.0*sunShadowMask) + directLightCol_multi * exp(-3.0*(sunShadowMask - (1.0-indirectShadowMask*indirectShadowMask)*0.5)) * powderEffect;
|
||||
vec3 indirectScattering = indirectLightCol * mix(1.0, exp2(-5.0*shape), (indirectShadowMask*indirectShadowMask) * distanceFade);
|
||||
|
||||
float powderEffect = 1.0-exp(-10.0*shapeFaded); powderEffect *= powderEffect; powderEffect *= 2.0;
|
||||
vec3 directScattering = directLightCol_multi * powderEffect * exp(-3.0*sunShadowMask) + directLightCol * exp(-10.0*sunShadowMask);
|
||||
vec3 indirectScattering = indirectLightCol * mix(1.0, exp2(-5.0*shape), indirectShadowMask*indirectShadowMask);
|
||||
|
||||
// return indirectScattering;
|
||||
// return directScattering;
|
||||
return indirectScattering + directScattering;
|
||||
@@ -239,7 +237,6 @@ vec4 raymarchCloud(
|
||||
vec3 sunScattering,
|
||||
vec3 sunMultiScattering,
|
||||
vec3 skyScattering,
|
||||
float distanceFade,
|
||||
|
||||
float referenceDistance,
|
||||
vec3 sampledSkyCol,
|
||||
@@ -291,7 +288,7 @@ vec4 raymarchCloud(
|
||||
float sunShadowMask = (shapeWithDensity + getCloudScattering(LayerIndex, rayPosition, sunVector, dither, minHeight, maxHeight, density)) * (1.0-abs(WsunVec.y));
|
||||
float indirectShadowMask = 0.5;
|
||||
|
||||
vec3 lighting = getCloudLighting(shapeWithDensity, shapeWithDensity, sunShadowMask, sunScattering, sunMultiScattering, indirectShadowMask, skyScattering, distanceFade);
|
||||
vec3 lighting = getCloudLighting(shapeWithDensity, shapeWithDensity, sunShadowMask, sunScattering, sunMultiScattering, indirectShadowMask, skyScattering);
|
||||
|
||||
vec3 newPos = rayPosition - cameraPosition;
|
||||
newPos.xz /= max(newPos.y,0.0)*0.0025 + 1.0;
|
||||
@@ -322,8 +319,6 @@ vec4 raymarchCloud(
|
||||
float upperLayerOcclusion = getCloudShape(LARGECUMULUS_LAYER, 0, rayPosition + vec3(0.0,1.0,0.0) * max((CloudLayer1_height+20) - rayPosition.y,0.0), CloudLayer1_height, CloudLayer1_height+100.0);
|
||||
skylightOcclusion = mix(mix(0.0,0.2,parameters.largeCumulus.y), 1.0, pow(1.0 - upperLayerOcclusion*parameters.largeCumulus.y,2));
|
||||
}
|
||||
|
||||
skylightOcclusion = mix(1.0, skylightOcclusion, distanceFade);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -352,6 +347,7 @@ vec4 raymarchCloud(
|
||||
|
||||
// can add the initial cloud shape sample for a free shadow starting step :D
|
||||
float indirectShadowMask = 1.0 - min(max(rayPosition.y - minHeight,0.0) / max(maxHeight-minHeight,1.0), 1.0);
|
||||
|
||||
float sunShadowMask = shapeWithDensity + getCloudScattering(LayerIndex, rayPosition, sunVector, dither, minHeight, maxHeight, density);
|
||||
|
||||
// do cloud shadows from one layer to another
|
||||
@@ -368,13 +364,13 @@ vec4 raymarchCloud(
|
||||
sunShadowMask += getCloudShape(ALTOSTRATUS_LAYER, 0, shadowStartPos, CloudLayer2_height, CloudLayer2_height) * parameters.altostratus.y * (1.0-abs(sunVector.y));
|
||||
#endif
|
||||
|
||||
vec3 lighting = getCloudLighting(shapeWithDensity, shapeWithDensityFaded, sunShadowMask, sunScattering, sunMultiScattering, indirectShadowMask, skyScattering * skylightOcclusion, distanceFade);
|
||||
vec3 lighting = getCloudLighting(shapeWithDensity, shapeWithDensityFaded, sunShadowMask, sunScattering, sunMultiScattering, indirectShadowMask, skyScattering * skylightOcclusion);
|
||||
|
||||
vec3 newPos = rayPosition - cameraPosition;
|
||||
newPos.xz /= max(newPos.y,0.0)*0.0025 + 1.0;
|
||||
newPos.y = min(newPos.y,0.0);
|
||||
|
||||
float distancefog = exp(-0.00025*length(newPos));
|
||||
float distancefog = exp(-0.00035*length(newPos));
|
||||
vec3 atmosphereHaze = (sampledSkyCol - sampledSkyCol * distancefog);
|
||||
lighting = lighting * distancefog + atmosphereHaze;
|
||||
|
||||
@@ -505,32 +501,15 @@ vec4 GetVolumetricClouds(
|
||||
|
||||
///------- do color stuff outside of the raymarcher loop
|
||||
vec3 sunScattering = directLightCol * (phaseCloud(SdotV, 0.85) + phaseCloud(SdotV, 0.75)) * 3.14;
|
||||
vec3 sunMultiScattering = directLightCol * 0.8;// * (phaseCloud(SdotV, 0.35) + phaseCloud(-SdotV, 0.35) * 0.5) * 6.28;
|
||||
vec3 skyScattering = indirectLightCol;
|
||||
|
||||
vec3 distanceEstimation = normalize(NormPlayerPos.xyz * (cloudheight/abs(NormPlayerPos.y)/samples));
|
||||
|
||||
// terrible fake rayleigh scattering
|
||||
// vec3 rC = vec3(sky_coefficientRayleighR*1e-6, sky_coefficientRayleighG*1e-5, sky_coefficientRayleighB*1e-5)*3.0;
|
||||
// vec3 rayleighScatter = exp(-10000.0 * rC * exp(abs(distanceEstimation.y) * -5.0));
|
||||
// sunMultiScattering *= rayleighScatter;
|
||||
// sunScattering *= rayleighScatter;
|
||||
|
||||
float distanceFade = 1.0 - clamp(exp2(pow(abs(distanceEstimation.y),1.5) * -100.0),0.0,1.0)*heightRelativeToClouds;
|
||||
distanceFade = 1.0;
|
||||
|
||||
// - pow(1.0-clamp(signedSunVec.y,0.0,1.0),5.0)
|
||||
skyScattering *= 2.0;
|
||||
// sunScattering *= distanceFade;
|
||||
// sunMultiScattering *= distanceFade;
|
||||
|
||||
vec3 sunMultiScattering = directLightCol;
|
||||
vec3 skyScattering = indirectLightCol * 2.0;
|
||||
|
||||
////------- RENDER SMALL CUMULUS CLOUDS
|
||||
vec4 smallCumulusClouds = cloudColor;
|
||||
|
||||
vec2 cloudLayer0_Distance = vec2(startDistance, 1.0);
|
||||
#ifdef CloudLayer0
|
||||
smallCumulusClouds = raymarchCloud(SMALLCUMULUS_LAYER, samples, rayPosition, rayDirection, dither.x, minHeight, maxHeight, unignedSunVec, sunScattering, sunMultiScattering, skyScattering, distanceFade, lViewPosM, sampledSkyCol, cloudLayer0_Distance);
|
||||
smallCumulusClouds = raymarchCloud(SMALLCUMULUS_LAYER, samples, rayPosition, rayDirection, dither.x, minHeight, maxHeight, unignedSunVec, sunScattering, sunMultiScattering, skyScattering, lViewPosM, sampledSkyCol, cloudLayer0_Distance);
|
||||
#endif
|
||||
|
||||
////------- RENDER LARGE CUMULUS CLOUDS
|
||||
@@ -546,7 +525,7 @@ vec4 GetVolumetricClouds(
|
||||
rayPosition = getRayOrigin(rayDirection, cameraPosition, dither.y, minHeight, maxHeight);
|
||||
|
||||
vec2 cloudLayer1_Distance = vec2(startDistance, 1.0);
|
||||
if(smallCumulusClouds.a > 1e-5) largeCumulusClouds = raymarchCloud(LARGECUMULUS_LAYER, samples, rayPosition, rayDirection, dither.x, minHeight, maxHeight, unignedSunVec, sunScattering, sunMultiScattering, skyScattering, distanceFade, lViewPosM, sampledSkyCol, cloudLayer1_Distance);
|
||||
if(smallCumulusClouds.a > 1e-5) largeCumulusClouds = raymarchCloud(LARGECUMULUS_LAYER, samples, rayPosition, rayDirection, dither.x, minHeight, maxHeight, unignedSunVec, sunScattering, sunMultiScattering, skyScattering, lViewPosM, sampledSkyCol, cloudLayer1_Distance);
|
||||
#endif
|
||||
|
||||
////------- RENDER ALTOSTRATUS CLOUDS
|
||||
@@ -562,7 +541,7 @@ vec4 GetVolumetricClouds(
|
||||
rayPosition = getRayOrigin(rayDirection, cameraPosition, dither.y, minHeight, maxHeight);
|
||||
|
||||
vec2 cloudLayer2_Distance = vec2(startDistance, 1.0);
|
||||
if(smallCumulusClouds.a > 1e-5 || largeCumulusClouds.a > 1e-5) altoStratusClouds = raymarchCloud(ALTOSTRATUS_LAYER, samples, rayPosition, rayDirection, dither.x, minHeight, maxHeight, unignedSunVec, sunScattering, sunMultiScattering, skyScattering, distanceFade, lViewPosM, sampledSkyCol, cloudLayer2_Distance);
|
||||
if(smallCumulusClouds.a > 1e-5 || largeCumulusClouds.a > 1e-5) altoStratusClouds = raymarchCloud(ALTOSTRATUS_LAYER, samples, rayPosition, rayDirection, dither.x, minHeight, maxHeight, unignedSunVec, sunScattering, sunMultiScattering, skyScattering, lViewPosM, sampledSkyCol, cloudLayer2_Distance);
|
||||
#endif
|
||||
|
||||
////------- BLEND LAYERS
|
||||
|
||||
Reference in new issue
Block a user