Add chunk fade in for 1.21.11, add BoP trims to emissive trims, some fixes and lots of internal restructuring, fix https://github.com/Merlin1809/Eclipse-Shader/issues/54

This commit is contained in:
Merlin1809
2025-12-13 21:10:37 +01:00
parent 5e2ee66164
commit 25802c29d2
78 changed files with 1005 additions and 1008 deletions
+3 -7
View File
@@ -1,8 +1,6 @@
#include "/lib/settings.glsl"
#ifdef CUSTOM_MOON_ROTATION
#include "/lib/SSBOs.glsl"
#endif
#include "/lib/SSBOs.glsl"
#include "/lib/util.glsl"
#include "/lib/res_params.glsl"
@@ -68,8 +66,6 @@ uniform int frameCounter;
// uniform sampler2D colortex4;
flat varying vec3 averageSkyCol_Clouds;
flat varying vec4 lightCol;
flat varying vec3 WsunVec;
flat varying vec3 WsunVec2;
@@ -368,7 +364,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
vec3 Direct_lighting = vec3(0.0);
#ifdef OVERWORLD_SHADER
vec3 DirectLightColor = lightCol.rgb/2400.0;
vec3 DirectLightColor = lightSourceColorSSBO/2400.0;
float NdotL = clamp(dot(worldSpaceNormals, WsunVec),0.0,1.0);
NdotL = clamp((-15 + NdotL*255.0) / 240.0 ,0.0,1.0);
@@ -406,7 +402,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
Direct_lighting = DirectLightColor * NdotL * Shadows;
vec3 AmbientLightColor = averageSkyCol_Clouds/900.0 ;
vec3 AmbientLightColor = averageSkyCol_CloudsSSBO/900.0 ;
vec3 indirectNormal = worldSpaceNormals.xyz / dot(abs(worldSpaceNormals.xyz), vec3(1.0));
float SkylightDir = clamp(indirectNormal.y*0.7+0.3,0.0,1.0);
+5 -18
View File
@@ -1,9 +1,7 @@
#include "/lib/settings.glsl"
#include "/lib/res_params.glsl"
#ifdef CUSTOM_MOON_ROTATION
#include "/lib/SSBOs.glsl"
#endif
#include "/lib/SSBOs.glsl"
varying vec4 pos;
varying vec4 gcolor;
@@ -14,8 +12,6 @@ flat varying int isWater;
uniform sampler2D colortex4;
flat varying vec3 averageSkyCol_Clouds;
flat varying vec4 lightCol;
#ifdef OVERWORLD_SHADER
#include "/lib/scene_controller.glsl"
@@ -99,15 +95,6 @@ void main() {
gcolor = gl_Color;
lightmapCoords = gl_MultiTexCoord1.xy;
lightCol.rgb = texelFetch2D(colortex4,ivec2(6,37),0).rgb;
averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(0,37),0).rgb;
#ifdef OVERWORLD_SHADER
readSceneControllerParameters(colortex4, SC_parameters.smallCumulus, SC_parameters.largeCumulus, SC_parameters.altostratus, SC_parameters.cirrus, SC_parameters.fog);
#endif
#ifdef CUSTOM_MOON_ROTATION
vec3 WmoonVec = customMoonVecSSBO;
@@ -121,13 +108,13 @@ void main() {
WsunVec = mix(WmoonVec, WsunVec, float(sunElevation > 1e-5));
WsunVec2 = mix(normalize(mat3(gbufferModelView)*WmoonVec), WsunVec2, float(sunElevation > 1e-5));
#else
lightCol.a = float(sunElevation > 1e-5)*2.0 - 1.0;
float lightSourceCheck = float(sunElevation > 1e-5)*2.0 - 1.0;
#ifdef SMOOTH_SUN_ROTATION
WsunVec = lightCol.a * WsunVecSmooth;
WsunVec = lightSourceCheck * WsunVecSmooth;
#else
WsunVec = lightCol.a * normalize(mat3(gbufferModelViewInverse) * sunPosition);
WsunVec = lightSourceCheck * normalize(mat3(gbufferModelViewInverse) * sunPosition);
#endif
WsunVec2 = lightCol.a * normalize(sunPosition);
WsunVec2 = lightSourceCheck * normalize(sunPosition);
#endif
#ifdef TAA_UPSCALING
+12 -16
View File
@@ -14,9 +14,7 @@
#include "/lib/settings.glsl"
#if defined CUSTOM_MOON_ROTATION || defined END_ISLAND_LIGHT
#include "/lib/SSBOs.glsl"
#endif
#include "/lib/SSBOs.glsl"
// #if defined END_SHADER || defined NETHER_SHADER
// #undef IS_LPV_ENABLED
@@ -42,9 +40,6 @@ varying vec4 color;
#endif
flat varying vec3 WsunVec;
flat varying vec3 averageSkyCol_Clouds;
flat varying vec4 lightCol;
#endif
uniform int renderStage;
@@ -402,7 +397,8 @@ void main() {
vec2 tempOffset = offsets[framemod8];
vec3 viewPos = toScreenSpace(gl_FragCoord.xyz*vec3(texelSize/RENDER_SCALE,1.0)-vec3(vec2(tempOffset)*texelSize*0.5,0.0));
vec3 feetPlayerPos = mat3(gbufferModelViewInverse) * viewPos;
vec3 feetPlayerPos_normalized = normalize(feetPlayerPos);
vec3 worldPos = feetPlayerPos + cameraPosition;
// vec3 feetPlayerPos_normalized = normalize(feetPlayerPos);
vec4 TEXTURE = texture2D(gtexture, lmtexcoord.xy)*color;
@@ -421,13 +417,13 @@ void main() {
#if defined Hand_Held_lights && !defined LPV_ENABLED
#ifdef IS_IRIS
vec3 playerCamPos = cameraPosition - relativeEyePosition;
vec3 playerCamPos = relativeEyePosition;
#else
vec3 playerCamPos = cameraPosition;
vec3 playerCamPos = vec3(0.0);
#endif
// lightmap.x = max(lightmap.x, HELD_ITEM_BRIGHTNESS * clamp( pow(max(1.0-length((feetPlayerPos+cameraPosition) - playerCamPos)/HANDHELD_LIGHT_RANGE,0.0),1.5),0.0,1.0));
if(heldItemId > 999 || heldItemId2 > 999){
float pointLight = clamp(1.0-(length((feetPlayerPos+cameraPosition)-playerCamPos)-1.0)/HANDHELD_LIGHT_RANGE,0.0,1.0);
float pointLight = clamp(1.0-(length(feetPlayerPos-playerCamPos)-1.0)/HANDHELD_LIGHT_RANGE,0.0,1.0);
lightmap.x = mix(lightmap.x, 0.9, pointLight*pointLight);
}
@@ -464,8 +460,8 @@ void main() {
if(lightmap.x >= 0.9) Torch_Color *= LIT_PARTICLE_BRIGHTNESS;
#ifdef OVERWORLD_SHADER
directLightColor = lightCol.rgb/2400.0;
AmbientLightColor = averageSkyCol_Clouds / 900.0;
directLightColor = lightSourceColorSSBO/2400.0;
AmbientLightColor = averageSkyCol_CloudsSSBO / 900.0;
#ifdef USE_CUSTOM_DIFFUSE_LIGHTING_COLORS
directLightColor = luma(directLightColor) * vec3(DIRECTLIGHT_DIFFUSE_R,DIRECTLIGHT_DIFFUSE_G,DIRECTLIGHT_DIFFUSE_B);
@@ -486,10 +482,10 @@ void main() {
Shadows *= mix(LM_shadowMapFallback, 1.0, shadowMapFalloff2);
Shadows *= GetCloudShadow(feetPlayerPos+cameraPosition, WsunVec);
Shadows *= GetCloudShadow(worldPos, WsunVec);
if(isEyeInWater == 1){
float distanceFromWaterSurface = max(-(feetPlayerPos.y + (cameraPosition.y - waterEnteredAltitude)),0.0) ;
float distanceFromWaterSurface = max(-(worldPos.y - waterEnteredAltitude),0.0) ;
directLightColor *= exp(-vec3(Water_Absorb_R, Water_Absorb_G, Water_Absorb_B) * distanceFromWaterSurface);
}
Direct_lighting = directLightColor * Shadows;
@@ -531,9 +527,9 @@ void main() {
#if RAINBOW_SELECT_BOX > 0
#if RAINBOW_SELECT_BOX == 1
float selectBoxHue = length(sin(mod(1.4*(feetPlayerPos+cameraPosition), 3.14159)));
float selectBoxHue = length(sin(mod(1.4*worldPos, 3.14159)));
#else
float selectBoxHue = length(sin(mod(1.4*(feetPlayerPos+cameraPosition)+0.7*frameTimeCounter, 3.14159)));
float selectBoxHue = length(sin(mod(1.4*worldPos+0.7*frameTimeCounter, 3.14159)));
#endif
vec3 selectBoxColor = HsvToRgb(vec3(selectBoxHue, 1.0, 1.0));
+2 -10
View File
@@ -20,8 +20,6 @@ uniform sampler2D colortex4;
#endif
#ifdef OVERWORLD_SHADER
flat varying vec3 averageSkyCol_Clouds;
flat varying vec4 lightCol;
flat varying vec3 WsunVec;
#include "/lib/scene_controller.glsl"
@@ -123,18 +121,12 @@ void main() {
if(dot(color.rgb,vec3(0.33333)) < 0.00001) SELECTION_BOX = 1;
#endif
#ifdef OVERWORLD_SHADER
lightCol.rgb = texelFetch2D(colortex4,ivec2(6,37),0).rgb;
lightCol.a = float(sunElevation > 1e-5)*2.0 - 1.0;
averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(0,37),0).rgb;
#ifdef OVERWORLD_SHADER
#ifdef SMOOTH_SUN_ROTATION
WsunVec = WsunVecSmooth;
#else
WsunVec = lightCol.a * normalize(mat3(gbufferModelViewInverse) * sunPosition);
WsunVec = float(sunElevation > 1e-5)*2.0 - 1.0 * normalize(mat3(gbufferModelViewInverse) * sunPosition);
#endif
readSceneControllerParameters(colortex4, SC_parameters.smallCumulus, SC_parameters.largeCumulus, SC_parameters.altostratus, SC_parameters.cirrus, SC_parameters.fog);
#endif
+48 -36
View File
@@ -24,6 +24,10 @@
in DATA {
vec4 color;
#if defined IRIS_FEATURE_FADE_VARIABLE && VANILLA_CHUNK_FADING > 0 && !defined HAND
float chunkFade;
#endif
vec4 lmtexcoord;
vec3 normalMat;
@@ -329,9 +333,9 @@ float getTrimEmission(vec3 Albedo) {
return sqrt(hsv.z);
}
#if defined HAND || (defined WORLD && !defined ENTITIES && !defined BLOCKENTITIES)
uniform float alphaTestRef;
#endif
// #if defined HAND || (defined WORLD && !defined ENTITIES && !defined BLOCKENTITIES)
// uniform float alphaTestRef;
// #endif
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
@@ -386,6 +390,7 @@ void main() {
#endif
float BN = blueNoise();
float R2 = R2_dither();
vec2 tempOffset = offsets[framemod8];
@@ -481,7 +486,7 @@ void main() {
#ifndef HAND
#ifdef WORLD
if(data_in.blockID == BLOCK_GROUND_WAVING_VERTICAL || data_in.blockID == BLOCK_GRASS_SHORT || data_in.blockID == BLOCK_GRASS_TALL_LOWER || data_in.blockID == BLOCK_GRASS_TALL_UPPER ) opaqueMasks = 0.60;
if(data_in.blockID == BLOCK_AIR_WAVING) opaqueMasks = 0.55;
else if(data_in.blockID == BLOCK_AIR_WAVING) opaqueMasks = 0.55;
#endif
#if defined ENTITIES
@@ -492,7 +497,7 @@ void main() {
#ifdef INCLUDE_UNLISTED_ENTITIES
opaqueMasks = 0.45;
#else
if(data_in.blockID == ENTITY_BOAT || data_in.blockID == ENTITY_SMALLSHIPS || data_in.blockID == ENTITY_SSS_MEDIUM || data_in.blockID == ENTITY_SSS_WEAK || data_in.blockID == ENTITY_PLAYER || data_in.blockID == ENTITY_CURRENT_PLAYER || data_in.blockID == 2468) opaqueMasks = 0.45;
if(data_in.blockID == ENTITY_SSS_NONE || data_in.blockID == ENTITY_BOAT || data_in.blockID == ENTITY_SMALLSHIPS || data_in.blockID == ENTITY_SSS_MEDIUM || data_in.blockID == ENTITY_SSS_WEAK || data_in.blockID == ENTITY_PLAYER || data_in.blockID == ENTITY_CURRENT_PLAYER) opaqueMasks = 0.45;
#endif
#endif
@@ -548,19 +553,27 @@ void main() {
float viewDist = length(playerpos);
float ditherFade = smoothstep(0.98 * far, 1.03 * far, viewDist);
if(step(ditherFade, R2_dither()) == 0.0) discard;
if(step(ditherFade, R2) == 0.0) discard;
#endif
#if defined HAND || (defined WORLD && !defined ENTITIES && !defined BLOCKENTITIES)
if (Albedo.a < alphaTestRef) discard;
if (Albedo.a < 0.1) discard;
#endif
#if defined IRIS_FEATURE_FADE_VARIABLE && VANILLA_CHUNK_FADING > 0 && !defined HAND
#ifdef TAA
if(sqrt(data_in.chunkFade) < BN) discard;
#else
if(sqrt(data_in.chunkFade) < R2) discard;
#endif
#endif
#if (defined BLOCKENTITIES || defined ENTITIES || defined HAND) && !defined TRANSLUCENT_ENTITIES && defined TRANSLUCENT_ENTITIES_DITHER_FALLBACK
float entitiyAlbedo = clamp((Albedo.a - 0.1) * 10.0 / 9.0, 0.0, 1.0);
float entityAlbedo = clamp((Albedo.a - 0.1) * 10.0 / 9.0, 0.0, 1.0);
#ifdef TAA
if(step(1.0-entitiyAlbedo, BN) == 0.0) discard;
if(entityAlbedo < BN) discard;
#else
if(step(1.0-entitiyAlbedo, R2_dither()) == 0.0) discard;
if(entityAlbedo < R2) discard;
#endif
#endif
@@ -749,19 +762,18 @@ void main() {
/////// ----- SSS ON BLOCKS ----- ///////
// strong
if (
data_in.blockID == BLOCK_SSS_STRONG || data_in.blockID == BLOCK_SAPLING || data_in.blockID == BLOCK_AIR_WAVING
else if (
data_in.blockID == BLOCK_SSS_STRONG || data_in.blockID == BLOCK_AIR_WAVING
) {
SSSAMOUNT = 1.0;
}
// medium
if (
else if (
data_in.blockID == BLOCK_GROUND_WAVING || data_in.blockID == BLOCK_GROUND_WAVING_VERTICAL
|| data_in.blockID == BLOCK_GRASS_SHORT || data_in.blockID == BLOCK_GRASS_TALL_UPPER || data_in.blockID == BLOCK_GRASS_TALL_LOWER
) {
SSSAMOUNT = 0.5;
}
} else
if (
data_in.blockID == BLOCK_SSS_WEAK || data_in.blockID == BLOCK_SSS_WEAK_2 ||
data_in.blockID == BLOCK_GLOW_LICHEN || data_in.blockID == BLOCK_SNOW_LAYERS || data_in.blockID == BLOCK_CARPET ||
@@ -773,7 +785,7 @@ void main() {
// low
#ifdef MISC_BLOCK_SSS
if(
else if(
data_in.blockID == BLOCK_SSS_WEIRD || data_in.blockID == BLOCK_GRASS
){
SSSAMOUNT = 0.5;
@@ -782,14 +794,14 @@ void main() {
#ifdef ENTITIES
#ifdef MOB_SSS
/////// ----- SSS ON MOBS----- ///////
// strong
if(data_in.blockID == ENTITY_SSS_MEDIUM) SSSAMOUNT = 0.75;
// medium
// low
if(data_in.blockID == ENTITY_SSS_WEAK || data_in.blockID == ENTITY_PLAYER || data_in.blockID == ENTITY_CURRENT_PLAYER) SSSAMOUNT = 0.4;
/////// ----- SSS ON MOBS----- ///////
// strong
else if(data_in.blockID == ENTITY_SSS_MEDIUM) SSSAMOUNT = 0.75;
// medium
// low
else if(data_in.blockID == ENTITY_SSS_WEAK || data_in.blockID == ENTITY_PLAYER || data_in.blockID == ENTITY_CURRENT_PLAYER) SSSAMOUNT = 0.4;
#endif
#endif
@@ -798,7 +810,7 @@ void main() {
// strong
// medium
if(data_in.blockID == BLOCK_SSS_WEAK_3) SSSAMOUNT = 0.4;
else if(data_in.blockID == BLOCK_SSS_WEAK_3) SSSAMOUNT = 0.4;
// low
@@ -819,24 +831,24 @@ void main() {
// normal block lightsources
if(data_in.blockID >= 100 && data_in.blockID < 300) EMISSIVE = 0.5;
if(data_in.blockID == 266 || data_in.blockID == 497) EMISSIVE = 0.2; // sculk stuff
else if(data_in.blockID == 266 || data_in.blockID == 497) EMISSIVE = 0.2; // sculk stuff
if(data_in.blockID == 195) EMISSIVE = 2.3; // glow lichen
else if(data_in.blockID == 195) EMISSIVE = 2.3; // glow lichen
if(data_in.blockID == 185) EMISSIVE = 1.5; // crying obsidian
else if(data_in.blockID == 185) EMISSIVE = 1.5; // crying obsidian
if(data_in.blockID == 105) EMISSIVE = 2.0; // brewing stand
else if(data_in.blockID == 105) EMISSIVE = 2.0; // brewing stand
if(data_in.blockID == 236) EMISSIVE = 1.0; // respawn anchor
else if(data_in.blockID == 236) EMISSIVE = 1.0; // respawn anchor
if(data_in.blockID == 101) EMISSIVE = 0.7; // large amethyst bud
else if(data_in.blockID == 101) EMISSIVE = 0.7; // large amethyst bud
if(data_in.blockID == 103) EMISSIVE = 1.0; // amethyst cluster
else if(data_in.blockID == 103) EMISSIVE = 1.0; // amethyst cluster
if(data_in.blockID == 244) EMISSIVE = 1.5; // soul fire
else if(data_in.blockID == 244) EMISSIVE = 1.5; // soul fire
#if EMISSIVE_ORES > 0
if(data_in.blockID == 502) {
else if(data_in.blockID == 502) {
EMISSIVE = EMISSIVE_ORES_STRENGTH;
#ifndef HARDCODED_EMISSIVES_APPROX
@@ -905,13 +917,13 @@ void main() {
#endif
#if EMISSIVE_TYPE == 1
EMISSIVE = clamp(EMISSIVE, 0.0, 1.0);
EMISSIVE = clamp(EMISSIVE, 0.0, 0.99);
gl_FragData[1].a = EMISSIVE;
#endif
#if EMISSIVE_TYPE == 2
gl_FragData[1].a = SpecularTex.a;
EMISSIVE = clamp(EMISSIVE, 0.0, 1.0);
EMISSIVE = clamp(EMISSIVE, 0.0, 0.99);
if(emissionCheck) gl_FragData[1].a = EMISSIVE;
#endif
+17
View File
@@ -22,6 +22,10 @@ in DATA {
vec4 color;
#if defined IRIS_FEATURE_FADE_VARIABLE && VANILLA_CHUNK_FADING > 0 && !defined HAND
float chunkFade;
#endif
vec4 lmtexcoord;
vec3 normalMat;
@@ -40,6 +44,10 @@ in DATA {
out DATA {
vec4 color;
#if defined IRIS_FEATURE_FADE_VARIABLE && VANILLA_CHUNK_FADING > 0 && !defined HAND
float chunkFade;
#endif
vec4 lmtexcoord;
vec3 normalMat;
@@ -176,6 +184,11 @@ void main() {
gl_Position = vertex;
data_out.color = data_in[i].color;
#if defined IRIS_FEATURE_FADE_VARIABLE && VANILLA_CHUNK_FADING > 0 && !defined HAND
data_out.chunkFade = data_in[i].chunkFade;
#endif
data_out.lmtexcoord = data_in[i].lmtexcoord;
data_out.normalMat = data_in[i].normalMat;
@@ -387,6 +400,10 @@ void main() {
if (data_in[i].color.rgb == vec3(1.0)) data_out.color.rgb = vec3(0.22,0.32,0.11)*heightfade;
#if defined IRIS_FEATURE_FADE_VARIABLE && VANILLA_CHUNK_FADING > 0 && !defined HAND
data_out.chunkFade = data_in[i].chunkFade;
#endif
data_out.lmtexcoord = data_in[i].lmtexcoord;
#ifdef MC_NORMAL_MAP
+13 -2
View File
@@ -6,11 +6,14 @@ in DATA {
#if !defined ENTITIES && !defined HAND && defined SHADER_GRASS && !defined BLOCKENTITIES
vec4 grassSideCheck;
vec3 centerPosition;
int discardGrass;
#endif
vec4 color;
#if defined IRIS_FEATURE_FADE_VARIABLE && VANILLA_CHUNK_FADING > 0 && !defined HAND
float chunkFade;
#endif
vec4 lmtexcoord;
vec3 normalMat;
@@ -34,6 +37,10 @@ out DATA {
vec4 color;
#if defined IRIS_FEATURE_FADE_VARIABLE && VANILLA_CHUNK_FADING > 0 && !defined HAND
float chunkFade;
#endif
vec4 lmtexcoord;
vec3 normalMat;
@@ -73,6 +80,10 @@ void main() {
data_out[gl_InvocationID].texcoord = data_in[gl_InvocationID].texcoord;
#endif
#if defined IRIS_FEATURE_FADE_VARIABLE && VANILLA_CHUNK_FADING > 0 && !defined HAND
data_out[gl_InvocationID].chunkFade = data_in[gl_InvocationID].chunkFade;
#endif
#ifdef MC_NORMAL_MAP
data_out[gl_InvocationID].tangent = data_in[gl_InvocationID].tangent;
#endif
@@ -148,7 +159,7 @@ void main() {
}
#if REPLACE_SHORT_GRASS > 0
if(data_in[gl_InvocationID].discardGrass == 1){
if(data_in[gl_InvocationID].blockID == -10){
gl_TessLevelOuter[0] = 0;
gl_TessLevelOuter[1] = 0;
gl_TessLevelOuter[2] = 0;
+12
View File
@@ -10,6 +10,10 @@ in DATA {
vec4 color;
#if defined IRIS_FEATURE_FADE_VARIABLE && VANILLA_CHUNK_FADING > 0 && !defined HAND
float chunkFade;
#endif
vec4 lmtexcoord;
vec3 normalMat;
@@ -33,6 +37,10 @@ out DATA {
vec4 color;
#if defined IRIS_FEATURE_FADE_VARIABLE && VANILLA_CHUNK_FADING > 0 && !defined HAND
float chunkFade;
#endif
vec4 lmtexcoord;
vec3 normalMat;
@@ -64,6 +72,10 @@ void main() {
data_out.texcoord = calcTessellation(data_in[0].texcoord, data_in[1].texcoord, data_in[2].texcoord);
#endif
#if defined IRIS_FEATURE_FADE_VARIABLE && VANILLA_CHUNK_FADING > 0 && !defined HAND
data_out.chunkFade = calcTessellation(data_in[0].chunkFade, data_in[1].chunkFade, data_in[2].chunkFade);
#endif
#ifdef MC_NORMAL_MAP
data_out.tangent = calcTessellation(data_in[0].tangent, data_in[1].tangent, data_in[2].tangent);
#endif
+27 -22
View File
@@ -33,11 +33,14 @@ out DATA {
#if !defined ENTITIES && !defined HAND && defined SHADER_GRASS && !defined BLOCKENTITIES
vec4 grassSideCheck;
vec3 centerPosition;
int discardGrass;
#endif
vec4 color;
#if defined IRIS_FEATURE_FADE_VARIABLE && VANILLA_CHUNK_FADING > 0 && !defined HAND
float chunkFade;
#endif
vec4 lmtexcoord;
vec3 normalMat;
@@ -222,6 +225,10 @@ vec3 viewToWorld(vec3 viewPos) {
pos = gbufferModelViewInverse * pos;
return pos.xyz;
}
#if defined IRIS_FEATURE_FADE_VARIABLE && VANILLA_CHUNK_FADING > 1 && !defined HAND
uniform float caveDetection;
#endif
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
@@ -242,6 +249,10 @@ void main() {
/////// ----- COLOR STUFF ----- ///////
data_out.color = gl_Color;
#if defined IRIS_FEATURE_FADE_VARIABLE && VANILLA_CHUNK_FADING > 0 && !defined HAND
data_out.chunkFade = abs(mc_chunkFade);
#endif
/////// ----- RANDOM STUFF ----- ///////
// gl_TextureMatrix[0] for animated things like charged creepers
@@ -255,22 +266,14 @@ void main() {
data_out.texcoord.xy = sign(texcoordminusmid)*0.5+0.5;
#endif
vec2 lmcoord = gl_MultiTexCoord1.xy / 240.0;
data_out.lmtexcoord.zw = lmcoord;
data_out.lmtexcoord.zw = gl_MultiTexCoord1.xy / 240.0;
#ifdef MC_NORMAL_MAP
vec3 alterTangent = at_tangent.rgb;
data_out.tangent = vec4(normalize(gl_NormalMatrix * alterTangent.rgb), at_tangent.w);
data_out.tangent = vec4(normalize(gl_NormalMatrix * at_tangent.rgb), at_tangent.w);
#endif
data_out.normalMat = normalize(gl_NormalMatrix * gl_Normal);
vec3 vFlatNormals = data_out.normalMat;
#ifdef ENTITIES
data_out.blockID = int(entityId);
#elif defined BLOCKENTITIES
@@ -299,7 +302,7 @@ void main() {
vec3 worldpos = mat3(gbufferModelViewInverse) * position + gbufferModelViewInverse[3].xyz;
vec3 worldNormals = viewToWorld(vFlatNormals);
vec3 worldNormals = viewToWorld(data_out.normalMat);
#if !defined ENTITIES && !defined HAND && defined SHADER_GRASS && (defined GRASS_DETECT_FALLOFF || defined GRASS_DETECT_INV_FALLOFF || REPLACE_SHORT_GRASS > 0) && !defined BLOCKENTITIES
@@ -362,7 +365,6 @@ void main() {
}
}
data_out.discardGrass = 0;
#if REPLACE_SHORT_GRASS > 0
#if GRASS_DENSITY == 3
float maxShortGrassRange = 28.0;
@@ -378,7 +380,7 @@ void main() {
data_out.centerPosition = worldpos + at_midBlock.xyz / 64.0;
vec3 LPVpos = GetLpvPosition(data_out.centerPosition);
uint blockBelow = GetVoxelBlock(ivec3(LPVpos.x, LPVpos.y - 0.6, LPVpos.z));
if(blockBelow == 85) data_out.discardGrass = 1;
if(blockBelow == 85) data_out.blockID = -10;
}
#endif
#endif
@@ -400,23 +402,26 @@ void main() {
) && abs(position.z) < 64.0
){
vec3 UnalteredWorldpos = worldpos;
// vec3 offsetPos = UnalteredWorldpos+vec3(0.0, 1.0, 0.0)+relativeEyePosition;
// float playerDist = smoothstep(0.5, 0.05, length(offsetPos.xz)) * smoothstep(1.0, 0.2, abs(offsetPos.y));
// vec2 dir2 = normalize(UnalteredWorldpos.xz+relativeEyePosition.xz);
// apply displacement for waving plant blocks
worldpos += calcMovePlants(worldpos + cameraPosition) * max(data_out.lmtexcoord.w,0.5);
// worldpos.xz += playerDist*dir2;
// apply displacement for waving leaf blocks specifically, overwriting the other waving mode. these wave off of the air. they wave uniformly
if(mc_Entity.x == BLOCK_AIR_WAVING) worldpos = UnalteredWorldpos + calcMoveLeaves(worldpos + cameraPosition, 0.0040, 0.0064, 0.0043, 0.0035, 0.0037, 0.0041, vec3(1.0,0.2,1.0), vec3(0.5,0.1,0.5))*data_out.lmtexcoord.w;
if(mc_Entity.x == BLOCK_AIR_WAVING) {
worldpos += calcMoveLeaves(worldpos + cameraPosition, 0.0040, 0.0064, 0.0043, 0.0035, 0.0037, 0.0041, vec3(1.0,0.2,1.0), vec3(0.5,0.1,0.5))*data_out.lmtexcoord.w;
} else {
// apply displacement for waving plant blocks
worldpos += calcMovePlants(worldpos + cameraPosition) * max(data_out.lmtexcoord.w,0.5);
// worldpos.xz += playerDist*dir2;
}
}
#endif
#if defined IRIS_FEATURE_FADE_VARIABLE && VANILLA_CHUNK_FADING > 1 && !defined HAND
worldpos.y += -45.0*(1.0-data_out.chunkFade)*(1.0-caveDetection)*smoothstep(25.0, far, length(worldpos));
#endif
// position = mat3(gbufferModelView) * worldpos + gbufferModelView[3].xyz;
#ifdef SHADER_GRASS
+28 -18
View File
@@ -10,9 +10,7 @@
#include "/lib/settings.glsl"
#if defined CUSTOM_MOON_ROTATION || defined END_ISLAND_LIGHT || WATER_INTERACTION == 2
#include "/lib/SSBOs.glsl"
#endif
#include "/lib/SSBOs.glsl"
#undef FLASHLIGHT_BOUNCED_INDIRECT
@@ -26,6 +24,10 @@ varying vec4 lmtexcoord;
varying vec4 color;
uniform vec4 entityColor;
#if defined IRIS_FEATURE_FADE_VARIABLE && VANILLA_CHUNK_FADING > 0 && !defined HAND
varying float chunkFade;
#endif
#if defined OVERWORLD_SHADER || (defined END_ISLAND_LIGHT && defined END_SHADER)
const bool shadowHardwareFiltering = true;
uniform sampler2DShadow shadow;
@@ -38,9 +40,6 @@ uniform vec4 entityColor;
uniform float lightSign;
flat varying vec3 WsunVec;
flat varying vec3 averageSkyCol_Clouds;
flat varying vec4 lightCol;
#endif
@@ -330,8 +329,7 @@ float ld(float dist) {
#ifdef RIPPLE_WATER
#include "/lib/ripples.glsl"
uniform int biome_precipitation;
uniform float rippleAmount;
#endif
// #undef BASIC_SHADOW_FILTER
@@ -489,6 +487,8 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
vec3 FragCoord = gl_FragCoord.xyz;
float mipmapBias = bias();
float BN = blueNoise();
#ifdef TAA
vec2 tempOffset = offsets[framemod8];
vec3 viewPos = toScreenSpace(FragCoord*vec3(texelSize/RENDER_SCALE,1.0)-vec3(vec2(tempOffset)*texelSize*0.5, 0.0));
@@ -542,6 +542,16 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
gl_FragData[0] = _color;
#endif
#if defined IRIS_FEATURE_FADE_VARIABLE && VANILLA_CHUNK_FADING > 0 && !defined HAND
gl_FragData[0].a *= sqrt(chunkFade);
#ifdef TAA
if(sqrt(chunkFade) < BN && isWater) discard;
#else
if(sqrt(chunkFade) < R2_dither() && isWater) discard;
#endif
#endif
float UnchangedAlpha = gl_FragData[0].a;
#ifdef WhiteWorld
@@ -650,9 +660,9 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
vec3 flowDir = normalize(worldSpaceNormal*10.0) * frameTimeCounter * 2.0 * WATER_WAVE_SPEED;
vec2 newPos = playerPos.xy + cameraPosition.xy + abs(flowDir.xz);
newPos = mix(newPos, playerPos.zy + cameraPosition.zy + abs(flowDir.zx), clamp(abs(worldSpaceNormal.x),0.0,1.0));
newPos = mix(newPos, playerPos.xz + cameraPosition.xz, clamp(abs(worldSpaceNormal.y),0.0,1.0));
vec2 newPos = worldPos.xy + abs(flowDir.xz);
newPos = mix(newPos, worldPos.zy + abs(flowDir.zx), clamp(abs(worldSpaceNormal.x),0.0,1.0));
newPos = mix(newPos, worldPos.xz, clamp(abs(worldSpaceNormal.y),0.0,1.0));
waterPos.xy = newPos;
waterPos.xyz = getParallaxDisplacement(waterPos, playerPos);
@@ -660,8 +670,8 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
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);
if(viewDist < 35 && rainStrength > 0.0 && rippleAmount > 0.01 && abs(worldSpaceNormal.z) < 0.95 && abs(worldSpaceNormal.x) < 0.95) {
float effectStrength = smoothstep(0.85, 1.0, lightmap.y) * smoothstep(0.0, 1.0, rippleAmount);
rippleBump = ripples(worldPos.xz);
bump += 0.6 * RIPPLE_STRENGTH * rippleBump * rainStrength * effectStrength * smoothstep(35.0, 10.0, viewDist);
}
@@ -802,8 +812,8 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
vec3 Direct_lighting = vec3(0.0);
#ifdef OVERWORLD_SHADER
vec3 DirectLightColor = lightCol.rgb/2400.0;
vec3 AmbientLightColor = averageSkyCol_Clouds/900.0;
vec3 DirectLightColor = lightSourceColorSSBO/2400.0;
vec3 AmbientLightColor = averageSkyCol_CloudsSSBO/900.0;
#ifdef USE_CUSTOM_DIFFUSE_LIGHTING_COLORS
DirectLightColor = luma(DirectLightColor) * vec3(DIRECTLIGHT_DIFFUSE_R,DIRECTLIGHT_DIFFUSE_G,DIRECTLIGHT_DIFFUSE_B);
@@ -826,7 +836,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
float LM_shadowMapFallback = min(max(lightmap.y-0.8, 0.0) * 25,1.0);
Shadows = ComputeShadowMap(DirectLightColor, shadowPlayerPos, shadowMapFalloff, blueNoise(), geoNormals);
Shadows = ComputeShadowMap(DirectLightColor, shadowPlayerPos, shadowMapFalloff, BN, geoNormals);
// Shadows = mix(LM_shadowMapFallback, Shadows, shadowMapFalloff2);
Shadows *= mix(LM_shadowMapFallback,1.0,shadowMapFalloff2);
@@ -882,7 +892,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
float LM_shadowMapFallback = min(max(lightmap.y-0.8, 0.0) * 25,1.0);
Shadows = ComputeShadowMap(DirectLightColor, shadowPlayerPos, shadowMapFalloff, blueNoise(), geoNormals);
Shadows = ComputeShadowMap(DirectLightColor, shadowPlayerPos, shadowMapFalloff, BN, geoNormals);
// Shadows = mix(LM_shadowMapFallback, Shadows, shadowMapFalloff2);
Shadows *= mix(LM_shadowMapFallback,1.0,shadowMapFalloff2);
@@ -979,7 +989,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
vec3 DirectLightColor = WsunVec;
float Shadows = 0.0;
#endif
vec3 specularReflections = specularReflections(viewPos, normalize(feetPlayerPos), WsunVec, vec3(blueNoise(), vec2(interleaved_gradientNoise_temporal())), worldSpaceNormal, roughness, f0, Albedo, FinalColor*gl_FragData[0].a, DirectLightColor * Shadows * Shadows, lightmap.y, isHand, isWater, reflectance, flashLightSpecularData);
vec3 specularReflections = specularReflections(viewPos, normalize(feetPlayerPos), WsunVec, vec3(BN, vec2(interleaved_gradientNoise_temporal())), worldSpaceNormal, roughness, f0, Albedo, FinalColor*gl_FragData[0].a, DirectLightColor * Shadows * Shadows, lightmap.y, isHand, isWater, reflectance, flashLightSpecularData);
gl_FragData[0].a = gl_FragData[0].a + (1.0-gl_FragData[0].a) * reflectance;
+34 -28
View File
@@ -3,9 +3,7 @@
#include "/lib/bokeh.glsl"
#include "/lib/items.glsl"
#ifdef CUSTOM_MOON_ROTATION
#include "/lib/SSBOs.glsl"
#endif
#include "/lib/SSBOs.glsl"
#include "/lib/entities.glsl"
@@ -26,12 +24,14 @@ Read the terms of modification and sharing before changing something below pleas
varying vec4 lmtexcoord;
varying vec4 color;
#if defined IRIS_FEATURE_FADE_VARIABLE && VANILLA_CHUNK_FADING > 0 && !defined HAND
varying float chunkFade;
#endif
uniform sampler2D colortex4;
uniform sampler2D noisetex;
#ifdef OVERWORLD_SHADER
flat varying vec3 averageSkyCol_Clouds;
flat varying vec4 lightCol;
flat varying vec3 WsunVec;
#include "/lib/scene_controller.glsl"
@@ -113,6 +113,11 @@ vec3 getWaveNormal(vec3 posxz, float range){
return wave;
}
#if defined IRIS_FEATURE_FADE_VARIABLE && VANILLA_CHUNK_FADING > 1 && !defined HAND
uniform float caveDetection;
#endif
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
@@ -144,8 +149,7 @@ void main() {
// lmtexcoord.xy = (gl_MultiTexCoord0).xy;
lmtexcoord.xy = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
vec2 lmcoord = gl_MultiTexCoord1.xy / 240.0;
lmtexcoord.zw = lmcoord;
lmtexcoord.zw = gl_MultiTexCoord1.xy / 240.0;
#if defined LARGE_WAVE_DISPLACEMENT && !defined PHYSICS_OCEAN
if(isWater) {
@@ -166,15 +170,25 @@ void main() {
}
#endif
vec3 worldpos = mat3(gbufferModelViewInverse) * position + gbufferModelViewInverse[3].xyz;
#ifdef PLANET_CURVATURE
float curvature = length(worldpos) / (16*8);
worldpos.y -= curvature*curvature * CURVATURE_AMOUNT;
#endif
position = mat3(gbufferModelView) * worldpos + gbufferModelView[3].xyz;
#if defined IRIS_FEATURE_FADE_VARIABLE && VANILLA_CHUNK_FADING > 0 && !defined HAND
chunkFade = abs(mc_chunkFade);
#endif
#if defined PLANET_CURVATURE || (defined IRIS_FEATURE_FADE_VARIABLE && VANILLA_CHUNK_FADING > 1 && !defined HAND)
vec3 worldpos = mat3(gbufferModelViewInverse) * position + gbufferModelViewInverse[3].xyz;
#if defined IRIS_FEATURE_FADE_VARIABLE && VANILLA_CHUNK_FADING > 1 && !defined HAND
worldpos.y += -45.0*(1.0-chunkFade)*(1.0-caveDetection)*smoothstep(25.0, far, length(worldpos));
#endif
#ifdef PLANET_CURVATURE
float curvature = length(worldpos) / (16*8);
worldpos.y -= curvature*curvature * CURVATURE_AMOUNT;
#endif
position = mat3(gbufferModelView) * worldpos + gbufferModelView[3].xyz;
#endif
#if !defined ENTITIES && !defined HAND
gl_Position = toClipSpace3(position);
@@ -195,7 +209,7 @@ void main() {
// translucent entities
#if defined ENTITIES || defined BLOCKENTITIES
mat = 0.9;
if (entityId == 1803) mat = 0.8;
if (entityId == 1804) mat = 0.8;
#endif
// translucent blocks
@@ -227,21 +241,16 @@ void main() {
}
#endif
flatnormal = normalMat.xyz;
viewVector = position.xyz;
viewVector = normalize(tbnMatrix * viewVector);
viewVector = position.xyz;
if(isWater) viewVector = normalize(tbnMatrix * viewVector);
color = vec4(gl_Color.rgb, 1.0);
#ifdef LIGHTNING
color.a = gl_Color.a;
#endif
#ifdef OVERWORLD_SHADER
lightCol.rgb = texelFetch2D(colortex4,ivec2(6,37),0).rgb;
lightCol.a = float(sunElevation > 1e-5)*2.0 - 1.0;
averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(0,37),0).rgb;
#ifdef OVERWORLD_SHADER
// WsunVec = lightCol.a * normalize(mat3(gbufferModelViewInverse) * sunPosition);
#ifdef SMOOTH_SUN_ROTATION
@@ -262,10 +271,7 @@ void main() {
vec3 WmoonVec = moonVec;
WsunVec = mix(WmoonVec, WsunVec, clamp(lightCol.a,0,1));
readSceneControllerParameters(colortex4, SC_parameters.smallCumulus, SC_parameters.largeCumulus, SC_parameters.altostratus, SC_parameters.cirrus, SC_parameters.fog);
WsunVec = mix(WmoonVec, WsunVec, clamp(float(sunElevation > 1e-5)*2.0 - 1.0,0,1));
#endif
LIGHTNING_BOLT = 0.0;
+1 -1
View File
@@ -67,7 +67,7 @@ void main() {
vec3 GlintColor = vec3(0.0);
Albedo.a = 0.0;
#else
vec3 GlintColor = Albedo.rgb * 0.2 * Emissive_Brightness;
vec3 GlintColor = Albedo.rgb * 0.2 * Emissive_Brightness * ENCHANT_GLINT_BRIGHTNESS;
#endif
gl_FragData[0] = vec4(GlintColor*0.1, 0.000001);
+293 -18
View File
@@ -1,20 +1,75 @@
#include "/lib/settings.glsl"
#include "/lib/SSBOs.glsl"
layout (local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
const ivec3 workGroups = ivec3(1, 1, 1);
#include "/lib/scene_controller.glsl"
uniform int worldDay;
uniform bool worldTimeChangeCheck;
uniform float frameTime;
uniform int frameCounter;
uniform sampler2D colortex1;
uniform sampler2D colortex4;
uniform float rainStrength;
uniform float thunderStrength;
uniform vec2 texelSize;
uniform float moonElevation;
uniform float sunElevation;
uniform float noPuddleAreas;
uniform float eyeAltitude;
uniform mat4 gbufferModelViewInverse;
uniform vec3 moonPosition;
uniform vec3 sunPosition;
uniform vec3 cameraPosition;
float hash11(float p)
{
p = fract(p * .1031);
p *= p + 33.33;
p *= p + p;
return fract(p);
}
float luma(vec3 color) {
return dot(color,vec3(0.21, 0.72, 0.07));
}
vec3 rodSample(vec2 Xi)
{
float r = sqrt(1.0f - Xi.x*Xi.y);
float phi = 2 * 3.14159265359 * Xi.y;
return normalize(vec3(cos(phi) * r, sin(phi) * r, Xi.x)).xzy;
}
//Low discrepancy 2D sequence, integration error is as low as sobol but easier to compute : http://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/
vec2 R2_samples(int n){
vec2 alpha = vec2(0.75487765, 0.56984026);
return fract(alpha * n);
}
#define interpolateValue(old_value, new_value, mixhistory) clamp(mix(old_value, new_value, clamp(mixhistory,0.0,1.0)),0.0,65000.)
vec2 decodeVec2(float a){
const vec2 constant1 = 65535. / vec2( 256., 65536.);
const float constant2 = 256. / 255.;
return fract( a * constant1 ) * constant2 ;
}
vec3 toLinear(vec3 sRGB){
return sRGB * (sRGB * (sRGB * 0.305306011 + 0.682171111) + 0.012522878);
}
#include "/lib/util.glsl"
#ifdef CUSTOM_MOON_ROTATION
uniform float sunElevation;
uniform mat4 shadowModelView;
uniform int worldTime;
uniform float worldTimeSmooth;
uniform int worldDay;
// uniform float frameTimeCounter;
uniform vec4 lightningBoltPosition;
#include "/lib/util.glsl"
vec3 moonDirection(float worldTime, float latitude, float pathRotation) {
float phi = radians(-latitude);
float del = radians(pathRotation);
@@ -41,9 +96,6 @@ const ivec3 workGroups = ivec3(1, 1, 1);
#endif
#if (defined CUSTOM_MOON_ROTATION && defined OVERWORLD_SHADER) || (defined END_ISLAND_LIGHT && defined END_SHADER)
#include "/lib/SSBOs.glsl"
uniform vec3 cameraPosition;
#if defined END_ISLAND_LIGHT && defined END_SHADER
const float NEAR = 15.0;
const float FAR = 256.0;
@@ -107,12 +159,16 @@ const ivec3 workGroups = ivec3(1, 1, 1);
}
#endif
uniform mat4 gbufferModelViewInverse;
uniform vec3 moonPosition;
uniform vec3 sunPosition;
#include "/lib/sky_gradient.glsl"
#include "/lib/ROBOBO_sky.glsl"
void main() {
#if defined SMOOTH_SUN_ROTATION && (daySpeed < 1.0 || nightSpeed < 1.0)
vec3 WsunVec = WsunVecSmooth;
#else
vec3 WsunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition);
#endif
#if defined CUSTOM_MOON_ROTATION && defined OVERWORLD_SHADER
#ifdef CAELUM_SUPPORT
@@ -145,12 +201,6 @@ void main() {
}
#endif
#if defined SMOOTH_SUN_ROTATION && (daySpeed < 1.0 || nightSpeed < 1.0)
vec3 WsunVec = WsunVecSmooth;
#else
vec3 WsunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition);
#endif
#if defined CAELUM_SUPPORT || (defined SMOOTH_SUN_ROTATION && (daySpeed < 1.0 || nightSpeed < 1.0))
#if LIGHTNING_SHADOWS > 1
if (sunElevation > 0.0 && lightningBoltPosition.w == 0.0)
@@ -171,4 +221,229 @@ void main() {
customShadowMatrixSSBO = BuildShadowViewMatrix(normalize(END_LIGHT_POS));
customShadowPerspectiveSSBO = createPerspectiveMatrix();
#endif
#ifdef OVERWORLD_SHADER
////////////////////////////////
/// --- SCENE CONTROLLER --- ///
////////////////////////////////
float mixhistory = 0.06;
if(worldTimeChangeCheck) mixhistory = 1.0;
vec2 smallCumulus = vec2(CloudLayer0_coverage, CloudLayer0_density);
vec2 largeCumulus = vec2(CloudLayer1_coverage, CloudLayer1_density);
vec2 altostratus = vec2(CloudLayer2_coverage, CloudLayer2_density);
vec2 cirrus = vec2(CloudLayer3_coverage, CloudLayer3_density);
vec2 fog = vec2(1.0);
#ifdef Daily_Weather
#ifdef CHOOSE_RANDOM_WEATHER_PROFILE
int dayCounter = int(clamp(hash11(float(mod(worldDay, 1000))) * 10.0, 0,10));
#else
int dayCounter = int(mod(worldDay, 10));
#endif
//----------- cloud coverage
vec4 weatherProfile_cloudCoverage[10] = vec4[](
vec4(DAY0_l0_coverage, DAY0_l1_coverage, DAY0_l2_coverage, DAY0_l3_coverage),
vec4(DAY1_l0_coverage, DAY1_l1_coverage, DAY1_l2_coverage, DAY1_l3_coverage),
vec4(DAY2_l0_coverage, DAY2_l1_coverage, DAY2_l2_coverage, DAY2_l3_coverage),
vec4(DAY3_l0_coverage, DAY3_l1_coverage, DAY3_l2_coverage, DAY3_l3_coverage),
vec4(DAY4_l0_coverage, DAY4_l1_coverage, DAY4_l2_coverage, DAY4_l3_coverage),
vec4(DAY5_l0_coverage, DAY5_l1_coverage, DAY5_l2_coverage, DAY5_l3_coverage),
vec4(DAY6_l0_coverage, DAY6_l1_coverage, DAY6_l2_coverage, DAY6_l3_coverage),
vec4(DAY7_l0_coverage, DAY7_l1_coverage, DAY7_l2_coverage, DAY7_l3_coverage),
vec4(DAY8_l0_coverage, DAY8_l1_coverage, DAY8_l2_coverage, DAY8_l3_coverage),
vec4(DAY9_l0_coverage, DAY9_l1_coverage, DAY9_l2_coverage, DAY9_l3_coverage)
);
//----------- cloud density
vec4 weatherProfile_cloudDensity[10] = vec4[](
vec4(DAY0_l0_density, DAY0_l1_density, DAY0_l2_density, DAY0_l3_density),
vec4(DAY1_l0_density, DAY1_l1_density, DAY1_l2_density, DAY1_l3_density),
vec4(DAY2_l0_density, DAY2_l1_density, DAY2_l2_density, DAY2_l3_density),
vec4(DAY3_l0_density, DAY3_l1_density, DAY3_l2_density, DAY3_l3_density),
vec4(DAY4_l0_density, DAY4_l1_density, DAY4_l2_density, DAY4_l3_density),
vec4(DAY5_l0_density, DAY5_l1_density, DAY5_l2_density, DAY5_l3_density),
vec4(DAY6_l0_density, DAY6_l1_density, DAY6_l2_density, DAY6_l3_density),
vec4(DAY7_l0_density, DAY7_l1_density, DAY7_l2_density, DAY7_l3_density),
vec4(DAY8_l0_density, DAY8_l1_density, DAY8_l2_density, DAY8_l3_density),
vec4(DAY9_l0_density, DAY9_l1_density, DAY9_l2_density, DAY9_l3_density)
);
vec4 getWeatherProfile_coverage = weatherProfile_cloudCoverage[dayCounter];
vec4 getWeatherProfile_density = weatherProfile_cloudDensity[dayCounter];
smallCumulus = vec2(getWeatherProfile_coverage.r, getWeatherProfile_density.r);
largeCumulus = vec2(getWeatherProfile_coverage.g, getWeatherProfile_density.g);
altostratus = vec2(getWeatherProfile_coverage.b, getWeatherProfile_density.b);
cirrus = vec2(getWeatherProfile_coverage.a, getWeatherProfile_density.a);
//----------- fog density
vec2 weatherProfile_fogDensity[10] = vec2[](
vec2(DAY0_ufog_density, DAY0_cfog_density),
vec2(DAY1_ufog_density, DAY1_cfog_density),
vec2(DAY2_ufog_density, DAY2_cfog_density),
vec2(DAY3_ufog_density, DAY3_cfog_density),
vec2(DAY4_ufog_density, DAY4_cfog_density),
vec2(DAY5_ufog_density, DAY5_cfog_density),
vec2(DAY6_ufog_density, DAY6_cfog_density),
vec2(DAY7_ufog_density, DAY7_cfog_density),
vec2(DAY8_ufog_density, DAY8_cfog_density),
vec2(DAY9_ufog_density, DAY9_cfog_density)
);
fog = weatherProfile_fogDensity[dayCounter];
#endif
float SCmixhistory = 0.1*frameTime;
if(frameCounter < 4) SCmixhistory = 1.0;
SC_smallCumulus = interpolateValue(SC_smallCumulus, smallCumulus, SCmixhistory);
SC_largeCumulus = interpolateValue(SC_largeCumulus, largeCumulus, SCmixhistory);
SC_altostratus = interpolateValue(SC_altostratus, altostratus, SCmixhistory);
SC_cirrus = interpolateValue(SC_cirrus, cirrus, SCmixhistory);
SC_fog = interpolateValue(SC_fog, fog, SCmixhistory);
///////////////////////////////////
/// --- AMBIENT LIGHT STUFF --- ///
///////////////////////////////////
vec3 averageSkyCol_Clouds = vec3(0.0);
vec3 averageSkyCol = vec3(0.0);
vec2 sample3x3[9] = vec2[](
vec2(-1.0, -0.3),
vec2( 0.0, 0.0),
vec2( 1.0, -0.3),
vec2(-1.0, -0.5),
vec2( 0.0, -0.5),
vec2( 1.0, -0.5),
vec2(-1.0, -1.0),
vec2( 0.0, -1.0),
vec2( 1.0, -1.0)
);
// sample in a 3x3 pattern to get a good area for average color
// int maxIT = 9;
// for (int i = 0; i < maxIT; i++) {
// vec3 pos = vec3(0.0,1.0,0.0);
// pos.xy += normalize(sample3x3[i]) * vec2(0.3183,0.9000);
// averageSkyCol_Clouds += skyCloudsFromTex(pos,colortex4).rgb/maxIT/150.0;
// averageSkyCol += skyFromTex(pos,colortex4).rgb/maxIT/150.0;
// }
float maxIT = 20.0;
for (int i = 0; i < int(maxIT); i++) {
vec2 ij = R2_samples(((i*50+1)%1000)*int(maxIT)+i) * vec2(1.0,0.9000);
vec3 pos = normalize(rodSample(ij)) * vec3(1.0,0.5,1.0) + vec3(0.0,0.5,0.0);
averageSkyCol_Clouds += skyCloudsFromTex(pos,colortex4).rgb/maxIT/150.0;
averageSkyCol += 1.5 * skyFromTex(pos,colortex4).rgb/maxIT/150.0;
}
// vec3 minimumlight = vec3(1.0) * 0.01 * MIN_LIGHT_AMOUNT + nightVision * 0.05;
// luminance based reinhard is useful ouside of tonemapping too.
averageSkyCol_Clouds = averageSkyCol_Clouds / (1.0+luma(averageSkyCol_Clouds)*0.2);
averageSkyCol = max(averageSkyCol, 0.0); // + minimumlight;
#ifdef USE_CUSTOM_SKY_GROUND_LIGHTING_COLORS
averageSkyCol = luma(averageSkyCol) * vec3(SKY_GROUND_R,SKY_GROUND_G,SKY_GROUND_B);
#endif
averageSkyColSSBO = averageSkyCol;
////////////////////////////////////////
/// --- SUNLIGHT/MOONLIGHT STUFF --- ///
////////////////////////////////////////
vec2 planetSphere = vec2(0.0);
float sunVis = clamp(sunElevation,0.0,0.04)/0.04*clamp(sunElevation,0.0,0.04)/0.04;
float moonVis = clamp(-moonElevation,0.0,0.04)/0.04*clamp(-moonElevation,0.0,0.04)/0.04;
vec3 skyAbsorb = vec3(0.0);
vec3 sunColor = calculateAtmosphere(vec3(0.0), WsunVec, vec3(0.0,1.0,0.0), WsunVec, -WsunVec, planetSphere, skyAbsorb, 25,0.0);
sunColor = sunColorBase/4000.0 * skyAbsorb;
vec3 moonColor = moonColorBase/4000.0;
#ifdef CUSTOM_MOON_ROTATION
#if LIGHTNING_SHADOWS > 0
vec3 WmoonVec = customMoonVec2SSBO;
#else
vec3 WmoonVec = customMoonVecSSBO;
#endif
float moonPhase = 1.0 - 0.5 * (dot(WsunVec, WmoonVec) + 1.0);
moonVis = smoothstep(0.08, -0.03, -WmoonVec.y);
moonColor *= moonPhase;
#endif
// lightSourceColor = sunVis >= 1e-5 ? sunColor * sunVis : moonColor * moonVis;
vec3 lightSourceColor = sunColor * sunVis + moonColor * moonVis;
#ifdef CUSTOM_MOON_ROTATION
lightSourceColor *= smoothstep(0.005, 0.09, length(WmoonVec - WsunVec));
#endif
#if defined TWILIGHT_FOREST_FLAG
vec3 lightSourceColor = vec3(0.0);
vec3 moonColor = vec3(0.0);
#endif
/////////////////////////////////
///// --- STORE COLOR LUT --- ///
/////////////////////////////////
#ifdef SeparateAmbientColorRain
vec3 AmbientLightTint = mix(vec3(AmbientLight_R, AmbientLight_G, AmbientLight_B), mix(vec3(AmbientLightRain_R, AmbientLightRain_G, AmbientLightRain_B), vec3(AmbientLightThunder_R, AmbientLightThunder_G, AmbientLightThunder_B), thunderStrength), rainStrength*noPuddleAreas);
#else
vec3 AmbientLightTint = vec3(AmbientLight_R, AmbientLight_G, AmbientLight_B);
#endif
// --- the color of the atmosphere + the average color of the atmosphere.
vec3 skyGroundCol = skyFromTex(vec3(0, -1 ,0), colortex4).rgb * AmbientLightTint;
/// --- Save light values
averageSkyCol_CloudsSSBO = interpolateValue(averageSkyCol_CloudsSSBO, averageSkyCol_Clouds * AmbientLightTint * 150.0, mixhistory);
skyGroundColSSBO = interpolateValue(skyGroundColSSBO, skyGroundCol, mixhistory);
#ifdef ambientLight_only
lightSourceColorSSBO = vec3(0.0);
sunColorSSBO = vec3(0.0);
moonColorSSBO = vec3(0.0);
#else
lightSourceColorSSBO = interpolateValue(lightSourceColorSSBO, lightSourceColor*150.0, mixhistory);
sunColorSSBO = interpolateValue(sunColorSSBO, sunColor*150.0, mixhistory);
moonColorSSBO = interpolateValue(moonColorSSBO, moonColor*150.0, mixhistory);
#endif
#else
lightSourceColorSSBO = vec3(0.0);
sunColorSSBO = vec3(0.0);
moonColorSSBO = vec3(0.0);
#endif
#if defined FLASHLIGHT && defined FLASHLIGHT_BOUNCED_INDIRECT
// sample center pixel of albedo color, and interpolate it overtime.
vec3 data = texelFetch(colortex1, ivec2(0.5/texelSize), 0).rgb;
vec3 decodeAlbedo = vec3(decodeVec2(data.x).x,decodeVec2(data.y).x, decodeVec2(data.z).x);
vec3 albedo = toLinear(decodeAlbedo);
albedo = normalize(albedo + 1e-7) * (dot(albedo,vec3(0.21, 0.72, 0.07))*0.5+0.5);
albedoSmoothSSBO = interpolateValue(albedoSmoothSSBO, albedo*150.0, 0.01);
#endif
}
+4 -6
View File
@@ -1,8 +1,6 @@
#include "/lib/settings.glsl"
#if defined CUSTOM_MOON_ROTATION || defined END_ISLAND_LIGHT
#include "/lib/SSBOs.glsl"
#endif
#include "/lib/SSBOs.glsl"
#ifndef END_SHADER
flat varying vec3 WsunVec;
@@ -379,7 +377,7 @@ float ld(float dist) {
#include "/lib/sky_gradient.glsl"
/* RENDERTARGETS:3,14,12,10*/
/* RENDERTARGETS:3,14,12*/
void main() {
@@ -457,7 +455,7 @@ void main() {
vec3 FlatNormals = normalize(texture2D(colortex15,texcoord).rgb * 2.0 - 1.0);
#if defined DENOISE_SSS_AND_SSAO && indirect_effect == SSAO_FILTERED || indirect_effect == SSAO_HQ
#if indirect_effect == SSAO_FILTERED || indirect_effect == SSAO_HQ
if(z >= 1.0) FlatNormals = normal;
@@ -474,7 +472,7 @@ void main() {
/*------------- VOLUMETRICS BEHIND TRANSLUCENTS PASS-THROUGH -------------*/
// colortex10 is the history buffer used in reprojection of volumetrics, i can just hijack that.
gl_FragData[3] = texture2D(colortex10, texcoord);
// gl_FragData[3] = texture2D(colortex10, texcoord);
// if(texture2D(colortex7,texcoord).a > 0.0) {
// vec4 VL = BilateralUpscale_VLFOG(colortex13, depthtex1, gl_FragCoord.xy - 1.5, ld(z));
+1 -3
View File
@@ -1,8 +1,6 @@
#include "/lib/settings.glsl"
#ifdef CUSTOM_MOON_ROTATION
#include "/lib/SSBOs.glsl"
#endif
#include "/lib/SSBOs.glsl"
flat varying vec2 TAA_Offset;
flat varying vec3 WsunVec;
+11 -22
View File
@@ -1,11 +1,9 @@
#include "/lib/settings.glsl"
#if defined CUSTOM_MOON_ROTATION || defined END_ISLAND_LIGHT
#include "/lib/SSBOs.glsl
#include "/lib/SSBOs.glsl
#ifdef CUSTOM_MOON_ROTATION
uniform sampler2D CoronaTex;
#endif
#ifdef CUSTOM_MOON_ROTATION
uniform sampler2D CoronaTex;
#endif
// #if defined END_SHADER || defined NETHER_SHADER
@@ -38,9 +36,6 @@ uniform float rainStrength;
uniform sampler2DShadow shadowtex1;
#endif
flat varying vec3 averageSkyCol_Clouds;
flat varying vec4 lightCol;
#if ShaderSnow > 0
uniform sampler2D snowTexA;
uniform sampler2D snowTexN;
@@ -51,8 +46,7 @@ uniform float rainStrength;
#if defined RIPPLE_PUDDLES && PUDDLE_MODE > 0
#include "/lib/ripples.glsl"
uniform int biome_precipitation;
uniform float rippleAmount;
#endif
#include "/lib/stars.glsl"
@@ -62,12 +56,8 @@ uniform float rainStrength;
#ifdef MOON_NORMALS
uniform sampler2D moonN;
#endif
#else
flat varying vec3 moonCol;
#endif
flat varying vec3 sunCol;
#if SUN_SPECULAR_MULT != 0
#define LIGHTSOURCE_REFLECTION
#endif
@@ -174,7 +164,6 @@ uniform vec3 sunVec;
flat varying vec3 unsigned_WsunVec;
flat varying vec3 WmoonVec;
flat varying float exposure;
flat varying vec3 albedoSmooth;
#ifdef IS_LPV_ENABLED
uniform int heldItemId;
@@ -879,11 +868,11 @@ uniform float wetness;
float viewDist = length(worldPos - cameraPosition);
vec3 rippleNormal = flatNormals;
if(viewDist < 35 && rainStrength > 0.0 && biome_precipitation == 1 && snowAmount < 0.01) {
if(viewDist < 35 && rainStrength > 0.0 && rippleAmount > 0.01 && snowAmount < 0.01) {
vec3 ripple = ripples(1.2 * worldPos.xz);
ripple = ripple.xzy;
rippleNormal = mix(flatNormals, ripple, smoothstep(35., 10., viewDist) * rainStrength);
rippleNormal = mix(flatNormals, ripple, smoothstep(35., 10., viewDist) * rainStrength * smoothstep(0.0, 1.0, rippleAmount));
}
normals = mix(normals, rippleNormal, puddles * effectStrength * clamp(flatNormals.y,0.0,1.0));
@@ -1140,8 +1129,8 @@ void main() {
float lightLeakFix = clamp(pow(eyeBrightnessSmooth.y/240. + lightmap.y,2.0) ,0.0,1.0);
#ifdef OVERWORLD_SHADER
DirectLightColor = lightCol.rgb / 2400.0;
AmbientLightColor = averageSkyCol_Clouds / 900.0;
DirectLightColor = lightSourceColorSSBO / 2400.0;
AmbientLightColor = averageSkyCol_CloudsSSBO / 900.0;
#if defined CUSTOM_MOON_ROTATION && LIGHTNING_SHADOWS > 0
#if LIGHTNING_SHADOWS < 2
@@ -1508,7 +1497,7 @@ void main() {
const float flashlightshadows = 1.0;
#endif
Indirect_lighting += flashlightshadows*calculateFlashlight(texcoord, viewPos, albedoSmooth, slopednormal, flashLightSpecularData, hand);
Indirect_lighting += flashlightshadows*calculateFlashlight(texcoord, viewPos, albedoSmoothSSBO, slopednormal, flashLightSpecularData, hand);
#endif
/////////////////////////////////////////////////////////////////////////////////////
@@ -1672,7 +1661,7 @@ void main() {
vec3 sunVec = unsigned_WsunVec;
#endif
Background += drawSun(dot(sunVec, feetPlayerPos_normalized), sunCol / 2400.0);
Background += drawSun(dot(sunVec, feetPlayerPos_normalized), sunColorSSBO / 2400.0);
#ifdef REALMOON
vec3 tangent = normalize(cross(WmoonVec, vec3(0.0, 1.0, 0.0)));
@@ -1744,7 +1733,7 @@ void main() {
vec3 moonLightCol = moonColorBase2;
Background += pow(moonTex, vec3(3.2)) * 20.0 * drawRealMoon(feetPlayerPos_normalized, WmoonVec, moonLightCol, Background, moonSize);
#else
vec3 moonLightCol = moonCol / 2400.0;
vec3 moonLightCol = moonColorSSBO / 2400.0;
Background += drawMoon(feetPlayerPos_normalized, WmoonVec, moonLightCol, Background);
#endif
#endif
+2 -25
View File
@@ -1,9 +1,7 @@
#include "/lib/settings.glsl"
#include "/lib/res_params.glsl"
#ifdef CUSTOM_MOON_ROTATION
#include "/lib/SSBOs.glsl"
#endif
#include "/lib/SSBOs.glsl"
#ifdef END_SHADER
flat varying float Flashing;
@@ -14,11 +12,6 @@
flat varying vec3 WsunVec;
flat varying vec3 WmoonVec;
flat varying vec3 unsigned_WsunVec;
flat varying vec3 averageSkyCol_Clouds;
flat varying vec4 lightCol;
flat varying vec3 sunCol;
flat varying vec3 moonCol;
flat varying vec3 albedoSmooth;
flat varying float exposure;
@@ -55,18 +48,6 @@ void main() {
zMults = vec3(1.0/(far * near),far+near,far-near);
lightCol.rgb = texelFetch2D(colortex4,ivec2(6,37),0).rgb;
lightCol.a = float(sunElevation > 1e-5)*2.0 - 1.0;
sunCol = texelFetch2D(colortex4,ivec2(8,37),0).rgb;
moonCol = texelFetch2D(colortex4,ivec2(9,37),0).rgb;
#if defined FLASHLIGHT && defined FLASHLIGHT_BOUNCED_INDIRECT
albedoSmooth = texelFetch2D(colortex4,ivec2(15.5,2.5),0).rgb;
#endif
averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(0,37),0).rgb;
#ifdef SMOOTH_SUN_ROTATION
unsigned_WsunVec = WsunVecSmooth;
#else
@@ -86,16 +67,12 @@ void main() {
WmoonVec = moonVec;
WsunVec = mix(WmoonVec, unsigned_WsunVec, clamp(lightCol.a,0,1));
WsunVec = mix(WmoonVec, unsigned_WsunVec, clamp(float(sunElevation > 1e-5)*2.0 - 1.0,0,1));
#if defined CUSTOM_MOON_ROTATION && LIGHTNING_SHADOWS > 0
WmoonVec = customMoonVec2SSBO;
#endif
// exposure = texelFetch2D(colortex4,ivec2(10,37),0).r;
readSceneControllerParameters(colortex4, SC_parameters.smallCumulus, SC_parameters.largeCumulus, SC_parameters.altostratus, SC_parameters.cirrus, SC_parameters.fog);
#ifdef TAA
TAA_Offset = offsets[framemod8];
#else
+12 -4
View File
@@ -2,9 +2,8 @@
#include "/lib/res_params.glsl"
#include "/lib/SSBOs.glsl"
flat varying vec4 exposure;
flat varying vec2 rodExposureDepth;
varying vec2 texcoord;
const bool colortex5MipmapEnabled = true;
@@ -215,6 +214,12 @@ void main() {
float vignette = (1.5-dot(texcoord-0.5,texcoord-0.5)*2.);
vec3 col = texture2D(colortex5,texcoord).rgb;
vec2 rodExposureDepth = rodExposureDepthSSBO;
rodExposureDepth.y = sqrt(rodExposureDepth.y/65000.0);
vec4 exposure = vec4(exposureSSBO);
#if DOF_QUALITY >= 0
/*--------------------------------*/
float z = ld(texture2D(depthtex1, texcoord.st*RENDER_SCALE).r)*far;
@@ -284,6 +289,9 @@ void main() {
float VL_abs = texture2D(colortex7, texcoord*RENDER_SCALE).r;
float bloomyFog_Mult = BLOOMY_FOG;
if(isEyeInWater == 1) bloomyFog_Mult = UNDERWATER_BLOOMY_FOG;
#if Purkinje_strength > 0
float pstrength = float(Purkinje_strength) / 100.0;
@@ -293,7 +301,7 @@ void main() {
float purkinje = clamp(rodExposureDepth.x/(1.0+rodExposureDepth.x)*pstrength,0,1);
#endif
VL_abs = clamp((1.0-VL_abs)*BLOOMY_FOG*0.75*(1.0+rainStrength) * (1.0-purkinje*0.3),0.0,1.0)*clamp(1.0-pow(cdist(texcoord.xy),15.0),0.0,1.0);
VL_abs = clamp((1.0-VL_abs)*bloomyFog_Mult*0.75*(1.0+rainStrength) * (1.0-purkinje*0.3),0.0,1.0)*clamp(1.0-pow(cdist(texcoord.xy),15.0),0.0,1.0);
col = (mix(col, fogBloom, VL_abs) + bloom*lightScat) * exposure.rgb;
float lum = dot(col, vec3(0.15,0.3,0.55));
@@ -303,7 +311,7 @@ void main() {
col = mix(lum * vec3(Purkinje_R, Purkinje_G, Purkinje_B) * Purkinje_Multiplier, col, rodCurve);
#else
VL_abs = clamp((1.0-VL_abs)*BLOOMY_FOG*0.75*(1.0+rainStrength),0.0,1.0)*clamp(1.0-pow(cdist(texcoord.xy),15.0),0.0,1.0);
VL_abs = clamp((1.0-VL_abs)*bloomyFog_Mult*0.75*(1.0+rainStrength),0.0,1.0)*clamp(1.0-pow(cdist(texcoord.xy),15.0),0.0,1.0);
col = (mix(col, fogBloom, VL_abs) + bloom*lightScat) * exposure.rgb;
#endif
-10
View File
@@ -2,11 +2,6 @@
varying vec2 texcoord;
uniform sampler2D colortex4;
flat varying vec4 exposure;
flat varying vec2 rodExposureDepth;
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
@@ -14,11 +9,6 @@ flat varying vec2 rodExposureDepth;
//////////////////////////////VOID MAIN//////////////////////////////
void main() {
gl_Position = ftransform();
texcoord = gl_MultiTexCoord0.xy;
exposure = vec4(vec3(texelFetch2D(colortex4,ivec2(10,37),0).r),texelFetch2D(colortex4,ivec2(10,37),0).r);
rodExposureDepth = texelFetch2D(colortex4,ivec2(14,37),0).rg;
rodExposureDepth.y = sqrt(rodExposureDepth.y/65000.0);
}
+24 -30
View File
@@ -1,17 +1,9 @@
#include "/lib/settings.glsl"
#if defined CUSTOM_MOON_ROTATION || (defined END_SHADER && defined END_ISLAND_LIGHT)
#include "/lib/SSBOs.glsl"
#endif
#include "/lib/SSBOs.glsl"
#define EXCLUDE_WRITE_TO_LUT
flat varying vec4 lightCol;
flat varying vec3 sunlightCol;
flat varying vec3 moonlightCol;
flat varying vec3 averageSkyCol;
flat varying vec3 averageSkyCol_Clouds;
uniform float skyLightLevelSmooth;
@@ -107,9 +99,6 @@ float linearizeDepthFast(const in float depth, const in float near, const in flo
#define IS_LPV_ENABLED
#if defined LPV_VL_FOG_ILLUMINATION && defined IS_LPV_ENABLED
flat varying float exposure;
#ifdef IS_LPV_ENABLED
#extension GL_ARB_shader_image_load_store: enable
#extension GL_ARB_shading_language_packing: enable
@@ -140,7 +129,10 @@ float linearizeDepthFast(const in float depth, const in float near, const in flo
return vec3(0.0);
#endif
int SAMPLECOUNT = 8;
const int SAMPLECOUNT = 8;
const float density = 0.0001;
const float fadeLength = 10.0; // in blocks
vec3 playerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz;
vec3 LPVrayStartPos = playerPos - gbufferModelViewInverse[3].xyz;
@@ -157,18 +149,17 @@ float linearizeDepthFast(const in float depth, const in float near, const in flo
vec3 LPVrayProgress = vec3(0.0);
vec4 color = vec4(0.0,0.0,0.0,1.0);
float expFactor = 11.0;
const float expFactor = 11.0;
for (int i = 0; i < SAMPLECOUNT; i++) {
float d = (pow(expFactor, float(i+dither)/float(SAMPLECOUNT))/expFactor - 1.0/expFactor)/(1-1.0/expFactor);
float d = (pow(expFactor, float(i+dither)/float(SAMPLECOUNT))/expFactor - 1.0/expFactor)/(1.0-1.0/expFactor);
float dd = pow(expFactor, float(i+dither)/float(SAMPLECOUNT)) * log(expFactor) / float(SAMPLECOUNT)/(expFactor-1.0);
LPVrayProgress = gbufferModelViewInverse[3].xyz + d*LPVrayStartPos;
vec3 lpvPos = GetLpvPosition(LPVrayProgress);
float fadeLength = 10.0; // in blocks
vec3 cubicRadius = clamp( min(((LpvSize3-1.0) - lpvPos)/fadeLength, lpvPos/fadeLength) ,0.0,1.0);
vec3 cubicRadius = clamp( min(((LpvSize3-1.0) - lpvPos)/fadeLength, lpvPos/fadeLength) ,0.0,1.0);
float LpvFadeF = cubicRadius.x*cubicRadius.y*cubicRadius.z;
if(LpvFadeF < 0.01) break;
@@ -180,13 +171,12 @@ float linearizeDepthFast(const in float depth, const in float near, const in flo
vec3 lighting = sampleColor * LPV_VL_FOG_ILLUMINATION_BRIGHTNESS * 25. * exp(-5 * (1.0-luma(sampleColor)));
#endif
float density = 0.0001;
float volumeCoeff = exp(-dd*density*LPVRayLength);
color.rgb += (lighting - lighting * volumeCoeff) * color.a;
color.a *= volumeCoeff;
}
return color.rgba;
return color;
}
#endif
@@ -312,6 +302,7 @@ void waterVolumetrics_notoverworld(inout vec3 inColor, vec3 rayStart, vec3 rayEn
}
uniform float waterEnteredAltitude;
float lightSourceCheck = float(sunElevation > 1e-5)*2.0 - 1.0;
vec4 waterVolumetrics(vec3 rayStart, vec3 rayEnd, float rayLength, vec2 dither, vec3 waterCoefs, vec3 scatterCoef, vec3 ambient, vec3 lightSource, float VdotL, vec3 LPV){
int spCount = 8;
@@ -382,7 +373,7 @@ vec4 waterVolumetrics(vec3 rayStart, vec3 rayEnd, float rayLength, vec2 dither,
#endif
}
sh *= GetCloudShadow(progressW, WsunVec * lightCol.a);
sh *= GetCloudShadow(progressW, WsunVec * lightSourceCheck);
#endif
@@ -679,16 +670,19 @@ void main() {
vec3 totEpsilon = vec3(Water_Absorb_R, Water_Absorb_G, Water_Absorb_B);
vec3 scatterCoef = dirtAmount * vec3(Dirt_Scatter_R, Dirt_Scatter_G, Dirt_Scatter_B) / 3.14;
vec3 directLightColor = lightCol.rgb / 2400.0;
vec3 directSunlightColor = sunlightCol / 2400.0;
vec3 directMoonlightColor = moonlightCol / 2400.0;
vec3 directLightColor = lightSourceColorSSBO / 2400.0;
vec3 directSunlightColor = sunColorSSBO / 2400.0;
#ifdef CUSTOM_MOON_ROTATION
directSunlightColor *= smoothstep(0.005, 0.09, length(WmoonVec - WrealSunVec));
#endif
vec3 directMoonlightColor = moonColorSSBO / 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;
vec3 indirectLightColor = skyGroundColSSBO / 1200.0;
vec3 indirectLightColor_dynamic = averageSkyCol_CloudsSSBO / 1200.0;
// #if defined DISTANT_HORIZONS || defined VOXY
// float godrays = godrayTest(viewPos0, normalize(WsunVec*mat3(gbufferModelViewInverse)),BN.x, z0);
@@ -696,7 +690,7 @@ void main() {
// float godrays = 1.0;
// #endif
#if defined LPV_VL_FOG_ILLUMINATION
#if defined LPV_VL_FOG_ILLUMINATION && defined IS_LPV_ENABLED
vec4 LPV_ILLUMINATION = raymarchLPV(viewPos0, R2_dither());
#else
vec4 LPV_ILLUMINATION = vec4(0.0,0.0,0.0,1.0);
@@ -721,7 +715,7 @@ void main() {
bool eyeInWater = isEyeInWater == 1;
if (eyeInWater){
vec4 underWaterFog = waterVolumetrics(vec3(0.0), viewPos0, length(viewPos0), vec2(noise_1), totEpsilon, scatterCoef, indirectLightColor_dynamic, directLightColor, dot(normalize(viewPos0), normalize(sunVec * lightCol.a)), LPV_ILLUMINATION.rgb);
vec4 underWaterFog = waterVolumetrics(vec3(0.0), viewPos0, length(viewPos0), vec2(noise_1), totEpsilon, scatterCoef, indirectLightColor_dynamic, directLightColor, dot(normalize(viewPos0), normalize(sunVec * lightSourceCheck)), LPV_ILLUMINATION.rgb);
VolumetricFog = vec4(underWaterFog.rgb, 1.0);
} else {
#ifdef OVERWORLD_SHADER
@@ -750,7 +744,7 @@ void main() {
// vec3 sceneColor = texelFetch2D(colortex3,texcoord,0).rgb * VolumetricClouds.a + VolumetricClouds.rgb;
VolumetricFog = GetVolumetricFog(viewPos0, WsunVec, BN, directLightColor, indirectLight_fog, indirectLightColor_dynamic, cloudPlaneDistance);
#if defined LPV_VL_FOG_ILLUMINATION
#if defined LPV_VL_FOG_ILLUMINATION && defined IS_LPV_ENABLED
VolumetricFog.a *= LPV_ILLUMINATION.a;
VolumetricFog.rgb = VolumetricFog.rgb * LPV_ILLUMINATION.a + LPV_ILLUMINATION.rgb;
#endif
@@ -764,7 +758,7 @@ void main() {
#if defined NETHER_SHADER || defined END_SHADER
VolumetricFog = GetVolumetricFog(viewPos0, noise_1, noise_1);
#if defined LPV_VL_FOG_ILLUMINATION
#if defined LPV_VL_FOG_ILLUMINATION && defined IS_LPV_ENABLED
VolumetricFog.a *= LPV_ILLUMINATION.a;
VolumetricFog.rgb = VolumetricFog.rgb * LPV_ILLUMINATION.a + LPV_ILLUMINATION.rgb;
#endif
@@ -819,7 +813,7 @@ void main() {
directLightColor *= lightleakfix;
VolumetricFog = waterVolumetrics_alt(viewPos0, viewPos1, estimatedDepth, estimatedSunDepth, Vdiff, noise_1, totEpsilon, scatterCoef, indirectLight, directLightColor, dot(normalize(viewPos0), normalize(sunVec*lightCol.a)));
VolumetricFog = waterVolumetrics_alt(viewPos0, viewPos1, estimatedDepth, estimatedSunDepth, Vdiff, noise_1, totEpsilon, scatterCoef, indirectLight, directLightColor, dot(normalize(viewPos0), normalize(sunVec*lightSourceCheck)));
} else {
#if defined OVERWORLD_SHADER
VolumetricClouds = GetVolumetricClouds(viewPos1, vec2(noise_1), WrealSunVec, WmoonVec, directSunlightColor, directMoonlightColor, indirectLightColor, cloudPlaneDistance, cloudDistance);
+2 -39
View File
@@ -6,16 +6,6 @@
#include "/lib/SSBOs.glsl"
#endif
flat varying vec4 lightCol;
flat varying vec3 sunlightCol;
flat varying vec3 moonlightCol;
flat varying vec3 averageSkyCol;
flat varying vec3 averageSkyCol_Clouds;
#if defined LPV_VL_FOG_ILLUMINATION && defined IS_LPV_ENABLED
flat varying float exposure;
#endif
#include "/lib/scene_controller.glsl"
@@ -54,31 +44,9 @@ void main() {
gl_Position.xy = (gl_Position.xy*0.5+0.5)*(0.01+VL_RENDER_SCALE)*2.0-1.0;
#ifdef OVERWORLD_SHADER
lightCol.rgb = texelFetch2D(colortex4,ivec2(6,37),0).rgb;
sunlightCol = texelFetch2D(colortex4,ivec2(8,37),0).rgb;
moonlightCol = texelFetch2D(colortex4,ivec2(9,37),0).rgb;
averageSkyCol = texelFetch2D(colortex4,ivec2(1,37),0).rgb;
averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(0,37),0).rgb;
readSceneControllerParameters(colortex4, SC_parameters.smallCumulus, SC_parameters.largeCumulus, SC_parameters.altostratus, SC_parameters.cirrus, SC_parameters.fog);
#endif
#ifdef NETHER_SHADER
lightCol.rgb = vec3(0.0);
averageSkyCol = vec3(0.0);
averageSkyCol_Clouds = vec3(0.0);
#endif
#ifdef END_SHADER
lightCol.rgb = vec3(0.0);
averageSkyCol = vec3(0.0);
averageSkyCol_Clouds = vec3(5.0);
#endif
float lightSourceCheck = float(sunElevation > 1e-5)*2.0 - 1.0;
#ifdef OVERWORLD_SHADER
lightCol.a = float(sunElevation > 1e-5)*2.0 - 1.0;
#ifdef SMOOTH_SUN_ROTATION
WsunVec = WsunVecSmooth;
#else
@@ -91,7 +59,6 @@ void main() {
#else
vec3 moonVec = customMoonVecSSBO;
#endif
sunlightCol *= smoothstep(0.005, 0.09, length(moonVec - WsunVec));
#else
#ifdef SMOOTH_MOON_ROTATION
vec3 moonVec = WmoonVecSmooth;
@@ -104,17 +71,13 @@ void main() {
WmoonVec = moonVec;
WrealSunVec = WsunVec;
WsunVec = mix(WmoonVec, WsunVec, clamp(lightCol.a,0,1));
WsunVec = mix(WmoonVec, WsunVec, clamp(lightSourceCheck,0,1));
#else
WmoonVec = vec3(0.0, 1.0, 0.0);
WsunVec = vec3(0.0, 1.0, 0.0);
WrealSunVec = vec3(0.0, 1.0, 0.0);
#endif
#if defined LPV_VL_FOG_ILLUMINATION && defined IS_LPV_ENABLED
exposure = texelFetch2D(colortex4,ivec2(10,37),0).r;
#endif
#ifdef TAA
TAA_Offset = offsets[framemod8];
#else
+9 -9
View File
@@ -1,15 +1,13 @@
#include "/lib/settings.glsl"
#include "/lib/SSBOs.glsl"
flat varying vec3 zMults;
flat varying vec2 TAA_Offset;
flat varying vec3 WsunVec;
flat varying vec3 WmoonVec;
#ifdef OVERWORLD_SHADER
flat varying vec3 skyGroundColor;
#endif
uniform sampler2D noisetex;
uniform sampler2D depthtex0;
uniform sampler2D depthtex1;
@@ -526,14 +524,13 @@ float getBorderFogDensity(float linearDistance, vec3 playerPos, bool sky){
if(sky) return 0.0;
#if defined DISTANT_HORIZONS || defined VOXY
float borderFogDensity = smoothstep(1.0, 0.0, min(max(1.0 - linearDistance / dhVoxyRenderDistance,0.0)*3.0,1.0) );
float borderFogDensity = smoothstep(1.0, 0.0, min(max(1.0 - linearDistance / dhVoxyRenderDistance,0.0)*3.0/BorderFogIntensity,1.0) );
#else
float borderFogDensity = smoothstep(1.0, 0.0, min(max(1.0 - linearDistance / far,0.0)*3.0,1.0) );
float borderFogDensity = smoothstep(1.0, 0.0, min(max(1.0 - linearDistance / far,0.0)*3.0/BorderFogIntensity,1.0) );
#endif
borderFogDensity *= exp(-10.0 * pow(clamp(playerPos.y,0.0,1.0)*4.0,2.0));
borderFogDensity *= (1.0-caveDetection);
borderFogDensity *= BorderFogIntensity;
return borderFogDensity;
}
@@ -839,12 +836,15 @@ void main() {
// blend border fog. be sure to blend before and after forward rendered color blends.
#if defined BorderFog && defined OVERWORLD_SHADER
float borderFogDensity = getBorderFogDensity(linearDistance_cylinder, playerPos_normalized, isSky);
vec4 borderFog = vec4(skyGroundColor, borderFogDensity);
vec4 borderFog;
#if !defined SKY_GROUND
borderFog.rgb = skyFromTex(playerPos_normalized, colortex4)/1200.0 * Sky_Brightness;
#else
borderFog.rgb = skyGroundColSSBO / 1200.0 * Sky_Brightness;
#endif
borderFog *= BorderFogIntensity;
borderFog.a = borderFogDensity;
#if !defined DISTANT_HORIZONS && !defined VOXY
if(!isWater) color = mix(color, borderFog.rgb, getBorderFogDensity(linearDistance_cylinder_alt, normalize(playerPos_alt), z2 >= 1.0 || TranslucentShader.a <= 0));
#endif
+1 -14
View File
@@ -1,8 +1,6 @@
#include "/lib/settings.glsl"
#ifdef CUSTOM_MOON_ROTATION
#include "/lib/SSBOs.glsl"
#endif
#include "/lib/SSBOs.glsl"
varying vec2 texcoord;
flat varying vec3 zMults;
@@ -12,10 +10,6 @@ flat varying vec3 zMults;
#include "/lib/scene_controller.glsl"
#endif
#ifdef BorderFog
flat varying vec3 skyGroundColor;
#endif
flat varying vec3 WsunVec;
flat varying vec3 WmoonVec;
@@ -41,9 +35,6 @@ uniform int framemod8;
void main() {
#ifdef OVERWORLD_SHADER
#ifdef BorderFog
skyGroundColor = texelFetch2D(colortex4,ivec2(1,37),0).rgb / 1200.0 * Sky_Brightness;
#endif
#ifdef SMOOTH_SUN_ROTATION
WsunVec = WsunVecSmooth;
#else
@@ -62,10 +53,6 @@ void main() {
if(dot(-WmoonVec, WsunVec) < 0.9999) WmoonVec = -WmoonVec;
#endif
#endif
#if defined CUMULONIMBUS_LIGHTNING && CUMULONIMBUS > 0
readSceneControllerParameters(colortex4, SC_parameters.smallCumulus, SC_parameters.largeCumulus, SC_parameters.altostratus, SC_parameters.cirrus, SC_parameters.fog);
#endif
#endif
#ifdef TAA
+1 -3
View File
@@ -1,9 +1,7 @@
#include "/lib/settings.glsl"
#include "/lib/res_params.glsl"
#ifdef CUSTOM_MOON_ROTATION
#include "/lib/SSBOs.glsl"
#endif
#include "/lib/SSBOs.glsl"
/*
const int colortex0Format = RGBA16F; // low res clouds (deferred->composite2) + low res VL (composite5->composite15)
+1 -1
View File
@@ -11,5 +11,5 @@ void main() {
vec2 clampedRes = max(vec2(viewWidth,viewHeight),vec2(1920.0,1080.));
gl_Position = ftransform();
//*0.51 to avoid errors when sampling outside since clearing is disabled
gl_Position.xy = (gl_Position.xy*0.5+0.5)*0.26/clampedRes*vec2(1920.0,1080.)*2-1.0;
gl_Position.xy = (gl_Position.xy*0.5+0.5)*0.26/clampedRes*vec2(1920.0,1080.)*2.0-1.0;
}
-1
View File
@@ -15,5 +15,4 @@ void main() {
//0-0.5
gl_Position.x = (gl_Position.x*0.5+0.5)*0.5/clampedRes.x*1920.0*2.0-1.0;
texcoord = gl_MultiTexCoord0.xy/clampedRes*vec2(1920.,1080.);
}
+82
View File
@@ -0,0 +1,82 @@
#include "/lib/settings.glsl"
#include "/lib/SSBOs.glsl"
#include "/lib/res_params.glsl"
layout (local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
const ivec3 workGroups = ivec3(1, 1, 1);
uniform vec2 texelSize;
uniform sampler2D colortex6;
uniform float frameTime;
uniform float far;
uniform float near;
uniform int frameCounter;
uniform sampler2D depthtex2;
float luma(vec3 color) {
return dot(color,vec3(0.21, 0.72, 0.07));
}
float ld(float depth) {
return (2.0 * near) / (far + near - depth * (far - near)); // (-depth * (far - near)) = (2.0 * near)/ld - far - near
}
//Low discrepancy 2D sequence, integration error is as low as sobol but easier to compute : http://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/
vec2 R2_samples(int n){
vec2 alpha = vec2(0.75487765, 0.56984026);
return fract(alpha * n);
}
void main() {
//////////////////////////////
/// --- EXPOSURE STUFF --- ///
//////////////////////////////
vec2 clampedRes = max(1.0/texelSize,vec2(1920.0,1080.));
float avgExp = 0.0;
float avgB = 0.0;
vec2 resScale = vec2(1920.,1080.)/clampedRes;
const int maxITexp = 50;
for (int i = 0; i < maxITexp; i++){
vec2 ij = R2_samples((frameCounter%2000)*maxITexp+i);
vec2 tc = 0.5 + (ij-0.5) * 0.7;
vec3 sp = texture2D(colortex6, tc/16. * resScale+vec2(0.375*resScale.x+4.5*texelSize.x,.0)).rgb;
avgExp += log(sqrt(luma(sp)));
avgB += log(min(dot(sp,vec3(0.07,0.22,0.71)),8e-2));
}
avgExp = exp(avgExp/maxITexp);
avgB = exp(avgB/maxITexp);
float avgBrightness = clamp(mix(avgExp,avgBrightnessSSBO,0.95),0.00003051757,65000.0);
float L = max(avgBrightness,1e-8);
// float keyVal = 1.03-2.0/(log(L*4000/150.*8./3.0+1.0)/log(10.0)+2.0);
// float expFunc = 0.5+0.5*tanh(log(L));
// float targetExposure = 1.0/log(L+1.05);
float targetExposure = (EXPOSURE_DARKENING * 0.35)/log(L+1.0 + EXPOSURE_BRIGHTENING * 0.05);
// float targetExposure = 0.18/log2(L*2.5+1.045)*0.62; // choc original
float avgL2 = clamp(mix(avgB,avgL2SSBO,0.985),0.00003051757,65000.0);
float targetrodExposure = max(0.012/log2(avgL2+1.002)-0.1,0.0)*1.2;
float exposure = max(targetExposure*EXPOSURE_MULTIPLIER, 0.0);
float currCenterDepth = ld(texture2D(depthtex2, vec2(0.5)*RENDER_SCALE).r);
float centerDepth = mix(sqrt(rodExposureDepthSSBO.y/65000.0), currCenterDepth, clamp(DoF_Adaptation_Speed*exp(-0.016/frameTime+1.0)/(6.0+currCenterDepth*far),0.0,1.0));
centerDepth = centerDepth * centerDepth * 65000.0;
float rodExposure = targetrodExposure;
#ifndef AUTO_EXPOSURE
exposure = Manual_exposure_value;
rodExposure = clamp(log(Manual_exposure_value*2.0+1.0)-0.1,0.0,2.0);
#endif
//Exposure values
exposureSSBO = exposure;
avgBrightnessSSBO = avgBrightness;
avgL2SSBO = avgL2;
rodExposureDepthSSBO = vec2(rodExposure, centerDepth);
}
-326
View File
@@ -1,326 +0,0 @@
#include "/lib/settings.glsl"
#include "/lib/res_params.glsl"
// uniform int dhVoxyRenderDistance;
uniform float frameTimeCounter;
#include "/lib/Shadow_Params.glsl"
flat varying vec3 averageSkyCol_Clouds;
flat varying vec3 averageSkyCol;
flat varying vec3 sunColor;
flat varying vec3 moonColor;
flat varying vec3 lightSourceColor;
flat varying vec3 zenithColor;
flat varying vec2 tempOffsets;
flat varying float exposure;
flat varying float avgBrightness;
flat varying float rodExposure;
flat varying float avgL2;
flat varying float centerDepth;
uniform int hideGUI;
uniform sampler2D colortex4;
uniform sampler2D colortex6;
uniform sampler2D depthtex0;
uniform sampler2D depthtex1;
uniform sampler2D depthtex2;
uniform mat4 gbufferModelViewInverse;
uniform vec3 sunPosition;
uniform vec2 texelSize;
uniform float sunElevation;
uniform float moonElevation;
uniform float eyeAltitude;
uniform float rainStrength;
uniform float nightVision;
uniform float near;
// uniform float far;
uniform float frameTime;
uniform int frameCounter;
uniform vec3 cameraPosition;
uniform vec4 lightningBoltPosition;
#ifdef SMOOTH_SUN_ROTATION
vec3 sunVec = WsunVecSmooth;
#else
vec3 sunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition);
#endif
#include "/lib/sky_gradient.glsl"
#include "/lib/util.glsl"
#include "/lib/ROBOBO_sky.glsl"
float luma(vec3 color) {
return dot(color,vec3(0.21, 0.72, 0.07));
}
vec3 rodSample(vec2 Xi)
{
float r = sqrt(1.0f - Xi.x*Xi.y);
float phi = 2 * 3.14159265359 * Xi.y;
return normalize(vec3(cos(phi) * r, sin(phi) * r, Xi.x)).xzy;
}
//Low discrepancy 2D sequence, integration error is as low as sobol but easier to compute : http://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/
vec2 R2_samples(int n){
vec2 alpha = vec2(0.75487765, 0.56984026);
return fract(alpha * n);
}
float tanh(float x){
return (exp(x) - exp(-x))/(exp(x) + exp(-x));
}
float ld(float depth) {
return (2.0 * near) / (far + near - depth * (far - near)); // (-depth * (far - near)) = (2.0 * near)/ld - far - near
}
float hash11(float p)
{
p = fract(p * .1031);
p *= p + 33.33;
p *= p + p;
return fract(p);
}
#define USE_SCENE_CONTROLLER_SETTINGS
#include "/lib/scene_controller.glsl"
#ifdef CUSTOM_MOON_ROTATION
#include "/lib/SSBOs.glsl"
#if LIGHTNING_SHADOWS > 0
float lightningFlashTimer = floor(frameTimeCounter * 11.0);
float randomSeed = fract(sin(dot(vec2(lightningFlashTimer), vec2(12.9898,78.233))) * 43758.5453);
float lightningFlash = mix(0.1, 2.5, randomSeed);
#endif
#endif
void main() {
gl_Position = ftransform()*0.5+0.5;
gl_Position.xy = gl_Position.xy*vec2(18.+258*2,258.)*texelSize;
gl_Position.xy = gl_Position.xy*2.-1.0;
#ifdef OVERWORLD_SHADER
///////////////////////////////////
/// --- AMBIENT LIGHT STUFF --- ///
///////////////////////////////////
averageSkyCol_Clouds = vec3(0.0);
averageSkyCol = vec3(0.0);
vec2 sample3x3[9] = vec2[](
vec2(-1.0, -0.3),
vec2( 0.0, 0.0),
vec2( 1.0, -0.3),
vec2(-1.0, -0.5),
vec2( 0.0, -0.5),
vec2( 1.0, -0.5),
vec2(-1.0, -1.0),
vec2( 0.0, -1.0),
vec2( 1.0, -1.0)
);
// sample in a 3x3 pattern to get a good area for average color
// int maxIT = 9;
// for (int i = 0; i < maxIT; i++) {
// vec3 pos = vec3(0.0,1.0,0.0);
// pos.xy += normalize(sample3x3[i]) * vec2(0.3183,0.9000);
// averageSkyCol_Clouds += skyCloudsFromTex(pos,colortex4).rgb/maxIT/150.0;
// averageSkyCol += skyFromTex(pos,colortex4).rgb/maxIT/150.0;
// }
float maxIT = 20.0;
for (int i = 0; i < int(maxIT); i++) {
vec2 ij = R2_samples(((i*50+1)%1000)*int(maxIT)+i) * vec2(1.0,0.9000);
vec3 pos = normalize(rodSample(ij)) * vec3(1.0,0.5,1.0) + vec3(0.0,0.5,0.0);
averageSkyCol_Clouds += skyCloudsFromTex(pos,colortex4).rgb/maxIT/150.0;
averageSkyCol += 1.5 * skyFromTex(pos,colortex4).rgb/maxIT/150.0;
}
// vec3 minimumlight = vec3(1.0) * 0.01 * MIN_LIGHT_AMOUNT + nightVision * 0.05;
// luminance based reinhard is useful ouside of tonemapping too.
averageSkyCol_Clouds = averageSkyCol_Clouds / (1.0+luma(averageSkyCol_Clouds)*0.2);
averageSkyCol = max(averageSkyCol, 0.0); // + minimumlight;
#ifdef USE_CUSTOM_SKY_GROUND_LIGHTING_COLORS
averageSkyCol = luma(averageSkyCol) * vec3(SKY_GROUND_R,SKY_GROUND_G,SKY_GROUND_B);
#endif
////////////////////////////////////////
/// --- SUNLIGHT/MOONLIGHT STUFF --- ///
////////////////////////////////////////
vec2 planetSphere = vec2(0.0);
float sunVis = clamp(sunElevation,0.0,0.04)/0.04*clamp(sunElevation,0.0,0.04)/0.04;
float moonVis = clamp(-moonElevation,0.0,0.04)/0.04*clamp(-moonElevation,0.0,0.04)/0.04;
vec3 skyAbsorb = vec3(0.0);
sunColor = calculateAtmosphere(vec3(0.0), sunVec, vec3(0.0,1.0,0.0), sunVec, -sunVec, planetSphere, skyAbsorb, 25,0.0);
sunColor = sunColorBase/4000.0 * skyAbsorb;
moonColor = moonColorBase/4000.0;
#ifdef CUSTOM_MOON_ROTATION
#if LIGHTNING_SHADOWS > 0
vec3 WmoonVec = customMoonVec2SSBO;
#else
vec3 WmoonVec = customMoonVecSSBO;
#endif
float moonPhase = 1.0 - 0.5 * (dot(sunVec, WmoonVec) + 1.0);
moonVis = smoothstep(0.08, -0.03, -WmoonVec.y);
moonColor *= moonPhase;
#endif
// lightSourceColor = sunVis >= 1e-5 ? sunColor * sunVis : moonColor * moonVis;
lightSourceColor = sunColor * sunVis + moonColor * moonVis;
#ifdef CUSTOM_MOON_ROTATION
lightSourceColor *= smoothstep(0.005, 0.09, length(WmoonVec - sunVec));
#endif
#endif
#if defined OVERWORLD_SHADER && defined TWILIGHT_FOREST_FLAG
lightSourceColor = vec3(0.0);
moonColor = vec3(0.0);
#endif
///////////////////////////////////////////
/// --- SCENE CONTROLLER PARAMETERS --- ///
///////////////////////////////////////////
// components are split for readability/user friendliness within this function
applySceneControllerParameters(
SC_parameters.smallCumulus.x, SC_parameters.smallCumulus.y,
SC_parameters.largeCumulus.x, SC_parameters.largeCumulus.y,
SC_parameters.altostratus.x, SC_parameters.altostratus.y,
SC_parameters.cirrus.x, SC_parameters.cirrus.y,
SC_parameters.fog.x, SC_parameters.fog.y
);
#ifdef Daily_Weather
#ifdef CHOOSE_RANDOM_WEATHER_PROFILE
int dayCounter = int(clamp(hash11(float(mod(worldDay, 1000))) * 10.0, 0,10));
#else
int dayCounter = int(mod(worldDay, 10));
#endif
//----------- cloud coverage
vec4 weatherProfile_cloudCoverage[10] = vec4[](
vec4(DAY0_l0_coverage, DAY0_l1_coverage, DAY0_l2_coverage, DAY0_l3_coverage),
vec4(DAY1_l0_coverage, DAY1_l1_coverage, DAY1_l2_coverage, DAY1_l3_coverage),
vec4(DAY2_l0_coverage, DAY2_l1_coverage, DAY2_l2_coverage, DAY2_l3_coverage),
vec4(DAY3_l0_coverage, DAY3_l1_coverage, DAY3_l2_coverage, DAY3_l3_coverage),
vec4(DAY4_l0_coverage, DAY4_l1_coverage, DAY4_l2_coverage, DAY4_l3_coverage),
vec4(DAY5_l0_coverage, DAY5_l1_coverage, DAY5_l2_coverage, DAY5_l3_coverage),
vec4(DAY6_l0_coverage, DAY6_l1_coverage, DAY6_l2_coverage, DAY6_l3_coverage),
vec4(DAY7_l0_coverage, DAY7_l1_coverage, DAY7_l2_coverage, DAY7_l3_coverage),
vec4(DAY8_l0_coverage, DAY8_l1_coverage, DAY8_l2_coverage, DAY8_l3_coverage),
vec4(DAY9_l0_coverage, DAY9_l1_coverage, DAY9_l2_coverage, DAY9_l3_coverage)
);
//----------- cloud density
vec4 weatherProfile_cloudDensity[10] = vec4[](
vec4(DAY0_l0_density, DAY0_l1_density, DAY0_l2_density, DAY0_l3_density),
vec4(DAY1_l0_density, DAY1_l1_density, DAY1_l2_density, DAY1_l3_density),
vec4(DAY2_l0_density, DAY2_l1_density, DAY2_l2_density, DAY2_l3_density),
vec4(DAY3_l0_density, DAY3_l1_density, DAY3_l2_density, DAY3_l3_density),
vec4(DAY4_l0_density, DAY4_l1_density, DAY4_l2_density, DAY4_l3_density),
vec4(DAY5_l0_density, DAY5_l1_density, DAY5_l2_density, DAY5_l3_density),
vec4(DAY6_l0_density, DAY6_l1_density, DAY6_l2_density, DAY6_l3_density),
vec4(DAY7_l0_density, DAY7_l1_density, DAY7_l2_density, DAY7_l3_density),
vec4(DAY8_l0_density, DAY8_l1_density, DAY8_l2_density, DAY8_l3_density),
vec4(DAY9_l0_density, DAY9_l1_density, DAY9_l2_density, DAY9_l3_density)
);
vec4 getWeatherProfile_coverage = weatherProfile_cloudCoverage[dayCounter];
vec4 getWeatherProfile_density = weatherProfile_cloudDensity[dayCounter];
SC_parameters.smallCumulus = vec2(getWeatherProfile_coverage.r, getWeatherProfile_density.r);
SC_parameters.largeCumulus = vec2(getWeatherProfile_coverage.g, getWeatherProfile_density.g);
SC_parameters.altostratus = vec2(getWeatherProfile_coverage.b, getWeatherProfile_density.b);
SC_parameters.cirrus = vec2(getWeatherProfile_coverage.a, getWeatherProfile_density.a);
//----------- fog density
vec2 weatherProfile_fogDensity[10] = vec2[](
vec2(DAY0_ufog_density, DAY0_cfog_density),
vec2(DAY1_ufog_density, DAY1_cfog_density),
vec2(DAY2_ufog_density, DAY2_cfog_density),
vec2(DAY3_ufog_density, DAY3_cfog_density),
vec2(DAY4_ufog_density, DAY4_cfog_density),
vec2(DAY5_ufog_density, DAY5_cfog_density),
vec2(DAY6_ufog_density, DAY6_cfog_density),
vec2(DAY7_ufog_density, DAY7_cfog_density),
vec2(DAY8_ufog_density, DAY8_cfog_density),
vec2(DAY9_ufog_density, DAY9_cfog_density)
);
SC_parameters.fog = weatherProfile_fogDensity[dayCounter];
#endif
//////////////////////////////
/// --- EXPOSURE STUFF --- ///
//////////////////////////////
float avgLuma = 0.0;
float m2 = 0.0;
int n=100;
vec2 clampedRes = max(1.0/texelSize,vec2(1920.0,1080.));
float avgExp = 0.0;
float avgB = 0.0;
vec2 resScale = vec2(1920.,1080.)/clampedRes;
const int maxITexp = 50;
float w = 0.0;
for (int i = 0; i < maxITexp; i++){
vec2 ij = R2_samples((frameCounter%2000)*maxITexp+i);
vec2 tc = 0.5 + (ij-0.5) * 0.7;
vec3 sp = texture2D(colortex6, tc/16. * resScale+vec2(0.375*resScale.x+4.5*texelSize.x,.0)).rgb;
avgExp += log(sqrt(luma(sp)));
avgB += log(min(dot(sp,vec3(0.07,0.22,0.71)),8e-2));
}
avgExp = exp(avgExp/maxITexp);
avgB = exp(avgB/maxITexp);
avgBrightness = clamp(mix(avgExp,texelFetch2D(colortex4,ivec2(10,37),0).g,0.95),0.00003051757,65000.0);
float L = max(avgBrightness,1e-8);
float keyVal = 1.03-2.0/(log(L*4000/150.*8./3.0+1.0)/log(10.0)+2.0);
float expFunc = 0.5+0.5*tanh(log(L));
// float targetExposure = 1.0/log(L+1.05);
float targetExposure = (EXPOSURE_DARKENING * 0.35)/log(L+1.0 + EXPOSURE_BRIGHTENING * 0.05);
// float targetExposure = 0.18/log2(L*2.5+1.045)*0.62; // choc original
avgL2 = clamp(mix(avgB,texelFetch2D(colortex4,ivec2(10,37),0).b,0.985),0.00003051757,65000.0);
float targetrodExposure = max(0.012/log2(avgL2+1.002)-0.1,0.0)*1.2;
exposure = max(targetExposure*EXPOSURE_MULTIPLIER, 0.0);
float currCenterDepth = ld(texture2D(depthtex2, vec2(0.5)*RENDER_SCALE).r);
centerDepth = mix(sqrt(texelFetch2D(colortex4,ivec2(14,37),0).g/65000.0), currCenterDepth, clamp(DoF_Adaptation_Speed*exp(-0.016/frameTime+1.0)/(6.0+currCenterDepth*far),0.0,1.0));
centerDepth = centerDepth * centerDepth * 65000.0;
rodExposure = targetrodExposure;
#ifndef AUTO_EXPOSURE
exposure = Manual_exposure_value;
rodExposure = clamp(log(Manual_exposure_value*2.0+1.0)-0.1,0.0,2.0);
#endif
}
+8 -3
View File
@@ -1,12 +1,11 @@
#include "/lib/settings.glsl"
#ifdef CUSTOM_MOON_ROTATION
#include "/lib/SSBOs.glsl"
#endif
#include "/lib/SSBOs.glsl"
uniform sampler2D colortex7;
uniform sampler2D colortex5;
uniform sampler2D colortex6;
uniform sampler2D colortex10;
uniform sampler2D colortex14;
uniform sampler2D depthtex0;
uniform sampler2D depthtex1;
@@ -150,6 +149,8 @@ float doVignette( in vec2 texcoord, in float noise){
layout (rgba16f) uniform image2D waveSim2;
#endif
layout (RGBA8) uniform image2D cloudShadow;
void main() {
float noise = blueNoise();
@@ -239,4 +240,8 @@ void main() {
if (length(waveNormals.xy) > 0.0) gl_FragColor.rgb += waveNormals;
}
#endif
// gl_FragColor.rgb = texture2D(colortex10, texcoord).rgb;
//if(gl_FragCoord.x < 512 && gl_FragCoord.y < 512) gl_FragColor.rgb = vec3(imageLoad(cloudShadow, ivec2(gl_FragCoord.x,gl_FragCoord.y)*2).g);
}
+4 -4
View File
@@ -54,7 +54,7 @@ void main() {
// Big shenanigans lol, don't ask, it just works
if(noSimOngoingCheck == true) {
if(noSimOngoingCheck) {
noSimOngoing = true;
} else {
noSimOngoing = false;
@@ -82,13 +82,13 @@ void main() {
if(inShipCurrentFrame || inShipLastFrame || inShip2Frames) inShip = true;
vec2 playerMovement = getPlayerMovementOffset();
water_move_ompensation_counter_SSBO += playerMovement;
water_move_compensation_counter_SSBO += playerMovement;
water_move_compensationSSBO = ivec2(0);
ivec2 offset = ivec2(trunc(water_move_ompensation_counter_SSBO));
ivec2 offset = ivec2(trunc(water_move_compensation_counter_SSBO));
if (any(notEqual(offset, ivec2(0)))) {
water_move_compensationSSBO = offset;
water_move_ompensation_counter_SSBO -= vec2(offset);
water_move_compensation_counter_SSBO -= vec2(offset);
}
}
#endif
@@ -2,28 +2,8 @@
#define ReflectedFog
#ifdef CUSTOM_MOON_ROTATION
#include "/lib/SSBOs.glsl"
#endif
#include "/lib/SSBOs.glsl"
flat varying vec3 averageSkyCol_Clouds;
flat varying vec3 averageSkyCol;
flat varying vec3 lightSourceColor;
flat varying vec3 sunColor;
flat varying vec3 moonColor;
// flat varying vec3 zenithColor;
// flat varying vec3 rayleighAborbance;
// flat varying vec3 WsunVec;
flat varying vec2 tempOffsets;
flat varying float exposure;
flat varying float avgBrightness;
flat varying float rodExposure;
flat varying float avgL2;
flat varying float centerDepth;
uniform float skyLightLevelSmooth;
uniform float nightVision;
@@ -234,89 +214,13 @@ float mixhistory = 0.06;
#ifdef OVERWORLD_SHADER
//////////////////////////////////////////////
/// --- STORE DAILY WEATHER PARAMETERS --- ///
//////////////////////////////////////////////
// the idea is to store the 8 values, coverage + density of 3 cloud layers and 2 fog density values.
if (gl_FragCoord.x > 1 && gl_FragCoord.x < 4 && gl_FragCoord.y > 1 && gl_FragCoord.y < 4){
mixhistory = 10.0 * frameTime;
gl_FragData[0].rgb = writeSceneControllerParameters(gl_FragCoord.xy, SC_parameters.smallCumulus, SC_parameters.largeCumulus, SC_parameters.altostratus, SC_parameters.cirrus, SC_parameters.fog);
}
///////////////////////////////
/// --- STORE COLOR LUT --- ///
///////////////////////////////
#ifdef SeparateAmbientColorRain
vec3 AmbientLightTint = mix(vec3(AmbientLight_R, AmbientLight_G, AmbientLight_B), mix(vec3(AmbientLightRain_R, AmbientLightRain_G, AmbientLightRain_B), vec3(AmbientLightThunder_R, AmbientLightThunder_G, AmbientLightThunder_B), thunderStrength), rainStrength*noPuddleAreas);
#else
vec3 AmbientLightTint = vec3(AmbientLight_R, AmbientLight_G, AmbientLight_B);
#endif
// --- the color of the atmosphere + the average color of the atmosphere.
vec3 skyGroundCol = skyFromTex(vec3(0, -1 ,0), colortex4).rgb * AmbientLightTint;
/// --- Save light values
if (gl_FragCoord.x < 1. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 ){
gl_FragData[0] = vec4(averageSkyCol_Clouds * AmbientLightTint,1.0);
if(worldTimeChangeCheck) mixhistory = 1.0;
}
if (gl_FragCoord.x > 1. && gl_FragCoord.x < 2. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 ){
gl_FragData[0] = vec4(skyGroundCol/150.0,1.0);
if(worldTimeChangeCheck) mixhistory = 1.0;
}
#ifdef ambientLight_only
if (gl_FragCoord.x > 6. && gl_FragCoord.x < 7. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(0.0,0.0,0.0,1.0);
if (gl_FragCoord.x > 8. && gl_FragCoord.x < 9. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(0.0,0.0,0.0,1.0);
if (gl_FragCoord.x > 13. && gl_FragCoord.x < 14. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(0.0,0.0,0.0,1.0);
#else
if (gl_FragCoord.x > 6. && gl_FragCoord.x < 7. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 ){
gl_FragData[0] = vec4(lightSourceColor,1.0);
if(worldTimeChangeCheck) mixhistory = 1.0;
}
if (gl_FragCoord.x > 8. && gl_FragCoord.x < 9. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 ){
gl_FragData[0] = vec4(sunColor,1.0);
if(worldTimeChangeCheck) mixhistory = 1.0;
}
if (gl_FragCoord.x > 9. && gl_FragCoord.x < 10. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 ){
gl_FragData[0] = vec4(moonColor,1.0);
if(worldTimeChangeCheck) mixhistory = 1.0;
}
#endif
#if defined FLASHLIGHT && defined FLASHLIGHT_BOUNCED_INDIRECT
// sample center pixel of albedo color, and interpolate it overtime.
if (gl_FragCoord.x > 15 && gl_FragCoord.x < 16 && gl_FragCoord.y > 2 && gl_FragCoord.y < 3){
mixhistory = 0.01;
vec3 data = texelFetch2D(colortex1, ivec2(0.5/texelSize), 0).rgb;
vec3 decodeAlbedo = vec3(decodeVec2(data.x).x,decodeVec2(data.y).x, decodeVec2(data.z).x);
vec3 albedo = toLinear(decodeAlbedo);
albedo = normalize(albedo + 1e-7) * (dot(albedo,vec3(0.21, 0.72, 0.07))*0.5+0.5);
gl_FragData[0] = vec4(albedo,1.0);
}
#endif
////////////////////////////////
/// --- ATMOSPHERE IMAGE --- ///
////////////////////////////////
/// --- Sky only
if (gl_FragCoord.x > 18. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257){
vec2 p = clamp(floor(gl_FragCoord.xy-vec2(18.,1.))/256.+tempOffsets/256.,0.0,1.0);
vec2 p = clamp(floor(gl_FragCoord.xy-vec2(18.,1.))/256.,0.0,1.0);
vec3 viewVector = cartToSphere(p);
vec2 planetSphere = vec2(0.0);
@@ -340,11 +244,11 @@ if (gl_FragCoord.x > 18. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257){
if(dot(-WmoonVec, WsunVec) < 0.9999) WmoonVec = -WmoonVec;
#endif
sky = calculateAtmosphere((averageSkyCol*2000.0), viewVector, vec3(0.0,1.0,0.0), WsunVec, WmoonVec, planetSphere, skyAbsorb, 10, blueNoise());
sky = calculateAtmosphere((averageSkyColSSBO*2000.0), viewVector, vec3(0.0,1.0,0.0), WsunVec, WmoonVec, planetSphere, skyAbsorb, 10, blueNoise());
// fade atmosphere conditions for rain away when you pass above the cloud plane.
float heightRelativeToClouds = clamp(1.0 - max(eyeAltitude - CloudLayer0_height,0.0) / 200.0 ,0.0,1.0);
if(rainStrength > 0.0) sky = mix(sky, averageSkyCol*2000.0 * (skyAbsorb*0.7+0.3), clamp(1.0 - exp(pow(clamp(-viewVector.y+0.9,0.0,1.0),2) * -5.0),0.0,1.0) * heightRelativeToClouds * rainStrength);
if(rainStrength > 0.0) sky = mix(sky, averageSkyColSSBO*2000.0 * (skyAbsorb*0.7+0.3), clamp(1.0 - exp(pow(clamp(-viewVector.y+0.9,0.0,1.0),2) * -5.0),0.0,1.0) * heightRelativeToClouds * rainStrength);
#ifdef AEROCHROME_MODE
sky *= vec3(0.0, 0.18, 0.35);
@@ -357,7 +261,7 @@ if (gl_FragCoord.x > 18. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257){
/// --- Sky + clouds + fog
if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+257.){
vec2 p = clamp(floor(gl_FragCoord.xy-vec2(18.+257,1.))/256.+tempOffsets/256.,0.0,1.0);
vec2 p = clamp(floor(gl_FragCoord.xy-vec2(18.+257,1.))/256.,0.0,1.0);
vec3 viewVector = cartToSphere(p);
vec3 viewPos = mat3(gbufferModelView)*viewVector*1024.0;
@@ -375,7 +279,7 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
#else
WmoonVec = customMoonVecSSBO;
#endif
vec3 moonColor2 = moonColor * mix(0.0, 1.0, clamp(WmoonVec.y + 0.05, 0.0, 0.1)/0.1);
vec3 moonColor2 = moonColorSSBO * mix(0.0, 1.0, clamp(WmoonVec.y + 0.05, 0.0, 0.1)/0.1);
//suncol *= mix(0.0, 1.0, clamp(WmoonVec.y + 0.05, 0.0, 0.1)/0.1);
#else
#ifdef SMOOTH_MOON_ROTATION
@@ -384,12 +288,12 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
WmoonVec = normalize(mat3(gbufferModelViewInverse) * moonPosition + gbufferModelViewInverse[3].xyz);
#endif
if(dot(-WmoonVec, WsunVec) < 0.9999) WmoonVec = -WmoonVec;
vec3 moonColor2 = moonColor;
vec3 moonColor2 = moonColorSSBO;
#endif
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;
sky = mix(averageSkyCol_CloudsSSBO / 600.0, sky, pow(clamp(viewVector.y+1.0,0.0,1.0),5.0));
vec3 suncol = lightSourceColorSSBO;
#ifdef ambientLight_only
suncol = vec3(0.0);
@@ -399,20 +303,20 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
vec2 cloudDistance = vec2(0.0);
#ifdef CUSTOM_MOON_ROTATION
vec3 sunColor2 = sunColor * smoothstep(0.005, 0.09, length(WmoonVec - WsunVec));
vec3 sunColor2 = sunColorSSBO * smoothstep(0.005, 0.09, length(WmoonVec - WsunVec));
#else
vec3 sunColor2 = sunColor;
vec3 sunColor2 = sunColorSSBO;
#endif
vec4 volumetricClouds = GetVolumetricClouds(viewPos, vec2(noise, 1.0-noise), WsunVec, WmoonVec, sunColor2*2.5, moonColor2*2.5, skyGroundCol/30.0, cloudPlaneDistance, cloudDistance);
vec4 volumetricClouds = GetVolumetricClouds(viewPos, vec2(noise, 1.0-noise), WsunVec, WmoonVec, sunColor2*2.5/150.0, moonColor2*2.5/150.0, skyGroundColSSBO/30.0, cloudPlaneDistance, cloudDistance);
WsunVec = mix(WmoonVec, WsunVec, clamp(float(sunElevation > 1e-5)*2.0-1.0 ,0,1));
float minimumLightAmount = 0.8*nightVision + 0.05 * mix(MIN_LIGHT_AMOUNT_INSIDE, MIN_LIGHT_AMOUNT, clamp(skyLightLevelSmooth, 0.0, 1.0));
vec3 indirectLight_fog = skyGroundCol/30.0 + vec3(1.0) * minimumLightAmount;
vec3 indirectLight_fog = skyGroundColSSBO/30.0 + vec3(1.0) * minimumLightAmount;
vec4 volumetricFog = GetVolumetricFog(viewPos, WsunVec, vec2(noise, 1.0-noise), suncol*2.5, indirectLight_fog, averageSkyCol_Clouds*5.0, cloudPlaneDistance);
vec4 volumetricFog = GetVolumetricFog(viewPos, WsunVec, vec2(noise, 1.0-noise), suncol*2.5/150.0, indirectLight_fog, averageSkyCol_CloudsSSBO/30.0, cloudPlaneDistance);
#if AURORA_LOCATION > 0
if (WsunVec.y < 0.0 && volumetricClouds.a > 0.01
@@ -447,7 +351,7 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
//Sky gradient with clouds
if (gl_FragCoord.x > (fogPos.x - fogPos.x*0.22) && gl_FragCoord.y > 0.4 && gl_FragCoord.x < 535){
vec2 p = clamp(floor(gl_FragCoord.xy-fogPos)/256.+tempOffsets/256.,-0.2,1.2);
vec2 p = clamp(floor(gl_FragCoord.xy-fogPos)/256.,-0.2,1.2);
vec3 viewVector = cartToSphere(p);
float noise = interleaved_gradientNoise_temporal();
@@ -517,10 +421,4 @@ vec3 currentFrame = gl_FragData[0].rgb*150.;
gl_FragData[0].rgb = clamp(mix(frameHistory, currentFrame, clamp(mixhistory,0.0,1.0)),0.0,65000.);
//Exposure values
if (gl_FragCoord.x > 10. && gl_FragCoord.x < 11. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(exposure, avgBrightness, avgL2,1.0);
if (gl_FragCoord.x > 14. && gl_FragCoord.x < 15. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 )
gl_FragData[0] = vec4(rodExposure, centerDepth,0.0, 1.0);
}
+9
View File
@@ -0,0 +1,9 @@
#include "/lib/settings.glsl"
#include "/lib/res_params.glsl"
uniform vec2 texelSize;
void main() {
gl_Position = ftransform()*0.5+0.5;
gl_Position.xy = gl_Position.xy*vec2(18.+258*2,258.)*texelSize;
gl_Position.xy = gl_Position.xy*2.-1.0;
}
+33 -1
View File
@@ -59,7 +59,39 @@
ivec2 water_move_compensationSSBO;
vec2 water_move_ompensation_counter_SSBO;
vec2 water_move_compensation_counter_SSBO;
vec2 SC_smallCumulus;
vec2 SC_largeCumulus;
vec2 SC_altostratus;
vec2 SC_cirrus;
vec2 SC_fog;
vec3 sunColorSSBO;
vec3 moonColorSSBO;
vec3 lightSourceColorSSBO;
vec3 averageSkyColSSBO;
vec3 averageSkyCol_CloudsSSBO;
vec3 skyGroundColSSBO;
vec3 albedoSmoothSSBO;
float avgBrightnessSSBO;
float avgL2SSBO;
float exposureSSBO;
vec2 rodExposureDepthSSBO;
}"},
"useViewportDims": true,
+15 -16
View File
@@ -50,19 +50,18 @@ void voxy_emitFragment(VoxyFragmentParameters parameters) {
/////// ----- SSS ON BLOCKS ----- ///////
// strong
if (
blockID == BLOCK_SSS_STRONG || blockID == BLOCK_SAPLING || blockID == BLOCK_AIR_WAVING
blockID == BLOCK_SSS_STRONG || blockID == BLOCK_AIR_WAVING
) {
SSSAMOUNT = 1.0;
}
// medium
if (
else if (
blockID == BLOCK_GROUND_WAVING || blockID == BLOCK_GROUND_WAVING_VERTICAL
|| blockID == BLOCK_GRASS_SHORT || blockID == BLOCK_GRASS_TALL_UPPER || blockID == BLOCK_GRASS_TALL_LOWER
) {
SSSAMOUNT = 0.5;
}
if (
else if (
blockID == BLOCK_SSS_WEAK || blockID == BLOCK_SSS_WEAK_2 ||
blockID == BLOCK_GLOW_LICHEN || blockID == BLOCK_SNOW_LAYERS || blockID == BLOCK_CARPET ||
blockID == BLOCK_AMETHYST_BUD_MEDIUM || blockID == BLOCK_AMETHYST_BUD_LARGE || blockID == BLOCK_AMETHYST_CLUSTER ||
@@ -73,7 +72,7 @@ void voxy_emitFragment(VoxyFragmentParameters parameters) {
// low
#ifdef MISC_BLOCK_SSS
if(
else if(
blockID == BLOCK_SSS_WEIRD || blockID == BLOCK_GRASS
){
SSSAMOUNT = 0.5;
@@ -91,24 +90,24 @@ void voxy_emitFragment(VoxyFragmentParameters parameters) {
// normal block lightsources
if(blockID >= 100 && blockID < 300) EMISSIVE = 0.5;
if(blockID == 266 || blockID == 497) EMISSIVE = 0.2; // sculk stuff
else if(blockID == 266 || blockID == 497) EMISSIVE = 0.2; // sculk stuff
if(blockID == 195) EMISSIVE = 2.3; // glow lichen
else if(blockID == 195) EMISSIVE = 2.3; // glow lichen
if(blockID == 185) EMISSIVE = 1.5; // crying obsidian
else if(blockID == 185) EMISSIVE = 1.5; // crying obsidian
if(blockID == 105) EMISSIVE = 2.0; // brewing stand
else if(blockID == 105) EMISSIVE = 2.0; // brewing stand
if(blockID == 236) EMISSIVE = 1.0; // respawn anchor
else if(blockID == 236) EMISSIVE = 1.0; // respawn anchor
if(blockID == 101) EMISSIVE = 0.7; // large amethyst bud
else if(blockID == 101) EMISSIVE = 0.7; // large amethyst bud
if(blockID == 103) EMISSIVE = 1.0; // amethyst cluster
else if(blockID == 103) EMISSIVE = 1.0; // amethyst cluster
if(blockID == 244) EMISSIVE = 1.5; // soul fire
else if(blockID == 244) EMISSIVE = 1.5; // soul fire
#if EMISSIVE_ORES > 0
if(blockID == 502) EMISSIVE = EMISSIVE_ORES_STRENGTH;
else if(blockID == 502) EMISSIVE = EMISSIVE_ORES_STRENGTH;
#endif
#ifdef HARDCODED_EMISSIVES_APPROX
@@ -117,8 +116,8 @@ void voxy_emitFragment(VoxyFragmentParameters parameters) {
#endif
Albedo.a = 1.0;
if(blockID == BLOCK_GROUND_WAVING_VERTICAL || blockID == BLOCK_GRASS_SHORT || blockID == BLOCK_GRASS_TALL_LOWER || blockID == BLOCK_GRASS_TALL_UPPER ) Albedo.a = 0.60;
if(blockID == BLOCK_AIR_WAVING) Albedo.a = 0.55;
if(blockID == BLOCK_GROUND_WAVING_VERTICAL || blockID == BLOCK_GRASS_SHORT || blockID == BLOCK_GRASS_TALL_LOWER || blockID == BLOCK_GRASS_TALL_UPPER) Albedo.a = 0.60;
else if(blockID == BLOCK_AIR_WAVING) Albedo.a = 0.55;
vec3 normal = vec3(uint((parameters.face>>1)==2), uint((parameters.face>>1)==0), uint((parameters.face>>1)==1)) * (float(int(parameters.face)&1)*2-1);
+6 -15
View File
@@ -193,18 +193,9 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
if (normal.z<=-0.9) normal.xy = vec2(-0.0000000000001);
vec4 lightCol;
vec3 WsunVec;
vec3 WsunVec2;
lightCol.rgb = texelFetch(colortex4,ivec2(6,37),0).rgb;
vec3 averageSkyCol_Clouds = texelFetch(colortex4,ivec2(0,37),0).rgb;
#ifdef OVERWORLD_SHADER
readSceneControllerParameters(colortex4, SC_parameters.smallCumulus, SC_parameters.largeCumulus, SC_parameters.altostratus, SC_parameters.cirrus, SC_parameters.fog);
#endif
#ifdef CUSTOM_MOON_ROTATION
vec3 WmoonVec = customMoonVecSSBO;
@@ -218,13 +209,13 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
WsunVec = mix(WmoonVec, WsunVec, float(sunElevation > 1e-5));
WsunVec2 = mix(normalize(mat3(vxModelView)*WmoonVec), WsunVec2, float(sunElevation > 1e-5));
#else
lightCol.a = float(sunElevation > 1e-5)*2.0 - 1.0;
float lightSourceCheck = float(sunElevation > 1e-5)*2.0 - 1.0;
#ifdef SMOOTH_SUN_ROTATION
WsunVec = lightCol.a * WsunVecSmooth;
WsunVec = lightSourceCheck * WsunVecSmooth;
#else
WsunVec = lightCol.a * normalize(mat3(vxModelViewInv) * sunPosition);
WsunVec = lightSourceCheck * normalize(mat3(vxModelViewInv) * sunPosition);
#endif
WsunVec2 = lightCol.a * normalize(sunPosition);
WsunVec2 = lightSourceCheck * normalize(sunPosition);
#endif
// diffuse
@@ -233,7 +224,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
vec3 Direct_lighting = vec3(0.0);
#ifdef OVERWORLD_SHADER
vec3 DirectLightColor = lightCol.rgb/2400.0;
vec3 DirectLightColor = lightSourceColorSSBO/2400.0;
float NdotL = clamp(dot(normal, WsunVec),0.0,1.0);
NdotL = clamp((-15.0 + NdotL*255.0) / 240.0 ,0.0,1.0);
@@ -244,7 +235,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
Direct_lighting = DirectLightColor * NdotL * Shadows;
vec3 AmbientLightColor = averageSkyCol_Clouds/900.0 ;
vec3 AmbientLightColor = averageSkyCol_CloudsSSBO/900.0 ;
vec3 indirectNormal = normal.xyz / dot(abs(normal.xyz), vec3(1.0));
float SkylightDir = clamp(indirectNormal.y*0.7+0.3,0.0,1.0);
+6 -3
View File
@@ -38,16 +38,19 @@ entity.1614=current_player
################################################
## medium sss (same as strong sss for blocks)
entity.1801=giant ghast elder_guardian \
entity.1801=giant ghast happy_ghast elder_guardian sniffer magma_cube \
naturalist:butterfly naturalist:firefly naturalist:caterpillar naturalist:dragonfly
## weak sss (same as weak sss for blocks)
entity.1802=furnace_minecart sheep frog chicken iron_golem snow_golem polar_bear zombie_horse armor_stand arrow squid bat cat cod cow donkey fox horse mooshroom mule ocelot parrot pig piglin pufferfish rabbit salmon strider tropical_fish turtle villager wandering_trader bee cave_spider dolphin enderman llama panda spider wolf zombified_piglin creeper drowned endermite evoker guardian hoglin husk phantom piglin_brute pillager ravager silverfish stray vex vindicator witch zoglin zombie zombie_villager trader_llama \
entity.1802=warden furnace_minecart sheep frog chicken iron_golem snow_golem polar_bear zombie_horse armor_stand arrow squid bat cat cod cow donkey fox horse mooshroom mule ocelot parrot pig piglin pufferfish rabbit salmon strider tropical_fish turtle villager wandering_trader bee cave_spider dolphin enderman llama panda spider wolf zombified_piglin creeper drowned endermite evoker guardian hoglin husk phantom piglin_brute pillager ravager silverfish vex vindicator witch zoglin zombie zombie_villager trader_llama nautilus zombie_nautilus camel_husk creaking bogged axolotl armadillo goat tadpole copper_golem \
naturalist:bear naturalist:snail naturalist:snake naturalist:coral_snake naturalist:rattlesnake naturalist:bluejay naturalist:cardinal naturalist:canary naturalist:robin naturalist:finch naturalist:sparrow naturalist:rhino naturalist:elephant naturalist:lion naturalist:zebra naturalist:giraffe naturalist:hippo naturalist:vulture naturalist:boar naturalist:catfish naturalist:alligator naturalist:bass naturalist:tortoise naturalist:duck
#removed: player blaze magma_cube
## no sss
entity.1803=skeleton wither_skeleton skeleton_horse stray parched
################################################
###### REFLECTIVE TRANSLUCENTS
################################################
entity.1803=slime
entity.1804=slime
+1 -1
View File
@@ -56,7 +56,7 @@ item.1024=torch
item.1025=copper_torch copper_lantern exposed_copper_lantern weathered_copper_lantern oxidized_copper_lantern waxed_copper_lantern waxed_exposed_copper_lantern waxed_weathered_copper_lantern waxed_oxidized_copper_lantern
## netherite trim is too dark and looks horrible when glowing
item.1026=trim_amethyst trim_emerald trim_diamond trim_resin trim_copper trim_gold trim_iron trim_quartz
item.1026=trim_amethyst trim_emerald trim_diamond trim_resin trim_copper trim_gold trim_iron trim_quartz trim_glowworm_silk trim_rose_quartz
## darker trims
item.1027=trim_redstone trim_lapis
+8 -1
View File
@@ -1,6 +1,6 @@
option.SHADER_VERSION_LABEL = §d§lECLIPSE§r - A Bliss Edit
prefix.SHADER_VERSION_LABEL = V
value.SHADER_VERSION_LABEL.482 = 5.6.1
value.SHADER_VERSION_LABEL.482 = 5.7.0
# if you're here to translate, this is not a joke, these do what they say
profile.POTATO=§4Potato
@@ -309,6 +309,7 @@ screen.Fog = Fog Settings
option.VL_SAMPLES = Fog Samples
option.FOG_START_HEIGHT = Fog Start Height
option.BLOOMY_FOG = Bloomy Fog Multiplier
option.UNDERWATER_BLOOMY_FOG = Bloomy Fog Multiplier Underwater
option.Haze_amount = Atmospheric Haze Density
option.RainFog_amount = Rain Fog Multiplier
option.BorderFog = Chunk Border Fog
@@ -818,6 +819,7 @@ screen.Resource_Pack_Support = Materials / Resource Pack Support
value.SUN_SPECULAR_MULT.1 = ON
suffix.SUN_SPECULAR_MULT =x brighter
option.ROUGHNESS_THRESHOLD = Reflection Visibilty Threshold
suffix.ROUGHNESS_THRESHOLD = %
value.ROUGHNESS_THRESHOLD.0.0 = no threshold
option.QUARTER_RES_SSR = Sample 1/4 resolution depth
@@ -936,6 +938,11 @@ option.EMISSIVE_TRIMS_STRENGTH = Emissive Trims Brightness
option.PLANET_CURVATURE = Planet Curvature §c(VOXY NOT SUPPORTED!)
option.CURVATURE_AMOUNT = Curvature Amount
option.VANILLA_CHUNK_FADING = Chunks Fade In §c(Iris 1.10.3+)
value.VANILLA_CHUNK_FADING.0 = Off
value.VANILLA_CHUNK_FADING.1 = Fade In
value.VANILLA_CHUNK_FADING.2 = Fade In + Slide In
option.FISHEYE_EFFECT = Fisheye Effect
option.FISHEYE_STRENGTH = Fisheye Strength
+2 -1
View File
@@ -1,6 +1,6 @@
option.SHADER_VERSION_LABEL = §d§lECLIPSE§r - Bliss 编辑版
prefix.SHADER_VERSION_LABEL = 版本
value.SHADER_VERSION_LABEL.482 = 5.6.1
value.SHADER_VERSION_LABEL.482 = 5.7.0
# 如果你是来翻译的,这不是玩笑,这些选项的功能正如其名
profile.POTATO=§4土豆 (极低配置)
@@ -870,6 +870,7 @@ screen.Resource_Pack_Support = 材质 / 资源包支持
value.SUN_SPECULAR_MULT.1 = 开启
suffix.SUN_SPECULAR_MULT =x 更亮
option.ROUGHNESS_THRESHOLD = 反射可见度阈值
suffix.ROUGHNESS_THRESHOLD = %
value.ROUGHNESS_THRESHOLD.0.0 = 无阈值
screen.Emissives = 自发光 / 发光纹理
+1 -1
View File
@@ -109,7 +109,7 @@ vec3 calculateAtmosphere(vec3 background, vec3 viewVector, vec3 upVector, vec3 s
float GroundDarkening = max(planetGround * 0.7+0.3,clamp(sunVector.y*2.0,0.0,1.0));
vec3 viewPos = (sky_planetRadius + 1.0 + max(eyeAltitude-300.0,0.0)*1.0) * upVector;
vec3 viewPos = (sky_planetRadius + 1.0 + max(eyeAltitude-300.0,0.0)) * upVector;
vec2 aid = rsi(viewPos, viewVector, sky_atmosphereRadius);
if (aid.y < 0.0) {transmittance = vec3(1.0); return vec3(0.0);}
+33 -1
View File
@@ -35,5 +35,37 @@ layout(binding = 0) buffer SSBO1 {
ivec2 water_move_compensationSSBO; // 8 bytes
vec2 water_move_ompensation_counter_SSBO; // 8 bytes
vec2 water_move_compensation_counter_SSBO; // 8 bytes
vec2 SC_smallCumulus;
vec2 SC_largeCumulus;
vec2 SC_altostratus;
vec2 SC_cirrus;
vec2 SC_fog;
vec3 sunColorSSBO;
vec3 moonColorSSBO;
vec3 lightSourceColorSSBO;
vec3 averageSkyColSSBO;
vec3 averageSkyCol_CloudsSSBO;
vec3 skyGroundColSSBO;
vec3 albedoSmoothSSBO;
float avgBrightnessSSBO;
float avgL2SSBO;
float exposureSSBO;
vec2 rodExposureDepthSSBO;
};
+1 -1
View File
@@ -400,7 +400,7 @@
vec2(-0.992326501717018, -0.062069798758671524)
);
#endif
#if DOF_QUALITY == 5 || defined(DOF_JITTER_SHADOW) // DOF_QUALITY == 5 && defined(SCREENSHOT_MODE)
#if DOF_QUALITY == 5 // DOF_QUALITY == 5 && defined(SCREENSHOT_MODE)
const vec2 jitter_offsets[64] = vec2[](
vec2(0.08838834764831845, 0),
vec2(-0.1846432401149469, -0.8598513673187094),
+1 -1
View File
@@ -321,7 +321,7 @@ vec4 GetVolumetricFog(
float shiftedLinearDistance = length(scaledViewPos);
float lightFalloff = 1.0 - clamp(1.0-linearDistance/FLASHLIGHT_RANGE, -0.999,1.0);
lightFalloff = max(exp(-30.0 * lightFalloff),0.0);
lightFalloff = max(exp(-10.0 * FLASHLIGHT_BRIGHTNESS_FALLOFF_MULT * lightFalloff),0.0);
float projectedCircle = clamp(1.0 - shiftedLinearDistance*FLASHLIGHT_SIZE,0.0,1.0);
vec3 flashlightGlow = vec3(FLASHLIGHT_R,FLASHLIGHT_G,FLASHLIGHT_B) * lightFalloff * projectedCircle * 0.5;
+2 -1
View File
@@ -16,4 +16,5 @@
#define ENTITY_CURRENT_PLAYER 1614
#define ENTITY_SSS_MEDIUM 1801
#define ENTITY_SSS_WEAK 1802
#define ENTITY_SLIME 1803
#define ENTITY_SSS_NONE 1803
#define ENTITY_SLIME 1804
+1 -1
View File
@@ -128,7 +128,7 @@ vec4 GetVolumetricFog(
float shiftedLinearDistance = length(scaledViewPos);
float lightFalloff = 1.0 - clamp(1.0-linearDistance/FLASHLIGHT_RANGE, -0.999,1.0);
lightFalloff = max(exp(-30.0 * lightFalloff),0.0);
lightFalloff = max(exp(-10.0 * FLASHLIGHT_BRIGHTNESS_FALLOFF_MULT * lightFalloff),0.0);
float projectedCircle = clamp(1.0 - shiftedLinearDistance*FLASHLIGHT_SIZE,0.0,1.0);
vec3 flashlightGlow = vec3(FLASHLIGHT_R,FLASHLIGHT_G,FLASHLIGHT_B) * lightFalloff * projectedCircle * 0.5;
+13 -7
View File
@@ -42,13 +42,14 @@ float cloudVol(in vec3 pos, float maxDistance ){
medium_gradientFog = mix(medium_gradientFog, 1.0, sandStorm+snowStorm);
}
FogDensities(medium_gradientFog, cloudyFog, rainyFog, maxDistance, SC_parameters.fog.x, SC_parameters.fog.y);
FogDensities(medium_gradientFog, cloudyFog, rainyFog, maxDistance, SC_fog.x, SC_fog.y);
return uniformFog + medium_gradientFog + cloudyFog + rainyFog;
}
float phaseRayleigh(float cosTheta) {
const vec2 mul_add = vec2(0.1, 0.28) / acos(-1.0);
const float oneOverPi = 1.0 / acos(-1.0);
const vec2 mul_add = vec2(0.1, 0.28) * oneOverPi;
return cosTheta * mul_add.x + mul_add.y; // optimized version from [Elek09], divided by 4 pi for energy conservation
}
float fogPhase(float lightPoint){
@@ -102,10 +103,15 @@ vec4 GetVolumetricFog(
vec3 dV = fragposition - start;
vec3 dVWorld = playerPos - gbufferModelViewInverse[3].xyz;
// vec3 nPlayerPos = normalize(playerPos);
float rayLength = length(dVWorld);
#if defined DISTANT_HORIZONS || defined VOXY
float maxLength = min(min(length(dVWorld), cloudPlaneDistance), max(far, dhVoxyRenderDistance))/length(dVWorld);
float maxLength = min(min(rayLength, cloudPlaneDistance), max(far, dhVoxyRenderDistance))/rayLength;
// float maxLength = min(length(dVWorld), max(far, dhVoxyRenderDistance))/length(dVWorld);
#else
float maxLength = min(min(length(dVWorld), cloudPlaneDistance), far)/length(dVWorld);
float maxLength = min(min(rayLength, cloudPlaneDistance), far)/rayLength;
#endif
dV *= maxLength;
@@ -126,13 +132,13 @@ vec4 GetVolumetricFog(
// float atmosphereAbsorbance = 1.0;
vec3 atmosphereAbsorbance = vec3(1.0);
float SdotV = dot(mat3(gbufferModelView) * sunVector, normalize(viewPosition));
float SdotV = dot(sunVector, normalize(viewPosition));
///// ----- 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 skyPhase = 2.0 + pow(1.0-pow(1.0-clamp(normalize(playerPos).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 skyPhase = 0.5 + pow(1.0-pow(1.0-clamp(normalize(playerPos).y*0.5+0.5,0.0,1.0),2.0),5.0)*2.0;
float rayL = phaseRayleigh(SdotV);
vec3 rC = vec3(sky_coefficientRayleighR*1e-6, sky_coefficientRayleighG*1e-5, sky_coefficientRayleighB*1e-5) ;
@@ -259,7 +265,7 @@ vec4 GetVolumetricFog(
float shiftedLinearDistance = length(scaledViewPos);
float lightFalloff = 1.0 - clamp(1.0-linearDistance/FLASHLIGHT_RANGE, -0.999,1.0);
lightFalloff = max(exp(-30.0 * lightFalloff),0.0);
lightFalloff = max(exp(-10.0 * FLASHLIGHT_BRIGHTNESS_FALLOFF_MULT * lightFalloff),0.0);
float projectedCircle = clamp(1.0 - shiftedLinearDistance*FLASHLIGHT_SIZE,0.0,1.0);
vec3 flashlightGlow = vec3(FLASHLIGHT_R,FLASHLIGHT_G,FLASHLIGHT_B) * lightFalloff * projectedCircle * 0.5;
+25 -25
View File
@@ -153,14 +153,14 @@ void applySceneControllerParameters(
){
// these are the default parameters if no "trigger" or custom uniform is being used.
// do not remove them
smallCumulusCoverage = CloudLayer0_coverage;
smallCumulusDensity = CloudLayer0_density;
largeCumulusCoverage = CloudLayer1_coverage;
largeCumulusDensity = CloudLayer1_density;
altostratusCoverage = CloudLayer2_coverage;
altostratusDensity = CloudLayer2_density;
cirrusCoverage = CloudLayer3_coverage;
cirrusDensity = CloudLayer3_density;
smallCumulusCoverage = CloudLayer0_coverage;
smallCumulusDensity = CloudLayer0_density;
largeCumulusCoverage = CloudLayer1_coverage;
largeCumulusDensity = CloudLayer1_density;
altostratusCoverage = CloudLayer2_coverage;
altostratusDensity = CloudLayer2_density;
cirrusCoverage = CloudLayer3_coverage;
cirrusDensity = CloudLayer3_density;
fogA = 1.0;
fogB = 1.0;
@@ -190,23 +190,23 @@ void applySceneControllerParameters(
// fog = (uniform fog density, cloudy fog density)
// ... and more, eventually
#if !defined VOXY_PROGRAM && !defined CLOUD_SHADOW_PASS
flat varying struct sceneController {
vec2 smallCumulus;
vec2 largeCumulus;
vec2 altostratus;
vec2 cirrus;
vec2 fog;
} SC_parameters;
#else
struct sceneController {
vec2 smallCumulus;
vec2 largeCumulus;
vec2 altostratus;
vec2 cirrus;
vec2 fog;
} SC_parameters;
#endif
// #if !defined VOXY_PROGRAM && !defined CLOUD_SHADOW_PASS
// flat varying struct sceneController {
// vec2 smallCumulus;
// vec2 largeCumulus;
// vec2 altostratus;
// vec2 cirrus;
// vec2 fog;
// } SC_parameters;
// #else
// struct sceneController {
// vec2 smallCumulus;
// vec2 largeCumulus;
// vec2 altostratus;
// vec2 cirrus;
// vec2 fog;
// } SC_parameters;
// #endif
vec3 writeSceneControllerParameters(
vec2 uv,
+15 -11
View File
@@ -39,8 +39,6 @@ const float WATER_SIM_FRAMETIME = 1.0/float(WATER_SIM_FRAMERATE);
#define FAKE_DISPERSION_AMOUNT 4 // [0 1 2 3 4 5 6 7 8]
#define REFRACTION_SMUDGE_AMOUNT 0 // [0 1 2 3 4 5 6 7 8]
#define USE_QUARTER_RES_DEPTH
////////////////////////////////////////
// ----- PLANT RELATED SETTINGS ----- //
////////////////////////////////////////
@@ -215,6 +213,7 @@ const float entityShadowDistanceMul = 0.25; // [0.01 0.02 0.03 0.04 0.05 0.10 0.
#define RainFog_amount 0.15 // [0.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 BLOOMY_FOG 1.0 // [0.0 0.25 0.5 0.75 1.0 1.25 1.5 1.75 2.0 3.0 4.0 6.0 10.0 15.0 20.0]
#define UNDERWATER_BLOOMY_FOG 1.0 // [0.0 0.25 0.5 0.75 1.0 1.25 1.5 1.75 2.0 3.0 4.0 6.0 10.0 15.0 20.0]
#define BLOOM_STRENGTH 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 6.0 7.0 8.0 9.0 10.0 15.0 20.0 25.0 50.0 75.0 100.0]
#define CAVE_FOG
@@ -226,7 +225,9 @@ const float entityShadowDistanceMul = 0.25; // [0.01 0.02 0.03 0.04 0.05 0.10 0.
#define CaveFogColor_B 0.5 // [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 BorderFog
#define BorderFogIntensity 0.8 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]
#ifdef BorderFog
#endif
#define BorderFogIntensity 0.6 // [0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]
#if !defined OVERWORLD_SHADER
#undef BorderFog
#endif
@@ -285,7 +286,7 @@ const float entityShadowDistanceMul = 0.25; // [0.01 0.02 0.03 0.04 0.05 0.10 0.
///////////////////////////////////////////////////
#define SUN_SPECULAR_MULT 1 // [0 1 2 3 4 5 6 7 8 9 10]
#define ROUGHNESS_THRESHOLD 0.3 // [0.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.00]
#define ROUGHNESS_THRESHOLD 30 // [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100]
#define QUARTER_RES_SSR
#ifdef Specular_Reflections
@@ -696,7 +697,6 @@ const float aperture = focal/fstop;
#define MANUAL_FOCUS -2 // [-2 -1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 19 20 21 22 24 25 26 28 29 30 32 33 35 36 38 40 41 43 45 47 48 50 52 54 56 58 60 63 65 67 70 72 75 77 80 83 85 88 91 94 98 101 104 108 111 115 119 123 127 132 136 141 146 151 156 161 167 173 179 186 193 200 207 215 224 232 242 251 262 273 284 297 310 324 339 355 372 391 411 433 457 483 512]
#define DoF_Adaptation_Speed 1.00 // [0.20 0.21 0.23 0.24 0.25 0.27 0.29 0.30 0.32 0.34 0.36 0.39 0.41 0.43 0.46 0.49 0.52 0.55 0.59 0.62 0.66 0.70 0.74 0.79 0.84 0.89 0.94 1.00 1.06 1.13 1.20 1.27 1.35 1.43 1.52 1.61 1.71 1.82 1.93 2.05 2.18 2.31 2.45 2.60 2.76 2.93 3.11 3.30 3.51 3.72 3.95 4.19 4.45 4.73 5.02 5.33 5.65 6.00]
// #define DOF_JITTER_SHADOW
// // #define DOF_JITTER_FOCUS 32 // [-1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 19 20 21 22 24 25 26 28 29 30 32 33 35 36 38 40 41 43 45 47 48 50 52 54 56 58 60 63 65 67 70 72 75 77 80 83 85 88 91 94 98 101 104 108 111 115 119 123 127 132 136 141 146 151 156 161 167 173 179 186 193 200 207 215 224 232 242 251 262 273 284 297 310 324 339 355 372 391 411 433 457 483 512]
#define JITTER_STRENGTH 1.0 // sorry [0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 2.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0]
#define FOCUS_LASER_COLOR 1 // Red, Green, Blue, Pink, Yellow, White [0 1 2 3 4 5]
@@ -989,6 +989,8 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
#define CAVE_DETECTION 1.0 // [0.0 1.0 2.0]
#define FORCE_TRANSLUCENT_GLASS
#define ENCHANT_GLINT_BRIGHTNESS 1.0 // [0.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.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 4.0 5.0]
// #define PLANET_CURVATURE
#define CURVATURE_AMOUNT 1.0 // [-10.0 -9.0 -8.0 -7.0 -6.0 -5.0 -4.0 -3.0 -2.0 -1.9 -1.8 -1.7 -1.6 -1.5 -1.4 -1.3 -1.2 -1.1 -1.0 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0.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 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0]
@@ -996,6 +998,8 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
#undef PLANET_CURVATURE
#endif
#define VANILLA_CHUNK_FADING 1 // [0 1 2]
// #define SHADER_GRASS
#ifdef SHADER_GRASS
@@ -1028,12 +1032,12 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
/// distant horizons stuff
#define DISTORT_SHADOWMAP
// #define DISTANT_HORIZONS_SHADOWMAP
#ifdef DISTANT_HORIZONS_SHADOWMAP
#undef DISTORT_SHADOWMAP
const float shadowNearPlane = -1.0;
const float shadowFarPlane = -1.0;
#endif
//#ifdef DISTANT_HORIZONS_SHADOWMAP
// #undef DISTORT_SHADOWMAP
//
// const float shadowNearPlane = -1.0;
// const float shadowFarPlane = -1.0;
//#endif
// #define DH_SHADOWPROJECTIONTWEAK
#define DH_OVERDRAW_PREVENTION
+45 -43
View File
@@ -146,35 +146,35 @@ vec3 rayTraceSpeculars(vec3 dir, vec3 position, float dither, float quality, boo
#if (defined VOXY && defined VOXY_REFLECTIONS) || (defined DISTANT_HORIZONS && defined DH_SCREENSPACE_REFLECTIONS)
const float biasAmount2 = 0.000015;
const float biasAmount2 = 0.000015;
_near = dhVoxyNearPlane;
_far = dhVoxyFarPlane;
_near = dhVoxyNearPlane;
_far = dhVoxyFarPlane;
vec3 clipPosition2 = toClipSpace3_DH(position, true);
float rayLength2 = ((position.z + dir.z * _far*sqrt(3.)) > -_near) ? (-_near -position.z) / dir.z : _far*sqrt(3.);
vec3 clipPosition2 = toClipSpace3_DH(position, true);
float rayLength2 = ((position.z + dir.z * _far*sqrt(3.)) > -_near) ? (-_near -position.z) / dir.z : _far*sqrt(3.);
vec3 direction2 = toClipSpace3_DH(position + dir*rayLength2, true) - clipPosition2; //convert to clip space
vec3 direction2 = toClipSpace3_DH(position + dir*rayLength2, true) - clipPosition2; //convert to clip space
//get at which length the ray intersects with the edge of the screen
vec3 maxLengths2 = (step(0.0, direction2) - clipPosition2) / direction2;
float mult2 = min(min(maxLengths2.x, maxLengths2.y), maxLengths2.z);
vec3 stepv2 = direction2 * mult2 / quality;
//get at which length the ray intersects with the edge of the screen
vec3 maxLengths2 = (step(0.0, direction2) - clipPosition2) / direction2;
float mult2 = min(min(maxLengths2.x, maxLengths2.y), maxLengths2.z);
vec3 stepv2 = direction2 * mult2 / quality;
clipPosition2.xy *= RENDER_SCALE;
stepv2.xy *= RENDER_SCALE;
clipPosition2.xy *= RENDER_SCALE;
stepv2.xy *= RENDER_SCALE;
vec3 spos2 = clipPosition2 + stepv2*dither;
spos2 += stepv2*0.5 + vec3(0.5*texelSize,0.0); // small offsets to reduce artifacts from precision differences.
#if defined DEFERRED_SPECULAR && defined TAA
spos2.xy += TAA_Offset*texelSize*0.5/RENDER_SCALE;
#endif
vec3 spos2 = clipPosition2 + stepv2*dither;
spos2 += stepv2*0.5 + vec3(0.5*texelSize,0.0); // small offsets to reduce artifacts from precision differences.
#if defined DEFERRED_SPECULAR && defined TAA
spos2.xy += TAA_Offset*texelSize*0.5/RENDER_SCALE;
#endif
float minZ2 = spos2.z - 0.00025 / linZ2(spos2.z, _near, _far);
float maxZ2 = spos2.z;
float minZ2 = spos2.z - 0.00025 / linZ2(spos2.z, _near, _far);
float maxZ2 = spos2.z;
#endif
vec3 hitPos = vec3(1.1);
@@ -356,33 +356,35 @@ float getReflectionVisibility(float f0, float roughness){
// the goal is to determine if the reflection is even visible.
// if it reaches a point in smoothness or reflectance where it is not visible, allow it to interpolate to diffuse lighting.
float thresholdValue = ROUGHNESS_THRESHOLD;
#if ROUGHNESS_THRESHOLD < 1
return 0.0;
#else
float thresholdValue = ROUGHNESS_THRESHOLD/100.0;
if(thresholdValue < 0.01) return 0.0;
// the visibility gradient should only happen for dialectric materials. because metal is always shiny i guess or something
float dialectrics = max(f0*255.0 - 26.0,0.0)/229.0;
float value = 0.35; // so to a value you think is good enough.
float thresholdA = min(max( (1.0-dialectrics) - value, 0.0)/value, 1.0);
// the visibility gradient should only happen for dialectric materials. because metal is always shiny i guess or something
float dialectrics = max(f0*255.0 - 26.0,0.0)/229.0;
float value = 0.35; // so to a value you think is good enough.
float thresholdA = min(max( (1.0-dialectrics) - value, 0.0)/value, 1.0);
// use perceptual smoothness instead of linear roughness. it just works better i guess
float smoothness = 1.0-sqrt(roughness);
value = thresholdValue; // this one is typically want you want to scale.
float thresholdB = min(max(smoothness - value, 0.0)/value, 1.0);
// preserve super smooth reflections. if thresholdB's value is really high, then fully smooth, low f0 materials would be removed (like water).
value = 0.1; // super low so only the smoothest of materials are includes.
float thresholdC = 1.0-min(max(value - (1.0-smoothness), 0.0)/value, 1.0);
float visibilityGradient = max(thresholdA*thresholdC - thresholdB,0.0);
// use perceptual smoothness instead of linear roughness. it just works better i guess
float smoothness = 1.0-sqrt(roughness);
value = thresholdValue; // this one is typically want you want to scale.
float thresholdB = min(max(smoothness - value, 0.0)/value, 1.0);
// preserve super smooth reflections. if thresholdB's value is really high, then fully smooth, low f0 materials would be removed (like water).
value = 0.1; // super low so only the smoothest of materials are includes.
float thresholdC = 1.0-min(max(value - (1.0-smoothness), 0.0)/value, 1.0);
float visibilityGradient = max(thresholdA*thresholdC - thresholdB,0.0);
// a curve to make the gradient look smooth/nonlinear. just preference
visibilityGradient = 1.0-visibilityGradient;
visibilityGradient *=visibilityGradient;
visibilityGradient = 1.0-visibilityGradient;
visibilityGradient *=visibilityGradient;
// a curve to make the gradient look smooth/nonlinear. just preference
visibilityGradient = 1.0-visibilityGradient;
visibilityGradient *=visibilityGradient;
visibilityGradient = 1.0-visibilityGradient;
visibilityGradient *=visibilityGradient;
return visibilityGradient;
return visibilityGradient;
#endif
}
// derived from N and K from labPBR wiki https://shaderlabs.org/wiki/LabPBR_Material_Standard
+18 -18
View File
@@ -139,7 +139,7 @@ float getCloudShape(int LayerIndex, int LOD, in vec3 position, float minHeight,
#ifdef CloudLayer3
case CIRRUS_LAYER: {
coverage = SC_parameters.cirrus.x;
coverage = SC_cirrus.x;
vec2 coord = position.zx + 6.0*cloud_movement;
@@ -177,7 +177,7 @@ float getCloudShape(int LayerIndex, int LOD, in vec3 position, float minHeight,
#ifdef CloudLayer2
case ALTOSTRATUS_LAYER: {
coverage = SC_parameters.altostratus.x;
coverage = SC_altostratus.x;
coverage += Rain_coverage * rainStrength;
coverage += Thunder_coverage * thunderStrength;
@@ -198,7 +198,7 @@ float getCloudShape(int LayerIndex, int LOD, in vec3 position, float minHeight,
#ifdef CloudLayer1
case LARGECUMULUS_LAYER: {
coverage = SC_parameters.largeCumulus.x;
coverage = SC_largeCumulus.x;
coverage += Rain_coverage * rainStrength;
coverage += Thunder_coverage * thunderStrength;
@@ -216,7 +216,7 @@ float getCloudShape(int LayerIndex, int LOD, in vec3 position, float minHeight,
#ifdef CloudLayer0
case SMALLCUMULUS_LAYER: {
coverage = SC_parameters.smallCumulus.x;
coverage = SC_smallCumulus.x;
coverage += Rain_coverage * rainStrength;
coverage += Thunder_coverage * thunderStrength;
@@ -252,7 +252,7 @@ float getCloudShape(int LayerIndex, int LOD, in vec3 position, float minHeight,
// shrink the coverage slightly so it is a similar shape to clouds with erosion. this helps cloud lighting and cloud shadows.
if (LOD < 1) return max(shape - 0.27*erodeAmount,0.0);
samplePos.xz += cloud_movement/4.0;
samplePos.xz -= cloud_movement/4.0;
// da wind
// if(LayerIndex == SMALLCUMULUS_LAYER)
@@ -441,15 +441,15 @@ float GetCloudShadow(vec3 playerPos, vec3 sunVector){
#ifdef CloudLayer0
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(SC_parameters.smallCumulus.y));
cloudShadows = getCloudShape(SMALLCUMULUS_LAYER, 0, startPosition, CloudLayer0_height, CloudLayer0_height + CloudLayer0_tallness/CloudLayer0_scale)*(getRainDensity(SC_smallCumulus.y));
#endif
#ifdef CloudLayer1
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(SC_parameters.largeCumulus.y));
cloudShadows += getCloudShape(LARGECUMULUS_LAYER, 0, startPosition, CloudLayer1_height, CloudLayer1_height + CloudLayer1_tallness/CloudLayer1_scale)*(getRainDensity(SC_largeCumulus.y));
#endif
#ifdef CloudLayer2
startPosition = playerPos + startOffset * max(CloudLayer2_height - playerPos.y, 0.0);
cloudShadows += getCloudShape(ALTOSTRATUS_LAYER, 0, startPosition, CloudLayer2_height, CloudLayer2_height + 5.0)*SC_parameters.altostratus.y * (1.0-abs(sunVector.y));
cloudShadows += getCloudShape(ALTOSTRATUS_LAYER, 0, startPosition, CloudLayer2_height, CloudLayer2_height + 5.0)*SC_altostratus.y * (1.0-abs(sunVector.y));
#endif
#if CUMULONIMBUS > 0
float distanceFactor = clamp(degrees(acos(dot(vec3(0.0, 1.0, 0.0), sunVector))), 45.0, 90.0) - 45.0;
@@ -700,10 +700,10 @@ vec4 raymarchCloud(
vec3 newPos = rayPosition - cameraPosition;
if(LayerIndex == ALTOSTRATUS_LAYER) {
density = SC_parameters.altostratus.y;
density = SC_altostratus.y;
density *= smoothstep(CloudLayer2_distance, CloudLayer2_distance*0.5, length(newPos));
} else {
density = SC_parameters.cirrus.y;
density = SC_cirrus.y;
density *= smoothstep(CloudLayer3_distance, CloudLayer3_distance*0.5, length(newPos));
}
if (density == 0.0) return vec4(color, totalAbsorbance);
@@ -757,13 +757,13 @@ vec4 raymarchCloud(
vec3 newPos = rayPosition - cameraPosition;
float densityLarge = getRainDensity(SC_parameters.largeCumulus.y);
float densityLarge = getRainDensity(SC_largeCumulus.y);
float density = 0.0;
if(LayerIndex == SMALLCUMULUS_LAYER) density = getRainDensity(SC_parameters.smallCumulus.y) * smoothstep(CloudLayer0_distance, CloudLayer0_distance*0.5, length(newPos));
if(LayerIndex == SMALLCUMULUS_LAYER) density = getRainDensity(SC_smallCumulus.y) * smoothstep(CloudLayer0_distance, CloudLayer0_distance*0.5, length(newPos));
if(LayerIndex == LARGECUMULUS_LAYER) density = getRainDensity(SC_parameters.largeCumulus.y) * smoothstep(CloudLayer1_distance, CloudLayer1_distance*0.5, length(newPos));
if(LayerIndex == LARGECUMULUS_LAYER) density = getRainDensity(SC_largeCumulus.y) * smoothstep(CloudLayer1_distance, CloudLayer1_distance*0.5, length(newPos));
if(LayerIndex == CUMULONIMBUS_LAYER) density = 0.8;
@@ -900,7 +900,7 @@ vec4 raymarchCloud(
// altostratus layer -> all cumulus layers
#ifdef CloudLayer2
shadowStartPos = rayPosition + mainLightVec / abs(mainLightVec.y) * max(CloudLayer2_height - rayPosition.y, 0.0);
sunShadowMask += getCloudShape(ALTOSTRATUS_LAYER, 0, shadowStartPos, CloudLayer2_height, CloudLayer2_height) * SC_parameters.altostratus.y * (1.0-abs(mainLightVec.y));
sunShadowMask += getCloudShape(ALTOSTRATUS_LAYER, 0, shadowStartPos, CloudLayer2_height, CloudLayer2_height) * SC_altostratus.y * (1.0-abs(mainLightVec.y));
#endif
vec3 lighting = getCloudLighting(LayerIndex, shapeWithDensity, shapeWithDensityFaded, sunShadowMask, sunScattering*sh, moonScattering*sh, indirectShadowMask, skyScattering*skylightOcclusion, rayPosition, backScatterPhase, phaseLevels, backScatterPhase2, phaseLevels2);
@@ -1416,7 +1416,7 @@ float raymarchCloudSimple(
if(LayerIndex == ALTOSTRATUS_LAYER){
vec3 newPos = rayPosition - startPos;
float density = SC_parameters.altostratus.y;
float density = SC_altostratus.y;
density *= smoothstep(CloudLayer2_distance, CloudLayer2_distance*0.5, length(newPos));
if (density == 0.0) return totalAbsorbance;
@@ -1442,12 +1442,12 @@ float raymarchCloudSimple(
vec3 newPos = rayPosition - startPos;
float densityLarge = getRainDensity(SC_parameters.largeCumulus.y);
float densityLarge = getRainDensity(SC_largeCumulus.y);
float density = 0.0;
if(LayerIndex == SMALLCUMULUS_LAYER) density = getRainDensity(SC_parameters.smallCumulus.y) * smoothstep(CloudLayer0_distance, CloudLayer0_distance*0.5, length(newPos));
if(LayerIndex == LARGECUMULUS_LAYER) density = getRainDensity(SC_parameters.largeCumulus.y) * smoothstep(CloudLayer1_distance, CloudLayer1_distance*0.5, length(newPos));
if(LayerIndex == SMALLCUMULUS_LAYER) density = getRainDensity(SC_smallCumulus.y) * smoothstep(CloudLayer0_distance, CloudLayer0_distance*0.5, length(newPos));
if(LayerIndex == LARGECUMULUS_LAYER) density = getRainDensity(SC_largeCumulus.y) * smoothstep(CloudLayer1_distance, CloudLayer1_distance*0.5, length(newPos));
if(LayerIndex == CUMULONIMBUS_LAYER) density = 0.8;
if (density < 0.01) return totalAbsorbance;
+1 -1
View File
@@ -58,7 +58,7 @@ void PopulateShadowVoxel(const in vec3 playerPos) {
voxelId = uint(blockEntityId);
}
else if (currentRenderedItemId > 100 && currentRenderedItemId < 300) {
#if MC_VERSION > 12100 && MC_VERSION != 12109 && MC_VERSION != 12110
#if MC_VERSION > 12100 && MC_VERSION != 12109 && MC_VERSION != 12110
if (entityId != ENTITY_ITEM_FRAME && entityId != ENTITY_CURRENT_PLAYER)
#else
if (entityId != ENTITY_ITEM_FRAME && entityId != ENTITY_PLAYER)
File diff suppressed because one or more lines are too long
+5
View File
@@ -0,0 +1,5 @@
#version 430
#define NETHER_SHADER
#include "/dimensions/begin.csh"
+5
View File
@@ -0,0 +1,5 @@
#version 430
#define NETHER_SHADER
#include "/dimensions/deferred.csh"
+1 -1
View File
@@ -2,4 +2,4 @@
#define NETHER_SHADER
#include "/dimensions/deferred.fsh"
#include "/dimensions/prepare4.fsh"
+1 -1
View File
@@ -2,4 +2,4 @@
#define NETHER_SHADER
#include "/dimensions/deferred.vsh"
#include "/dimensions/prepare4.vsh"
+6 -6
View File
@@ -256,13 +256,13 @@ void main() {
) && length(position.xy) < 24.0
){
// apply displacement for waving plant blocks
worldpos += calcMovePlants(playerpos + cameraPosition) * max(gl_MultiTexCoord1.y,0.5);
// apply displacement for waving leaf blocks specifically, overwriting the other waving mode. these wave off of the air. they wave uniformly
if(blockId == BLOCK_AIR_WAVING) worldpos = playerpos + calcMoveLeaves(playerpos + cameraPosition, 0.0040, 0.0064, 0.0043, 0.0035, 0.0037, 0.0041, vec3(1.0,0.2,1.0), vec3(0.5,0.1,0.5))*gl_MultiTexCoord1.y;
if(blockId == BLOCK_AIR_WAVING) {
worldpos += calcMoveLeaves(playerpos + cameraPosition, 0.0040, 0.0064, 0.0043, 0.0035, 0.0037, 0.0041, vec3(1.0,0.2,1.0), vec3(0.5,0.1,0.5))*gl_MultiTexCoord1.y;
} else {
// apply displacement for waving plant blocks
worldpos += calcMovePlants(playerpos + cameraPosition) * max(gl_MultiTexCoord1.y,0.5);
}
}
#endif
+5
View File
@@ -0,0 +1,5 @@
#version 430
#define OVERWORLD_SHADER
#include "/dimensions/deferred.csh"
+1 -1
View File
@@ -2,4 +2,4 @@
#define OVERWORLD_SHADER
#include "/dimensions/deferred.fsh"
#include "/dimensions/prepare4.fsh"
+1 -1
View File
@@ -2,4 +2,4 @@
#define OVERWORLD_SHADER
#include "/dimensions/deferred.vsh"
#include "/dimensions/prepare4.vsh"
+4 -4
View File
@@ -44,15 +44,15 @@ void main() {
vec4 shadowColor = vec4(texture2D(tex,texcoord.xy).rgb * color.rgb, texture2DLod(tex, texcoord.xy, 0).a);
#ifdef TRANSLUCENT_COLORED_SHADOWS
if(shadowColor.a > 0.9999) shadowColor.rgb = vec3(0.0);
#endif
// #ifdef TRANSLUCENT_COLORED_SHADOWS
// if(shadowColor.a > 0.9999) shadowColor.rgb = vec3(0.0);
// #endif
gl_FragData[0] = shadowColor;
// gl_FragData[0] = vec4(texture2D(tex,texcoord.xy).rgb * color.rgb, texture2DLod(tex, texcoord.xy, 0).a);
#ifdef Stochastic_Transparent_Shadows
if(gl_FragData[0].a < blueNoise() && (renderStage == MC_RENDER_STAGE_TERRAIN_TRANSLUCENT || renderStage == MC_RENDER_STAGE_ENTITIES || renderStage == MC_RENDER_STAGE_BLOCK_ENTITIES)) { discard; return;}
if(gl_FragData[0].a < blueNoise() && (renderStage == MC_RENDER_STAGE_TERRAIN_TRANSLUCENT || renderStage == MC_RENDER_STAGE_ENTITIES || renderStage == MC_RENDER_STAGE_BLOCK_ENTITIES || renderStage == MC_RENDER_STAGE_NONE)) { discard; return;}
#endif
}
+6 -6
View File
@@ -254,13 +254,13 @@ void main() {
) && length(position.xy) < 24.0
){
// apply displacement for waving plant blocks
worldpos += calcMovePlants(playerpos + cameraPosition) * max(gl_MultiTexCoord1.y,0.5);
// apply displacement for waving leaf blocks specifically, overwriting the other waving mode. these wave off of the air. they wave uniformly
if(blockId == BLOCK_AIR_WAVING) worldpos = playerpos + calcMoveLeaves(playerpos + cameraPosition, 0.0040, 0.0064, 0.0043, 0.0035, 0.0037, 0.0041, vec3(1.0,0.2,1.0), vec3(0.5,0.1,0.5))*gl_MultiTexCoord1.y;
if(blockId == BLOCK_AIR_WAVING) {
worldpos += calcMoveLeaves(playerpos + cameraPosition, 0.0040, 0.0064, 0.0043, 0.0035, 0.0037, 0.0041, vec3(1.0,0.2,1.0), vec3(0.5,0.1,0.5))*gl_MultiTexCoord1.y;
} else {
// apply displacement for waving plant blocks
worldpos += calcMovePlants(playerpos + cameraPosition) * max(gl_MultiTexCoord1.y,0.5);
}
}
#endif
@@ -0,0 +1,5 @@
#version 430
#define OVERWORLD_SHADER
#include "/dimensions/deferred.csh"
+1 -1
View File
@@ -3,4 +3,4 @@
#define OVERWORLD_SHADER
#define AETHER_FLAG
#include "/dimensions/deferred.fsh"
#include "/dimensions/prepare4.fsh"
+1 -1
View File
@@ -3,4 +3,4 @@
#define OVERWORLD_SHADER
#define AETHER_FLAG
#include "/dimensions/deferred.vsh"
#include "/dimensions/prepare4.vsh"
+3 -3
View File
@@ -25,9 +25,9 @@ void main() {
vec4 shadowColor = vec4(texture2D(tex,texcoord.xy).rgb * color.rgb, texture2DLod(tex, texcoord.xy, 0).a);
#ifdef TRANSLUCENT_COLORED_SHADOWS
if(shadowColor.a > 0.9999) shadowColor.rgb = vec3(0.0);
#endif
// #ifdef TRANSLUCENT_COLORED_SHADOWS
// if(shadowColor.a > 0.9999) shadowColor.rgb = vec3(0.0);
// #endif
gl_FragData[0] = shadowColor;
+6 -6
View File
@@ -254,13 +254,13 @@ void main() {
) && length(position.xy) < 24.0
){
// apply displacement for waving plant blocks
worldpos += calcMovePlants(playerpos + cameraPosition) * max(gl_MultiTexCoord1.y,0.5);
// apply displacement for waving leaf blocks specifically, overwriting the other waving mode. these wave off of the air. they wave uniformly
if(blockId == BLOCK_AIR_WAVING) worldpos = playerpos + calcMoveLeaves(playerpos + cameraPosition, 0.0040, 0.0064, 0.0043, 0.0035, 0.0037, 0.0041, vec3(1.0,0.2,1.0), vec3(0.5,0.1,0.5))*gl_MultiTexCoord1.y;
if(blockId == BLOCK_AIR_WAVING) {
worldpos += calcMoveLeaves(playerpos + cameraPosition, 0.0040, 0.0064, 0.0043, 0.0035, 0.0037, 0.0041, vec3(1.0,0.2,1.0), vec3(0.5,0.1,0.5))*gl_MultiTexCoord1.y;
} else {
// apply displacement for waving plant blocks
worldpos += calcMovePlants(playerpos + cameraPosition) * max(gl_MultiTexCoord1.y,0.5);
}
}
#endif
@@ -0,0 +1,5 @@
#version 430
#define OVERWORLD_SHADER
#include "/dimensions/deferred.csh"
@@ -3,4 +3,4 @@
#define OVERWORLD_SHADER
#define TWILIGHT_FOREST_FLAG
#include "/dimensions/deferred.fsh"
#include "/dimensions/prepare4.fsh"
@@ -3,4 +3,4 @@
#define OVERWORLD_SHADER
#define TWILIGHT_FOREST_FLAG
#include "/dimensions/deferred.vsh"
#include "/dimensions/prepare4.vsh"
@@ -25,9 +25,9 @@ void main() {
vec4 shadowColor = vec4(texture2D(tex,texcoord.xy).rgb * color.rgb, texture2DLod(tex, texcoord.xy, 0).a);
#ifdef TRANSLUCENT_COLORED_SHADOWS
if(shadowColor.a > 0.9999) shadowColor.rgb = vec3(0.0);
#endif
// #ifdef TRANSLUCENT_COLORED_SHADOWS
// if(shadowColor.a > 0.9999) shadowColor.rgb = vec3(0.0);
// #endif
gl_FragData[0] = shadowColor;
@@ -254,13 +254,13 @@ void main() {
) && length(position.xy) < 24.0
){
// apply displacement for waving plant blocks
worldpos += calcMovePlants(playerpos + cameraPosition) * max(gl_MultiTexCoord1.y,0.5);
// apply displacement for waving leaf blocks specifically, overwriting the other waving mode. these wave off of the air. they wave uniformly
if(blockId == BLOCK_AIR_WAVING) worldpos = playerpos + calcMoveLeaves(playerpos + cameraPosition, 0.0040, 0.0064, 0.0043, 0.0035, 0.0037, 0.0041, vec3(1.0,0.2,1.0), vec3(0.5,0.1,0.5))*gl_MultiTexCoord1.y;
if(blockId == BLOCK_AIR_WAVING) {
worldpos += calcMoveLeaves(playerpos + cameraPosition, 0.0040, 0.0064, 0.0043, 0.0035, 0.0037, 0.0041, vec3(1.0,0.2,1.0), vec3(0.5,0.1,0.5))*gl_MultiTexCoord1.y;
} else {
// apply displacement for waving plant blocks
worldpos += calcMovePlants(playerpos + cameraPosition) * max(gl_MultiTexCoord1.y,0.5);
}
}
#endif
+1 -1
View File
@@ -2,4 +2,4 @@
#define END_SHADER
#include "/dimensions/composite10.vsh"
#include "/dimensions/composite11.vsh"
+5
View File
@@ -0,0 +1,5 @@
#version 430
#define END_SHADER
#include "/dimensions/deferred.csh"
-1
View File
@@ -6,7 +6,6 @@ varying vec4 color;
uniform sampler2D gtexture;
uniform sampler2D gaux1;
uniform vec4 lightCol;
uniform vec3 sunVec;
uniform vec2 texelSize;
+1 -1
View File
@@ -2,4 +2,4 @@
#define END_SHADER
#include "/dimensions/deferred.fsh"
#include "/dimensions/prepare4.fsh"
+1 -1
View File
@@ -2,4 +2,4 @@
#define END_SHADER
#include "/dimensions/deferred.vsh"
#include "/dimensions/prepare4.vsh"
+3 -3
View File
@@ -32,9 +32,9 @@ void main() {
vec4 shadowColor = vec4(texture2D(tex,texcoord.xy).rgb * color.rgb, texture2DLod(tex, texcoord.xy, 0).a);
#ifdef TRANSLUCENT_COLORED_SHADOWS
if(shadowColor.a > 0.9999) shadowColor.rgb = vec3(0.0);
#endif
// #ifdef TRANSLUCENT_COLORED_SHADOWS
// if(shadowColor.a > 0.9999) shadowColor.rgb = vec3(0.0);
// #endif
gl_FragData[0] = shadowColor;