Add auroras and floodfill/flashlight handheld shadows, improve cloud light leaking around edges, merge xonks latest commits

This commit is contained in:
Merlin1809
2025-09-17 23:23:44 +02:00
parent 0f73983f26
commit c0439532d8
25 changed files with 781 additions and 296 deletions
+3 -10
View File
@@ -9,13 +9,13 @@ Notable changes/additions compared to Bliss unstable:
+ Additional cirrus & cumulonimbus cloud layers (WIP)
+ Distant Horizons chunk fading
+ Moon Texture with phases
+ Improved Puddles, Snow Overlay and Rain Ripples
+ Snow Overlay and Rain Ripples
+ Better mod support
+ Better shader-side (hardcoded) emissives
+ Lightsource with shadows on the main end island
+ Rain & thunder cloud coverage and daily weather
+ Much better lightning strikes with clouds lighting up and shadows
+ Rainbows
+ Aurora & Rainbow
+ Caelum (Arda Craft) support
+ Emissive Ores
@@ -65,15 +65,8 @@ Note: With default settings there is at least one guaranteed eclipse per ingame
### [You can contact me by joining Xonk's discord server and using the Eclipse channel!](https://discord.gg/8nVt56H9zH)
# IN-DEVELOPMENT VERSIONS AND RELEASE VERSIONS
`Unstable` are the very latest versions, and are released regularly to be tested by anyone. **Please report any issues you find.**
`Release versions` are uploaded when the in-development version is stable enough, and has enough changes to warrant a release. These are the versions uploaded to Modrinth or Curseforge. The release versions are not the very latest version.
### Download the latest `Unstable` version:
# How to download the latest version:
- locate the `green "code" button` on this page. this button is NOT in the `releases` page.
- click the `green "code" button` and select `"download zip"`.
- once the zip file finishes downloading, install it like a normal shader. you do NOT need to unzip/extract/decompress.
### Download the latest `Release` version:
- locate the `"Releases"` tab on the right side of this page.
- find the release version you want to download. locate the files attactched to it, and download the file named similar to `"Eclipse_(version)_chocapic13_shaders_edit.zip"`
- once the zip file finishes downloading, install it like a normal shader. you do NOT need to unzip/extract/decompress.
+2 -1
View File
@@ -672,7 +672,7 @@ block.265=betterend:iron_bulb_lantern_yellow betterend:terminite_bulb_lantern_ye
humility-afm:led_yellow \
mcwlights:yellow_lamp:lit=true mcwlights:yellow_paper_lamp:lit=true mcwlights:yellow_ceiling_light:lit=true
block.266=sculk sculk_vein sculk_sensor sculk_catalyst calibrated_sculk_sensor sculk_shrieker
block.266=sculk sculk_sensor sculk_catalyst calibrated_sculk_sensor sculk_shrieker
####### ----- reflective translucents / glass ----- #######
@@ -1093,6 +1093,7 @@ block.495=cobblestone_wall:north=tall:east=low:south=tall:west=low:up=false ande
block.496=cobblestone_wall:north=low:east=tall:south=low:west=tall:up=false andesite_wall:north=low:east=tall:south=low:west=tall:up=false blackstone_wall:north=low:east=tall:south=low:west=tall:up=false brick_wall:north=low:east=tall:south=low:west=tall:up=false cobbled_deepslate_wall:north=low:east=tall:south=low:west=tall:up=false deepslate_brick_wall:north=low:east=tall:south=low:west=tall:up=false deepslate_tile_wall:north=low:east=tall:south=low:west=tall:up=false diorite_wall:north=low:east=tall:south=low:west=tall:up=false end_stone_brick_wall:north=low:east=tall:south=low:west=tall:up=false granite_wall:north=low:east=tall:south=low:west=tall:up=false mossy_cobblestone_wall:north=low:east=tall:south=low:west=tall:up=false mossy_stone_brick_wall:north=low:east=tall:south=low:west=tall:up=false mud_brick_wall:north=low:east=tall:south=low:west=tall:up=false nether_brick_wall:north=low:east=tall:south=low:west=tall:up=false polished_blackstone_brick_wall:north=low:east=tall:south=low:west=tall:up=false polished_blackstone_wall:north=low:east=tall:south=low:west=tall:up=false polished_deepslate_wall:north=low:east=tall:south=low:west=tall:up=false prismarine_wall:north=low:east=tall:south=low:west=tall:up=false red_nether_brick_wall:north=low:east=tall:south=low:west=tall:up=false red_sandstone_wall:north=low:east=tall:south=low:west=tall:up=false sandstone_wall:north=low:east=tall:south=low:west=tall:up=false stone_brick_wall:north=low:east=tall:south=low:west=tall:up=false \
create:cut_andesite_wall:north=low:east=tall:south=low:west=tall:up=false create:polished_cut_andesite_wall:north=low:east=tall:south=low:west=tall:up=false create:cut_andesite_brick_wall:north=low:east=tall:south=low:west=tall:up=false create:small_andesite_brick_wall:north=low:east=tall:south=low:west=tall:up=false create:cut_asurine_wall:north=low:east=tall:south=low:west=tall:up=false create:polished_cut_asurine_wall:north=low:east=tall:south=low:west=tall:up=false create:cut_asurine_brick_wall:north=low:east=tall:south=low:west=tall:up=false create:small_asurine_brick_wall:north=low:east=tall:south=low:west=tall:up=false create:cut_calcite_wall:north=low:east=tall:south=low:west=tall:up=false create:polished_cut_calcite_wall:north=low:east=tall:south=low:west=tall:up=false create:cut_calcite_brick_wall:north=low:east=tall:south=low:west=tall:up=false create:small_calcite_brick_wall:north=low:east=tall:south=low:west=tall:up=false create:cut_crimsite_wall:north=low:east=tall:south=low:west=tall:up=false create:polished_cut_crimsite_wall:north=low:east=tall:south=low:west=tall:up=false create:cut_crimsite_brick_wall:north=low:east=tall:south=low:west=tall:up=false create:small_crimsite_brick_wall:north=low:east=tall:south=low:west=tall:up=false create:cut_deepslate_wall:north=low:east=tall:south=low:west=tall:up=false create:polished_cut_deepslate_wall:north=low:east=tall:south=low:west=tall:up=false create:cut_deepslate_brick_wall:north=low:east=tall:south=low:west=tall:up=false create:small_deepslate_brick_wall:north=low:east=tall:south=low:west=tall:up=false create:cut_diorite_wall:north=low:east=tall:south=low:west=tall:up=false create:polished_cut_diorite_wall:north=low:east=tall:south=low:west=tall:up=false create:cut_diorite_brick_wall:north=low:east=tall:south=low:west=tall:up=false create:small_diorite_brick_wall:north=low:east=tall:south=low:west=tall:up=false create:cut_dripstone_wall:north=low:east=tall:south=low:west=tall:up=false create:polished_cut_dripstone_wall:north=low:east=tall:south=low:west=tall:up=false create:cut_dripstone_brick_wall:north=low:east=tall:south=low:west=tall:up=false create:small_dripstone_brick_wall:north=low:east=tall:south=low:west=tall:up=false create:cut_granite_wall:north=low:east=tall:south=low:west=tall:up=false create:polished_cut_granite_wall:north=low:east=tall:south=low:west=tall:up=false create:cut_granite_brick_wall:north=low:east=tall:south=low:west=tall:up=false create:small_granite_brick_wall:north=low:east=tall:south=low:west=tall:up=false create:cut_limestone_wall:north=low:east=tall:south=low:west=tall:up=false create:polished_cut_limestone_wall:north=low:east=tall:south=low:west=tall:up=false create:cut_limestone_brick_wall:north=low:east=tall:south=low:west=tall:up=false create:small_limestone_brick_wall:north=low:east=tall:south=low:west=tall:up=false create:cut_ochrum_wall:north=low:east=tall:south=low:west=tall:up=false create:polished_cut_ochrum_wall:north=low:east=tall:south=low:west=tall:up=false create:cut_ochrum_brick_wall:north=low:east=tall:south=low:west=tall:up=false create:small_ochrum_brick_wall:north=low:east=tall:south=low:west=tall:up=false create:cut_scorchia_wall:north=low:east=tall:south=low:west=tall:up=false create:polished_cut_scorchia_wall:north=low:east=tall:south=low:west=tall:up=false create:cut_scorchia_brick_wall:north=low:east=tall:south=low:west=tall:up=false create:small_scorchia_brick_wall:north=low:east=tall:south=low:west=tall:up=false create:cut_scoria_wall:north=low:east=tall:south=low:west=tall:up=false create:polished_cut_scoria_wall:north=low:east=tall:south=low:west=tall:up=false create:cut_scoria_brick_wall:north=low:east=tall:south=low:west=tall:up=false create:small_scoria_brick_wall:north=low:east=tall:south=low:west=tall:up=false create:cut_tuff_wall:north=low:east=tall:south=low:west=tall:up=false create:polished_cut_tuff_wall:north=low:east=tall:south=low:west=tall:up=false create:cut_tuff_brick_wall:north=low:east=tall:south=low:west=tall:up=false create:small_tuff_brick_wall:north=low:east=tall:south=low:west=tall:up=false create:cut_veridium_wall:north=low:east=tall:south=low:west=tall:up=false create:polished_cut_veridium_wall:north=low:east=tall:south=low:west=tall:up=false create:cut_veridium_brick_wall:north=low:east=tall:south=low:west=tall:up=false create:small_veridium_brick_wall:north=low:east=tall:south=low:west=tall:up=false
block.497=sculk_vein
####### ----- misc ----- #######
+1 -1
View File
@@ -39,7 +39,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
float maxOverdrawDistance = OVERDRAW_MAX_DISTANCE;
#endif
if(length(playerPos) < clamp(far-16*4, 16, maxOverdrawDistance) || texture2D(depthtex1, gl_FragCoord.xy*texelSize).x < 1.0){ discard; return;}
if(length(playerPos) < clamp(far-16*4, 16, maxOverdrawDistance) || texelFetch2D(depthtex1, ivec2(gl_FragCoord.xy), 0).x < 1.0){ discard; return;}
#endif
+1 -1
View File
@@ -479,7 +479,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 - viewDist/clamp(far-16*4, 16, maxOverdrawDistance),0.0)*5,1.0);
if(texture2D(depthtex0, gl_FragCoord.xy*texelSize).x < 1.0 || distancefade > 0.0){
if(texelFetch2D(depthtex0, ivec2(gl_FragCoord.xy), 0).x < 1.0 || distancefade > 0.0){
gl_FragData[0].a = 0.0;
material = 0.0;
}
+4 -3
View File
@@ -310,7 +310,7 @@ void main() {
#ifdef POM
vec3 fragpos = toScreenSpace(gl_FragCoord.xyz*vec3(texelSize/RENDER_SCALE,1.0)-vec3(0.0));
vec3 worldpos = mat3(gbufferModelViewInverse) * fragpos + gbufferModelViewInverse[3].xyz + cameraPosition;
// vec3 worldpos = mat3(gbufferModelViewInverse) * fragpos + gbufferModelViewInverse[3].xyz + cameraPosition;
vec3 normal = normalMat.xyz;
vec3 tangent2 = normalize(cross(tangent.rgb,normal)*tangent.w);
@@ -365,8 +365,9 @@ void main() {
Albedo.rgb = toLinear(Albedo.rgb);
if(dot(Albedo.rgb, vec3(0.33333)) < 1.0/255.0 || Albedo.a < 0.01 ) { discard; return; }
// if(dot(Albedo.rgb, vec3(0.33333)) < 1.0/255.0 || Albedo.a < 0.01 ) { discard; return; }
if(Albedo.a < 0.01 ) { discard; return; }
gl_FragData[0] = vec4(encodeVec2(vec2(0.5)), encodeVec2(Albedo.rg), encodeVec2(vec2(Albedo.b,0.02)), 1.0);
#endif
+16 -8
View File
@@ -96,21 +96,29 @@ void main() {
#endif
#ifdef WEATHER
#if defined WEATHER || defined LINES
vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
vec3 worldpos = mat3(gbufferModelViewInverse) * position + gbufferModelViewInverse[3].xyz;
vec3 worldpos = mat3(gbufferModelViewInverse) * position + gbufferModelViewInverse[3].xyz + cameraPosition;
bool istopv = worldpos.y > cameraPosition.y + 5.0 && lmtexcoord.w > 0.99;
#ifdef WEATHER
worldpos += cameraPosition;
bool istopv = worldpos.y > cameraPosition.y + 5.0 && lmtexcoord.w > 0.99;
if(!istopv){
if(!istopv){
worldpos.xyz -= cameraPosition - vec3(2.0,0.0,2.0) * min(max(clamp(eyeBrightnessSmooth.y/240.0,0,1)-0.95,0)/0.05,1);
}else{
}else{
worldpos.xyz -= cameraPosition;
}
}
#endif
position = mat3(gbufferModelView) * worldpos + gbufferModelView[3].xyz;
#if defined LINES && defined PLANET_CURVATURE
float curvature = length(worldpos) / (16*8);
worldpos.y -= curvature*curvature * CURVATURE_AMOUNT;
#endif
gl_Position = toClipSpace3(position);
position = mat3(gbufferModelView) * worldpos + gbufferModelView[3].xyz;
gl_Position = toClipSpace3(position);
#else
gl_Position = ftransform();
#endif
+3 -3
View File
@@ -265,7 +265,7 @@ void main() {
lmtexcoord.w = 0.0;
}
#if defined Puddles || ShaderSnow > 0
#if PUDDLE_MODE > 0 || ShaderSnow > 0
if(blockID == 215) lmtexcoord.w = 0.0;
#endif
#endif
@@ -307,7 +307,7 @@ void main() {
// normal block lightsources
if(mc_Entity.x >= 100 && mc_Entity.x < 300) EMISSIVE = 0.5;
if(mc_Entity.x == 266) EMISSIVE = 0.2; // sculk stuff
if(mc_Entity.x == 266 || mc_Entity.x == 497) EMISSIVE = 0.2; // sculk stuff
if(mc_Entity.x == 195) EMISSIVE = 2.3; // glow lichen
@@ -323,7 +323,7 @@ void main() {
if(mc_Entity.x == 244) EMISSIVE = 1.5; // soul fire
#if defined Puddles || ShaderSnow > 0
#if PUDDLE_MODE > 0 || ShaderSnow > 0
if (mc_Entity.x == 244 || mc_Entity.x == 189) lmtexcoord.w = 0.0;
#endif
+7 -4
View File
@@ -624,15 +624,17 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
waterPos.xyz = getParallaxDisplacement(waterPos, playerPos);
vec3 bump = getWaveNormal(waterPos, playerPos);
#ifdef RIPPLE_WATER
if(viewDist < 35 && rainStrength > 0.0 && biome_precipitation == 1 && abs(worldSpaceNormal.z) < 0.95 && abs(worldSpaceNormal.x) < 0.95) {
float effectStrength = smoothstep(0.85, 1.0, lightmap.y);
rippleBump = ripples(worldPos.xz);
waterPos.xyz += RIPPLE_STRENGTH * rippleBump * rainStrength * effectStrength * smoothstep(35.0, 10.0, viewDist);
bump += 0.6 * RIPPLE_STRENGTH * rippleBump * rainStrength * effectStrength * smoothstep(35.0, 10.0, viewDist);
}
#endif
vec3 bump = normalize(getWaveNormal(waterPos, playerPos));
bump = normalize(bump);
float bumpmult = WATER_WAVE_STRENGTH;
bump = bump * vec3(bumpmult, bumpmult, bumpmult) + vec3(0.0f, 0.0f, 1.0f - bumpmult);
@@ -882,6 +884,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
#ifdef LIGHTNING
vec3 lightColor = vec3(1.0);
gl_FragData[0].a = max(gl_FragData[0].a, 1.0/255.0);
#else
vec3 lightColor = vec3(TORCH_R,TORCH_G,TORCH_B);
#endif
@@ -972,7 +975,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
float maxOverdrawDistance = OVERDRAW_MAX_DISTANCE;
#endif
bool WATER = texture2D(colortex7, gl_FragCoord.xy*texelSize).a > 0.0 && length(feetPlayerPos) > clamp(far-16.0*4.0, 16.0, maxOverdrawDistance) && texture2D(depthtex1, gl_FragCoord.xy*texelSize).x >= 1.0;
bool WATER = texture2D(colortex7, gl_FragCoord.xy*texelSize).a > 0.0 && length(feetPlayerPos) > clamp(far-16.0*4.0, 16.0, maxOverdrawDistance) && texelFetch2D(depthtex1, ivec2(gl_FragCoord.xy), 0).x >= 1.0;
if(WATER && isWater) {
gl_FragData[0].a = 0.0;
@@ -987,7 +990,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
#endif
#if DEBUG_VIEW == debug_NORMALS
gl_FragData[0].rgb = worldSpaceNormal.xyz * 0.1;
gl_FragData[0].a = 1;
gl_FragData[0].a = 1.0;
#endif
#if DEBUG_VIEW == debug_INDIRECT
gl_FragData[0].rgb = Indirect_lighting * 0.1;
+21 -7
View File
@@ -261,7 +261,7 @@ float convertHandDepth_2(in float depth, bool hand) {
vec2 SSAO(
vec3 viewPos, vec3 normal, vec3 flatnormal, bool hand, float noise
){
int samples = 4;
int samples = 7;
float occlusion = 0.0;
float sss = 0.0;
@@ -272,8 +272,6 @@ vec2 SSAO(
float distanceScale = hand ? 30.0 : mix(40.0, 10.0, pow(clamp(1.0 - linearViewDistance/50.0,0.0,1.0),2.0));
float depthCancelation = (linearViewDistance*linearViewDistance) / distanceScale ;
if (linearViewDistance < 15.0 || hand) samples = 7;
// distanceScale *= 10;
vec2 screenEdges = 2.0/vec2(viewWidth, viewHeight);
@@ -377,9 +375,11 @@ void main() {
// bool blocklights = abs(dataUnpacked1.w-0.8) <0.01;
float z = texelFetch2D(depthtex1,ivec2(gl_FragCoord.xy),0).x;
float z0 = texelFetch2D(depthtex0,ivec2(gl_FragCoord.xy),0).x;
#ifdef DISTANT_HORIZONS
float DH_depth1 = texelFetch2D(dhDepthTex1,ivec2(gl_FragCoord.xy),0).x;
float DH_depth0 = texelFetch2D(dhDepthTex,ivec2(gl_FragCoord.xy),0).x;
float swappedDepth = z >= 1.0 ? DH_depth1 : z;
#else
float DH_depth1 = 1.0;
@@ -390,6 +390,7 @@ void main() {
vec3 playerPos = mat3(gbufferModelViewInverse) * viewPos;
float depth = z;
float depth0 = z0;
#ifdef DISTANT_HORIZONS
float _near = near;
@@ -402,16 +403,29 @@ void main() {
depth = linearizeDepthFast(depth, _near, _far);
depth = depth / dhFarPlane;
_near = near;
_far = far*4.0;
if (depth0 >= 1.0) {
depth0 = DH_depth1;
_near = dhNearPlane;
_far = dhFarPlane;
}
depth0 = linearizeDepthFast(depth0, _near, _far);
depth0 = depth0 / dhFarPlane;
#endif
if(depth < 1.0)
gl_FragData[2] = vec4(vec3(0.0), depth * depth * 65000.0);
if(depth < 1.0 || depth0 < 1.0)
gl_FragData[2] = vec4(vec2(0.0), depth0 * depth0 * 65000.0, depth * depth * 65000.0);
else
gl_FragData[2] = vec4(vec3(0.0), 65000.0);
gl_FragData[2] = vec4(vec2(0.0), 65000.0, 65000.0);
vec3 FlatNormals = normalize(texture2D(colortex15,texcoord).rgb * 2.0 - 1.0);
#if defined DENOISE_SSS_AND_SSAO && indirect_effect == 1
vec3 FlatNormals = normalize(texture2D(colortex15,texcoord).rgb * 2.0 - 1.0);
if(z >= 1.0) FlatNormals = normal;
+74 -47
View File
@@ -45,11 +45,11 @@ uniform float rainStrength;
uniform sampler2D snowTexA;
uniform sampler2D snowTexN;
#endif
#if ShaderSnow > 0 || defined Puddles
#if ShaderSnow > 0 || PUDDLE_MODE > 0
uniform sampler2D snowTexR;
#endif
#if defined RIPPLE_PUDDLES && defined Puddles
#if defined RIPPLE_PUDDLES && PUDDLE_MODE > 0
#include "/lib/ripples.glsl"
uniform int biome_precipitation;
@@ -225,6 +225,7 @@ float convertHandDepth_2(in float depth, bool hand) {
#endif
uniform vec3 relativeEyePosition;
#define MAIN_SHADOW_PASS
#define FULLRESDEPTH
#include "/lib/specular.glsl"
@@ -500,13 +501,19 @@ vec2 SSRT_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, float noise, boo
return vec2(shadows, SSS / samples );
}
float SSRT_FlashLight_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, float noise){
#if defined FLASHLIGHT_SHADOWS && defined FLASHLIGHT
float SSRT_FlashLight_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, float noise, vec3 normals, bool hand){
if(hand) return 1.0;
float steps = 16.0;
float Shadow = 1.0;
vec3 WlightDir = normalize((gbufferModelViewInverse*vec4(lightDir, 1.0)).xyz);
float NdotL = dot(normals, WlightDir);
NdotL = smoothstep(0.0, 0.2, abs(NdotL));
float shadows = 1.0;
float samples = 16.0;
float SSS = 0.0;
// isSSS = true;
float _near = near; float _far = far*4.0;
@@ -514,44 +521,43 @@ float SSRT_FlashLight_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, floa
_near = dhNearPlane;
_far = dhFarPlane;
}
vec3 clipPosition = toClipSpace3_DH(viewPos, depthCheck);
vec3 position = toClipSpace3_DH(viewPos, depthCheck) ;
//prevents the ray from going behind the camera
float rayLength = ((viewPos.z + lightDir.z * _far*sqrt(3.)) > -_near) ?
(-_near -viewPos.z) / lightDir.z : _far*sqrt(3.);
float rayLength = ((viewPos.z + lightDir.z * _far * sqrt(3.)) > -_near) ? (-_near - viewPos.z) / lightDir.z : _far * sqrt(3.);
vec3 direction = toClipSpace3_DH(viewPos + lightDir*rayLength, depthCheck) - clipPosition; //convert to clip space
vec3 direction = toClipSpace3_DH(viewPos + lightDir*rayLength, depthCheck) - position;
direction.xyz = direction.xyz / max(max(abs(direction.x)/0.0005, abs(direction.y)/0.0005),400.0); //fixed step size
direction *= 6.0;
direction.xyz = direction.xyz / max(abs(direction.x)/0.0005, abs(direction.y)/0.0005); //fixed step size
float Stepmult = 6.0;
vec3 rayDir = direction * Stepmult * vec3(RENDER_SCALE,1.0);
vec3 screenPos = clipPosition * vec3(RENDER_SCALE,1.0) + rayDir*noise;
position.xy *= RENDER_SCALE;
direction.xy *= RENDER_SCALE;
vec3 newPos = position + direction*noise;
// literally shadow bias to fight shadow acne due to precision problems when comparing sampled depth and marched position
//newPos += direction*0.3;
for (int i = 0; i < int(steps); i++) {
for (int i = 0; i < int(16); i++) {
float samplePos = texture2D(depthtex2, screenPos.xy).x;
float samplePos = texelFetch2D(depthtex2, ivec2(newPos.xy/texelSize).xy,0).x;
#ifdef DISTANT_HORIZONS
if(depthCheck) samplePos = texture2D(dhDepthTex1, screenPos.xy).x;
if(depthCheck) samplePos = texelFetch2D(dhDepthTex1, ivec2(newPos.xy/texelSize),0).x;
#endif
if(samplePos < screenPos.z){// && (samplePos <= max(minZ,maxZ) && samplePos >= min(minZ,maxZ))){
// vec2 linearZ = vec2(swapperlinZ(screenPos.z, _near, _far), swapperlinZ(samplePos, _near, _far));
// float calcthreshold = abs(linearZ.x - linearZ.y) / linearZ.x;
// if (calcthreshold < 0.035)
Shadow = 0.0;
if(samplePos < newPos.z && samplePos > 0.0){// && (samplePos <= max(minZ,maxZ) && samplePos >= min(minZ,maxZ))){
shadows = 0.0;
break;
}
screenPos += rayDir;
newPos += direction;
}
return Shadow;
return clamp(shadows*NdotL, 1.0-FLASHLIGHT_SHADOWS_STRENGTH, 1.0);
}
#endif
void Emission(
inout vec3 Lighting,
@@ -587,7 +593,7 @@ void doEdgeAwareBlur(
for(int i = 0; i < 4; i++) {
#ifdef DISTANT_HORIZONS
float offsetDepth = sqrt(texelFetch2D(depth, UV + OFFSET[i] + UV_NOISE,0).a/65000.0);
float offsetDepth = sqrt(texelFetch2D(depth, UV + OFFSET[i] + UV_NOISE,0).z/65000.0);
#else
float offsetDepth = ld(convertHandDepth_2(texelFetch2D(depth, UV + OFFSET[i] + UV_NOISE, 0).r,hand));
#endif
@@ -636,7 +642,7 @@ vec4 BilateralUpscale_VLFOG(sampler2D tex, sampler2D depth, float referenceDepth
ivec2( 0, 0)
);
for(int i = 0; i < 4; i++) {
for(int i = 0; i < 5; i++) {
#ifdef DISTANT_HORIZONS
float offsetDepth = sqrt(texelFetch2D(depth, UV_DEPTH + (OFFSET[i] + UV_NOISE) * SCALE,0).a/65000.0);
#else
@@ -775,15 +781,22 @@ uniform float wetness;
void applyPuddles(
in vec3 worldPos, in vec3 flatNormals, in vec2 lightmap, in bool isWater, in int isEyeInWater, inout vec3 albedo, inout vec3 normals, inout float roughness, inout float f0
){
/* PUDDLE_MODE
0 = OFF, NO WETNESS
1 = puddles + full wetness
2 = only puddles
3 = only full wetness
*/
float effectStrength = smoothstep(0.85, 1.0, lightmap.y);
//float effectStrength = smoothstep(0.85, 1.0, max(lightmap.y-step(1.0,lightmap.x), 0.0));
vec2 snowCoords = worldPos.xz*0.1;
#if ShaderSnow > 0 || defined Puddles
#if ShaderSnow > 0 || PUDDLE_MODE > 0
float snowR = texture2D(snowTexR, snowCoords).g;
#endif
#ifdef Puddles
#if PUDDLE_MODE > 0
if (wetnessAmount > 0.01) {
float halfWet = min(wetnessAmount,1.0);
float fullWet = clamp(wetnessAmount - 2.0,0.0,1.0);
@@ -794,11 +807,23 @@ uniform float wetness;
UV = mix(UV, worldPos.zy*vec2(2.0, 0.5)+driprate, abs(flatNormals.x));
float noise = texture2D(noisetex, UV * 0.02).b;
float puddles = max(halfWet - noise,0.0);
puddles = clamp(halfWet - exp(-25.0 * puddles*puddles*puddles*puddles*puddles*Puddle_Size),0.0,1.0);
float wetnessStages = mix(puddles, 1.0, fullWet) * effectStrength;
#if PUDDLE_MODE == 1
float puddles = max(halfWet - noise,0.0);
puddles = clamp(halfWet - exp(-25.0 * puddles*puddles*puddles*puddles*puddles*Puddle_Size),0.0,1.0);
puddles = mix(puddles, 1.0, fullWet);
#endif
#if PUDDLE_MODE == 2
float puddles = max(halfWet - noise,0.0);
puddles = clamp(halfWet - exp(-25.0 * puddles*puddles*puddles*puddles*puddles*Puddle_Size),0.0,1.0);
#endif
#if PUDDLE_MODE == 3
float puddles = fullWet;
#endif
float wetnessStages = puddles * effectStrength;
if(isWater) wetnessStages = 0.0;
#ifdef RIPPLE_PUDDLES
@@ -881,9 +906,9 @@ void main() {
bool isDHrange = z >= 1.0;
#ifdef DISTANT_HORIZONS
float DH_mixedLinearZ = sqrt(texture2D(colortex12,texcoord).a/65000.0);
float DH_depth0 = texture2D(dhDepthTex,texcoord).x;
float DH_depth1 = texture2D(dhDepthTex1,texcoord).x;
float DH_mixedLinearZ = sqrt(texelFetch2D(colortex12,ivec2(gl_FragCoord.xy), 0).z/65000.0);
float DH_depth0 = texelFetch2D(dhDepthTex,ivec2(gl_FragCoord.xy), 0).x;
float DH_depth1 = texelFetch2D(dhDepthTex1,ivec2(gl_FragCoord.xy), 0).x;
float depthOpaque = z;
float depthOpaqueL = linearizeDepthFast(depthOpaque, near, farPlane);
@@ -1349,18 +1374,20 @@ void main() {
#else
const vec3 lpvPos = vec3(0.0);
#endif
vec3 blockLightColor = doBlockLightLighting( vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.x, feetPlayerPos, lpvPos);
vec3 blockLightColor = doBlockLightLighting(vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.x, feetPlayerPos, lpvPos, viewPos, isDHrange, blueNoise(), FlatNormals, hand);
Indirect_lighting += blockLightColor;
vec4 flashLightSpecularData = vec4(0.0);
#ifdef FLASHLIGHT
vec3 newViewPos = viewPos;
float flashlightshadows = SSRT_FlashLight_Shadows(toScreenSpace_DH(texcoord/RENDER_SCALE, z, DH_depth1), isDHrange, newViewPos, interleaved_gradientNoise_temporal());
#ifdef FLASHLIGHT_SHADOWS
vec3 newViewPos = viewPos + vec3(-0.25, 0.2, 0.0);
float flashlightshadows = SSRT_FlashLight_Shadows(toScreenSpace_DH(texcoord/RENDER_SCALE, z, DH_depth1), isDHrange, -newViewPos, blueNoise(), FlatNormals, hand);
#else
float flashlightshadows = 1.0;
#endif
Indirect_lighting += calculateFlashlight(texcoord, viewPos, albedoSmooth, slopednormal, flashLightSpecularData, hand);
Indirect_lighting += flashlightshadows*calculateFlashlight(texcoord, viewPos, albedoSmooth, slopednormal, flashLightSpecularData, hand);
#endif
/////////////////////////////////////////////////////////////////////////////////////
@@ -1458,7 +1485,7 @@ void main() {
#endif
#endif
#if defined OVERWORLD_SHADER && defined DEFERRED_SPECULAR && (defined Puddles || ShaderSnow > 0)
#if defined OVERWORLD_SHADER && defined DEFERRED_SPECULAR && (PUDDLE_MODE > 0 || ShaderSnow > 0)
if(!hand && !entities && (wetnessAmount > 0.01 || snowAmount > 0.01)) applyPuddles(feetPlayerPos + cameraPosition, FlatNormals, lightmap, isWater, isEyeInWater, albedo, normal, SpecularTex.r, SpecularTex.g);
#endif
+3 -2
View File
@@ -155,6 +155,7 @@ float invLinZ (float lindepth){
uniform float nightVision;
#ifdef OVERWORLD_SHADER
uniform float auroraAmount;
const bool shadowHardwareFiltering = true;
uniform sampler2DShadow shadow;
@@ -555,7 +556,7 @@ void main() {
#ifdef CAVE_FOG
#if (CAVE_DETECTION == 0.0) || (CAVE_DETECTION == 1.0)
#if (CAVE_DETECTION == 1.0)
float caveFactor = 1-smoothstep(60.0, 63.0, cameraPosition.y);
float caveFactor = 1.0-smoothstep(60.0, 63.0, cameraPosition.y);
#else
float caveFactor = 1.0;
#endif
@@ -570,7 +571,7 @@ void main() {
float atmosphereAlpha = 1.0;
vec3 sceneColor = texelFetch2D(colortex3,ivec2(tc/texelSize),0).rgb * VolumetricClouds.a + VolumetricClouds.rgb;
vec3 sceneColor = texelFetch2D(colortex3,texcoord,0).rgb * VolumetricClouds.a + VolumetricClouds.rgb;
vec4 VolumetricFog = GetVolumetricFog(viewPos0, WsunVec, BN, directLightColor, indirectLightColor, indirectLightColor_dynamic, atmosphereAlpha, VolumetricClouds.rgb, cloudPlaneDistance);
VolumetricFog = vec4(VolumetricClouds.rgb * VolumetricFog.a + VolumetricFog.rgb, VolumetricFog.a*VolumetricClouds.a);
+33 -6
View File
@@ -4,6 +4,7 @@ flat varying vec3 zMults;
flat varying vec2 TAA_Offset;
flat varying vec3 WsunVec;
flat varying vec3 WmoonVec;
#ifdef OVERWORLD_SHADER
flat varying vec3 skyGroundColor;
@@ -344,7 +345,7 @@ vec4 bilateralUpsample(out float outerEdgeResults, float referenceDepth, sampler
for(int i = 0; i < 5; i++) {
#ifdef DISTANT_HORIZONS
float offsetDepth = sqrt(texelFetch2D(depth, UV_DEPTH + (OFFSET[i] + UV_NOISE) * SCALE,0).a/65000.0);
float offsetDepth = sqrt(texelFetch2D(depth, UV_DEPTH + (OFFSET[i] + UV_NOISE) * SCALE,0).z/65000.0);
#else
float offsetDepth = linearize(texelFetch2D(depth, UV_DEPTH + (OFFSET[i] + UV_NOISE) * SCALE, 0).r);
#endif
@@ -506,6 +507,11 @@ float getBorderFogDensity(float linearDistance, vec3 playerPos, bool sky){
return borderFogDensity;
}
#if AURORA_LOCATION > 0
uniform float auroraAmount;
#include "/lib/aurora.glsl"
#endif
void main() {
/* RENDERTARGETS:7,3,10 */
@@ -520,7 +526,7 @@ void main() {
float swappedDepth = z;
#ifdef DISTANT_HORIZONS
float DH_depth0 = texture2D(dhDepthTex,texcoord).x;
float DH_depth0 = texelFetch2D(dhDepthTex, ivec2(gl_FragCoord.xy),0).x;
float depthOpaque = z;
float depthOpaqueL = linearizeDepthFast(depthOpaque, near, farPlane);
@@ -547,7 +553,7 @@ void main() {
vec3 playerPos_normalized = normalize(playerPos);
#ifndef DISTANT_HORIZONS
float z2 = texture2D(depthtex1, texcoord).x;
float z2 = texelFetch2D(depthtex1, ivec2(gl_FragCoord.xy),0).x;
vec3 viewPos_alt = toScreenSpace(vec3(texcoord/RENDER_SCALE, z2));
vec3 playerPos_alt = mat3(gbufferModelViewInverse) * viewPos_alt + gbufferModelViewInverse[3].xyz;
float linearDistance_cylinder_alt = length(playerPos_alt.xz);
@@ -587,8 +593,8 @@ void main() {
////// --------------- get volumetrics
#ifdef DISTANT_HORIZONS
float DH_mixedLinearZ = sqrt(texelFetch2D(colortex12,ivec2(gl_FragCoord.xy),0).a/65000.0);
vec4 temporallyFilteredVL = VLTemporalFiltering(viewPos, DH_mixedLinearZ, colortex12,hand);
float DH_mixedLinearZ = sqrt(texelFetch2D(colortex12,ivec2(gl_FragCoord.xy),0).z/65000.0);
vec4 temporallyFilteredVL = VLTemporalFiltering(viewPos, DH_mixedLinearZ, colortex12, hand);
#else
vec4 temporallyFilteredVL = VLTemporalFiltering(viewPos, frDepth, depthtex0, hand);
#endif
@@ -794,7 +800,7 @@ void main() {
// blend all fog types. volumetric fog, volumetric clouds, distance based fogs for lava, powdered snow, blindness, and darkness.
blendAllFogTypes(color, bloomyFogMult, temporallyFilteredVL, linearDistance, playerPos_normalized, cameraPosition, isSky, isLightning);
////// --------------- RAINBOWS
////// --------------- RAINBOW
#if RAINBOW > 0 && defined OVERWORLD_SHADER
#if RAINBOW > 1
@@ -832,6 +838,27 @@ void main() {
}
#endif
////// --------------- AURORA
#if AURORA_LOCATION > 0 && defined OVERWORLD_SHADER
if (WsunVec.y < 0.0 && temporallyFilteredVL.a > 0.001 && isSky
#if AURORA_LOCATION < 2
&& auroraAmount > 0.001
#endif
#ifdef AURORA_MOON
&& WmoonVec.y < 0.1
#endif
#if AURORA_CHANCE < 100
&& hash_aurora(float(worldDay)) <= 0.01 * float(AURORA_CHANCE)
#endif
)
{
vec3 aurora = 0.0875*aurora(playerPos_normalized, 21, blueNoise(), WmoonVec.y, WsunVec.y);
color += aurora * temporallyFilteredVL.a;
}
#endif
////// --------------- FINALIZE
#ifdef display_LUT
float zoomLevel = 1.0;
+19
View File
@@ -1,5 +1,9 @@
#include "/lib/settings.glsl"
#ifdef CUSTOM_MOON_ROTATION
#include "/lib/SSBOs.glsl"
#endif
varying vec2 texcoord;
flat varying vec3 zMults;
@@ -13,6 +17,7 @@ flat varying vec3 zMults;
#endif
flat varying vec3 WsunVec;
flat varying vec3 WmoonVec;
uniform float far;
uniform float near;
@@ -21,6 +26,7 @@ uniform float dhNearPlane;
uniform mat4 gbufferModelViewInverse;
uniform vec3 sunPosition;
uniform vec3 moonPosition;
uniform float sunElevation;
flat varying vec2 TAA_Offset;
uniform int framemod8;
@@ -47,6 +53,19 @@ void main() {
WsunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition);
#endif
#if AURORA_LOCATION > 0
#ifdef CUSTOM_MOON_ROTATION
WmoonVec = customMoonVecSSBO;
#else
#ifdef SMOOTH_MOON_ROTATION
WmoonVec = WmoonVecSmooth;
#else
WmoonVec = normalize(mat3(gbufferModelViewInverse) * moonPosition);
#endif
if(dot(-WmoonVec, WsunVec) < 0.9999) WmoonVec = -WmoonVec;
#endif
#endif
#if defined CUMULONIMBUS_LIGHTNING && CUMULONIMBUS > 0
readSceneControllerParameters(colortex4, parameters.smallCumulus, parameters.largeCumulus, parameters.altostratus, parameters.cirrus, parameters.fog);
#endif
+26 -2
View File
@@ -63,6 +63,9 @@ uniform ivec2 eyeBrightnessSmooth;
// uniform ivec2 eyeBrightness;
uniform float caveDetection;
uniform int isEyeInWater;
uniform float auroraAmount;
#define LUT
// vec4 lightCol = vec4(lightSourceColor, float(sunElevation > 1e-5)*2-1.);
@@ -216,6 +219,9 @@ uniform bool worldTimeChangeCheck;
uniform int hideGUI;
#if AURORA_LOCATION > 0
#include "/lib/aurora.glsl"
#endif
void main() {
/* DRAWBUFFERS:4 */
@@ -381,7 +387,6 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
vec3 sky = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy)-ivec2(257,0),0).rgb/150.0;
sky = mix(averageSkyCol_Clouds * AmbientLightTint * 0.25, sky, pow(clamp(viewVector.y+1.0,0.0,1.0),5.0));
vec3 suncol = lightSourceColor;
#ifdef ambientLight_only
@@ -401,7 +406,26 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
float atmosphereAlpha = 1.0;
WsunVec = mix(WmoonVec, WsunVec, clamp(float(sunElevation > 1e-5)*2.0-1.0 ,0,1));
vec4 volumetricFog = GetVolumetricFog(viewPos, WsunVec, vec2(noise, 1.0-noise), suncol*2.5, skyGroundCol/30.0, averageSkyCol_Clouds*5.0, atmosphereAlpha, volumetricClouds.rgb, cloudPlaneDistance);
vec4 volumetricFog = GetVolumetricFog(viewPos, WsunVec, vec2(noise, 1.0-noise), suncol*2.5, skyGroundCol/30.0, averageSkyCol_Clouds*5.0, atmosphereAlpha, volumetricClouds.rgb, cloudPlaneDistance);
#if AURORA_LOCATION > 0
if (WsunVec.y < 0.0 && volumetricClouds.a > 0.01
#if AURORA_LOCATION < 2
&& auroraAmount > 0.001
#endif
#ifdef AURORA_MOON
&& WmoonVec.y < 0.1
#endif
#if AURORA_CHANCE < 100
&& hash_aurora(float(worldDay)) <= 0.01 * float(AURORA_CHANCE)
#endif
)
{
vec3 aurora = aurora(viewVector, 10, noise, WmoonVec.y, WsunVec.y);
sky += 2.4 * aurora;
}
#endif
sky = sky * volumetricClouds.a + volumetricClouds.rgb / 5.0;
sky = sky * volumetricFog.a + volumetricFog.rgb / 5.0;
@@ -87,6 +87,7 @@ float linearizeDepthFast(const in float depth, const in float near, const in flo
#ifdef OVERWORLD_SHADER
uniform float auroraAmount;
const bool shadowHardwareFiltering = true;
uniform sampler2DShadow shadow;
@@ -259,6 +260,11 @@ vec2 decodeVec2(float a){
return fract( a * constant1 ) * constant2 ;
}
#if AURORA_LOCATION > 0
#define LUT
#include "/lib/aurora.glsl"
#endif
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
@@ -278,12 +284,11 @@ void main() {
bool iswater = alpha > 0.99;
bool isLightning = alpha < 0.51 && alpha > 0.49;
//////////////////////////////////////////////////////////
///////////////// BEHIND OF TRANSLUCENTS /////////////////
//////////////////////////////////////////////////////////
if(blendedAlpha > 0.0 || iswater || isLightning){
if(blendedAlpha > 0.0 || iswater){
float noise_1 = R2_dither();
float noise_2 = blueNoise();
@@ -328,9 +333,11 @@ void main() {
vec3 directLightColor = lightCol.rgb / 2400.0;
vec3 directSunlightColor = sunlightCol / 2400.0;
vec3 directMoonlightColor = moonlightCol / 2400.0;
#ifdef CUSTOM_MOON_ROTATION
directMoonlightColor *= mix(0.0, 1.0, clamp(WmoonVec.y + 0.05, 0.0, 0.1)/0.1);
#endif
vec3 indirectLightColor = averageSkyCol / 1200.0;
vec3 indirectLightColor_dynamic = averageSkyCol_Clouds / 1200.0;
@@ -360,7 +367,7 @@ void main() {
indirectLightColor_dynamic += mix(MIN_LIGHT_AMOUNT * 0.004 + nightVision*0.02, MIN_LIGHT_AMOUNT_INSIDE * 0.004 + nightVision*0.02, 1.0 - lightmap.y);
indirectLightColor_dynamic += vec3(TORCH_R,TORCH_G,TORCH_B) * pow(1.0-sqrt(1.0-clamp(lightmap.x,0.0,1.0)),2.0) * TORCH_AMOUNT;
indirectLightColor_dynamic += vec3(TORCH_R,TORCH_G,TORCH_B) * pow(1.0-sqrt(1.0-clamp(lightmap.x,0.0,1.0)),2.0) * TORCH_AMOUNT * blendedAlpha;
vec4 finalVolumetrics = vec4(0.0,0.0,0.0,1.0);
float cloudPlaneDistance = 0.0;
@@ -371,7 +378,26 @@ void main() {
float atmosphereAlpha = 1.0;
vec4 VolumetricFog = GetVolumetricFog(viewPos1, WsunVec, vec2(noise_1, noise_2), directLightColor, indirectLightColor, indirectLightColor_dynamic, atmosphereAlpha, VolumetricClouds.rgb,cloudPlaneDistance);
#if AURORA_LOCATION > 0
if (WrealSunVec.y < 0.0 && VolumetricClouds.a > 0.01
#if AURORA_LOCATION < 2
&& auroraAmount > 0.001
#endif
#ifdef AURORA_MOON
&& WmoonVec.y < 0.1
#endif
#if AURORA_CHANCE < 100
&& hash_aurora(float(worldDay)) <= 0.01 * float(AURORA_CHANCE)
#endif
)
{
vec3 aurora = aurora(normalize(playerPos), 10, noise_2, WmoonVec.y, WrealSunVec.y);
finalVolumetrics.rgb += 0.7 * aurora * VolumetricClouds.a;
}
#endif
finalVolumetrics.rgb += VolumetricClouds.rgb;
finalVolumetrics.a *= VolumetricClouds.a;
#endif
+13
View File
@@ -961,6 +961,19 @@ void main() {
mixMask = BuildLpvMask(1u, 1u, 1u, 1u, 1u, 0u);
mixWeight = 0.9;
break;
case BLOCK_SCULK_VEIN:
mixMask = BuildLpvMask(1u, 1u, 1u, 1u, 1u, 0u);
mixWeight = 0.9;
break;
case BLOCK_GLOW_LICHEN:
mixWeight = 1.00;
break;
case BLOCK_VINE:
mixWeight = 1.00;
break;
case BLOCK_VINE_OTHER:
mixWeight = 0.5;
break;
case BLOCK_DOOR_N:
mixMask = BuildLpvMask(0u, 1u, 1u, 1u, 1u, 1u);
+23 -4
View File
@@ -1,6 +1,6 @@
option.SHADER_VERSION_LABEL = §dECLIPSE§r - A Bliss Edit
prefix.SHADER_VERSION_LABEL = V
value.SHADER_VERSION_LABEL.482 = 2.1.4
value.SHADER_VERSION_LABEL.482 = 3.0.0
# if you're here to translate, this is not a joke, these do what they say
profile.POTATO=§4Potato
@@ -203,7 +203,9 @@ screen.Direct_Light = Direct Light
value.LPV_VL_FOG_ILLUMINATION.2 = On
option.LPV_VL_FOG_ILLUMINATION_BRIGHTNESS = Fog Light Propagation Brightness
suffix.LPV_VL_FOG_ILLUMINATION_BRIGHTNESS=%
option.VANILLA_LIGHTMAP_MASK = Vanilla Lightmap Mask
option.VANILLA_LIGHTMAP_MASK = Vanilla Lightmap Mask
option.LPV_HANDHELD_SHADOWS = Handheld Shadows
option.LPV_HANDHELD_SHADOWS_STRENGTH = Handheld Shadows Strength
screen.Ambient_light = Ambient Light
@@ -767,6 +769,19 @@ screen.Rainbow_Settings = Rainbow Settings
option.RAINBOW_TIME = Rainbow Fade Time (seconds)
option.RAINBOW_ONLY_BELOW_CLOUDS = Rainbow above Clouds
screen.AURORA_SETTINGS = Aurora Settings
option.AURORA_LOCATION = Aurora
value.AURORA_LOCATION.0 = Off
value.AURORA_LOCATION.1 = Only in snowy biome
value.AURORA_LOCATION.2 = Always on
option.AURORA_MOON = Aurora only when moon is below horizon
option.AURORA_CHANCE = Aurora Chance
suffix.AURORA_CHANCE = %
option.AURORA_BRIGHTNESS = Aurora Brightness
option.AURORA_R = Aurora Red
option.AURORA_G = Aurora Green
option.AURORA_B = Aurora Blue
option.MATERIAL_AO = Material Ambient Occlusion
option.NORMAL_MAP_MULT = Normal map multiplier
value.NORMAL_MAP_MULT.1.0 = Default 1.0 §aresourcepacks expect this value
@@ -922,7 +937,7 @@ screen.POM.comment = Configure settings related to parallax occlusion mapping th
screen.Porosity.comment = Configure settings related to wetness and puddles
option.Porosity.comment = §bWhat is this?§r Porosity is a description of how porous some material is, or essentially how much water can be held inside it. for examle, sponges are very porous; water is contained within and darkens it as a results. §aPERFORMANCE COST:§r low
option.Puddles.comment = Toggle puddles for when it rains. §aPERFORMANCE COST:§r low
option.PUDDLE_MODE.comment = Toggle puddles for when it rains. §aPERFORMANCE COST:§r low
option.Puddle_Size.comment = Configure the size of the puddles.
option.FAKE_REFRACTION_AMOUNT.comment = Configure the amount of distortion refraction will do. §bWhat is this?§r you could think of refraction as light bending when going through water or glass, making the things viewed through them look stretched, squished, distorted. §aPERFORMANCE COST:§r very low
@@ -963,7 +978,11 @@ screen.World.comment = Configure settings for various things that happen in the
screen.Water_fog_color.comment = Configure colors of the water fog.
screen.World_Effects = World Weather Effects
option.Puddles = Puddles
option.PUDDLE_MODE = Puddles
value.PUDDLE_MODE.0 = No Wetness
value.PUDDLE_MODE.1 = Puddles + Completely Wet
value.PUDDLE_MODE.2 = Only Puddles
value.PUDDLE_MODE.3 = Only Complete Wetness
option.Puddle_Size = Puddle Size Multiplier
option.Puddle_Reflection_Sharpness = Puddle Reflection Sharpness
option.Puddle_Reflection_Sharpness.comment = Controls the blurriness of puddles. 1.0 means mirror like
+112
View File
@@ -0,0 +1,112 @@
// from https://www.shadertoy.com/view/XtGGRt, edited
// Auroras by nimitz 2017 (twitter: @stormoid)
// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
// Contact the author for other licensing options
/*
There are two main hurdles I encountered rendering this effect.
First, the nature of the texture that needs to be generated to get a believable effect
needs to be very specific, with large scale band-like structures, small scale non-smooth variations
to create the trail-like effect, a method for animating said texture smoothly and finally doing all
of this cheaply enough to be able to evaluate it several times per fragment/pixel.
The second obstacle is the need to render a large volume while keeping the computational cost low.
Since the effect requires the trails to extend way up in the atmosphere to look good, this means
that the evaluated volume cannot be as constrained as with cloud effects. My solution was to make
the sample stride increase polynomially, which works very well as long as the trails are lower opcaity than
the rest of the effect. Which is always the case for auroras.
After that, there were some issues with getting the correct emission curves and removing banding at lowered
sample densities, this was fixed by a combination of sample number influenced dithering and slight sample blending.
N.B. the base setup is from an old shader and ideally the effect would take an arbitrary ray origin and
direction. But this was not required for this demo and would be trivial to fix.
*/
float hash_aurora(float p)
{
p = fract(p * .1031);
p *= p + 33.33;
p *= p + p;
return fract(p);
}
mat2 mm2(in float a) {
float c = cos(a), s = sin(a);
return mat2(c, s, -s, c);
}
const mat2 m2 = mat2(0.95534, 0.29552, -0.29552, 0.95534);
float tri(in float x) {
return clamp(abs(fract(x) - 0.5), 0.01, 0.49);
}
vec2 tri2(in vec2 p) {
float triX = tri(p.x);
float triY = tri(p.y);
return vec2(triX + triY, tri(triX + p.y));
}
float triNoise2d(in vec2 p) {
float z = 1.8;
float z2 = 2.5;
float rz = 0.0;
p *= mm2(p.x * 0.06);
vec2 bp = p;
mat2 rotation = mm2(frameTimeCounter * 0.06);
for (int i = 0; i < 3; i++) {
vec2 dg = tri2(bp * 1.75) * 0.75;
dg *= rotation;
p -= dg / z2;
bp *= 1.3;
z2 *= 0.45;
z *= 0.42;
p *= 1.21 + (rz - 1.0) * 0.02;
rz += tri(p.x + tri(p.y)) * z;
p *= -m2;
}
return clamp(1.0 / pow(rz * 29.0, 1.6), 0.0, 0.55);
}
vec3 aurora(vec3 dir, int samples, float noise, float WmoonVecY, float WsunVecY) {
vec3 col = vec3(0.0);
vec3 avgCol = vec3(0.0);
float hash = 0.05 * noise;
float fade = dir.y * 2.0 + 0.4;
float atmosphereGround = 1.0 - exp2(-50.0 * pow(clamp(dir.y+0.025,0.0,1.0),2.0));
#ifdef LUT
float mult = 6.0;
#else
float mult = 3.0;
#endif
for (int i = 0; i < samples; i++) {
float mI = mult * float(i);
float of = hash * smoothstep(0.0, 12.0, mI);
float pt = (0.8 + pow(mI, 1.4) * 0.0016) / fade - of;
vec3 bpos = pt * dir;
float rzt = triNoise2d(bpos.zx);
vec3 col2 = vec3(0.0, 0.0, 0.0);
col2 = (sin(vec3(AURORA_R, AURORA_G, AURORA_B) + mI * 0.063) * 0.5 + 0.5) * rzt;
avgCol = mix(avgCol, col2, 0.1);
col += avgCol * exp2(-mI * 0.05 - 2.5);
}
vec3 auroraCol = 14.5*pow(col, vec3(1.45));
#ifdef AURORA_MOON
auroraCol *= smoothstep(0.1, 0.0, WmoonVecY);
#endif
auroraCol *= smoothstep(0.0, -0.1, WsunVecY);
return auroraCol * atmosphereGround * auroraAmount * AURORA_BRIGHTNESS;
}
+1
View File
@@ -304,5 +304,6 @@
#define BLOCK_WALL_TALL_N_S_LOW_W_E 495
#define BLOCK_WALL_TALL_W_E_LOW_N_S 496
#define BLOCK_WALL_MAX 496
#define BLOCK_SCULK_VEIN 497
#define BLOCK_END_PORTAL 500
#define BLOCK_SIGN 501
+87 -7
View File
@@ -1,8 +1,69 @@
#if defined MAIN_SHADOW_PASS && defined LPV_HANDHELD_SHADOWS && defined IS_LPV_ENABLED
float swapperlinZ2(float depth, float _near, float _far) {
return (2.0 * _near) / (_far + _near - depth * (_far - _near));
}
float SSRT_Handlight_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, float noise, vec3 normals, bool hand){
if(hand) return 1.0;
vec3 WlightDir = normalize((gbufferModelViewInverse*vec4(lightDir, 1.0)).xyz);
float NdotL = dot(normals, WlightDir);
NdotL = smoothstep(0.0, 0.2, abs(NdotL));
float shadows = 1.0;
float samples = 16.0;
float SSS = 0.0;
float _near = near; float _far = far*4.0;
if (depthCheck) {
_near = dhNearPlane;
_far = dhFarPlane;
}
vec3 position = toClipSpace3_DH(viewPos, depthCheck) ;
//prevents the ray from going behind the camera
float rayLength = ((viewPos.z + lightDir.z * _far * sqrt(3.)) > -_near) ? (-_near - viewPos.z) / lightDir.z : _far * sqrt(3.);
vec3 direction = toClipSpace3_DH(viewPos + lightDir*rayLength, depthCheck) - position;
direction.xyz = direction.xyz / max(max(abs(direction.x)/0.0015, abs(direction.y)/0.0015),400.0); //fixed step size
direction *= 6.0;
position.xy *= RENDER_SCALE;
direction.xy *= RENDER_SCALE;
vec3 newPos = position + direction*noise;
// literally shadow bias to fight shadow acne due to precision problems when comparing sampled depth and marched position
//newPos += direction*0.3;
for (int i = 0; i < int(10); i++) {
float samplePos = texelFetch2D(depthtex2, ivec2(newPos.xy/texelSize).xy,0).x;
#ifdef DISTANT_HORIZONS
if(depthCheck) samplePos = texelFetch2D(dhDepthTex1, ivec2(newPos.xy/texelSize),0).x;
#endif
if(samplePos < newPos.z && samplePos > 0.0){// && (samplePos <= max(minZ,maxZ) && samplePos >= min(minZ,maxZ))){
shadows = 0.0;
break;
}
newPos += direction;
}
return clamp(shadows*NdotL, 1.0-LPV_HANDHELD_SHADOWS_STRENGTH, 1.0);
}
#endif
#ifdef IS_LPV_ENABLED
vec3 GetHandLight(const in int itemId, const in vec3 playerPos, const in vec3 normal) {
vec3 GetHandLight(const in int itemId, const in vec3 playerPos, inout float lightRange) {
vec3 lightFinal = vec3(0.0);
vec3 lightColor = vec3(0.0);
float lightRange = 0.0;
uvec2 blockData = texelFetch(texBlockData, itemId, 0).rg;
vec4 lightColorRange = unpackUnorm4x8(blockData.r);
@@ -24,6 +85,9 @@
vec3 doBlockLightLighting(
vec3 lightColor, float lightmap,
vec3 playerPos, vec3 lpvPos
#ifdef MAIN_SHADOW_PASS
, vec3 viewPos, bool depthCheck, float noise, vec3 normals, bool hand
#endif
){
lightmap = clamp(lightmap,0.0,1.0);
@@ -54,13 +118,29 @@ vec3 doBlockLightLighting(
#ifdef Hand_Held_lights
// create handheld lightsources
const vec3 normal = vec3(0.0); // TODO
if (heldItemId > 0)
blockLight += GetHandLight(heldItemId, playerPos, normal);
if (heldItemId > 0){
float lightRange = 0.0;
vec3 handLightCol = GetHandLight(heldItemId, playerPos, lightRange);
if (heldItemId2 > 0)
blockLight += GetHandLight(heldItemId2, playerPos, normal);
#if defined MAIN_SHADOW_PASS && defined LPV_HANDHELD_SHADOWS
if (lightRange > 0.0) handLightCol *= SSRT_Handlight_Shadows(viewPos, depthCheck, -(viewPos + vec3(-0.25, 0.2, 0.0)), noise, normals, hand);
#endif
blockLight += handLightCol;
}
if (heldItemId2 > 0){
float lightRange2 = 0.0;
vec3 handLightCol2 = GetHandLight(heldItemId2, playerPos, lightRange2);
#if defined MAIN_SHADOW_PASS && defined LPV_HANDHELD_SHADOWS
if (lightRange2 > 0.0) handLightCol2 *= SSRT_Handlight_Shadows(viewPos, depthCheck, -(viewPos + vec3(0.25, 0.2, 0.0)), noise, normals, hand);
#endif
blockLight += handLightCol2;
}
#endif
#endif
+3 -3
View File
@@ -128,7 +128,7 @@ vec4 GetVolumetricFog(
// float totalAbsorbance = 1.0;
vec3 totalAbsorbance = vec3(1.0);
float fogAbsorbance = 1.0;
// float fogAbsorbance = 1.0;
// float atmosphereAbsorbance = 1.0;
vec3 atmosphereAbsorbance = vec3(1.0);
@@ -137,7 +137,7 @@ vec4 GetVolumetricFog(
///// ----- fog lighting
//Mie phase + somewhat simulates multiple scattering (Horizon zero down cloud approx)
float sunPhase = fogPhase(SdotV)*5.0;// phaseCloudFog(SdotV, 0.9) + phaseCloudFog(SdotV, 0.85) + phaseCloudFog(SdotV, 0.5) * 5.0;
float sunPhase2 = (phaseCloudFog(SdotV, 0.85) + phaseCloudFog(SdotV, 0.5)) * 5.0;
// float sunPhase2 = (phaseCloudFog(SdotV, 0.85) + phaseCloudFog(SdotV, 0.5)) * 5.0;
float skyPhase = 2.0 + pow(1.0-pow(1.0-clamp(normalize(wpos).y*0.5+0.5,0.0,1.0),2.0),5.0)*2.0 ;//pow(clamp(normalize(wpos).y*0.5+0.5,0.0,1.0),4.0)*5.0;
float rayL = phaseRayleigh(SdotV);
@@ -173,7 +173,7 @@ vec4 GetVolumetricFog(
float lightLevelZero = pow(clamp(eyeBrightnessSmooth.y/240.0 ,0.0,1.0),3.0);
// SkyLightColor *= lightLevelZero*0.9 + 0.1;
vec3 finalsceneColor = vec3(0.0);
// vec3 finalsceneColor = vec3(0.0);
for (int i = 0; i < SAMPLECOUNT; i++) {
+20 -4
View File
@@ -305,7 +305,7 @@ const float entityShadowDistanceMul = 0.25; // [0.01 0.02 0.03 0.04 0.05 0.10 0.
#define SCREENSPACE_DIRECT_SSS_BLENDING 0.5 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]
// #define Porosity
//#define Puddles // yes
#define PUDDLE_MODE 0 // [0 1 2 3]
#define Puddle_Size 1.0 // [0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5]
#define Puddle_Reflection_Sharpness 0.9 // [0.9 0.925 0.95 0.975 1.0]
@@ -417,10 +417,18 @@ uniform vec3 unsigned_WmoonVecSmooth;
#define SKY_GROUND
// #define OLD_STARS
#define OLD_STARS
#define STARS_AMOUNT 1.0 // [0.5 0.75 1.0 1.25 1.5 1.75 2.0]
#define STARS_BRIGHTNESS 1.0 // [0.0 0.25 0.5 0.75 1.0 1.25 1.5 1.75 2.0 3.0 4.0 5.0]
#define AURORA_LOCATION 1 // [0 1 2]
#define AURORA_MOON
#define AURORA_CHANCE 100 // [5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100]
#define AURORA_BRIGHTNESS 1.0 // [0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.5 3.0 3.5 4.0 4.5 5.0 6.0 7.0 8.0 9.0 10.0]
#define AURORA_R 2.25 // [-5.0 -4.5 -4.0 -3.5 -3.0 -2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0]
#define AURORA_G -0.5 // [-5.0 -4.5 -4.0 -3.5 -3.0 -2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0]
#define AURORA_B 1.2 // [-5.0 -4.5 -4.0 -3.5 -3.0 -2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0]
////////////////////////////////////////
// ----- CLOUD RELATED SETTINGS ----- //
////////////////////////////////////////
@@ -779,7 +787,8 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
#define FLASHLIGHT_R 1.0 // [0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.2 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.3 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.4 0.41 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.5 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.59 0.6 0.61 0.62 0.63 0.64 0.65 0.66 0.67 0.68 0.69 0.7 0.71 0.72 0.73 0.74 0.75 0.76 0.77 0.78 0.79 0.8 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.88 0.89 0.9 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.99 1.0]
#define FLASHLIGHT_G 0.9 // [0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.2 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.3 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.4 0.41 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.5 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.59 0.6 0.61 0.62 0.63 0.64 0.65 0.66 0.67 0.68 0.69 0.7 0.71 0.72 0.73 0.74 0.75 0.76 0.77 0.78 0.79 0.8 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.88 0.89 0.9 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.99 1.0]
#define FLASHLIGHT_B 0.8 // [0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.2 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.3 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.4 0.41 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.5 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.59 0.6 0.61 0.62 0.63 0.64 0.65 0.66 0.67 0.68 0.69 0.7 0.71 0.72 0.73 0.74 0.75 0.76 0.77 0.78 0.79 0.8 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.88 0.89 0.9 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.99 1.0]
#define FLASHLIGHT_SHADOWS
#define FLASHLIGHT_SHADOWS_STRENGTH 0.95 // [0.75 0.775 0.8 0.825 0.85 0.875 0.9 0.925 0.95 0.975 1.0]
#ifdef FLASHLIGHT
#endif
@@ -995,6 +1004,12 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
// ruining parts of the effect to make it more like vanilla floodfill
// #define VANILLA_LIGHTMAP_MASK
#define LPV_HANDHELD_SHADOWS
#define LPV_HANDHELD_SHADOWS_STRENGTH 0.95 // [0.75 0.775 0.8 0.825 0.85 0.875 0.9 0.925 0.95 0.975 1.0]
#ifdef LPV_HANDHELD_SHADOWS
#endif
////////////////////////////////
// ----- DEBUG SETTINGS ----- //
////////////////////////////////
@@ -1076,7 +1091,7 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
#undef CUMULONIMBUS_LIGHTNING
#undef REALMOON
#define ShaderSnow 0
#undef Puddles
#define PUDDLE_MODE 0
#undef DEFERRED_SPECULAR
#undef CUSTOM_MOON_ROTATION
#define LIGHTNING_SHADOWS 0
@@ -1088,4 +1103,5 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
#if CUMULONIMBUS == 0 && !defined CloudLayer0 && !defined CloudLayer1 && !defined CloudLayer2 && !defined CloudLayer3
#undef VOLUMETRIC_CLOUDS
#undef CLOUDS_SHADOWS
#endif
+3 -3
View File
@@ -184,12 +184,12 @@ vec3 rayTraceSpeculars(vec3 dir, vec3 position, float dither, float quality, boo
#if defined DISTANT_HORIZONS && defined DH_SCREENSPACE_REFLECTIONS
#ifdef FULLRESDEPTH
float div = 1.0; // buffer is full res after first composite pass
// buffer is full res after first composite pass
float sampleDepth = texelFetch2D(colortex12, ivec2(spos.xy/texelSize),0).b/65000.0;
#else
float div = 4.0;
float sampleDepth = texelFetch2D(colortex12, ivec2(spos.xy/texelSize/4.0),0).a/65000.0;
#endif
float sampleDepth = texelFetch2D(colortex12, ivec2(spos.xy/texelSize/div),0).a/65000.0;
float sp = invertLinearizeDepthFast(sqrt(sampleDepth)*dhFarPlane);
#else
float sampleDepth = texelFetch2D(colortex4, ivec2(spos.xy/texelSize/4.0),0).a/65000.0;
+244 -156
View File
@@ -120,93 +120,99 @@ float getCloudShape(int LayerIndex, int LOD, in vec3 position, float minHeight,
float largeCloud = 0.0;
float smallCloud = 0.0;
if(LayerIndex == CIRRUS_LAYER){
coverage = parameters.cirrus.x;
vec2 coord = position.zx + 6.0*cloud_movement;
vec2 curl = curl2D(0.00002 * coord) * 0.5
+ curl2D(0.00005 * coord) * 0.25
+ curl2D(0.00018 * coord) * 0.125;
largeCloud = texture2D(noisetex, (position.xz + cloud_movement*2.0)/80000. * CloudLayer3_scale).b;
smallCloud = texture2D(noisetex, (0.000005 / CloudLayer3_scale) * coord).r;
float detail_amplitude = 0.3;
float detail_frequency = 0.00002;
float curl_strength = 1.3;
for (int i = 0; i < 3; ++i) {
float detail = texture2D(noisetex, coord * detail_frequency + curl * curl_strength).r;
smallCloud -= detail * detail_amplitude;
detail_amplitude *= 0.5;
detail_frequency *= 4.0;
curl_strength *= 2.7;
}
smallCloud = abs(largeCloud* -0.4) + smallCloud;
float val = coverage;
shape = min(max(val - smallCloud,0.0)/sqrt(val),1.0);
if (position.y < (-0.0001 * minHeight + 0.8)*minHeight) shape = 0.0;
return shape;
}
if(LayerIndex == ALTOSTRATUS_LAYER){
coverage = parameters.altostratus.x;
coverage += Rain_coverage * rainStrength;
coverage += Thunder_coverage * thunderStrength;
largeCloud = texture2D(noisetex, (position.xz + cloud_movement)/100000. * CloudLayer2_scale).b;
smallCloud = 1.0 - texture2D(noisetex, ((position.xz - cloud_movement)/7500. - vec2(1.0-largeCloud, -largeCloud)/7.0) * CloudLayer2_scale).b;
smallCloud = largeCloud + smallCloud * 0.4 * clamp(0.9-largeCloud,0.0,1.0);
float val = coverage;
shape = min(max(val - smallCloud,0.0)/sqrt(val),1.0);
shape *= shape;
if (position.y < (-0.0001 * minHeight + 0.8)*minHeight) shape = 0.0;
return shape;
}
vec3 samplePos = position*vec3(1.0, 1.0/48.0, 1.0)/4.0;
vec3 samplePos = position*vec3(0.25, 0.005, 0.25);
float tallness = maxHeight - minHeight;
float posToMax = maxHeight - position.y;
if(LayerIndex == LARGECUMULUS_LAYER){
coverage = parameters.largeCumulus.x;
coverage += Rain_coverage * rainStrength;
coverage += Thunder_coverage * thunderStrength;
switch (LayerIndex){
default : { break; }
case CIRRUS_LAYER: {
coverage = parameters.cirrus.x;
largeCloud = texture2D(noisetex, (samplePos.zx + cloud_movement*2.0)/10000.0 * CloudLayer1_scale).b;
smallCloud = texture2D(noisetex, (samplePos.zx - cloud_movement*2.0)/2500.0 * CloudLayer1_scale).b;
vec2 coord = position.zx + 6.0*cloud_movement;
vec2 curl = curl2D(0.00002 * coord) * 0.5
+ curl2D(0.00005 * coord) * 0.25
+ curl2D(0.00018 * coord) * 0.125;
largeCloud = texture2D(noisetex, (position.xz + cloud_movement*2.0)/80000. * CloudLayer3_scale).b;
smallCloud = texture2D(noisetex, (0.000005 / CloudLayer3_scale) * coord).r;
smallCloud = abs(largeCloud* -0.7) + smallCloud;
float detail_amplitude = 0.3;
float detail_frequency = 0.00002;
float curl_strength = 1.3;
float val = coverage;
shape = min(max(val - smallCloud,0.0)/sqrt(val),1.0);
for (int i = 0; i < 3; ++i) {
float detail = texture2D(noisetex, coord * detail_frequency + curl * curl_strength).r;
}
if(LayerIndex == SMALLCUMULUS_LAYER){
coverage = parameters.smallCumulus.x;
coverage += Rain_coverage * rainStrength;
coverage += Thunder_coverage * thunderStrength;
smallCloud -= detail * detail_amplitude;
largeCloud = texture2D(noisetex, (samplePos.xz + cloud_movement)/5000.0 * CloudLayer0_scale).b;
smallCloud = 1.0-texture2D(noisetex, (samplePos.xz - cloud_movement)/500.0 * CloudLayer0_scale).r;
detail_amplitude *= 0.5;
detail_frequency *= 4.0;
curl_strength *= 2.7;
}
smallCloud = abs(largeCloud* -0.4) + smallCloud;
smallCloud = abs(largeCloud-0.6) + smallCloud*smallCloud;
float val = coverage;
shape = min(max(val - smallCloud,0.0)/sqrt(val),1.0);
float val = coverage;
shape = min(max(val - smallCloud,0.0)/sqrt(val),1.0);
// shape = abs(largeCloud*2.0 - 1.2)*0.5 - (1.0-smallCloud);
if (position.y < (-0.0001 * minHeight + 0.8)*minHeight) shape = 0.0;
return shape;
break; }
case ALTOSTRATUS_LAYER: {
coverage = parameters.altostratus.x;
coverage += Rain_coverage * rainStrength;
coverage += Thunder_coverage * thunderStrength;
largeCloud = texture2D(noisetex, (position.xz + cloud_movement)/100000. * CloudLayer2_scale).b;
smallCloud = 1.0 - texture2D(noisetex, ((position.xz - cloud_movement)/7500. - vec2(1.0-largeCloud, -largeCloud)/7.0) * CloudLayer2_scale).b;
smallCloud = largeCloud + smallCloud * 0.4 * clamp(0.9-largeCloud,0.0,1.0);
float val = coverage;
shape = min(max(val - smallCloud,0.0)/sqrt(val),1.0);
shape *= shape;
if (position.y < (-0.0001 * minHeight + 0.8)*minHeight) shape = 0.0;
return shape;
break; }
case LARGECUMULUS_LAYER: {
coverage = parameters.largeCumulus.x;
coverage += Rain_coverage * rainStrength;
coverage += Thunder_coverage * thunderStrength;
largeCloud = texture2D(noisetex, (samplePos.zx + cloud_movement*2.0)/10000.0 * CloudLayer1_scale).b;
smallCloud = texture2D(noisetex, (samplePos.zx - cloud_movement*2.0)/2500.0 * CloudLayer1_scale).b;
smallCloud = abs(largeCloud* -0.7) + smallCloud;
float val = coverage;
shape = min(max(val - smallCloud,0.0)/sqrt(val),1.0);
break; }
case SMALLCUMULUS_LAYER: {
coverage = parameters.smallCumulus.x;
coverage += Rain_coverage * rainStrength;
coverage += Thunder_coverage * thunderStrength;
largeCloud = texture2D(noisetex, (samplePos.xz + cloud_movement)/5000.0 * CloudLayer0_scale).b;
smallCloud = 1.0-texture2D(noisetex, (samplePos.xz - cloud_movement)/500.0 * CloudLayer0_scale).r;
smallCloud = abs(largeCloud-0.6) + smallCloud*smallCloud;
float val = coverage;
shape = min(max(val - smallCloud,0.0)/sqrt(val),1.0);
// shape = abs(largeCloud*2.0 - 1.2)*0.5 - (1.0-smallCloud);
break; }
}
// clamp density of the cloud within its upper/lower bounds
@@ -237,22 +243,26 @@ float getCloudShape(int LayerIndex, int LOD, in vec3 position, float minHeight,
float erosion = 0.0;
float omShape = 1.0 - shape;
if(LayerIndex == SMALLCUMULUS_LAYER){
erosion += (1.0-densityAtPos(samplePos * CloudLayer0_detail * CloudLayer0_scale / 3.0)) * sqrt(omShape);
switch (LayerIndex){
default : { break; }
float falloff = 1.0 - clamp((posToMax)/100.0,0.0,1.0);
erosion += abs(densityAtPos(samplePos * CloudLayer0_detail * CloudLayer0_scale) - falloff) * 0.75 * (omShape) * (1.0-falloff*0.25);
case SMALLCUMULUS_LAYER: {
erosion += (1.0-densityAtPos(samplePos * CloudLayer0_detail * CloudLayer0_scale / 3.0)) * sqrt(omShape);
erosion = erosion*erosion*erosion*erosion;
}
if(LayerIndex == LARGECUMULUS_LAYER){
erosion += (1.0 - densityAtPos(samplePos * CloudLayer1_detail * CloudLayer1_scale / 4.5)) * sqrt(omShape);
float falloff = 1.0 - clamp((posToMax)/100.0,0.0,1.0);
erosion += abs(densityAtPos(samplePos * CloudLayer0_detail * CloudLayer0_scale) - falloff) * 0.75 * (omShape) * (1.0-falloff*0.25);
float falloff = 1.0 - clamp((posToMax)/200.0,0.0,1.0);
erosion += abs(densityAtPos(samplePos * CloudLayer1_detail * CloudLayer1_scale) - falloff) * 0.75 * (omShape) * (1.0-falloff*0.5);
erosion = erosion*erosion*erosion*erosion;
break; }
case LARGECUMULUS_LAYER: {
erosion += (1.0 - densityAtPos(samplePos * CloudLayer1_detail * CloudLayer1_scale / 4.5)) * sqrt(omShape);
erosion = erosion*erosion*erosion*erosion;
}
float falloff = 1.0 - clamp((posToMax)/200.0,0.0,1.0);
erosion += abs(densityAtPos(samplePos * CloudLayer1_detail * CloudLayer1_scale) - falloff) * 0.75 * (omShape) * (1.0-falloff*0.5);
erosion = erosion*erosion*erosion*erosion;
break; }
}
return max(shape - erosion*erodeAmount,0.0);
@@ -401,20 +411,21 @@ float GetCloudShadow(vec3 playerPos, vec3 sunVector){
float totalShadow = getPlanetShadow(playerPos, sunVector);
vec3 startPosition = playerPos;
vec3 startOffset = sunVector / abs(sunVector.y);
#ifdef CLOUDS_SHADOWS
float cloudShadows = 0.0;
#ifdef CloudLayer0
startPosition = playerPos + sunVector / abs(sunVector.y) * max((CloudLayer0_height + 20.0) - playerPos.y, 0.0);
cloudShadows = getCloudShape(SMALLCUMULUS_LAYER, 0, startPosition, CloudLayer0_height, CloudLayer0_height + CloudLayer0_tallness)*(getRainDensity(parameters.smallCumulus.y));
startPosition = playerPos + startOffset * max((CloudLayer0_height + 20.0) - playerPos.y, 0.0);
cloudShadows = getCloudShape(SMALLCUMULUS_LAYER, 0, startPosition, CloudLayer0_height, CloudLayer0_height + CloudLayer0_tallness/CloudLayer0_scale)*(getRainDensity(parameters.smallCumulus.y));
#endif
#ifdef CloudLayer1
startPosition = playerPos + sunVector / abs(sunVector.y) * max((CloudLayer1_height + 30.0) - playerPos.y, 0.0);
cloudShadows += getCloudShape(LARGECUMULUS_LAYER, 0, startPosition, CloudLayer1_height, CloudLayer1_height + CloudLayer1_tallness)*(getRainDensity(parameters.largeCumulus.y));
startPosition = playerPos + startOffset * max((CloudLayer1_height + 30.0) - playerPos.y, 0.0);
cloudShadows += getCloudShape(LARGECUMULUS_LAYER, 0, startPosition, CloudLayer1_height, CloudLayer1_height + CloudLayer1_tallness/CloudLayer1_scale)*(getRainDensity(parameters.largeCumulus.y));
#endif
#ifdef CloudLayer2
startPosition = playerPos + sunVector / abs(sunVector.y) * max(CloudLayer2_height - playerPos.y, 0.0);
startPosition = playerPos + startOffset * max(CloudLayer2_height - playerPos.y, 0.0);
cloudShadows += getCloudShape(ALTOSTRATUS_LAYER, 0, startPosition, CloudLayer2_height, CloudLayer2_height + 5.0)*parameters.altostratus.y * (1.0-abs(WsunVec.y));
#endif
#if CUMULONIMBUS > 0
@@ -435,17 +446,18 @@ float GetCloudShadow(vec3 playerPos, vec3 sunVector){
}
#ifndef CLOUDSHADOWSONLY
uniform sampler2D colortex4;
#if CLOUD_PHASE == 0
// Henyey-Greenstein
float phaseCloud(float x, float g){
float gg = g * g;
return (gg * -0.25 + 0.25) * pow(-2.0 * (g * x) + (gg + 1.0), -1.5);
return (gg * -0.25 + 0.25) * pow(-2.0 * (g * x) + (gg + 1.0), -1.5) / 3.14;
}
#else
// Cornette-Shanks
float phaseCloud(float x, float g){
return (3.0 * (1.0 - g * g) * (1.0 + x * x)) / (4.0 * 3.14159265359 * 2.0 * (2.0 + g * g) * pow(1.0 + g * g - 2.0 * g * x, 3.0/2.0));
return (3.0 * (1.0 - g * g) * (1.0 + x * x)) / (25.133 * (2.0 + g * g) * pow(1.0 + g * g - 2.0 * g * x, 1.5));
}
#endif
@@ -472,23 +484,32 @@ float getCloudScattering(
float sunVis = smoothstep(-0.06, 0.01, sunElevation);
sunVis = sunVis * sunVis;
#if defined CAELUM_SUPPORT || !defined CUSTOM_MOON_ROTATION
float moonVis = smoothstep(-0.04, 0.015, -moonElevation);
float moonVis = smoothstep(0.0, 0.075, -moonElevation);
#else
float moonVis = smoothstep(0.0, 0.2, moonVector.y);
#endif
moonVis = moonVis * moonVis;
moonVis *= smoothstep(0.06, -0.06, sunElevation);
float isLarge = 80;
vec3 lightVec = normalize(mix(moonVector, sunVector, smoothstep(-0.06, 0.06, sunElevation)));
for (int i = 0; i < samples; i++){
if((LayerIndex == ALTOSTRATUS_LAYER) || (LayerIndex == CIRRUS_LAYER)){
shadowRayPosition = rayPosition + sunVis * sunVector * (1.0 + i * dither) / (pow(abs(sunVector.y*0.5),3.0) * 0.995 + 0.005) + moonVis * moonVector * (1.0 + i * dither) / (pow(abs(moonVector.y*0.5),3.0) * 0.995 + 0.005);
}else if((LayerIndex == LARGECUMULUS_LAYER) || (LayerIndex == SMALLCUMULUS_LAYER)) {
} else
#if CUMULONIMBUS > 0
if((LayerIndex == LARGECUMULUS_LAYER) || (LayerIndex == SMALLCUMULUS_LAYER))
#endif
{
shadowRayPosition = rayPosition + lightVec * (1.0 + i + dither)*20.0;
} else {
}
#if CUMULONIMBUS > 0
else {
shadowRayPosition = rayPosition + lightVec * (1.0 + i + dither)*isLarge;
}
#endif
// float fadeddensity = density * pow(clamp((shadowRayPosition.y - minHeight)/(max(maxHeight-minHeight,1.0)*0.25),0.0,1.0),2.0);
#if CUMULONIMBUS > 0
@@ -513,31 +534,42 @@ vec3 getCloudLighting(
float sunShadowMask,
vec3 directLightCol,
vec3 directLightCol_multi,
vec3 directLightCol2,
vec3 directLightCol_multi2,
float indirectShadowMask,
vec3 indirectLightCol,
vec3 rayPosition
vec3 rayPosition,
float backScatterPhase,
vec4 phaseLevels,
float backScatterPhase2,
vec4 phaseLevels2
){
vec3 heightScal = vec3(mix(1.0, 0.5, clamp(rayPosition.y, 0.0, 7000.0)/7000));
vec3 heightScal = vec3(mix(1.0, 0.5, clamp(rayPosition.y, 0.0, 7000.0)/7000.0));
directLightCol = pow(directLightCol, heightScal);
directLightCol_multi = pow(directLightCol_multi, heightScal);
directLightCol2 = pow(directLightCol2, heightScal);
directLightCol_multi2 = pow(directLightCol_multi2, heightScal);
#ifdef ALTERNATE_POWDER_EFFECT
float powderEffect = 1.0-exp(-10.0*shapeFaded); powderEffect *= powderEffect; powderEffect *= 2.0;
#else
float powderEffect = 1.0 - exp(-8.0*shapeFaded);
#endif
vec3 directScattering = directLightCol_multi * powderEffect * exp(-3.0*sunShadowMask) + directLightCol * exp(-10.0*sunShadowMask);
directScattering += directLightCol_multi2 * powderEffect * exp(-3.0*sunShadowMask) + directLightCol2 * exp(-10.0*sunShadowMask);
float beerCoef = -4.0;
float powder = min(exp(beerCoef*exp(beerCoef*shapeFaded)) * 3.5, 1.0);
float backscatter = powder * backScatterPhase;
float forwardscatter = mix(mix(phaseLevels.x, phaseLevels.y, powder), mix(phaseLevels.z, phaseLevels.w, powder), powder);
float backscatter2 = powder * backScatterPhase2;
float forwardscatter2 = mix(mix(phaseLevels2.x, phaseLevels2.y, powder), mix(phaseLevels2.z, phaseLevels2.w, powder), powder);
// backscatter = powder * phaseCloud(-backScatterPhase, 0.25) * 2.0;
// forwardscatter = phaseCloud(backScatterPhase, mix(0.9,0.1,powder));
float expBeer = 6.28 * exp((beerCoef-1.0)*sunShadowMask);
vec3 directScattering = expBeer * directLightCol * (forwardscatter + backscatter);
directScattering += expBeer * directLightCol2 * (forwardscatter2 + backscatter2);
vec3 indirectScattering = indirectLightCol * mix(1.0, exp2(-5.0*shape), indirectShadowMask*indirectShadowMask);
// return indirectScattering;
@@ -545,8 +577,6 @@ vec3 getCloudLighting(
return indirectScattering + directScattering;
}
uniform sampler2D colortex4;
vec4 raymarchCloud(
int LayerIndex,
int samples,
@@ -560,19 +590,35 @@ vec4 raymarchCloud(
vec3 sunVector,
vec3 moonVector,
vec3 sunScattering,
vec3 sunMultiScattering,
vec3 moonScattering,
vec3 moonMultiScattering,
vec3 skyScattering,
float referenceDistance,
vec3 sampledSkyCol,
inout vec2 cloudPlaneDistance
inout vec2 cloudPlaneDistance,
float backScatterPhase,
vec4 phaseLevels,
float backScatterPhase2,
vec4 phaseLevels2
){
vec3 color = vec3(0.0);
float totalAbsorbance = 1.0;
#if AURORA_LOCATION > 0
#ifdef LUT
const float mult = 0.375*AURORA_BRIGHTNESS;
#else
const float mult = 0.015*AURORA_BRIGHTNESS;
#endif
vec3 auroraColor = sin(vec3(AURORA_R, AURORA_G, AURORA_B) + 0.63) * 0.5 + 0.5;
vec3 auroraLighting = mult*auroraColor * auroraAmount * smoothstep(0.0, -0.1, sunVector.y) * smoothstep(0.1, 0.0, moonVector.y);
#endif
// if(LayerIndex == SMALLCUMULUS_LAYER || LayerIndex == LARGECUMULUS_LAYER || LayerIndex == CUMULONIMBUS_LAYER) {
// float planetShadow = getPlanetShadow(rayPosition, sunVector);
// sunScattering *= planetShadow;
@@ -627,11 +673,14 @@ vec4 raymarchCloud(
if(shapeWithDensity > 1e-5){
// can add the initial cloud shape sample for a free shadow starting step :D
float sunShadowMask = (shapeWithDensity + getCloudScattering(LayerIndex, rayPosition, sunVector, moonVector, dither, minHeight, maxHeight, density)) * (1.0-abs(WsunVec.y));
float sunShadowMask = getCloudScattering(LayerIndex, rayPosition, sunVector, moonVector, dither, minHeight, maxHeight, density) * (1.0-abs(WsunVec.y));
float indirectShadowMask = 0.5;
vec3 lighting = getCloudLighting(LayerIndex, shapeWithDensity, shapeWithDensity, sunShadowMask, sunScattering, sunMultiScattering, moonScattering, moonMultiScattering, indirectShadowMask, skyScattering, rayPosition);
vec3 lighting = getCloudLighting(LayerIndex, shapeWithDensity, shapeWithDensity, sunShadowMask, sunScattering, moonScattering, indirectShadowMask, skyScattering, rayPosition, backScatterPhase, phaseLevels, backScatterPhase2, phaseLevels2);
#if AURORA_LOCATION > 0
lighting += auroraLighting;
#endif
newPos.xz /= max(newPos.y,0.0)*0.0025 + 1.0;
newPos.y = min(newPos.y,0.0);
@@ -664,12 +713,14 @@ vec4 raymarchCloud(
if (density < 0.01) return vec4(color, totalAbsorbance);
float skylightOcclusion = 1.0;
#if defined CloudLayer1 && defined CloudLayer0
if(LayerIndex == SMALLCUMULUS_LAYER) {
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,densityLarge), 1.0, pow(1.0 - upperLayerOcclusion*densityLarge,2));
}
#if AURORA_LOCATION == 0
float skylightOcclusion = 1.0;
#if defined CloudLayer1 && defined CloudLayer0
if(LayerIndex == SMALLCUMULUS_LAYER) {
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,densityLarge), 1.0, pow(1.0 - upperLayerOcclusion*densityLarge,2));
}
#endif
#endif
vec3 lightningPos = vec3(0.0);
@@ -719,11 +770,20 @@ vec4 raymarchCloud(
// check if the pixel has visible clouds before doing work.
if(shapeWithDensityFaded > 1e-5){
#if AURORA_LOCATION > 0
float skylightOcclusion = 1.0;
#if defined CloudLayer1 && defined CloudLayer0
if(LayerIndex == SMALLCUMULUS_LAYER) {
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+CloudLayer1_height);
skylightOcclusion = mix(mix(0.0,0.2,densityLarge), 1.0, pow(1.0 - upperLayerOcclusion*densityLarge,5));
}
#endif
#endif
// can add the initial cloud shape sample for a free shadow starting step :D
float indirectShadowMask = 1.0 - min(max(rayHeightInCloud,0.0) / max(tallness,1.0), 1.0);
float sunShadowMask = shapeWithDensity + getCloudScattering(LayerIndex, rayPosition, sunVector, moonVector, dither, minHeight, maxHeight, density);
float sunShadowMask = getCloudScattering(LayerIndex, rayPosition, sunVector, moonVector, dither, minHeight, maxHeight, density);
vec3 shadowStartPos = vec3(0.0);
// do cloud shadows from one layer to another
@@ -739,8 +799,8 @@ vec4 raymarchCloud(
if(LayerIndex != CUMULONIMBUS_LAYER){
float distanceFactor = clamp(degrees(acos(dot(vec3(0.0, 1.0, 0.0), mainLightVec))), 45.0, 90.0) - 45.0;
shadowStartPos = rayPosition + mainLightVec * 9000;
sunShadowMask += getCumulonimbusShape(0, shadowStartPos, 600, 4600+shadowStartPos.y).x * 3.0;
shadowStartPos = rayPosition + mainLightVec * 9000.;
sunShadowMask += getCumulonimbusShape(0, shadowStartPos, 600., 4600.+shadowStartPos.y).x * 3.0;
}
#endif
// altostratus layer -> all cumulus layers
@@ -749,7 +809,7 @@ vec4 raymarchCloud(
sunShadowMask += getCloudShape(ALTOSTRATUS_LAYER, 0, shadowStartPos, CloudLayer2_height, CloudLayer2_height) * parameters.altostratus.y * (1.0-abs(mainLightVec.y));
#endif
vec3 lighting = getCloudLighting(LayerIndex, shapeWithDensity, shapeWithDensityFaded, sunShadowMask, sunScattering, sunMultiScattering, moonScattering, moonMultiScattering, indirectShadowMask, skyScattering * skylightOcclusion, rayPosition);
vec3 lighting = getCloudLighting(LayerIndex, shapeWithDensity, shapeWithDensityFaded, sunShadowMask, sunScattering, moonScattering, indirectShadowMask, skyScattering*skylightOcclusion, rayPosition, backScatterPhase, phaseLevels, backScatterPhase2, phaseLevels2);
float lightningIntensity = 0.0;
@@ -779,6 +839,10 @@ vec4 raymarchCloud(
}
#endif
#if AURORA_LOCATION > 0
lighting += auroraLighting * min(max(rayHeightInCloud,0.0) / max(tallness,1.0), 1.0) * skylightOcclusion*skylightOcclusion;
#endif
newPos.xz /= max(newPos.y,0.0)*0.0025 + 1.0;
newPos.y = min(newPos.y,0.0);
@@ -919,9 +983,9 @@ vec4 GetVolumetricClouds(
float startDistance = length(playerPos);
float sunVis = smoothstep(-0.06, 0.1, sunElevation);
sunVis = sunVis * sunVis;
#if defined CAELUM_SUPPORT || !defined CUSTOM_MOON_ROTATION
float moonVis = smoothstep(-0.04, 0.015, -moonElevation);
float moonVis = smoothstep(0.0, 0.075, -moonElevation);
#else
float moonVis = smoothstep(0.0, 0.2, moonVector.y);
#endif
@@ -933,20 +997,44 @@ vec4 GetVolumetricClouds(
#endif
///------- do color stuff outside of the raymarcher loop
vec3 sunScattering = directLightCol * (phaseCloud(SdotV, 0.85) + phaseCloud(SdotV, 0.75));
vec3 sunMultiScattering = directLightCol;
vec3 moonScattering = directLightCol2 * (phaseCloud(SdotV2, 0.85) + phaseCloud(SdotV2, 0.75));
vec3 moonMultiScattering = directLightCol2;
// vec3 sunScattering = directLightCol * (phaseCloud(SdotV, 0.85) + phaseCloud(SdotV, 0.75));
// vec3 sunMultiScattering = directLightCol;
// vec3 moonScattering = directLightCol2 * (phaseCloud(SdotV2, 0.85) + phaseCloud(SdotV2, 0.75));
// vec3 moonMultiScattering = directLightCol2;
// the idea is to interpolate between 4 HG function calls with different G parameters
float backScatterPhase = 0.0;
vec4 phaseLevels = vec4(0.0);
if(sunVis > 0.0) {
backScatterPhase = phaseCloud(-SdotV, 0.25) * 2.0;
phaseLevels = vec4(phaseCloud(SdotV, 0.80), phaseCloud(SdotV, 0.55), phaseCloud(SdotV, 0.35), phaseCloud(SdotV, 0.10));
}
float backScatterPhase2 = 0.0;
vec4 phaseLevels2 = vec4(0.0);
if(moonVis > 0.0) {
backScatterPhase2 = phaseCloud(-SdotV2, 0.25) * 2.0;
phaseLevels2 = vec4(phaseCloud(SdotV2, 0.80), phaseCloud(SdotV2, 0.55), phaseCloud(SdotV2, 0.35), phaseCloud(SdotV2, 0.10));
}
// backScatterPhase = SdotV;
vec3 sunScattering = directLightCol * sunVis * sunVis;
vec3 moonScattering = directLightCol2 * moonVis * moonVis * (1.0 - sunVis * sunVis);
vec3 skyScattering = indirectLightCol * (1.0 + sunVis);
vec3 moonScattering3 = moonScattering * moonVis;
vec3 moonMultiScattering3 = moonMultiScattering * moonVis;
moonVis = moonVis * moonVis;
vec3 sunScattering2 = sunScattering * sunVis;
vec3 sunMultiScattering2 = sunMultiScattering * sunVis;
vec3 moonScattering2 = moonScattering * moonVis;
vec3 moonMultiScattering2 = moonMultiScattering * moonVis;
// vec3 moonScattering3 = moonScattering * moonVis;
// vec3 moonMultiScattering3 = moonMultiScattering * moonVis;
//
// moonVis = moonVis * moonVis;
// vec3 sunScattering2 = sunScattering * sunVis;
// vec3 sunMultiScattering2 = sunMultiScattering * sunVis;
// vec3 moonScattering2 = moonScattering * moonVis;
// vec3 moonMultiScattering2 = moonMultiScattering * moonVis;
////------- RENDER SMALL CUMULUS CLOUDS
vec4 smallCumulusClouds = cloudColor;
@@ -954,7 +1042,7 @@ vec4 GetVolumetricClouds(
vec2 cloudLayer0_Distance = vec2(startDistance, 1.0);
#ifdef CloudLayer0
float smallCumulusDistance = length(rayPosition - cameraPosition);
smallCumulusClouds = raymarchCloud(SMALLCUMULUS_LAYER, samples, rayPosition, rayDirection, dither.x, minHeight, maxHeight, unsignedSunVec, unsignedMoonVec, sunScattering2, sunMultiScattering2, moonScattering2, moonMultiScattering2, skyScattering, lViewPosM, sampledSkyCol, cloudLayer0_Distance);
smallCumulusClouds = raymarchCloud(SMALLCUMULUS_LAYER, samples, rayPosition, rayDirection, dither.x, minHeight, maxHeight, unsignedSunVec, unsignedMoonVec, sunScattering, moonScattering, skyScattering, lViewPosM, sampledSkyCol, cloudLayer0_Distance, backScatterPhase, phaseLevels, backScatterPhase2, phaseLevels2);
#endif
////------- RENDER LARGE CUMULUS CLOUDS
@@ -972,7 +1060,7 @@ vec4 GetVolumetricClouds(
rayDirection = NormPlayerPos.xyz * (cloudheight/length(NormPlayerPos.xyz/cloudDist)/samples);
rayPosition = getRayOrigin(rayDirection, cameraPosition, dither.y, minHeight, maxHeight);
largeCumulusClouds = raymarchCloud(LARGECUMULUS_LAYER, samples, rayPosition, rayDirection, dither.x, minHeight, maxHeight, unsignedSunVec, unsignedMoonVec, sunScattering2, sunMultiScattering2, moonScattering2, moonMultiScattering2, skyScattering, lViewPosM, sampledSkyCol, cloudLayer1_Distance);
largeCumulusClouds = raymarchCloud(LARGECUMULUS_LAYER, samples, rayPosition, rayDirection, dither.x, minHeight, maxHeight, unsignedSunVec, unsignedMoonVec, sunScattering, moonScattering, skyScattering, lViewPosM, sampledSkyCol, cloudLayer1_Distance, backScatterPhase, phaseLevels, backScatterPhase2, phaseLevels2);
}
float largeCumulusDistance = length(rayPosition - cameraPosition);
#endif
@@ -992,19 +1080,19 @@ vec4 GetVolumetricClouds(
rayDirection = NormPlayerPos.xyz * (cloudheight/length(NormPlayerPos.xyz/cloudDist)/cumulonimbusSamples);
rayPosition = getRayOrigin(rayDirection, cameraPosition, dither.y, minHeight, maxHeight);
cumulonimbusClouds = raymarchCloud(CUMULONIMBUS_LAYER, cumulonimbusSamples, rayPosition, rayDirection, dither.x, minHeight, maxHeight, unsignedSunVec, unsignedMoonVec, sunScattering2, sunMultiScattering2, moonScattering2, moonMultiScattering2, skyScattering, lViewPosM, sampledSkyCol, cloudLayer4_Distance);
cumulonimbusClouds = raymarchCloud(CUMULONIMBUS_LAYER, cumulonimbusSamples, rayPosition, rayDirection, dither.x, minHeight, maxHeight, unsignedSunVec, unsignedMoonVec, sunScattering, moonScattering, skyScattering, lViewPosM, sampledSkyCol, cloudLayer4_Distance, backScatterPhase, phaseLevels, backScatterPhase2, phaseLevels2);
}
float cumulonimbusDistance = length(rayPosition - cameraPosition);
#endif
#if defined CAELUM_SUPPORT || !defined CUSTOM_MOON_ROTATION
moonVis = smoothstep(-0.04, 0.015, -moonElevation);
#else
moonVis = smoothstep(0.0, 0.2, moonVector.y);
#endif
moonScattering2 = moonScattering * moonVis;
moonMultiScattering2 = moonMultiScattering * moonVis;
// #if defined CAELUM_SUPPORT || !defined CUSTOM_MOON_ROTATION
// moonVis = smoothstep(-0.04, 0.015, -moonElevation);
// #else
// moonVis = smoothstep(0.0, 0.2, moonVector.y);
// #endif
//
// moonScattering2 = moonScattering * moonVis;
// moonMultiScattering2 = moonMultiScattering * moonVis;
////------- RENDER ALTOSTRATUS CLOUDS
vec4 altoStratusClouds = cloudColor;
@@ -1020,7 +1108,7 @@ vec4 GetVolumetricClouds(
rayDirection = NormPlayerPos.xyz * (cloudheight/length(NormPlayerPos.xyz/cloudDist));
rayPosition = getRayOrigin(rayDirection, cameraPosition, dither.y, minHeight, maxHeight);
altoStratusClouds = raymarchCloud(ALTOSTRATUS_LAYER, samples, rayPosition, rayDirection, dither.x, minHeight, maxHeight, unsignedSunVec, unsignedMoonVec, sunScattering, sunMultiScattering, moonScattering3, moonMultiScattering3, skyScattering, lViewPosM, sampledSkyCol, cloudLayer2_Distance);
altoStratusClouds = raymarchCloud(ALTOSTRATUS_LAYER, samples, rayPosition, rayDirection, dither.x, minHeight, maxHeight, unsignedSunVec, unsignedMoonVec, sunScattering, moonScattering, skyScattering, lViewPosM, sampledSkyCol, cloudLayer2_Distance, backScatterPhase, phaseLevels, backScatterPhase2, phaseLevels2);
}
#endif
@@ -1038,7 +1126,7 @@ vec4 GetVolumetricClouds(
rayDirection = NormPlayerPos.xyz * (cloudheight/length(NormPlayerPos.xyz/cloudDist));
rayPosition = getRayOrigin(rayDirection, cameraPosition, dither.y, minHeight, maxHeight);
cirrusClouds = raymarchCloud(CIRRUS_LAYER, samples, rayPosition, rayDirection, dither.x, minHeight, maxHeight, unsignedSunVec, unsignedMoonVec, sunScattering, sunMultiScattering, moonScattering3, moonMultiScattering3, skyScattering, lViewPosM, sampledSkyCol, cloudLayer3_Distance);
cirrusClouds = raymarchCloud(CIRRUS_LAYER, samples, rayPosition, rayDirection, dither.x, minHeight, maxHeight, unsignedSunVec, unsignedMoonVec, sunScattering, moonScattering, skyScattering, lViewPosM, sampledSkyCol, cloudLayer3_Distance, backScatterPhase, phaseLevels, backScatterPhase2, phaseLevels2);
}
#endif
File diff suppressed because one or more lines are too long