mirror of
https://github.com/Merlin1809/Eclipse-Shader.git
synced 2026-10-10 04:53:07 +08:00
Massively improve boat water wave sim (iris 1.10.4+),add glass tint to DH/Voxy glass, make floodfill fog light propagation use true fog densities, add underwater fog light propagation for handheld lights, add unique foggy pale garden environment, fix block break effect shown through hand, add block breaking effect on translucents, fix magma overlays lightmap, fix translucent overlays z-fighting, add flashlight/handheld shadows on translucents (1.21.10+), improve flashlight fog illumination, improve SSAO/GTAO around hand, make selection box wave with leaves, fix DH/Voxy sky reflections in low light areas, fix https://github.com/Merlin1809/Eclipse-Shader/issues/59, add colorwheel/voxy programs to aether and twilight forest dimensions, bunch of other tiny fixes and stuff
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -26,6 +26,7 @@ uniform sampler2D dhDepthTex1;
|
||||
uniform sampler2D depthtex0;
|
||||
uniform sampler2D depthtex1;
|
||||
|
||||
uniform sampler2D colortex11;
|
||||
uniform sampler2D colortex12;
|
||||
// uniform sampler2D colortex7;
|
||||
uniform sampler2D colortex4;
|
||||
@@ -285,7 +286,7 @@ vec3 applyBump(mat3 tbnMatrix, vec3 bump, float puddle_values){
|
||||
#ifdef FORWARD_ROUGH_REFLECTION
|
||||
#endif
|
||||
|
||||
/* RENDERTARGETS:2,7,14 */
|
||||
/* RENDERTARGETS:2,7,11,14 */
|
||||
void main() {
|
||||
if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) {
|
||||
|
||||
@@ -342,7 +343,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
|
||||
|
||||
gl_FragData[0] = gcolor;
|
||||
// float UnchangedAlpha = gl_FragData[0].a;
|
||||
float UnchangedAlpha = gl_FragData[0].a;
|
||||
|
||||
#ifdef WhiteWorld
|
||||
gl_FragData[0].rgb = vec3(0.5);
|
||||
@@ -462,12 +463,12 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
#ifdef FORWARD_BACKGROUND_REFLECTION
|
||||
BackgroundReflection = skyCloudsFromTex(mat3(gbufferModelViewInverse) * reflectedVector, colortex4).rgb / 1200.0;
|
||||
#endif
|
||||
#ifdef WATER_SUN_SPECULAR
|
||||
SunReflection = (DirectLightColor * Shadows) * GGX(normalize(normals), -normalize(viewPos), normalize(WsunVec2), roughness, f0) * (1.0-Reflections.a);
|
||||
#if defined OVERWORLD_SHADER && SUN_SPECULAR_MULT > 0
|
||||
SunReflection = SUN_SPECULAR_MULT * DirectLightColor * Shadows * GGX(normalize(normals), -normalize(viewPos), normalize(WsunVec2), roughness, f0) * (1.0-Reflections.a);
|
||||
#endif
|
||||
|
||||
Reflections_Final = mix(FinalColor, mix(BackgroundReflection*SSR_HIT_SKY_MASK, Reflections.rgb, Reflections.a), fresnel);
|
||||
Reflections_Final += SunReflection*indoors;
|
||||
Reflections_Final += SunReflection*SSR_HIT_SKY_MASK;
|
||||
|
||||
gl_FragData[0].a = gl_FragData[0].a + (1.0-gl_FragData[0].a) * fresnel;
|
||||
|
||||
@@ -495,7 +496,21 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
|
||||
gl_FragData[1] = vec4(Albedo, material);
|
||||
|
||||
gl_FragData[2] = vec4(1, 1, encodeVec2(lightmapCoords.x, lightmapCoords.y), 1);
|
||||
vec4 GLASS_TINT_COLORS = vec4(Albedo, UnchangedAlpha);
|
||||
|
||||
#ifdef BIOME_TINT_WATER
|
||||
if (isWater) GLASS_TINT_COLORS.rgb = toLinear(gcolor.rgb);
|
||||
#endif
|
||||
|
||||
vec4 blockBreak = texelFetch(colortex11, ivec2(gl_FragCoord.xy), 0);
|
||||
|
||||
if(blockBreak.a > 0.99) {
|
||||
gl_FragData[2] = blockBreak;
|
||||
} else {
|
||||
gl_FragData[2] = vec4(encodeVec2(vec2(0.5)), encodeVec2(GLASS_TINT_COLORS.rg), encodeVec2(GLASS_TINT_COLORS.ba), 0.0);
|
||||
}
|
||||
|
||||
gl_FragData[3] = vec4(1, 1, encodeVec2(lightmapCoords.x, lightmapCoords.y), 1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -393,13 +393,10 @@ void main() {
|
||||
#endif
|
||||
|
||||
#if !defined DAMAGE_BLOCK_EFFECT
|
||||
#ifdef LINES
|
||||
bool selectionBox = renderStage == MC_RENDER_STAGE_OUTLINE;
|
||||
#endif
|
||||
|
||||
gl_FragData[2] = vec4(0.0);
|
||||
|
||||
#ifdef LINES
|
||||
bool selectionBox = renderStage == MC_RENDER_STAGE_OUTLINE;
|
||||
#ifndef SELECT_BOX
|
||||
if(selectionBox) discard;
|
||||
#endif
|
||||
@@ -455,7 +452,7 @@ void main() {
|
||||
|
||||
#ifdef FLASHLIGHT
|
||||
vec4 flashLightSpecularData = vec4(0.0);
|
||||
Indirect_lighting += calculateFlashlight(gl_FragCoord.xy*texelSize/RENDER_SCALE, viewPos, vec3(0.0), -normalize(feetPlayerPos), flashLightSpecularData, false);
|
||||
Indirect_lighting += 0.3*calculateFlashlight(gl_FragCoord.xy*texelSize/RENDER_SCALE, viewPos, vec3(0.0), -normalize(feetPlayerPos), flashLightSpecularData, false);
|
||||
#endif
|
||||
|
||||
TEXTURE.rgb *= Indirect_lighting + averageSkyCol_CloudsSSBO / 360.0;
|
||||
@@ -557,7 +554,6 @@ void main() {
|
||||
gl_FragData[0].rgb = (Indirect_lighting + Direct_lighting) * toLinear(color.rgb);
|
||||
|
||||
#if RAINBOW_SELECT_BOX > 0
|
||||
|
||||
#if RAINBOW_SELECT_BOX == 1
|
||||
float selectBoxHue = length(sin(mod(1.4*worldPos, 3.14159)));
|
||||
#else
|
||||
@@ -588,9 +584,9 @@ void main() {
|
||||
float BN = blueNoise();
|
||||
|
||||
// distance fade targeting the world border...
|
||||
float distaneFade = clamp(2.5 - length(feetPlayerPos) / (0.1*min(far, 225.0)),0.0,1.0);
|
||||
float distanceFade = clamp(2.5 - length(feetPlayerPos) / (0.1*min(far, 225.0)),0.0,1.0);
|
||||
|
||||
if(distaneFade < BN) discard;
|
||||
if(distanceFade < BN) discard;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -59,6 +59,44 @@ vec4 toClipSpace3(vec3 viewSpacePosition) {
|
||||
in vec4 at_tangent;
|
||||
#endif
|
||||
|
||||
#ifdef LINES
|
||||
uniform int currentSelectedBlockId;
|
||||
uniform int renderStage;
|
||||
uniform vec3 currentSelectedBlockPos;
|
||||
|
||||
#include "/lib/blocks.glsl"
|
||||
|
||||
const float PI48 = 150.796447372*WAVY_SPEED;
|
||||
float pi2wt = PI48*frameTimeCounter;
|
||||
|
||||
vec2 calcWave(in vec3 pos) {
|
||||
|
||||
float magnitude = abs(sin(dot(vec4(frameTimeCounter, pos),vec4(1.0,0.005,0.005,0.005)))*0.5+0.72)*0.013;
|
||||
vec2 ret = (sin(pi2wt*vec2(0.0063,0.0015)*4. - pos.xz + pos.y*0.05)+0.1)*magnitude;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
vec3 calcMovePlants(in vec3 pos) {
|
||||
vec2 move1 = calcWave(pos );
|
||||
float move1y = -length(move1);
|
||||
return vec3(move1.x,move1y,move1.y)*5.*WAVY_STRENGTH;
|
||||
}
|
||||
|
||||
vec3 calcWaveLeaves(in vec3 pos) {
|
||||
|
||||
float magnitude = abs(sin(dot(vec4(frameTimeCounter, pos),vec4(1.0,0.005,0.005,0.005)))*0.5+0.72)*0.013;
|
||||
vec3 ret = (sin(pi2wt*vec3(0.0063,0.0224,0.0015)*1.5 - pos))*magnitude;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
vec3 calcMoveLeaves(in vec3 pos, in vec3 amp1) {
|
||||
vec3 move1 = calcWaveLeaves(pos) * amp1;
|
||||
return move1*5.*WAVY_STRENGTH;
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
@@ -98,9 +136,19 @@ void main() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined LINES && defined PLANET_CURVATURE
|
||||
#ifdef LINES
|
||||
#ifdef PLANET_CURVATURE
|
||||
float curvature = length(worldpos) / (16*8);
|
||||
worldpos.y -= curvature*curvature * CURVATURE_AMOUNT;
|
||||
#endif
|
||||
|
||||
#if defined WAVY_PLANTS
|
||||
bool selectionBox = renderStage == MC_RENDER_STAGE_OUTLINE;
|
||||
if(currentSelectedBlockId == BLOCK_AIR_WAVING && abs(position.z) < 64.0 && selectionBox){
|
||||
// apply displacement for waving leaf blocks specifically, overwriting the other waving mode. these wave off of the air. they wave uniformly
|
||||
worldpos += calcMoveLeaves(worldpos + cameraPosition, vec3(1.0,0.2,1.0))*clamp(eyeBrightnessSmooth.y/240.0,0,1);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
position = mat3(gbufferModelView) * worldpos + gbufferModelView[3].xyz;
|
||||
|
||||
@@ -523,8 +523,9 @@ void main() {
|
||||
|
||||
vec2 lmcoord = data_in.lmtexcoord.zw;
|
||||
|
||||
vec4 Color = data_in.color;
|
||||
|
||||
#ifndef COLORWHEEL
|
||||
vec4 Color = data_in.color;
|
||||
float vanillaAO = 1.0 - clamp(Color.a,0,1);
|
||||
|
||||
// don't fix vanilla ao on some custom block models.
|
||||
@@ -580,7 +581,7 @@ void main() {
|
||||
#endif
|
||||
|
||||
#if (defined BLOCKENTITIES || defined ENTITIES || defined HAND) && !defined TRANSLUCENT_ENTITIES && defined TRANSLUCENT_ENTITIES_DITHER_FALLBACK
|
||||
float entityAlbedo = clamp((Albedo.a - 0.1) * 10.0 / 9.0, 0.0, 1.0);
|
||||
float entityAlbedo = clamp((Albedo.a*Color.a - 0.1) * 10.0 / 9.0, 0.0, 1.0);
|
||||
#ifdef TAA
|
||||
if(entityAlbedo < BN) discard;
|
||||
#else
|
||||
@@ -788,7 +789,7 @@ void main() {
|
||||
/////// ----- SSS ON BLOCKS ----- ///////
|
||||
// strong
|
||||
if (
|
||||
data_in.blockID == BLOCK_SSS_STRONG || data_in.blockID == BLOCK_AIR_WAVING
|
||||
data_in.blockID == BLOCK_SSS_STRONG || data_in.blockID == BLOCK_AIR_WAVING || data_in.blockID == BLOCK_SSS_STRONG_2
|
||||
) {
|
||||
SSSAMOUNT = 1.0;
|
||||
}
|
||||
|
||||
@@ -168,6 +168,7 @@ vec3 calcMoveLeaves(in vec3 pos, in vec3 amp1) {
|
||||
vec3 move1 = calcWaveLeaves(pos) * amp1;
|
||||
return move1*5.*WAVY_STRENGTH;
|
||||
}
|
||||
|
||||
vec3 srgbToLinear2(vec3 srgb){
|
||||
return mix(
|
||||
srgb / 12.92,
|
||||
@@ -291,7 +292,7 @@ void main() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if PUDDLE_MODE > 0 || ShaderSnow > 0
|
||||
#if (PUDDLE_MODE > 0 || ShaderSnow > 0) && !defined CUTOUT
|
||||
if(data_out.blockID == 215) data_out.lmtexcoord.w = 0.0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
|
||||
#undef FLASHLIGHT_BOUNCED_INDIRECT
|
||||
|
||||
#if MC_VERSION >= 12110
|
||||
#define MAIN_SHADOW_PASS
|
||||
#endif
|
||||
|
||||
// #if defined END_SHADER || defined NETHER_SHADER
|
||||
// #undef IS_LPV_ENABLED
|
||||
// #endif
|
||||
@@ -66,8 +70,9 @@ uniform vec4 entityColor;
|
||||
#endif
|
||||
|
||||
uniform sampler2D noisetex;
|
||||
uniform sampler2D depthtex1;
|
||||
uniform sampler2D depthtex0;
|
||||
uniform sampler2D depthtex1;
|
||||
uniform sampler2D depthtex2;
|
||||
|
||||
#ifdef DISTANT_HORIZONS
|
||||
uniform sampler2D dhDepthTex1;
|
||||
@@ -80,6 +85,7 @@ uniform sampler2D depthtex0;
|
||||
#endif
|
||||
|
||||
uniform sampler2D colortex7;
|
||||
uniform sampler2D colortex11;
|
||||
uniform sampler2D colortex12;
|
||||
uniform sampler2D colortex13;
|
||||
uniform sampler2D colortex14;
|
||||
@@ -127,6 +133,7 @@ uniform vec3 nsunColor;
|
||||
|
||||
uniform int heldItemId;
|
||||
uniform int heldItemId2;
|
||||
uniform bool firstPersonCamera;
|
||||
|
||||
uniform float waterEnteredAltitude;
|
||||
|
||||
@@ -465,6 +472,12 @@ void convertHandDepth(inout float depth) {
|
||||
depth = ndcDepth * 0.5 + 0.5;
|
||||
}
|
||||
|
||||
vec2 decodeVec2(float a){
|
||||
const vec2 constant1 = 65535. / vec2( 256., 65536.);
|
||||
const float constant2 = 256. / 255.;
|
||||
return fract( a * constant1 ) * constant2 ;
|
||||
}
|
||||
|
||||
void Emission(
|
||||
inout vec3 Lighting,
|
||||
vec3 Albedo,
|
||||
@@ -482,6 +495,67 @@ float bias(){
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined FLASHLIGHT_SHADOWS && defined FLASHLIGHT && defined MAIN_SHADOW_PASS
|
||||
float SSRT_FlashLight_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, float noise, vec3 normals, bool hand){
|
||||
|
||||
if(hand || !firstPersonCamera) return 1.0;
|
||||
|
||||
vec3 WlightDir = normalize((gbufferModelViewInverse*vec4(lightDir, 1.0)).xyz);
|
||||
|
||||
float NdotL = dot(normals, WlightDir);
|
||||
NdotL = smoothstep(0.0, 0.2, abs(NdotL));
|
||||
|
||||
float shadows = 1.0;
|
||||
float samples = 16.0;
|
||||
|
||||
float _near = near; float _far = far*4.0;
|
||||
|
||||
if (depthCheck) {
|
||||
_near = dhVoxyNearPlane;
|
||||
_far = dhVoxyFarPlane;
|
||||
}
|
||||
|
||||
vec3 position = toClipSpace3_DH(viewPos, depthCheck) ;
|
||||
|
||||
//prevents the ray from going behind the camera
|
||||
float rayLength = ((viewPos.z + lightDir.z * _far * sqrt(3.)) > -_near) ? (-_near - viewPos.z) / lightDir.z : _far * sqrt(3.);
|
||||
|
||||
vec3 direction = toClipSpace3_DH(viewPos + lightDir*rayLength, depthCheck) - position;
|
||||
direction.xyz = direction.xyz / max(max(abs(direction.x)/0.0005, abs(direction.y)/0.0005),400.0); //fixed step size
|
||||
direction *= 6.0;
|
||||
|
||||
position.xy *= RENDER_SCALE;
|
||||
direction.xy *= RENDER_SCALE;
|
||||
|
||||
vec3 newPos = position + direction*noise;
|
||||
// literally shadow bias to fight shadow acne due to precision problems when comparing sampled depth and marched position
|
||||
//newPos += direction*0.3;
|
||||
|
||||
|
||||
for (int i = 0; i < int(samples); i++) {
|
||||
float samplePos;
|
||||
|
||||
#if defined DISTANT_HORIZONS || defined VOXY
|
||||
if(depthCheck) {
|
||||
samplePos = texelFetch(dhVoxyDepthTex1, ivec2(newPos.xy/texelSize),0).x;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
samplePos = texelFetch(depthtex2, ivec2(newPos.xy/texelSize),0).x,hand;
|
||||
}
|
||||
|
||||
if(samplePos < newPos.z && samplePos > 0.0){// && (samplePos <= max(minZ,maxZ) && samplePos >= min(minZ,maxZ))){
|
||||
shadows = 0.0;
|
||||
break;
|
||||
}
|
||||
|
||||
newPos += direction;
|
||||
}
|
||||
|
||||
return clamp(shadows*NdotL, 1.0-FLASHLIGHT_SHADOWS_STRENGTH, 1.0);
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
@@ -783,13 +857,22 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
if (isWater) TangentNormal = mix(NormalTex.xy, normalize(wave.normal).xz, smoothstep(0.0, 0.1, physics_localWaviness));
|
||||
#endif
|
||||
|
||||
float nameTagMask = 0.0;
|
||||
gl_FragData[2].r = encodeVec2(TangentNormal*0.5+0.5);
|
||||
|
||||
#if defined ENTITIES && defined IS_IRIS
|
||||
if(NAMETAG > 0) nameTagMask = 0.1;
|
||||
#endif
|
||||
vec4 blockBreak = texelFetch(colortex11, ivec2(gl_FragCoord.xy), 0);
|
||||
|
||||
gl_FragData[2] = vec4(encodeVec2(TangentNormal*0.5+0.5), encodeVec2(GLASS_TINT_COLORS.rg), encodeVec2(GLASS_TINT_COLORS.ba), encodeVec2(0.0, nameTagMask));
|
||||
if(blockBreak.a > 0.99) {
|
||||
gl_FragData[2].gba = blockBreak.gba;
|
||||
} else {
|
||||
#if defined ENTITIES && defined IS_IRIS
|
||||
float nameTagMask = 0.0;
|
||||
if(NAMETAG > 0) nameTagMask = 1.0;
|
||||
#else
|
||||
const float nameTagMask = 0.0;
|
||||
#endif
|
||||
|
||||
gl_FragData[2].gba = vec3(encodeVec2(GLASS_TINT_COLORS.rg), encodeVec2(GLASS_TINT_COLORS.ba), nameTagMask);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////// SPECULARS /////////////////////////////////////
|
||||
@@ -947,11 +1030,21 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
vec3 lightColor = vec3(TORCH_R,TORCH_G,TORCH_B);
|
||||
#endif
|
||||
|
||||
Indirect_lighting += doBlockLightLighting(lightColor, lightmap.x, feetPlayerPos, lpvPos);
|
||||
#ifdef MAIN_SHADOW_PASS
|
||||
Indirect_lighting += doBlockLightLighting(lightColor, lightmap.x, feetPlayerPos, lpvPos, viewPos, false, BN, worldSpaceNormal, false);
|
||||
#else
|
||||
Indirect_lighting += doBlockLightLighting(lightColor, lightmap.x, feetPlayerPos, lpvPos);
|
||||
#endif
|
||||
|
||||
vec4 flashLightSpecularData = vec4(0.0);
|
||||
#ifdef FLASHLIGHT
|
||||
Indirect_lighting += calculateFlashlight(FragCoord.xy*texelSize/RENDER_SCALE, viewPos, vec3(0.0), worldSpaceNormal, flashLightSpecularData, false);
|
||||
#if defined FLASHLIGHT_SHADOWS && defined MAIN_SHADOW_PASS && !defined HAND && defined MAIN_SHADOW_PASS
|
||||
vec3 newViewPos = viewPos + vec3(-0.25, 0.2, 0.0);
|
||||
float flashlightshadows = SSRT_FlashLight_Shadows(viewPos, false, -newViewPos, BN, worldSpaceNormal, false);
|
||||
#else
|
||||
const float flashlightshadows = 1.0;
|
||||
#endif
|
||||
Indirect_lighting += flashlightshadows * calculateFlashlight(FragCoord.xy*texelSize/RENDER_SCALE, viewPos, vec3(0.0), worldSpaceNormal, flashLightSpecularData, false);
|
||||
#endif
|
||||
|
||||
vec3 FinalColor = (Indirect_lighting + Direct_lighting) * Albedo;
|
||||
@@ -1029,14 +1122,14 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined DISTANT_HORIZONS && defined DH_OVERDRAW_PREVENTION && !defined HAND
|
||||
#if defined DISTANT_HORIZONS && defined DH_OVERDRAW_PREVENTION && !defined HAND && !defined NETHER_SHADER
|
||||
#if OVERDRAW_MAX_DISTANCE == 0
|
||||
float maxOverdrawDistance = far;
|
||||
#else
|
||||
float maxOverdrawDistance = OVERDRAW_MAX_DISTANCE;
|
||||
#endif
|
||||
|
||||
bool WATER = texture(colortex7, gl_FragCoord.xy*texelSize).a > 0.0 && length(feetPlayerPos) > clamp(far-16.0*4.0, 16.0, maxOverdrawDistance) && texelFetch(depthtex1, ivec2(gl_FragCoord.xy), 0).x >= 1.0;
|
||||
bool WATER = texelFetch(colortex7, ivec2(gl_FragCoord.xy), 0).a > 0.0 && length(feetPlayerPos) > clamp(far-16.0*4.0, 16.0, maxOverdrawDistance) && texelFetch(depthtex1, ivec2(gl_FragCoord.xy), 0).x >= 1.0;
|
||||
|
||||
if(WATER && isWater) {
|
||||
gl_FragData[0].a = 0.0;
|
||||
|
||||
@@ -186,9 +186,10 @@ void main() {
|
||||
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;
|
||||
// keep this OUT of the #if block... otherwise there will be z-fighting when using some overlay textures for some random ass reason.....
|
||||
vec3 worldpos = mat3(gbufferModelViewInverse) * position + gbufferModelViewInverse[3].xyz;
|
||||
|
||||
#if defined PLANET_CURVATURE || (defined IRIS_FEATURE_FADE_VARIABLE && VANILLA_CHUNK_FADING > 1 && !defined HAND)
|
||||
#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
|
||||
@@ -197,9 +198,9 @@ void main() {
|
||||
float curvature = length(worldpos) / (16*8);
|
||||
worldpos.y -= curvature*curvature * CURVATURE_AMOUNT;
|
||||
#endif
|
||||
|
||||
position = mat3(gbufferModelView) * worldpos + gbufferModelView[3].xyz;
|
||||
#endif
|
||||
|
||||
position = mat3(gbufferModelView) * worldpos + gbufferModelView[3].xyz;
|
||||
|
||||
#if !defined ENTITIES && !defined HAND
|
||||
gl_Position = toClipSpace3(position);
|
||||
|
||||
@@ -14,6 +14,7 @@ in DATA {
|
||||
|
||||
uniform sampler2D depthtex0;
|
||||
uniform sampler2D depthtex1;
|
||||
uniform sampler2D depthtex2;
|
||||
|
||||
#ifdef DISTANT_HORIZONS
|
||||
uniform sampler2D dhDepthTex;
|
||||
@@ -274,7 +275,14 @@ float convertHandDepth_2(in float depth, bool hand) {
|
||||
vec4 viewPos = vec4(0.0);
|
||||
vec3 feetPlayerPos = vec3(0.0);
|
||||
|
||||
float depth = convertHandDepth_2(texelFetch(depthtex1, samplecoord, 0).x, hand);
|
||||
float depth;
|
||||
|
||||
if(hand) {
|
||||
depth = texelFetch(depthtex1, samplecoord, 0).x;
|
||||
convertHandDepth(depth);
|
||||
} else {
|
||||
depth = texelFetch(depthtex2, samplecoord, 0).x;
|
||||
}
|
||||
|
||||
if (depth < 1.0) {
|
||||
feetPlayerPos = vec3(texcoord, depth) * 2.0 - 1.0;
|
||||
@@ -326,7 +334,14 @@ vec2 SSAO(
|
||||
#if defined DISTANT_HORIZONS || defined VOXY
|
||||
vec3 offsetViewPos = toScreenSpace_DH_SSAO((offsetUV*texelSize - jitterOffsets) * (1.0/RENDER_SCALE), offsetUV, hand);
|
||||
#else
|
||||
float sampleDepth = convertHandDepth_2(texelFetch(depthtex1, offsetUV, 0).x, hand);
|
||||
float sampleDepth;
|
||||
if(hand) {
|
||||
sampleDepth = texelFetch(depthtex1, offsetUV, 0).x;
|
||||
convertHandDepth(sampleDepth);
|
||||
} else {
|
||||
sampleDepth = texelFetch(depthtex2, offsetUV, 0).x;
|
||||
}
|
||||
|
||||
vec3 offsetViewPos = toScreenSpace(vec3((offsetUV*texelSize - jitterOffsets) * (1.0/RENDER_SCALE), sampleDepth));
|
||||
#endif
|
||||
|
||||
@@ -411,10 +426,14 @@ void main() {
|
||||
float z0 = texelFetch(depthtex0,ivec2(gl_FragCoord.xy),0).x;
|
||||
|
||||
#if defined DISTANT_HORIZONS || defined VOXY
|
||||
float DH_depth1 = texelFetch(dhVoxyDepthTex1,ivec2(gl_FragCoord.xy),0).x;
|
||||
float DH_depth0 = texelFetch(dhVoxyDepthTex,ivec2(gl_FragCoord.xy),0).x;
|
||||
|
||||
float swappedDepth = z >= 1.0 ? DH_depth1 : z;
|
||||
float DH_depth1 = 1.0;
|
||||
float swappedDepth;
|
||||
if(z >= 1.0) {
|
||||
DH_depth1 = texelFetch(dhVoxyDepthTex1,ivec2(gl_FragCoord.xy),0).x;
|
||||
swappedDepth = DH_depth1;
|
||||
} else {
|
||||
swappedDepth = z;
|
||||
}
|
||||
#else
|
||||
float DH_depth1 = 1.0;
|
||||
float swappedDepth = z;
|
||||
@@ -442,7 +461,7 @@ void main() {
|
||||
_far = far*4.0;
|
||||
|
||||
if (depth0 >= 1.0) {
|
||||
depth0 = DH_depth0;
|
||||
depth0 = texelFetch(dhVoxyDepthTex,ivec2(gl_FragCoord.xy),0).x;
|
||||
_near = dhVoxyNearPlane;
|
||||
_far = dhVoxyFarPlane;
|
||||
}
|
||||
|
||||
@@ -490,8 +490,13 @@ vec2 SSRT_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, float noise, boo
|
||||
sampleDepth = texelFetch(dhVoxyDepthTex1, ivec2(newPos.xy/texelSize),0).x;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
sampleDepth = convertHandDepth_2(texelFetch(depthtex1, ivec2(newPos.xy/texelSize),0).x,hand);
|
||||
{
|
||||
if(hand) {
|
||||
sampleDepth = texelFetch(depthtex1, ivec2(newPos.xy/texelSize),0).x;
|
||||
convertHandDepth(sampleDepth);
|
||||
} else {
|
||||
sampleDepth = texelFetch(depthtex2, ivec2(newPos.xy/texelSize),0).x;
|
||||
}
|
||||
}
|
||||
|
||||
if(sampleDepth < newPos.z){
|
||||
@@ -737,10 +742,10 @@ vec3 ComputeShadowMap_COLOR(in vec3 projectedShadowPosition, float distortFactor
|
||||
#ifdef debug_SHADOWMAP
|
||||
shadowDebug = texture(shadow, projectedShadowPosition).x;
|
||||
#endif
|
||||
#ifdef TRANSLUCENT_COLORED_SHADOWS
|
||||
// directLightColor *= mix(vec3(1.0), translucentTint.rgb / samples, maxDistFade);
|
||||
tintedSunlight *= translucentTint.rgb / samples;
|
||||
#endif
|
||||
// #ifdef TRANSLUCENT_COLORED_SHADOWS
|
||||
// // directLightColor *= mix(vec3(1.0), translucentTint.rgb / samples, maxDistFade);
|
||||
// tintedSunlight *= translucentTint.rgb / samples;
|
||||
// #endif
|
||||
|
||||
return shadowColor.rgb / samples;
|
||||
// return mix(directLightColor, shadowColor.rgb / samples, maxDistFade);
|
||||
@@ -956,13 +961,12 @@ void main() {
|
||||
float z = texelFetch(depthtex1, ivec2(gl_FragCoord.xy), 0).x;
|
||||
float swappedDepth = z;
|
||||
|
||||
|
||||
|
||||
bool isDHrange = z >= 1.0;
|
||||
|
||||
#if defined DISTANT_HORIZONS || defined VOXY
|
||||
bool isDHrange = z >= 1.0;
|
||||
|
||||
float DH_mixedLinearZ = sqrt(texelFetch(colortex12,ivec2(gl_FragCoord.xy), 0).z/65000.0);
|
||||
float DH_depth0 = texelFetch(dhVoxyDepthTex,ivec2(gl_FragCoord.xy), 0).x;
|
||||
float DH_depth0 = 0.0;
|
||||
if(isDHrange) DH_depth0 = texelFetch(dhVoxyDepthTex,ivec2(gl_FragCoord.xy), 0).x;
|
||||
float DH_depth1 = texelFetch(dhVoxyDepthTex1,ivec2(gl_FragCoord.xy), 0).x;
|
||||
|
||||
float depthOpaque = z;
|
||||
@@ -971,13 +975,14 @@ void main() {
|
||||
float dhDepthOpaque = DH_depth1;
|
||||
float dhDepthOpaqueL = linearizeDepthFast(dhDepthOpaque, dhVoxyNearPlane, dhVoxyFarPlane);
|
||||
|
||||
if (depthOpaque >= 1.0 || (dhDepthOpaqueL < depthOpaqueL && dhDepthOpaque > 0.0)){
|
||||
if (isDHrange || (dhDepthOpaqueL < depthOpaqueL && dhDepthOpaque > 0.0)){
|
||||
depthOpaque = dhDepthOpaque;
|
||||
depthOpaqueL = dhDepthOpaqueL;
|
||||
}
|
||||
|
||||
swappedDepth = depthOpaque;
|
||||
#else
|
||||
bool isDHrange = false;
|
||||
float DH_depth0 = 0.0;
|
||||
float DH_depth1 = 0.0;
|
||||
#endif
|
||||
@@ -1141,7 +1146,7 @@ void main() {
|
||||
#endif
|
||||
{
|
||||
vec3 lightningColor = vec3(2.0, 4.5, 6.6) * lightningFlash;
|
||||
DirectLightColor += lightningColor * smoothstep(500.0, 0.0, length(feetPlayerPos-lightningBoltPosition.xyz));
|
||||
DirectLightColor += 0.5 * lightningColor * smoothstep(300.0, 0.0, length(feetPlayerPos-lightningBoltPosition.xyz));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1324,6 +1329,7 @@ void main() {
|
||||
|
||||
float ShadowAlpha = 0.0; // this is for subsurface scattering later.
|
||||
vec3 tintedSunlight = DirectLightColor; // this is for subsurface scattering later.
|
||||
// nobody cares, it makes zero difference
|
||||
|
||||
#if defined END_ISLAND_LIGHT && defined END_SHADER
|
||||
// make light fade out
|
||||
@@ -1372,11 +1378,11 @@ void main() {
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef TRANSLUCENT_COLORED_SHADOWS
|
||||
SSSColor = tintedSunlight;
|
||||
#else
|
||||
SSSColor = DirectLightColor;
|
||||
#endif
|
||||
// #ifdef TRANSLUCENT_COLORED_SHADOWS
|
||||
// SSSColor = tintedSunlight;
|
||||
// #else
|
||||
// SSSColor = DirectLightColor;
|
||||
// #endif
|
||||
|
||||
// TODO CHECK IF *= OR =
|
||||
// *= looks better idk
|
||||
|
||||
+233
-164
@@ -97,94 +97,6 @@ float linearizeDepthFast(const in float depth, const in float near, const in flo
|
||||
return (near * far) / (depth * (near - far) + far);
|
||||
}
|
||||
|
||||
#define IS_LPV_ENABLED
|
||||
|
||||
#if defined LPV_VL_FOG_ILLUMINATION && defined IS_LPV_ENABLED
|
||||
#ifdef IS_LPV_ENABLED
|
||||
#extension GL_ARB_shader_image_load_store: enable
|
||||
#extension GL_ARB_shading_language_packing: enable
|
||||
#endif
|
||||
|
||||
#ifdef IS_LPV_ENABLED
|
||||
uniform usampler1D texBlockData;
|
||||
uniform sampler3D texLpv1;
|
||||
uniform sampler3D texLpv2;
|
||||
#endif
|
||||
|
||||
// #ifdef IS_LPV_ENABLED
|
||||
// uniform int heldItemId;
|
||||
// uniform int heldItemId2;
|
||||
// #endif
|
||||
|
||||
#ifdef IS_LPV_ENABLED
|
||||
#include "/lib/hsv.glsl"
|
||||
#include "/lib/lpv_common.glsl"
|
||||
#include "/lib/lpv_render.glsl"
|
||||
#endif
|
||||
|
||||
vec4 raymarchLPV(
|
||||
in vec3 viewPos,
|
||||
in float dither
|
||||
){
|
||||
#if !defined LPV_VL_FOG_ILLUMINATION
|
||||
return vec3(0.0);
|
||||
#endif
|
||||
|
||||
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;
|
||||
|
||||
// ensure the max marching distance is the voxel distance, or the render distance if the voxels go farther than it
|
||||
float LPVRayLength = length(LPVrayStartPos);
|
||||
#if LPV_SIZE == 8
|
||||
LPVrayStartPos *= min(LPVRayLength, min(256.0,far))/LPVRayLength;
|
||||
#elif LPV_SIZE == 7
|
||||
LPVrayStartPos *= min(LPVRayLength, min(128.0,far))/LPVRayLength;
|
||||
#elif LPV_SIZE == 6
|
||||
LPVrayStartPos *= min(LPVRayLength, min(64.0,far))/LPVRayLength;
|
||||
#endif
|
||||
LPVRayLength = length(LPVrayStartPos);
|
||||
|
||||
vec3 LPVrayProgress = vec3(0.0);
|
||||
vec4 color = vec4(0.0,0.0,0.0,1.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.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);
|
||||
|
||||
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;
|
||||
|
||||
vec3 sampleColor = SampleLpvLinear(lpvPos).rgb;
|
||||
#ifdef VANILLA_LIGHTMAP_MASK
|
||||
vec3 lighting = sampleColor * LPV_VL_FOG_ILLUMINATION_BRIGHTNESS * 25. * exp(-10 * (1.0-luma(sampleColor)));
|
||||
#else
|
||||
vec3 lighting = sampleColor * LPV_VL_FOG_ILLUMINATION_BRIGHTNESS * 25. * exp(-5 * (1.0-luma(sampleColor)));
|
||||
#endif
|
||||
|
||||
float volumeCoeff = exp(-dd*density*LPVRayLength);
|
||||
|
||||
color.rgb += (lighting - lighting * volumeCoeff) * color.a;
|
||||
color.a *= volumeCoeff;
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
#endif
|
||||
float invLinZ (float lindepth){
|
||||
return -((2.0*near/lindepth)-far-near)/(far-near);
|
||||
}
|
||||
|
||||
uniform float nightVision;
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
@@ -201,8 +113,6 @@ uniform float nightVision;
|
||||
|
||||
#include "/lib/scene_controller.glsl"
|
||||
|
||||
|
||||
// uniform int dhRenderDistance;
|
||||
#define TIMEOFDAYFOG
|
||||
#include "/lib/lightning_stuff.glsl"
|
||||
|
||||
@@ -220,7 +130,172 @@ uniform sampler2D colortex4;
|
||||
#include "/lib/end_fog.glsl"
|
||||
#endif
|
||||
|
||||
#define fsign(a) (clamp((a)*1e35,0.,1.)*2.-1.)
|
||||
#define IS_LPV_ENABLED
|
||||
|
||||
#if defined LPV_VL_FOG_ILLUMINATION && defined IS_LPV_ENABLED
|
||||
#extension GL_ARB_shader_image_load_store: enable
|
||||
#extension GL_ARB_shading_language_packing: enable
|
||||
|
||||
uniform usampler1D texBlockData;
|
||||
uniform sampler3D texLpv1;
|
||||
uniform sampler3D texLpv2;
|
||||
|
||||
#include "/lib/hsv.glsl"
|
||||
#include "/lib/lpv_common.glsl"
|
||||
#include "/lib/lpv_render.glsl"
|
||||
|
||||
#if defined LPV_VL_FOG_ILLUMINATION_HANDHELD_WATER || defined LPV_VL_FOG_ILLUMINATION_HANDHELD
|
||||
uniform int heldItemId;
|
||||
uniform int heldItemId2;
|
||||
|
||||
#include "/lib/util.glsl"
|
||||
#include "/lib/diffuse_lighting.glsl"
|
||||
#endif
|
||||
#ifdef LPV_VL_FOG_ILLUMINATION_HANDHELD
|
||||
#endif
|
||||
#endif
|
||||
|
||||
bool eyeInWater = isEyeInWater == 1;
|
||||
|
||||
vec4 raymarchLPV(
|
||||
in vec3 viewPos,
|
||||
in float dither
|
||||
){
|
||||
#if (!defined LPV_VL_FOG_ILLUMINATION || !defined IS_LPV_ENABLED) && (!defined FLASHLIGHT_FOG_ILLUMINATION || !defined FLASHLIGHT)
|
||||
return vec3(0.0);
|
||||
#endif
|
||||
|
||||
const int SAMPLECOUNT = 8;
|
||||
float minimumDensity = 0.000025;
|
||||
if(eyeInWater) minimumDensity = 0.00006;
|
||||
const float fadeLength = 10.0; // in blocks
|
||||
|
||||
vec3 LPVrayStartPos = mat3(gbufferModelViewInverse) * viewPos;
|
||||
|
||||
// ensure the max marching distance is the voxel distance, or the render distance if the voxels go farther than it
|
||||
float LPVRayLength = length(LPVrayStartPos);
|
||||
#if LPV_SIZE == 8
|
||||
LPVrayStartPos *= min(LPVRayLength, min(256.0,far))/LPVRayLength;
|
||||
#elif LPV_SIZE == 7
|
||||
LPVrayStartPos *= min(LPVRayLength, min(128.0,far))/LPVRayLength;
|
||||
#elif LPV_SIZE == 6
|
||||
LPVrayStartPos *= min(LPVRayLength, min(64.0,far))/LPVRayLength;
|
||||
#endif
|
||||
LPVRayLength = length(LPVrayStartPos);
|
||||
|
||||
vec3 rayProgress = vec3(0.0);
|
||||
vec4 color = vec4(0.0,0.0,0.0,1.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.0-1.0/expFactor);
|
||||
float dd = pow(expFactor, float(i+dither)/float(SAMPLECOUNT)) * log(expFactor) / float(SAMPLECOUNT)/(expFactor-1.0);
|
||||
|
||||
rayProgress = gbufferModelViewInverse[3].xyz + d*LPVrayStartPos;
|
||||
|
||||
float density;
|
||||
float _minimumDensity = minimumDensity;
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
if(caveDetection < 0.9999) density = cloudVol(rayProgress + cameraPosition, 0.0) * (1.0 - caveDetection);
|
||||
|
||||
_minimumDensity += caveDetection * minimumDensity;
|
||||
#elif defined NETHER_SHADER
|
||||
vec3 progressW = rayProgress + cameraPosition;
|
||||
density = cloudVol(progressW);
|
||||
|
||||
float dist = length(rayProgress);
|
||||
float clearArea = 1.0 - min(max(1.0 - dist / 24.0,0.0),1.0);
|
||||
|
||||
float plumeDensity = min(density * pow(min(max(100.0-progressW.y,0.0)/30.0,1.0),4.0), pow(clamp(1.0 - dist/far,0.0,1.0),5.0));
|
||||
plumeDensity *= NETHER_PLUME_DENSITY;
|
||||
|
||||
float ceilingSmokeDensity = 0.001 * pow(min(max(progressW.y-40.0,0.0)/50.0,1.0),3.0);
|
||||
ceilingSmokeDensity *= NETHER_CEILING_SMOKE_DENSITY;
|
||||
|
||||
density = plumeDensity + ceilingSmokeDensity;
|
||||
#elif defined END_SHADER
|
||||
float volumeDensity = fogShape(rayProgress + cameraPosition);
|
||||
float clearArea = 1.0-min(max(1.0 - length(rayProgress) / 100,0.0),1.0);
|
||||
density = min(volumeDensity, clearArea*clearArea * END_STORM_DENSTIY);
|
||||
#endif
|
||||
|
||||
density = max(density/1000.0, _minimumDensity);
|
||||
|
||||
// density = 0.0001;
|
||||
|
||||
float volumeCoeff = exp(-dd*density*LPVRayLength);
|
||||
|
||||
#ifdef IS_LPV_ENABLED
|
||||
vec3 lpvPos = GetLpvPosition(rayProgress);
|
||||
|
||||
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;
|
||||
|
||||
vec3 sampleColor = SampleLpvLinear(lpvPos).rgb;
|
||||
#ifdef VANILLA_LIGHTMAP_MASK
|
||||
vec3 lighting = sampleColor * LPV_VL_FOG_ILLUMINATION_BRIGHTNESS * 25. * exp(-10 * (1.0-luma(sampleColor)));
|
||||
#else
|
||||
vec3 lighting = sampleColor * LPV_VL_FOG_ILLUMINATION_BRIGHTNESS * 25. * exp(-5 * (1.0-luma(sampleColor)));
|
||||
#endif
|
||||
|
||||
if(eyeInWater) lighting *= 2.5;
|
||||
|
||||
#if defined LPV_VL_FOG_ILLUMINATION && defined IS_LPV_ENABLED && defined LPV_VL_FOG_ILLUMINATION_HANDHELD
|
||||
float lightRange = 0.0;
|
||||
vec3 handLightCol = GetHandLight(heldItemId, rayProgress, lightRange);
|
||||
|
||||
vec3 handLightCol2 = GetHandLight(heldItemId2, rayProgress, lightRange);
|
||||
|
||||
lighting += (handLightCol + handLightCol2) * TORCH_AMOUNT * LPV_VL_FOG_ILLUMINATION_BRIGHTNESS * 0.04;
|
||||
#endif
|
||||
|
||||
color.rgb += (lighting - lighting * volumeCoeff) * color.a;
|
||||
#endif
|
||||
|
||||
#if defined FLASHLIGHT && defined FLASHLIGHT_FOG_ILLUMINATION
|
||||
// vec3 shiftedViewPos = mat3(gbufferModelView)*(progressW-cameraPosition) + vec3(-0.25, 0.2, 0.0);
|
||||
// vec3 shiftedPlayerPos = mat3(gbufferModelViewInverse) * shiftedViewPos;
|
||||
vec3 shiftedViewPos;
|
||||
vec3 shiftedPlayerPos;
|
||||
float forwardOffset;
|
||||
|
||||
#ifdef VIVECRAFT
|
||||
if (vivecraftIsVR) {
|
||||
forwardOffset = 0.0;
|
||||
shiftedPlayerPos = (rayProgress) + ( vivecraftRelativeMainHandPos);
|
||||
shiftedViewPos = shiftedPlayerPos * mat3(vivecraftRelativeMainHandRot);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
forwardOffset = 0.5;
|
||||
shiftedViewPos = mat3(gbufferModelView)*(rayProgress) + vec3(-0.25, 0.2, 0.0);
|
||||
shiftedPlayerPos = mat3(gbufferModelViewInverse) * shiftedViewPos;
|
||||
}
|
||||
|
||||
vec2 scaledViewPos = shiftedViewPos.xy / max(-shiftedViewPos.z - forwardOffset, 1e-7);
|
||||
float linearDistance = length(shiftedPlayerPos);
|
||||
float shiftedLinearDistance = length(scaledViewPos);
|
||||
|
||||
float lightFalloff = 1.0 - clamp(1.0-linearDistance/FLASHLIGHT_RANGE, -0.999,1.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 = 25.0 * vec3(FLASHLIGHT_R,FLASHLIGHT_G,FLASHLIGHT_B) * lightFalloff * projectedCircle * FLASHLIGHT_BRIGHTNESS_MULT;
|
||||
|
||||
color.rgb += (flashlightGlow - flashlightGlow * volumeCoeff) * color.a;
|
||||
#endif
|
||||
|
||||
color.a *= volumeCoeff;
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
float invLinZ (float lindepth){
|
||||
return -((2.0*near/lindepth)-far-near)/(far-near);
|
||||
}
|
||||
|
||||
/*
|
||||
from https://blog.demofox.org/2022/01/01/interleaved-gradient-noise-a-different-kind-of-low-discrepancy-sequence/
|
||||
@@ -257,56 +332,11 @@ float R2_dither(){
|
||||
return fract(alpha.x * coord.x + alpha.y * coord.y ) ;
|
||||
}
|
||||
|
||||
void waterVolumetrics_notoverworld(inout vec3 inColor, vec3 rayStart, vec3 rayEnd, float estEndDepth, float estSunDepth, float rayLength, float dither, vec3 waterCoefs, vec3 scatterCoef, vec3 ambient){
|
||||
inColor *= exp(-rayLength * waterCoefs); //No need to take the integrated value
|
||||
|
||||
int spCount = rayMarchSampleCount;
|
||||
vec3 start = toShadowSpaceProjected(rayStart);
|
||||
vec3 end = toShadowSpaceProjected(rayEnd);
|
||||
vec3 dV = (end-start);
|
||||
//limit ray length at 32 blocks for performance and reducing integration error
|
||||
//you can't see above this anyway
|
||||
float maxZ = min(rayLength,12.0)/(1e-8+rayLength);
|
||||
dV *= maxZ;
|
||||
|
||||
|
||||
rayLength *= maxZ;
|
||||
|
||||
float dY = normalize(mat3(gbufferModelViewInverse) * rayEnd).y * rayLength;
|
||||
estEndDepth *= maxZ;
|
||||
estSunDepth *= maxZ;
|
||||
|
||||
vec3 wpos = mat3(gbufferModelViewInverse) * rayStart + gbufferModelViewInverse[3].xyz;
|
||||
vec3 dVWorld = (wpos-gbufferModelViewInverse[3].xyz);
|
||||
|
||||
vec3 absorbance = vec3(1.0);
|
||||
vec3 vL = vec3(0.0);
|
||||
|
||||
float expFactor = 11.0;
|
||||
for (int i=0;i<spCount;i++) {
|
||||
float d = (pow(expFactor, float(i+dither)/float(spCount))/expFactor - 1.0/expFactor)/(1-1.0/expFactor);
|
||||
float dd = pow(expFactor, float(i+dither)/float(spCount)) * log(expFactor) / float(spCount)/(expFactor-1.0);
|
||||
vec3 spPos = start.xyz + dV*d;
|
||||
|
||||
vec3 progressW = start.xyz+cameraPosition+dVWorld;
|
||||
|
||||
vec3 ambientMul = exp(-max(estEndDepth * d,0.0) * waterCoefs );
|
||||
vec3 Indirectlight = ambientMul*ambient;
|
||||
|
||||
vec3 light = Indirectlight * scatterCoef;
|
||||
|
||||
vL += (light - light * exp(-waterCoefs * dd * rayLength)) / waterCoefs * absorbance;
|
||||
absorbance *= exp(-dd * rayLength * waterCoefs);
|
||||
}
|
||||
inColor += vL;
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
const int spCount = 8;
|
||||
|
||||
vec3 start = toShadowSpaceProjected(rayStart);
|
||||
vec3 end = toShadowSpaceProjected(rayEnd);
|
||||
@@ -325,11 +355,9 @@ vec4 waterVolumetrics(vec3 rayStart, vec3 rayEnd, float rayLength, vec2 dither,
|
||||
vec3 vL = vec3(0.0);
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
float lowlightlevel = clamp(eyeBrightnessSmooth.y/240.0,0.1,1.0);
|
||||
float phase = fogPhase(VdotL) * 5.0;
|
||||
#else
|
||||
float lowlightlevel = 1.0;
|
||||
float phase = 0.0;
|
||||
const float phase = 0.0;
|
||||
#endif
|
||||
|
||||
float thing = -normalize(dVWorld).y;
|
||||
@@ -342,7 +370,8 @@ vec4 waterVolumetrics(vec3 rayStart, vec3 rayEnd, float rayLength, vec2 dither,
|
||||
float d = (pow(expFactor, float(i+dither.x)/float(spCount))/expFactor - 1.0/expFactor)/(1-1.0/expFactor); // exponential step position (0-1)
|
||||
float dd = pow(expFactor, float(i+dither.y)/float(spCount)) * log(expFactor) / float(spCount)/(expFactor-1.0); //step length (derivative)
|
||||
|
||||
vec3 progressW = gbufferModelViewInverse[3].xyz+cameraPosition + d*dVWorld;
|
||||
vec3 progressP = gbufferModelViewInverse[3].xyz + d*dVWorld;
|
||||
vec3 progressW = progressP + cameraPosition;
|
||||
|
||||
float distanceFromWaterSurface = max(-(progressW.y - waterEnteredAltitude),0.0);
|
||||
|
||||
@@ -351,7 +380,7 @@ vec4 waterVolumetrics(vec3 rayStart, vec3 rayEnd, float rayLength, vec2 dither,
|
||||
vec3 spPos = start.xyz + dV*d;
|
||||
|
||||
//project into biased shadowmap space
|
||||
#ifdef DISTORT_SHADOWMAP && defined OVERWORLD_SHADER
|
||||
#if defined DISTORT_SHADOWMAP && defined OVERWORLD_SHADER
|
||||
float distortFactor = calcDistort(spPos.xy);
|
||||
#else
|
||||
float distortFactor = 1.0;
|
||||
@@ -386,7 +415,27 @@ vec4 waterVolumetrics(vec3 rayStart, vec3 rayEnd, float rayLength, vec2 dither,
|
||||
vec3 WaterAbsorbance = exp(-waterCoefs * (distanceFromWaterSurface + thing));
|
||||
|
||||
vec3 Directlight = lightSource * sh * phase * caustics * sunAbsorbance;
|
||||
vec3 Indirectlight = ambient * WaterAbsorbance;
|
||||
|
||||
vec3 _ambient = ambient;
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
float horizontalDist = length((progressP.xz) - lightningBoltPosition.xz);
|
||||
if (horizontalDist < 250.0 && lightningBoltPosition.w > 0.0) {
|
||||
float lightningIntensity = exp(-horizontalDist * 0.02) * lightningFlash;
|
||||
_ambient = mix(_ambient, vec3(1.3,1.5,3.0) * sh, lightningIntensity);
|
||||
}
|
||||
#endif
|
||||
|
||||
vec3 Indirectlight = _ambient * WaterAbsorbance;
|
||||
|
||||
#if defined LPV_VL_FOG_ILLUMINATION && defined IS_LPV_ENABLED && defined LPV_VL_FOG_ILLUMINATION_HANDHELD_WATER
|
||||
float lightRange = 0.0;
|
||||
vec3 handLightCol = GetHandLight(heldItemId, progressP, lightRange);
|
||||
|
||||
vec3 handLightCol2 = GetHandLight(heldItemId2, progressP, lightRange);
|
||||
|
||||
Indirectlight += (handLightCol + handLightCol2) * TORCH_AMOUNT * (LPV_VL_FOG_ILLUMINATION_BRIGHTNESS / 100.0) * 0.2 * exp(-waterCoefs * (length(progressP) + 0.05 * thing));
|
||||
#endif
|
||||
|
||||
|
||||
vec3 light = (Indirectlight + Directlight + LPV) * scatterCoef;
|
||||
@@ -531,13 +580,13 @@ vec4 waterVolumetrics_alt( vec3 rayStart, vec3 rayEnd, float estEndDepth, float
|
||||
estEndDepth *= maxZ;
|
||||
estSunDepth *= maxZ;
|
||||
|
||||
vec3 wpos = mat3(gbufferModelViewInverse) * rayStart + gbufferModelViewInverse[3].xyz;
|
||||
vec3 dVWorld = (wpos - gbufferModelViewInverse[3].xyz);
|
||||
vec3 dVWorld = mat3(gbufferModelViewInverse) * rayStart;
|
||||
vec3 wpos = dVWorld + gbufferModelViewInverse[3].xyz;
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
float phase = fogPhase(VdotL) * 5.0;
|
||||
#else
|
||||
float phase = 1.0;
|
||||
const float phase = 1.0;
|
||||
#endif
|
||||
|
||||
vec3 absorbance = vec3(1.0);
|
||||
@@ -560,9 +609,9 @@ vec4 waterVolumetrics_alt( vec3 rayStart, vec3 rayEnd, float estEndDepth, float
|
||||
float d = (pow(expFactor, float(i+dither)/float(spCount))/expFactor - 1.0/expFactor)/(1-1.0/expFactor);
|
||||
float dd = pow(expFactor, float(i+dither)/float(spCount)) * log(expFactor) / float(spCount)/(expFactor-1.0);
|
||||
|
||||
// progressW = gbufferModelViewInverse[3].xyz+cameraPosition + d*dVWorld;
|
||||
|
||||
vec3 progressW = gbufferModelViewInverse[3].xyz + cameraPosition + d*dVWorld;
|
||||
#if defined OVERWORLD_SHADER || (defined LPV_VL_FOG_ILLUMINATION && defined IS_LPV_ENABLED && defined LPV_VL_FOG_ILLUMINATION_HANDHELD_WATER)
|
||||
vec3 progressP = gbufferModelViewInverse[3].xyz + d*dVWorld + dVWorld;
|
||||
#endif
|
||||
|
||||
vec3 sh2 = sh;
|
||||
|
||||
@@ -598,7 +647,27 @@ vec4 waterVolumetrics_alt( vec3 rayStart, vec3 rayEnd, float estEndDepth, float
|
||||
vec3 ambientAbsorbance = exp(-waterCoefs * (estEndDepth * d + thing));
|
||||
|
||||
vec3 Directlight = lightSource * sh2 * phase * sunAbsorbance;
|
||||
vec3 Indirectlight = ambient * ambientAbsorbance;
|
||||
|
||||
vec3 _ambient = ambient;
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
float horizontalDist = length(progressP.xz - lightningBoltPosition.xz);
|
||||
if (horizontalDist < 250.0 && lightningBoltPosition.w > 0.0) {
|
||||
float lightningIntensity = exp(-horizontalDist * 0.02) * lightningFlash;
|
||||
_ambient = mix(_ambient, vec3(1.3,1.5,3.0) * sh2, lightningIntensity);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined LPV_VL_FOG_ILLUMINATION && defined IS_LPV_ENABLED && defined LPV_VL_FOG_ILLUMINATION_HANDHELD_WATER
|
||||
float lightRange = 0.0;
|
||||
vec3 handLightCol = GetHandLight(heldItemId, progressP, lightRange);
|
||||
|
||||
vec3 handLightCol2 = GetHandLight(heldItemId2, progressP, lightRange);
|
||||
|
||||
_ambient += (handLightCol + handLightCol2) * TORCH_AMOUNT * 0.225 * (LPV_VL_FOG_ILLUMINATION_BRIGHTNESS / 100.0);
|
||||
#endif
|
||||
|
||||
vec3 Indirectlight = _ambient * ambientAbsorbance;
|
||||
|
||||
vec3 light = (Indirectlight + Directlight) * scatterCoef;
|
||||
|
||||
@@ -656,7 +725,9 @@ void main() {
|
||||
// z0 = depth < 0.56 ? convertHandDepth(depth) : depth;
|
||||
|
||||
#if defined DISTANT_HORIZONS || defined VOXY
|
||||
float DH_z0 = texelFetch(dhVoxyDepthTex, texcoord,0).x;
|
||||
float DH_z0 = 0.0;
|
||||
|
||||
if (z0 >= 1.0) DH_z0 = texelFetch(dhVoxyDepthTex, texcoord,0).x;
|
||||
#else
|
||||
float DH_z0 = 0.0;
|
||||
#endif
|
||||
@@ -692,7 +763,7 @@ void main() {
|
||||
// float godrays = 1.0;
|
||||
// #endif
|
||||
|
||||
#if defined LPV_VL_FOG_ILLUMINATION && defined IS_LPV_ENABLED
|
||||
#if (defined LPV_VL_FOG_ILLUMINATION && defined IS_LPV_ENABLED) || (defined FLASHLIGHT && defined FLASHLIGHT_FOG_ILLUMINATION)
|
||||
vec4 LPV_ILLUMINATION = raymarchLPV(viewPos0, BN.y);
|
||||
#else
|
||||
vec4 LPV_ILLUMINATION = vec4(0.0,0.0,0.0,1.0);
|
||||
@@ -713,8 +784,6 @@ void main() {
|
||||
#ifdef OVERWORLD_SHADER
|
||||
vec4 VolumetricClouds;
|
||||
#endif
|
||||
|
||||
bool eyeInWater = isEyeInWater == 1;
|
||||
|
||||
if (eyeInWater){
|
||||
vec4 underWaterFog = waterVolumetrics(vec3(0.0), viewPos0, length(viewPos0), vec2(noise_1, BN.y), totEpsilon, scatterCoef, indirectLightColor_dynamic, directLightColor, dot(normalize(viewPos0), normalize(sunVec * lightSourceCheck)), LPV_ILLUMINATION.rgb);
|
||||
@@ -728,14 +797,14 @@ void main() {
|
||||
#endif
|
||||
|
||||
#ifdef CAVE_FOG
|
||||
#if CAVE_DETECTION == 0.0 || CAVE_DETECTION == 1.0
|
||||
#if CAVE_DETECTION == 1.0
|
||||
float caveFactor = 1.0-smoothstep(60.0, 63.0, cameraPosition.y);
|
||||
#if CAVE_DETECTION < 2
|
||||
#if CAVE_DETECTION == 1
|
||||
float caveFactor = 1.0 - smoothstep(60.0, 63.0, cameraPosition.y);
|
||||
#else
|
||||
float caveFactor = 1.0;
|
||||
const float caveFactor = 1.0;
|
||||
#endif
|
||||
#else
|
||||
float caveFactor = 0.0;
|
||||
const float caveFactor = 0.0;
|
||||
#endif
|
||||
|
||||
float skyhole = pow(clamp(1.0-pow(max(playerPos_normalized.y - 0.6,0.0)*5.0,2.0),0.0,1.0),2)* caveDetection * caveFactor;
|
||||
@@ -746,7 +815,7 @@ void main() {
|
||||
// vec3 sceneColor = texelFetch(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 && defined IS_LPV_ENABLED
|
||||
#if (defined LPV_VL_FOG_ILLUMINATION && defined IS_LPV_ENABLED) || (defined FLASHLIGHT && defined FLASHLIGHT_FOG_ILLUMINATION)
|
||||
VolumetricFog.a *= LPV_ILLUMINATION.a;
|
||||
VolumetricFog.rgb = VolumetricFog.rgb * LPV_ILLUMINATION.a + LPV_ILLUMINATION.rgb;
|
||||
#endif
|
||||
@@ -760,7 +829,7 @@ void main() {
|
||||
#if defined NETHER_SHADER || defined END_SHADER
|
||||
VolumetricFog = GetVolumetricFog(viewPos0, noise_1, noise_1);
|
||||
|
||||
#if defined LPV_VL_FOG_ILLUMINATION && defined IS_LPV_ENABLED
|
||||
#if (defined LPV_VL_FOG_ILLUMINATION && defined IS_LPV_ENABLED) || (defined FLASHLIGHT && defined FLASHLIGHT_FOG_ILLUMINATION)
|
||||
VolumetricFog.a *= LPV_ILLUMINATION.a;
|
||||
VolumetricFog.rgb = VolumetricFog.rgb * LPV_ILLUMINATION.a + LPV_ILLUMINATION.rgb;
|
||||
#endif
|
||||
@@ -792,7 +861,8 @@ void main() {
|
||||
float z1 = texelFetch(depthtex1, texcoord,0).x;
|
||||
|
||||
#if defined DISTANT_HORIZONS || defined VOXY
|
||||
float DH_z1 = texelFetch(dhVoxyDepthTex1, texcoord,0).x;
|
||||
float DH_z1 = 0.0;
|
||||
if (z1 >= 1.0) DH_z1 = texelFetch(dhVoxyDepthTex1, texcoord,0).x;
|
||||
#else
|
||||
float DH_z1 = 0.0;
|
||||
#endif
|
||||
@@ -811,7 +881,7 @@ void main() {
|
||||
float estimatedDepth = Vdiff * abs(playerPos_normalized.y);
|
||||
float estimatedSunDepth = Vdiff / abs(WsunVec.y); //assuming water plane
|
||||
|
||||
float lightleakfix = clamp(lightmap.y + (1-caveDetection),0.0,1.0);
|
||||
float lightleakfix = clamp(lightmap.y + (1.0-caveDetection),0.0,1.0);
|
||||
|
||||
directLightColor *= lightleakfix;
|
||||
|
||||
@@ -836,5 +906,4 @@ void main() {
|
||||
|
||||
gl_FragData[1] = clamp(VolumetricFog, 0.0, 65000.0);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -448,8 +448,6 @@ vec4 VLTemporalFiltering(vec3 viewPos, in float referenceDepth, sampler2D depth,
|
||||
|
||||
uniform float waterEnteredAltitude;
|
||||
|
||||
#define CAVE_FOG_DARKEN_SKY
|
||||
|
||||
void blendAllFogTypes( inout vec3 color, inout float bloomyFogMult, vec4 volumetrics, float linearDistance, vec3 playerPos, vec3 cameraPosition, bool isSky, bool isLightning){
|
||||
|
||||
// blend cave fog
|
||||
@@ -461,14 +459,14 @@ void blendAllFogTypes( inout vec3 color, inout float bloomyFogMult, vec4 volumet
|
||||
|
||||
float skyhole = pow(clamp(1.0-pow(max(playerPos.y - 0.6,0.0)*5.0,2.0),0.0,1.0),2);
|
||||
|
||||
#if (CAVE_DETECTION == 0.0) || (CAVE_DETECTION == 1.0)
|
||||
#if (CAVE_DETECTION == 1.0)
|
||||
float caveFactor = 1-smoothstep(60.0, 63.0, cameraPosition.y);
|
||||
#if CAVE_DETECTION < 2
|
||||
#if CAVE_DETECTION == 1
|
||||
float caveFactor = 1.0 - smoothstep(60.0, 63.0, cameraPosition.y);
|
||||
#else
|
||||
float caveFactor = 1.0;
|
||||
const float caveFactor = 1.0;
|
||||
#endif
|
||||
#else
|
||||
float caveFactor = 0.0;
|
||||
const float caveFactor = 0.0;
|
||||
#endif
|
||||
|
||||
color.rgb = mix(color.rgb + cavefogCol * caveDetection, cavefogCol, isSky ? skyhole * caveDetection * caveFactor: 0.0);
|
||||
@@ -552,29 +550,17 @@ void main() {
|
||||
|
||||
float frDepth = linearize(z);
|
||||
|
||||
float swappedDepth = z;
|
||||
|
||||
#if defined DISTANT_HORIZONS || defined VOXY
|
||||
float DH_depth0 = texelFetch(dhVoxyDepthTex, ivec2(gl_FragCoord.xy),0).x;
|
||||
|
||||
float depthOpaque = z;
|
||||
float depthOpaqueL = linearizeDepthFast(depthOpaque, near, farPlane);
|
||||
|
||||
float dhDepthOpaque = DH_depth0;
|
||||
float dhDepthOpaqueL = linearizeDepthFast(dhDepthOpaque, dhVoxyNearPlane, dhVoxyFarPlane);
|
||||
if (depthOpaque >= 1.0 || (dhDepthOpaqueL < depthOpaqueL && dhDepthOpaque > 0.0)){
|
||||
depthOpaque = dhDepthOpaque;
|
||||
depthOpaqueL = dhDepthOpaqueL;
|
||||
}
|
||||
|
||||
swappedDepth = depthOpaque;
|
||||
float DH_depth0 = 0.0;
|
||||
bool isDHrange = z >= 1.0;
|
||||
if(isDHrange) DH_depth0 = texelFetch(dhVoxyDepthTex, ivec2(gl_FragCoord.xy),0).x;
|
||||
|
||||
bool isSky = DH_depth0 >= 1.0;
|
||||
#else
|
||||
float DH_depth0 = 0.0;
|
||||
bool isSky = z >= 1.0;
|
||||
float DH_depth0 = 1.0;
|
||||
#endif
|
||||
|
||||
bool isSky = swappedDepth >= 1.0;
|
||||
|
||||
#if !defined DISTANT_HORIZONS && !defined VOXY || (AURORA_LOCATION > 0 && defined OVERWORLD_SHADER)
|
||||
float z2 = texelFetch(depthtex1, ivec2(gl_FragCoord.xy),0).x;
|
||||
#endif
|
||||
@@ -611,12 +597,12 @@ void main() {
|
||||
////// --------------- UNPACK TRANSLUCENT GBUFFERS --------------- //////
|
||||
vec4 data = texelFetch(colortex11,ivec2(texcoord/texelSize),0).rgba;
|
||||
vec4 unpack0 = vec4(decodeVec2(data.r),decodeVec2(data.g)) ;
|
||||
vec4 unpack1 = vec4(decodeVec2(data.b),decodeVec2(data.a)) ;
|
||||
vec2 unpack1 = decodeVec2(data.b);
|
||||
|
||||
vec4 albedo = vec4(unpack0.ba,unpack1.rg);
|
||||
vec4 albedo = vec4(unpack0.ba,unpack1);
|
||||
vec2 tangentNormals = unpack0.xy*2.0-1.0;
|
||||
|
||||
bool nameTagMask = abs(unpack1.a - 0.1) < 0.01;
|
||||
bool nameTagMask = abs(data.a - 0.1) < 0.01;
|
||||
float nametagbackground = nameTagMask ? 0.25 : 1.0;
|
||||
|
||||
if(albedo.a < 0.01) tangentNormals = vec2(0.0);
|
||||
@@ -648,7 +634,16 @@ void main() {
|
||||
////// --------------- distort texcoords as a refraction effect
|
||||
vec2 refractedCoord = texcoord;
|
||||
#if FAKE_REFRACTION_AMOUNT > 0
|
||||
vec3 color = doRefractionEffect(refractedCoord, tangentNormals.xy, linearDistance, isReflectiveEntity, isWater && isEyeInWater == 1);
|
||||
vec3 color;
|
||||
#if defined DISTANT_HORIZONS || defined VOXY
|
||||
if(isDHrange || hand) {
|
||||
color = texture(colortex3, texcoord).rgb;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
color = doRefractionEffect(refractedCoord, tangentNormals.xy, linearDistance, isReflectiveEntity, isWater && isEyeInWater == 1);
|
||||
}
|
||||
#else
|
||||
vec3 color = texture(colortex3, texcoord).rgb;
|
||||
#endif
|
||||
@@ -673,12 +668,6 @@ void main() {
|
||||
|
||||
float z0 = depth < 0.56 ? convertHandDepth(depth) : depth;
|
||||
|
||||
#if defined DISTANT_HORIZONS || defined VOXY
|
||||
float DH_z0 = DH_depth0;
|
||||
#else
|
||||
float DH_z0 = 1.0;
|
||||
#endif
|
||||
|
||||
float uvScalar = 3.0 * CUSTOM_LIGHTNING_SCALE;
|
||||
|
||||
vec3 normLightningpos = normalize(lightningpos);
|
||||
@@ -806,7 +795,7 @@ void main() {
|
||||
////// --------------- START BLENDING FOGS AND FORWARD RENDERED COLOR
|
||||
vec4 TranslucentShader = texelFetch(colortex2, ivec2(gl_FragCoord.xy), 0);
|
||||
|
||||
bool translucentCheck = TranslucentShader.a > 0.0 && TranslucentShader.a < 1.0;
|
||||
bool translucentCheck = TranslucentShader.a > 0.0 && TranslucentShader.a < 1.0;
|
||||
|
||||
////// --------------- AURORA
|
||||
|
||||
@@ -847,18 +836,19 @@ void main() {
|
||||
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));
|
||||
if(!isWater) color = mix(color, borderFog.rgb, getBorderFogDensity(linearDistance_cylinder_alt, normalize(playerPos_alt), z2 >= 1.0 || !translucentCheck));
|
||||
#endif
|
||||
#else
|
||||
vec4 borderFog = vec4(0.0);
|
||||
#endif
|
||||
|
||||
// apply block breaking effect.
|
||||
if(albedo.a > 0.01 && !isWater && TranslucentShader.a <= 0.0 && !isEntity) color = mix(color*6.0, color, luma(albedo.rgb)) * albedo.rgb;
|
||||
bool isBlockBreaking = data.a > 0.99;
|
||||
if(albedo.a > 0.01 && !isWater && !isEntity && isBlockBreaking && !hand) color = mix(color*6.0, color, luma(albedo.rgb)) * albedo.rgb;
|
||||
|
||||
// apply multiplicative color blend for glass n stuff
|
||||
#ifdef Glass_Tint
|
||||
if(!isWater) color *= mix(normalize(albedo.rgb+1e-7), vec3(1.0), max(borderFog.a, min(max(0.1-albedo.a,0.0) * 10.0,1.0))) ;
|
||||
if(!isWater && translucentCheck && !isBlockBreaking) color *= mix(normalize(albedo.rgb+1e-7), vec3(1.0), max(borderFog.a, min(max(0.1-albedo.a,0.0) * 10.0,1.0))) ;
|
||||
#endif
|
||||
|
||||
// blend forward rendered programs onto the color.
|
||||
|
||||
+103
-34
@@ -25,9 +25,29 @@ uint GetVoxelBlock(const in ivec3 voxelPos) {
|
||||
|
||||
uniform bool is_sneaking;
|
||||
uniform float frameTimeCounter;
|
||||
uniform float frameTime;
|
||||
|
||||
#if IRIS_VERSION >= 11004
|
||||
uniform bool onWaterSurface;
|
||||
uniform int vehicleId;
|
||||
uniform bool vehicleInWater;
|
||||
uniform bool feetInWater;
|
||||
uniform vec3 relativeVehiclePosition;
|
||||
uniform bool isRiding;
|
||||
#endif
|
||||
|
||||
vec2 getPlayerMovementOffset() {
|
||||
vec2 currentPos = cameraPosition.xz-relativeEyePosition.xz;
|
||||
vec2 currentPos = cameraPosition.xz;
|
||||
|
||||
#if IRIS_VERSION >= 11004
|
||||
if(isRiding) {
|
||||
currentPos -= relativeVehiclePosition.xz;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
currentPos -= relativeEyePosition.xz;
|
||||
}
|
||||
|
||||
vec2 previousPos = previousCameraPositionWave2.xz;
|
||||
vec2 movement = currentPos - previousPos;
|
||||
#if WATER_SIM_SCALE == 0
|
||||
@@ -40,46 +60,48 @@ vec2 getPlayerMovementOffset() {
|
||||
void main() {
|
||||
#if WATER_INTERACTION == 2
|
||||
if (abs(frameTimeCounter - lastFrameTimeCount) > WATER_SIM_FRAMETIME) {
|
||||
float playerTallness = 1.5;
|
||||
if(is_sneaking) playerTallness = 1.2;
|
||||
#if !defined IS_LPV_ENABLED && !defined SHADER_GRASS
|
||||
vec3 rayStart = vec3(0.0);
|
||||
#else
|
||||
vec3 rayStart = vec3(-relativeEyePosition);
|
||||
#endif
|
||||
vec3 LPVpos = GetLpvPosition(rayStart);
|
||||
uint BlockID1 = GetVoxelBlock(ivec3(LPVpos));
|
||||
uint BlockID2 = GetVoxelBlock(ivec3(LPVpos.x, LPVpos.y - 0.5*playerTallness, LPVpos.z));
|
||||
uint BlockID3 = GetVoxelBlock(ivec3(LPVpos.x, LPVpos.y - playerTallness, LPVpos.z));
|
||||
|
||||
|
||||
// Big shenanigans lol, don't ask, it just works
|
||||
if(noSimOngoingCheck) {
|
||||
noSimOngoing = true;
|
||||
} else {
|
||||
noSimOngoing = false;
|
||||
}
|
||||
noSimOngoing = noSimOngoingCheck;
|
||||
noSimOngoingCheck = true;
|
||||
inShip = false;
|
||||
onWaterSurface = false;
|
||||
inBoat = false;
|
||||
bool inBoat2Frames = inBoatLastFrame;
|
||||
inBoatLastFrame = inBoatCurrentFrame;
|
||||
inBoatCurrentFrame = false;
|
||||
|
||||
bool inShip2Frames = inShipLastFrame;
|
||||
inShipLastFrame = inShipCurrentFrame;
|
||||
inShipCurrentFrame = false;
|
||||
#if IRIS_VERSION >= 11004
|
||||
bool inBoat = vehicleId == ENTITY_BOAT;
|
||||
|
||||
if(BlockID1 == BLOCK_WATER || BlockID2 == BLOCK_WATER || BlockID3 == BLOCK_WATER) onWaterSurface = true;
|
||||
bool inShip = false;
|
||||
#else
|
||||
float playerTallness = 1.5;
|
||||
if(is_sneaking) playerTallness = 1.2;
|
||||
#if !defined IS_LPV_ENABLED && !defined SHADER_GRASS
|
||||
vec3 rayStart = vec3(0.0);
|
||||
#else
|
||||
vec3 rayStart = vec3(-relativeEyePosition);
|
||||
#endif
|
||||
vec3 LPVpos = GetLpvPosition(rayStart);
|
||||
uint BlockID1 = GetVoxelBlock(ivec3(LPVpos));
|
||||
uint BlockID2 = GetVoxelBlock(ivec3(LPVpos.x, LPVpos.y - 0.5*playerTallness, LPVpos.z));
|
||||
uint BlockID3 = GetVoxelBlock(ivec3(LPVpos.x, LPVpos.y - playerTallness, LPVpos.z));
|
||||
|
||||
if(BlockID1 == ENTITY_BOAT || BlockID2 == ENTITY_BOAT || BlockID3 == ENTITY_BOAT) inBoatCurrentFrame = true;
|
||||
// Big shenanigans lol, don't ask, it just works
|
||||
bool inShip = false;
|
||||
onWaterSurface = false;
|
||||
bool inBoat = false;
|
||||
bool inBoat2Frames = inBoatLastFrame;
|
||||
inBoatLastFrame = inBoatCurrentFrame;
|
||||
inBoatCurrentFrame = false;
|
||||
|
||||
if(BlockID1 == ENTITY_SMALLSHIPS || BlockID2 == ENTITY_SMALLSHIPS || BlockID3 == ENTITY_SMALLSHIPS) inShipCurrentFrame = true;
|
||||
bool inShip2Frames = inShipLastFrame;
|
||||
inShipLastFrame = inShipCurrentFrame;
|
||||
inShipCurrentFrame = false;
|
||||
|
||||
if(inBoatCurrentFrame || inBoatLastFrame || inBoat2Frames) inBoat = true;
|
||||
if(BlockID1 == BLOCK_WATER || BlockID2 == BLOCK_WATER || BlockID3 == BLOCK_WATER) onWaterSurface = true;
|
||||
|
||||
if(inShipCurrentFrame || inShipLastFrame || inShip2Frames) inShip = true;
|
||||
if(BlockID1 == ENTITY_BOAT || BlockID2 == ENTITY_BOAT || BlockID3 == ENTITY_BOAT) inBoatCurrentFrame = true;
|
||||
|
||||
if(BlockID1 == ENTITY_SMALLSHIPS || BlockID2 == ENTITY_SMALLSHIPS || BlockID3 == ENTITY_SMALLSHIPS) inShipCurrentFrame = true;
|
||||
|
||||
if(inBoatCurrentFrame || inBoatLastFrame || inBoat2Frames) inBoat = true;
|
||||
|
||||
if(inShipCurrentFrame || inShipLastFrame || inShip2Frames) inShip = true;
|
||||
#endif
|
||||
|
||||
vec2 playerMovement = getPlayerMovementOffset();
|
||||
water_move_compensation_counter_SSBO += playerMovement;
|
||||
@@ -90,6 +112,53 @@ void main() {
|
||||
water_move_compensationSSBO = offset;
|
||||
water_move_compensation_counter_SSBO -= vec2(offset);
|
||||
}
|
||||
|
||||
if (onWaterSurface) {
|
||||
vec3 position = cameraPosition-previousCameraPositionWave;
|
||||
#if IRIS_VERSION >= 11004
|
||||
if(isRiding) {
|
||||
position -= relativeVehiclePosition;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
position -= relativeEyePosition;
|
||||
}
|
||||
|
||||
vec3 velocity = position/frameTime;
|
||||
velocity.y *= 1.2;
|
||||
float speed = length(velocity);
|
||||
|
||||
float size = 10.0;
|
||||
#if IRIS_VERSION >= 11004
|
||||
if(inBoat) {
|
||||
size += 23.0;
|
||||
} else if (inShip) {
|
||||
size += 61.0 * smoothstep(0.0, 10.0, speed);
|
||||
} else {
|
||||
size += 10.0 * smoothstep(0.1, 13.0, speed);
|
||||
}
|
||||
#else
|
||||
if(inBoat) {
|
||||
size += 26.0 * smoothstep(0.0, 10.0, speed);
|
||||
} else if (inShip) {
|
||||
size += 61.0 * smoothstep(0.0, 10.0, speed);
|
||||
} else {
|
||||
size += 10.0 * smoothstep(0.1, 13.0, speed);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if WATER_SIM_SCALE == 0
|
||||
size *= 0.5;
|
||||
#else
|
||||
size *= WATER_SIM_SCALE;
|
||||
#endif
|
||||
|
||||
#if IRIS_VERSION >= 11004
|
||||
if(speed < 0.15 && isRiding) size = 0.01;
|
||||
#endif
|
||||
|
||||
waterRoundSize = size;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -43,11 +43,7 @@ layout (rgba16f) uniform image2D waveSim2;
|
||||
const ivec2 resolution = ivec2(workGroups.x * 32, workGroups.y * 32);
|
||||
|
||||
uniform int frameCounter;
|
||||
uniform float frameTime;
|
||||
uniform float frameTimeCounter;
|
||||
uniform vec3 cameraPosition;
|
||||
uniform vec3 previousCameraPosition;
|
||||
uniform vec3 relativeEyePosition;
|
||||
|
||||
#include "/lib/SSBOs.glsl"
|
||||
|
||||
@@ -61,10 +57,19 @@ uniform vec3 relativeEyePosition;
|
||||
const float delta = 1.4;
|
||||
#endif
|
||||
|
||||
#if IRIS_VERSION >= 11004
|
||||
uniform bool onWaterSurface;
|
||||
uniform vec3 vehicleLookVector;
|
||||
uniform bool isRiding;
|
||||
uniform int vehicleId;
|
||||
|
||||
#include "/lib/entities.glsl"
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
#if WATER_INTERACTION == 2
|
||||
if (abs(frameTimeCounter - lastFrameTimeCount) > WATER_SIM_FRAMETIME && (!noSimOngoing || onWaterSurface)) {
|
||||
if (frameCounter == 0) return;
|
||||
// if (frameCounter == 0) return;
|
||||
ivec2 imgCoord = ivec2(gl_GlobalInvocationID.xy);
|
||||
float dist = length(imgCoord-0.5*resolution);
|
||||
if (dist >= resolution.x) return;
|
||||
@@ -80,9 +85,9 @@ void main() {
|
||||
float pVel = oldState.y;
|
||||
|
||||
#if WATER_SIM_FRAMERATE == 30
|
||||
int offset = 2;
|
||||
const int offset = 2;
|
||||
#else
|
||||
int offset = 1;
|
||||
const int offset = 1;
|
||||
#endif
|
||||
|
||||
float p_down = imageLoad(waveSim2, clamp(sampledCoord + ivec2(0, -offset), ivec2(offset), resolution - ivec2(offset))).r;
|
||||
@@ -109,35 +114,33 @@ void main() {
|
||||
pVel -= 0.0014 * delta * pressure;
|
||||
|
||||
// Velocity damping so things eventually calm down
|
||||
pVel *= 1.0 - 0.003 * delta;
|
||||
pVel *= 1.0 - 0.006 * delta;
|
||||
|
||||
// Pressure damping to prevent it from building up forever.
|
||||
float distFade = smoothstep(0.49*resolution.x, 0.4*resolution.x, dist);
|
||||
float distFade = smoothstep(0.49*resolution.x, 0.25*resolution.x, dist);
|
||||
pressure *= 0.985 * distFade;
|
||||
pVel *= distFade;
|
||||
|
||||
if (onWaterSurface) {
|
||||
vec3 velocity = (cameraPosition-relativeEyePosition-previousCameraPositionWave)/frameTime;
|
||||
velocity.y *= 1.15;
|
||||
float speed = length(velocity);
|
||||
#if IRIS_VERSION >= 11004
|
||||
if(isRiding && vehicleId == ENTITY_BOAT) {
|
||||
vec2 p = imgCoord - 0.5 * resolution;
|
||||
vec2 f = normalize(vehicleLookVector.xz);
|
||||
|
||||
float size = 10.0;
|
||||
if(inBoat) {
|
||||
size += 26.0 * smoothstep(0.0, 10.0, speed);
|
||||
} else if (inShip) {
|
||||
size += 61.0 * smoothstep(0.0, 10.0, speed);
|
||||
} else {
|
||||
size += 10.0 * smoothstep(0.1, 13.0, speed);
|
||||
}
|
||||
#if WATER_SIM_SCALE == 0
|
||||
size *= 0.5;
|
||||
#else
|
||||
size *= WATER_SIM_SCALE;
|
||||
float t = dot(p, f);
|
||||
|
||||
t = clamp(t, -waterRoundSize * 0.73, waterRoundSize * 0.73);
|
||||
|
||||
float dist = length(p - f * t);
|
||||
|
||||
float shape = smoothstep(waterRoundSize, 0.7 * waterRoundSize, dist);
|
||||
|
||||
pressure += shape * (smoothstep(-waterRoundSize * 0.75, waterRoundSize * 0.75, t)* 2.0 - 1.0);
|
||||
} else
|
||||
#endif
|
||||
|
||||
float upOrDown = step(-0.1, cameraPosition.y-relativeEyePosition.y-previousCameraPositionWave.y)*2.0-1.0;
|
||||
|
||||
pressure += smoothstep(size, 0.7*size, dist) * upOrDown;
|
||||
{
|
||||
pressure += smoothstep(waterRoundSize, 0.7*waterRoundSize, dist);
|
||||
}
|
||||
}
|
||||
|
||||
if(abs(pressure) > 0.0) noSimOngoingCheck = false;
|
||||
|
||||
@@ -43,11 +43,8 @@ layout (rgba16f) uniform image2D waveSim2;
|
||||
const ivec2 resolution = ivec2(workGroups.x * 32, workGroups.y * 32);
|
||||
|
||||
uniform int frameCounter;
|
||||
uniform float frameTime;
|
||||
uniform float frameTimeCounter;
|
||||
uniform vec3 cameraPosition;
|
||||
uniform vec3 previousCameraPosition;
|
||||
uniform vec3 relativeEyePosition;
|
||||
|
||||
|
||||
#include "/lib/SSBOs.glsl"
|
||||
|
||||
@@ -61,10 +58,19 @@ uniform vec3 relativeEyePosition;
|
||||
const float delta = 1.4;
|
||||
#endif
|
||||
|
||||
#if IRIS_VERSION >= 11004
|
||||
uniform bool onWaterSurface;
|
||||
uniform vec3 vehicleLookVector;
|
||||
uniform bool isRiding;
|
||||
uniform int vehicleId;
|
||||
|
||||
#include "/lib/entities.glsl"
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
#if WATER_INTERACTION == 2
|
||||
if (abs(frameTimeCounter - lastFrameTimeCount) > WATER_SIM_FRAMETIME && (!noSimOngoing || onWaterSurface)) {
|
||||
if (frameCounter == 0) return;
|
||||
// if (frameCounter == 0) return;
|
||||
ivec2 imgCoord = ivec2(gl_GlobalInvocationID.xy);
|
||||
float dist = length(imgCoord-0.5*resolution);
|
||||
if (dist >= resolution.x) return;
|
||||
@@ -78,9 +84,9 @@ void main() {
|
||||
float pVel = oldState.y;
|
||||
|
||||
#if WATER_SIM_FRAMERATE == 30
|
||||
int offset = 2;
|
||||
const int offset = 2;
|
||||
#else
|
||||
int offset = 1;
|
||||
const int offset = 1;
|
||||
#endif
|
||||
|
||||
float p_down = imageLoad(waveSim, clamp(sampledCoord + ivec2(0, -offset), ivec2(offset), resolution - ivec2(offset))).r;
|
||||
@@ -107,35 +113,33 @@ void main() {
|
||||
pVel -= 0.0014 * delta * pressure;
|
||||
|
||||
// Velocity damping so things eventually calm down
|
||||
pVel *= 1.0 - 0.003 * delta;
|
||||
pVel *= 1.0 - 0.006 * delta;
|
||||
|
||||
// Pressure damping to prevent it from building up forever.
|
||||
float distFade = smoothstep(0.49*resolution.x, 0.4*resolution.x, dist);
|
||||
float distFade = smoothstep(0.49*resolution.x, 0.25*resolution.x, dist);
|
||||
pressure *= 0.985 * distFade;
|
||||
pVel *= distFade;
|
||||
|
||||
if (onWaterSurface) {
|
||||
vec3 velocity = (cameraPosition-relativeEyePosition-previousCameraPositionWave)/frameTime;
|
||||
velocity.y *= 1.15;
|
||||
float speed = length(velocity);
|
||||
#if IRIS_VERSION >= 11004
|
||||
if(isRiding && vehicleId == ENTITY_BOAT) {
|
||||
vec2 p = imgCoord - 0.5 * resolution;
|
||||
vec2 f = normalize(vehicleLookVector.xz);
|
||||
|
||||
float size = 10.0;
|
||||
if(inBoat) {
|
||||
size += 26.0 * smoothstep(0.0, 10.0, speed);
|
||||
} else if (inShip) {
|
||||
size += 61.0 * smoothstep(0.0, 10.0, speed);
|
||||
} else {
|
||||
size += 10.0 * smoothstep(0.1, 13.0, speed);
|
||||
}
|
||||
#if WATER_SIM_SCALE == 0
|
||||
size *= 0.5;
|
||||
#else
|
||||
size *= WATER_SIM_SCALE;
|
||||
float t = dot(p, f);
|
||||
|
||||
t = clamp(t, -waterRoundSize * 0.73, waterRoundSize * 0.73);
|
||||
|
||||
float dist = length(p - f * t);
|
||||
|
||||
float shape = smoothstep(waterRoundSize, 0.7 * waterRoundSize, dist);
|
||||
|
||||
pressure += shape * (smoothstep(-waterRoundSize * 0.75, waterRoundSize * 0.75, t)* 2.0 - 1.0);
|
||||
} else
|
||||
#endif
|
||||
|
||||
float upOrDown = step(-0.1, cameraPosition.y-relativeEyePosition.y-previousCameraPositionWave.y)*2.0-1.0;
|
||||
|
||||
pressure += smoothstep(size, 0.7*size, dist) * upOrDown;
|
||||
{
|
||||
pressure += smoothstep(waterRoundSize, 0.7*waterRoundSize, dist);
|
||||
}
|
||||
}
|
||||
|
||||
imageStore(waveSim2, imgCoord, vec4(pressure, pVel, (p_right - p_left) / 2.0, (p_up - p_down) / 2.0));
|
||||
|
||||
@@ -9,13 +9,33 @@ uniform float frameTimeCounter;
|
||||
uniform vec3 cameraPosition;
|
||||
uniform vec3 relativeEyePosition;
|
||||
|
||||
#if IRIS_VERSION >= 11004
|
||||
uniform vec3 relativeVehiclePosition;
|
||||
uniform bool isRiding;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
#if WATER_INTERACTION == 2
|
||||
if (abs(frameTimeCounter - lastFrameTimeCount) > WATER_SIM_FRAMETIME) {
|
||||
lastFrameTimeCount = frameTimeCounter;
|
||||
previousCameraPositionWave2 = cameraPosition-relativeEyePosition;
|
||||
}
|
||||
if (abs(frameTimeCounter - lastFrameTimeCount) > WATER_SIM_FRAMETIME) {
|
||||
lastFrameTimeCount = frameTimeCounter;
|
||||
|
||||
#if IRIS_VERSION >= 11004
|
||||
if(isRiding) {
|
||||
previousCameraPositionWave2 = cameraPosition - relativeVehiclePosition;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
previousCameraPositionWave2 = cameraPosition - relativeEyePosition;
|
||||
}
|
||||
}
|
||||
|
||||
previousCameraPositionWave = cameraPosition-relativeEyePosition;
|
||||
#if IRIS_VERSION >= 11004
|
||||
if(isRiding) {
|
||||
previousCameraPositionWave = cameraPosition - relativeVehiclePosition;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
previousCameraPositionWave = cameraPosition - relativeEyePosition;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -531,8 +531,8 @@ void main() {
|
||||
}
|
||||
|
||||
if (blockId == BLOCK_FURNACE_LIT) {
|
||||
lightColor = vec3(0.8, 0.7, 0.1);
|
||||
lightRange = 13.0;
|
||||
lightColor = vec3(0.85, 0.6, 0.12);
|
||||
lightRange = 12.0;
|
||||
}
|
||||
|
||||
if (blockId == BLOCK_GLOW_LICHEN || blockId == ITEM_GLOW_LICHEN) {
|
||||
|
||||
@@ -24,6 +24,7 @@ layout (local_size_x = 8, local_size_y = 8, local_size_z = 8) in;
|
||||
#include "/lib/hsv.glsl"
|
||||
#include "/lib/util.glsl"
|
||||
#include "/lib/blocks.glsl"
|
||||
#include "/lib/entities.glsl"
|
||||
#include "/lib/lpv_common.glsl"
|
||||
#include "/lib/lpv_blocks.glsl"
|
||||
#include "/lib/lpv_buffer.glsl"
|
||||
@@ -56,6 +57,10 @@ layout (local_size_x = 8, local_size_y = 8, local_size_z = 8) in;
|
||||
uint blockId = imageLoad(imgVoxelMask, voxelPos).r;
|
||||
|
||||
blockId = blockId % 2000u;
|
||||
|
||||
#if IRIS_VERSION < 11004
|
||||
if (blockId == ENTITY_BOAT || blockId == ENTITY_SMALLSHIPS) return BLOCK_EMPTY;
|
||||
#endif
|
||||
|
||||
return blockId;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"version": 1,
|
||||
"opaqueDrawBuffers": [1, 8, 15],
|
||||
"excludeLodsFromVanillaDepth": true,
|
||||
"translucentDrawBuffers": [2, 7, 14],
|
||||
"translucentDrawBuffers": [2, 7, 11, 14],
|
||||
#ifdef TAA
|
||||
"taaOffset": "{
|
||||
const vec2[4] offsets = vec2[4](
|
||||
@@ -21,7 +21,7 @@
|
||||
#ifdef TAA_UPSCALING
|
||||
"renderScale": [SCALE_FACTOR, SCALE_FACTOR],
|
||||
#endif
|
||||
"blending": {-1:"SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE"},
|
||||
"blending": {-1:"SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE", 2:"off"},
|
||||
"ssbos": {0:"{
|
||||
mat4 customShadowMatrixSSBO;
|
||||
|
||||
@@ -33,19 +33,19 @@
|
||||
|
||||
vec3 customSunVecSSBO;
|
||||
|
||||
#if IRIS_VERSION < 11004
|
||||
bool onWaterSurface;
|
||||
|
||||
bool inBoat;
|
||||
|
||||
bool inBoatCurrentFrame;
|
||||
|
||||
bool inBoatLastFrame;
|
||||
|
||||
bool inShip;
|
||||
|
||||
bool inShipCurrentFrame;
|
||||
|
||||
bool inShipLastFrame;
|
||||
#endif
|
||||
|
||||
float waterRoundSize;
|
||||
|
||||
float lastFrameTimeCount;
|
||||
|
||||
@@ -96,6 +96,8 @@
|
||||
}"},
|
||||
"useViewportDims": true,
|
||||
"uniforms": [
|
||||
"nightVision",
|
||||
"cloudTime",
|
||||
"noPuddleAreas",
|
||||
"dhVoxyRenderDistance",
|
||||
"worldDay",
|
||||
@@ -146,9 +148,6 @@
|
||||
"noisetex",
|
||||
"colortex4",
|
||||
"colortex5",
|
||||
"colortex7",
|
||||
"colortex8",
|
||||
"colortex12",
|
||||
"depthtex0",
|
||||
"depthtex1"
|
||||
]
|
||||
|
||||
@@ -61,7 +61,7 @@ void voxy_emitFragment(VoxyFragmentParameters parameters) {
|
||||
/////// ----- SSS ON BLOCKS ----- ///////
|
||||
// strong
|
||||
if (
|
||||
blockID == BLOCK_SSS_STRONG || blockID == BLOCK_AIR_WAVING
|
||||
blockID == BLOCK_SSS_STRONG || blockID == BLOCK_AIR_WAVING || blockID == BLOCK_SSS_STRONG_2
|
||||
) {
|
||||
SSSAMOUNT = 1.0;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
layout (location = 0) out vec4 gbuffer_data_0;
|
||||
layout (location = 1) out vec4 gbuffer_data_1;
|
||||
layout (location = 2) out vec4 gbuffer_data_2;
|
||||
layout (location = 3) out vec4 gbuffer_data_3;
|
||||
|
||||
#include "/lib/settings.glsl"
|
||||
#include "/lib/blocks.glsl"
|
||||
@@ -10,6 +11,9 @@ layout (location = 2) out vec4 gbuffer_data_2;
|
||||
#include "/lib/res_params.glsl"
|
||||
#include "/lib/TAA_jitter.glsl"
|
||||
|
||||
#undef IS_LPV_ENABLED
|
||||
#include "/lib/diffuse_lighting.glsl"
|
||||
|
||||
#ifdef OVERWORLD_SHADER
|
||||
#include "/lib/scene_controller.glsl"
|
||||
#define CLOUDSHADOWSONLY
|
||||
@@ -121,7 +125,7 @@ float DH_ld(float dist) {
|
||||
|
||||
vec3 rayTrace(vec3 dir, vec3 position, float dither, float fresnel) {
|
||||
|
||||
const float biasAmount = 0.000015;
|
||||
const float biasAmount = 0.00015;
|
||||
|
||||
float quality = float(FORWARD_SSR_QUALITY);
|
||||
vec3 clipPosition = DH_toClipSpace3(position);
|
||||
@@ -150,11 +154,15 @@ vec3 rayTrace(vec3 dir, vec3 position, float dither, float fresnel) {
|
||||
if(spos.x < 0 || spos.x > 1 || spos.y < 0 || spos.y > 1) return vec3(1.1);
|
||||
#endif
|
||||
|
||||
float sp = texelFetch(vxDepthTexOpaque, ivec2(spos.xy / texelSize), 0).r;
|
||||
|
||||
if (sp < max(minZ, maxZ) && sp > min(minZ, maxZ)) {
|
||||
return vec3(spos.xy / RENDER_SCALE, sp);
|
||||
}
|
||||
float vanillaDepth = texelFetch(depthtex0, ivec2(spos.xy / texelSize), 0).r;
|
||||
|
||||
if(vanillaDepth >= 1.0) {
|
||||
float sp = texelFetch(vxDepthTexOpaque, ivec2(spos.xy / texelSize), 0).r;
|
||||
|
||||
if (sp < max(minZ, maxZ) && sp > min(minZ, maxZ)) {
|
||||
return vec3(spos.xy / RENDER_SCALE, sp);
|
||||
}
|
||||
}
|
||||
|
||||
minZ = maxZ - biasAmount / DH_ld(spos.z);
|
||||
maxZ += stepv.z;
|
||||
@@ -248,8 +256,16 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
vec3 AmbientLightColor = vec3(0.5);
|
||||
#endif
|
||||
|
||||
Indirect_lighting = AmbientLightColor;
|
||||
vec3 MinimumLightColor = vec3(1.0);
|
||||
Indirect_lighting = doIndirectLighting(AmbientLightColor, MinimumLightColor, parameters.lightMap.y);
|
||||
|
||||
|
||||
float indoors = min(max(parameters.lightMap.y-0.5,0.0)/0.4,1.0);
|
||||
|
||||
vec3 lightColor = vec3(TORCH_R,TORCH_G,TORCH_B);
|
||||
const vec3 lpvPos = vec3(0.0);
|
||||
Indirect_lighting += doBlockLightLighting(lightColor, parameters.lightMap.x * 0.8, feetPlayerPos, lpvPos);
|
||||
|
||||
vec3 FinalColor = (Indirect_lighting + Direct_lighting*indoors) * Albedo;
|
||||
|
||||
#ifndef VANILLA_LIKE_WATER
|
||||
@@ -305,12 +321,12 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
#if defined FORWARD_BACKGROUND_REFLECTION
|
||||
BackgroundReflection = skyCloudsFromTex(mat3(gbufferModelViewInverse) * reflectedVector, colortex4).rgb / 1200.0;
|
||||
#endif
|
||||
#ifdef WATER_SUN_SPECULAR
|
||||
SunReflection = (DirectLightColor * Shadows) * GGX(normalize(normals), -normalize(viewPos), normalize(WsunVec2), roughness, f0) * (1.0-Reflections.a);
|
||||
#if defined OVERWORLD_SHADER && SUN_SPECULAR_MULT > 0
|
||||
SunReflection = SUN_SPECULAR_MULT * DirectLightColor * Shadows * GGX(normalize(normals), -normalize(viewPos), normalize(WsunVec2), roughness, f0) * (1.0-Reflections.a);
|
||||
#endif
|
||||
|
||||
Reflections_Final = mix(FinalColor, mix(BackgroundReflection*SSR_HIT_SKY_MASK, Reflections.rgb, Reflections.a), fresnel);
|
||||
Reflections_Final += SunReflection*indoors;
|
||||
Reflections_Final += SunReflection*SSR_HIT_SKY_MASK;
|
||||
|
||||
gbuffer_data_0.a = gbuffer_data_0.a + (1.0-gbuffer_data_0.a) * fresnel;
|
||||
|
||||
@@ -328,7 +344,15 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
|
||||
gbuffer_data_1 = vec4(Albedo, material);
|
||||
|
||||
gbuffer_data_2 = vec4(1, 1, encodeVec2(parameters.lightMap), 1);
|
||||
vec4 GLASS_TINT_COLORS = vec4(Albedo, UnchangedAlpha);
|
||||
|
||||
#ifdef BIOME_TINT_WATER
|
||||
if (isWater) GLASS_TINT_COLORS.rgb = toLinear(parameters.tinting.rgb);
|
||||
#endif
|
||||
|
||||
gbuffer_data_2 = vec4(encodeVec2(vec2(0.5)), encodeVec2(GLASS_TINT_COLORS.rg), encodeVec2(GLASS_TINT_COLORS.ba), 0.0);
|
||||
|
||||
gbuffer_data_3 = vec4(1, 1, encodeVec2(parameters.lightMap), 1);
|
||||
|
||||
}
|
||||
}
|
||||
+17
-4
@@ -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.10.2
|
||||
value.SHADER_VERSION_LABEL.482 = 6.0.0
|
||||
|
||||
# if you're here to translate, this is not a joke, these do what they say
|
||||
profile.POTATO=§4Potato
|
||||
@@ -17,9 +17,9 @@ profile.ULTRA=§dUltra
|
||||
|
||||
option.OLD_LIGHTLEAK_FIX = Old Lightleak Fix
|
||||
option.CAVE_DETECTION = Cave detection
|
||||
value.CAVE_DETECTION.0.0 = ON
|
||||
value.CAVE_DETECTION.1.0 = Y < 62.0
|
||||
value.CAVE_DETECTION.2.0 = OFF
|
||||
value.CAVE_DETECTION.0 = ON
|
||||
value.CAVE_DETECTION.1 = Y < 62.0
|
||||
value.CAVE_DETECTION.2 = OFF
|
||||
option.sunPathRotation = Sun Angle
|
||||
suffix.sunPathRotation = °
|
||||
option.sun_illuminance = Sun Brightness
|
||||
@@ -246,6 +246,7 @@ screen.Direct_Light = Direct Light
|
||||
value.LPV_VL_FOG_ILLUMINATION.2 = On
|
||||
option.LPV_VL_FOG_ILLUMINATION_BRIGHTNESS = Fog Light Propagation Brightness
|
||||
suffix.LPV_VL_FOG_ILLUMINATION_BRIGHTNESS=%
|
||||
option.LPV_VL_FOG_ILLUMINATION_HANDHELD_WATER = Water Fog Handheld Light Propagation
|
||||
option.VANILLA_LIGHTMAP_MASK = Vanilla Lightmap Mask
|
||||
option.LPV_HANDHELD_SHADOWS = Handheld Shadows
|
||||
option.LPV_HANDHELD_SHADOWS_STRENGTH = Handheld Shadows Strength
|
||||
@@ -276,6 +277,7 @@ screen.Ambient_light = Ambient Light
|
||||
option.RAY_COUNT.comment = Helps reduce visual noise of SSRT. §aPERFORMANCE COST:§r High
|
||||
option.RAY_STEPS = Ray Steps
|
||||
option.HANDHELD_LIGHT_RANGE = Handheld Light Range
|
||||
option.GTAO_SLICES = GTAO Quality
|
||||
|
||||
screen.SSRT_SETTINGS = SSRT Settings
|
||||
|
||||
@@ -639,6 +641,14 @@ screen.Climate = Climate Settings
|
||||
option.DARKFOREST_R = Red Amount
|
||||
option.DARKFOREST_G = Green Amount
|
||||
option.DARKFOREST_B = Blue Amount
|
||||
|
||||
screen.PALE_GARDEN = Dark Forest
|
||||
option.PALE_GARDEN_ENV = Pale Garden Environment
|
||||
option.PALE_GARDEN_UNIFORM_DENSITY = Uniform Fog Density
|
||||
option.PALE_GARDEN_CLOUDY_DENSITY = Cloudy Fog Density
|
||||
option.PALE_GARDEN_R = Red Amount
|
||||
option.PALE_GARDEN_G = Green Amount
|
||||
option.PALE_GARDEN_B = Blue Amount
|
||||
|
||||
screen.World = World
|
||||
screen.Sky_coefficients = Sky Coefficients
|
||||
@@ -1159,6 +1169,9 @@ screen.Climate.comment = Configure settings related to the climate, like seasona
|
||||
screen.DARKFOREST.comment = Configure the environment in this biome type.
|
||||
option.DARKFOREST_ENV.comment = Toggle the environment only for this biome type. The other biome environments remain active even if this one is disabled.
|
||||
|
||||
screen.PALE_GARDEN.comment = Configure the environment in this biome type.
|
||||
option.PALE_GARDEN_ENV.comment = Toggle the environment only for this biome type. The other biome environments remain active even if this one is disabled.
|
||||
|
||||
|
||||
screen.Foliage.comment = Configure settings related to foliage.
|
||||
option.WAVY_PLANTS.comment = Toggle waving plants. §aPERFORMANCE COST:§r very low
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
option.SHADER_VERSION_LABEL = §d§lECLIPSE§r - Bliss 编辑版
|
||||
prefix.SHADER_VERSION_LABEL = 版本
|
||||
value.SHADER_VERSION_LABEL.482 = 5.10.2
|
||||
value.SHADER_VERSION_LABEL.482 = 6.0.0
|
||||
|
||||
# 如果你是来翻译的,这不是玩笑,这些选项的功能正如其名
|
||||
profile.POTATO=§4土豆 (极低配置)
|
||||
@@ -17,9 +17,9 @@ profile.ULTRA=§d极致
|
||||
|
||||
option.OLD_LIGHTLEAK_FIX = 旧版漏光修复
|
||||
option.CAVE_DETECTION = 洞穴检测
|
||||
value.CAVE_DETECTION.0.0 = 开启
|
||||
value.CAVE_DETECTION.1.0 = Y < 62.0
|
||||
value.CAVE_DETECTION.2.0 = 关闭
|
||||
value.CAVE_DETECTION.0 = 开启
|
||||
value.CAVE_DETECTION.1 = Y < 62.0
|
||||
value.CAVE_DETECTION.2 = 关闭
|
||||
option.sunPathRotation = 太阳角度
|
||||
suffix.sunPathRotation = °
|
||||
option.sun_illuminance = 太阳亮度
|
||||
|
||||
@@ -96,7 +96,7 @@ vec3 view_to_screen_space(vec3 view_pos, bool handle_jitter) {
|
||||
// ambient occlusion
|
||||
// ---------------------
|
||||
|
||||
#define GTAO_SLICES 2
|
||||
#define GTAO_SLICES 2 // [1 2 3 4 5 6 7 8 9 10]
|
||||
#define GTAO_HORIZON_STEPS 3
|
||||
#define GTAO_RADIUS 2.0
|
||||
#define GTAO_FALLOFF_START 0.75
|
||||
@@ -122,7 +122,7 @@ float calculate_maximum_horizon_angle(
|
||||
|
||||
|
||||
for (int i = 0; i < GTAO_HORIZON_STEPS; ++i, ray_pos += ray_step) {
|
||||
float depth = texelFetch(depthtex1, ivec2(clamp(ray_pos,0.0,1.0) * view_res * taau_render_scale - 0.5), 0).x;
|
||||
float depth = texelFetch(depthtex2, ivec2(clamp(ray_pos,0.0,1.0) * view_res * taau_render_scale - 0.5), 0).x;
|
||||
|
||||
if (depth == 1.0 || depth < hand_depth || depth == screen_pos.z) continue;
|
||||
|
||||
|
||||
@@ -9,19 +9,19 @@ layout(binding = 0) buffer SSBO1 {
|
||||
|
||||
vec3 customSunVecSSBO; // 12 bytes
|
||||
|
||||
#if IRIS_VERSION < 11004
|
||||
bool onWaterSurface; // 1 byte
|
||||
|
||||
bool inBoat; // 1 byte
|
||||
|
||||
bool inBoatCurrentFrame; // 1 byte
|
||||
|
||||
bool inBoatLastFrame; // 1 byte
|
||||
|
||||
bool inShip; // 1 byte
|
||||
|
||||
bool inShipCurrentFrame; // 1 byte
|
||||
|
||||
bool inShipLastFrame; // 1 byte
|
||||
#endif
|
||||
|
||||
float waterRoundSize;
|
||||
|
||||
float lastFrameTimeCount; // 4 bytes
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#define BLOCK_GROUND_WAVING 54
|
||||
#define BLOCK_GROUND_WAVING_VERTICAL 55
|
||||
#define BLOCK_AIR_WAVING 56
|
||||
#define BLOCK_SSS_STRONG_2 79
|
||||
#define BLOCK_SSS_STRONG 80
|
||||
#define BLOCK_SSS_WEAK 81
|
||||
#define BLOCK_SSS_WEAK_2 82
|
||||
|
||||
@@ -126,47 +126,23 @@
|
||||
uniform float isJungles;
|
||||
uniform float isSwamps;
|
||||
uniform float isDarkForests;
|
||||
uniform float isPaleGarden;
|
||||
uniform float sandStorm;
|
||||
uniform float snowStorm;
|
||||
#endif
|
||||
|
||||
#ifdef PER_BIOME_ENVIRONMENT
|
||||
|
||||
void BiomeFogColor(
|
||||
inout vec3 FinalFogColor
|
||||
){
|
||||
|
||||
|
||||
// this is a little complicated? lmao
|
||||
vec3 BiomeColors = vec3(0.0);
|
||||
BiomeColors.r = isSwamps*SWAMP_R + isJungles*JUNGLE_R + isDarkForests*DARKFOREST_R + sandStorm*1.0 + snowStorm*0.6;
|
||||
BiomeColors.g = isSwamps*SWAMP_G + isJungles*JUNGLE_G + isDarkForests*DARKFOREST_G + sandStorm*0.5 + snowStorm*0.8;
|
||||
BiomeColors.b = isSwamps*SWAMP_B + isJungles*JUNGLE_B + isDarkForests*DARKFOREST_B + sandStorm*0.3 + snowStorm*1.0;
|
||||
|
||||
// insure the biome colors are locked to the fog shape and lighting, but not its orignal color.
|
||||
BiomeColors *= max(dot(FinalFogColor,vec3(0.33333)), MIN_LIGHT_AMOUNT*0.025);
|
||||
|
||||
// these range 0.0-1.0. they will never overlap.
|
||||
float Inbiome = isJungles+isSwamps+isDarkForests+sandStorm+snowStorm;
|
||||
|
||||
// interpoloate between normal fog colors and biome colors. the transition speeds are conrolled by the biome uniforms.
|
||||
FinalFogColor = mix(FinalFogColor, BiomeColors, Inbiome);
|
||||
}
|
||||
|
||||
void BiomeFogDensity(
|
||||
inout vec4 UniformDensity,
|
||||
inout vec4 CloudyDensity,
|
||||
float maxDistance
|
||||
){
|
||||
// these range 0.0-1.0. they will never overlap.
|
||||
float Inbiome = isJungles+isSwamps+isDarkForests+sandStorm+snowStorm;
|
||||
float Inbiome = clamp(isPaleGarden+isJungles+isSwamps+isDarkForests+sandStorm+snowStorm, 0.0, 1.0);
|
||||
|
||||
vec2 BiomeFogDensity = vec2(0.0); // x = uniform || y = cloudy
|
||||
// BiomeFogDensity.x = isSwamps*SWAMP_UNIFORM_DENSITY + isJungles*JUNGLE_UNIFORM_DENSITY + isDarkForests*DARKFOREST_UNIFORM_DENSITY + sandStorm*15 + snowStorm*150;
|
||||
// BiomeFogDensity.y = isSwamps*SWAMP_CLOUDY_DENSITY + isJungles*JUNGLE_CLOUDY_DENSITY + isDarkForests*DARKFOREST_CLOUDY_DENSITY + sandStorm*255 + snowStorm*255;
|
||||
|
||||
BiomeFogDensity.x = isSwamps*SWAMP_UNIFORM_DENSITY + isJungles*JUNGLE_UNIFORM_DENSITY + isDarkForests*DARKFOREST_UNIFORM_DENSITY + sandStorm*0.0 + snowStorm*0.01;
|
||||
BiomeFogDensity.y = isSwamps*SWAMP_CLOUDY_DENSITY + isJungles*JUNGLE_CLOUDY_DENSITY + isDarkForests*DARKFOREST_CLOUDY_DENSITY + sandStorm*0.5 + snowStorm*0.5;
|
||||
BiomeFogDensity.y = isPaleGarden*PALE_GARDEN_CLOUDY_DENSITY + isSwamps*SWAMP_CLOUDY_DENSITY + isJungles*JUNGLE_CLOUDY_DENSITY + isDarkForests*DARKFOREST_CLOUDY_DENSITY + sandStorm*0.5 + snowStorm*0.5;
|
||||
|
||||
UniformDensity = mix(UniformDensity, vec4(BiomeFogDensity.x), Inbiome*maxDistance);
|
||||
CloudyDensity = mix(CloudyDensity, vec4(BiomeFogDensity.y), Inbiome*maxDistance);
|
||||
@@ -176,23 +152,17 @@
|
||||
|
||||
// this is a little complicated? lmao
|
||||
vec3 BiomeColors = vec3(0.0);
|
||||
BiomeColors.r = isSwamps*SWAMP_R + isJungles*JUNGLE_R + isDarkForests*DARKFOREST_R + sandStorm*1.0 + snowStorm*0.6;
|
||||
BiomeColors.g = isSwamps*SWAMP_G + isJungles*JUNGLE_G + isDarkForests*DARKFOREST_G + sandStorm*0.3 + snowStorm*0.8;
|
||||
BiomeColors.b = isSwamps*SWAMP_B + isJungles*JUNGLE_B + isDarkForests*DARKFOREST_B + sandStorm*0.1 + snowStorm*1.0;
|
||||
|
||||
// insure the biome colors are locked to the fog shape and lighting, but not its orignal color.
|
||||
// DirectLightCol = BiomeColors * max(dot(DirectLightCol,vec3(0.33333)), MIN_LIGHT_AMOUNT*0.025 + nightVision*0.2);
|
||||
// IndirectLightCol = BiomeColors * max(dot(IndirectLightCol,vec3(0.33333)), MIN_LIGHT_AMOUNT*0.025 + nightVision*0.2);
|
||||
BiomeColors.r = isPaleGarden*PALE_GARDEN_R + isSwamps*SWAMP_R + isJungles*JUNGLE_R + isDarkForests*DARKFOREST_R + sandStorm*1.0 + snowStorm*0.6;
|
||||
BiomeColors.g = isPaleGarden*PALE_GARDEN_G + isSwamps*SWAMP_G + isJungles*JUNGLE_G + isDarkForests*DARKFOREST_G + sandStorm*0.3 + snowStorm*0.8;
|
||||
BiomeColors.b = isPaleGarden*PALE_GARDEN_B + isSwamps*SWAMP_B + isJungles*JUNGLE_B + isDarkForests*DARKFOREST_B + sandStorm*0.1 + snowStorm*1.0;
|
||||
|
||||
DirectLightCol = BiomeColors * max(dot(DirectLightCol,vec3(0.33333)), MIN_LIGHT_AMOUNT*0.025 );
|
||||
IndirectLightCol = BiomeColors * max(dot(IndirectLightCol,vec3(0.33333)), MIN_LIGHT_AMOUNT*0.025 );
|
||||
DirectLightCol *= BiomeColors;
|
||||
IndirectLightCol *= BiomeColors;
|
||||
|
||||
// these range 0.0-1.0. they will never overlap.
|
||||
float Inbiome = isJungles+isSwamps+isDarkForests+sandStorm+snowStorm;
|
||||
float Inbiome = clamp(isPaleGarden+isJungles+isSwamps+isDarkForests+sandStorm+snowStorm, 0.0, 1.0);
|
||||
|
||||
return Inbiome;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -200,9 +170,8 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef TIMEOFDAYFOG
|
||||
// uniform int worldTime;
|
||||
void FogDensities(
|
||||
inout float Uniform, inout float Cloudy, inout float Rainy, float maxDistance, float DailyWeather_UniformFogDensity, float DailyWeather_CloudyFogDensity
|
||||
inout float Uniform, inout float Cloudy, float maxDistance, float DailyWeather_UniformFogDensity, float DailyWeather_CloudyFogDensity
|
||||
) {
|
||||
|
||||
float Time = worldTime%24000;
|
||||
@@ -217,8 +186,6 @@
|
||||
vec4 UniformDensity = TOD_Fog_mult * vec4(Morning_Uniform_Fog, Noon_Uniform_Fog, Evening_Uniform_Fog, Night_Uniform_Fog);
|
||||
vec4 CloudyDensity = TOD_Fog_mult * vec4(Morning_Cloudy_Fog, Noon_Cloudy_Fog, Evening_Cloudy_Fog, Night_Cloudy_Fog);
|
||||
|
||||
Rainy = Rainy*RainFog_amount;
|
||||
|
||||
#ifdef Daily_Weather
|
||||
// let daily weather influence fog densities.
|
||||
UniformDensity = max(UniformDensity, DailyWeather_UniformFogDensity);
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
samplePos = texelFetch(depthtex2, ivec2(newPos.xy/texelSize),0).x,hand;
|
||||
samplePos = texelFetch(depthtex2, ivec2(newPos.xy/texelSize),0).x;
|
||||
}
|
||||
|
||||
if(samplePos < newPos.z && samplePos > 0.0){// && (samplePos <= max(minZ,maxZ) && samplePos >= min(minZ,maxZ))){
|
||||
@@ -119,7 +119,7 @@ vec3 doBlockLightLighting(
|
||||
|
||||
// create a smooth falloff at the edges of the voxel volume.
|
||||
float fadeLength = 10.0; // in meters
|
||||
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 voxelRangeFalloff = cubicRadius.x*cubicRadius.y*cubicRadius.z;
|
||||
voxelRangeFalloff = 1.0 - pow(1.0-pow(voxelRangeFalloff,1.5),3.0);
|
||||
|
||||
@@ -137,6 +137,10 @@ vec3 doBlockLightLighting(
|
||||
if (lightRange > 0.0 && firstPersonCamera) handLightCol *= SSRT_Handlight_Shadows(viewPos, depthCheck, -(viewPos + vec3(-0.25, 0.2, 0.0)), noise, normals, hand);
|
||||
#endif
|
||||
|
||||
#ifdef WEATHER
|
||||
handLightCol *= 0.5;
|
||||
#endif
|
||||
|
||||
blockLight += handLightCol;
|
||||
}
|
||||
|
||||
@@ -149,6 +153,10 @@ vec3 doBlockLightLighting(
|
||||
if (lightRange2 > 0.0 && firstPersonCamera) handLightCol2 *= SSRT_Handlight_Shadows(viewPos, depthCheck, -(viewPos + vec3(0.25, 0.2, 0.0)), noise, normals, hand);
|
||||
#endif
|
||||
|
||||
#ifdef WEATHER
|
||||
handLightCol2 *= 0.5;
|
||||
#endif
|
||||
|
||||
blockLight += handLightCol2;
|
||||
}
|
||||
#endif
|
||||
@@ -173,6 +181,7 @@ vec3 doIndirectLighting(
|
||||
return indirectLight;
|
||||
}
|
||||
|
||||
#ifndef VOXY_PROGRAM
|
||||
uniform float centerDepthSmooth;
|
||||
|
||||
#if defined VIVECRAFT
|
||||
@@ -245,3 +254,4 @@ vec3 calculateFlashlight(in vec2 texcoord, in vec3 viewPos, in vec3 albedo, in v
|
||||
|
||||
return flashlightDiffuse * vec3(FLASHLIGHT_R,FLASHLIGHT_G,FLASHLIGHT_B);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -314,23 +314,6 @@ vec4 GetVolumetricFog(
|
||||
float hazeDensity = 0.001 * END_HAZE_DENSTIY;
|
||||
vec3 hazeLighting = vec3(0.37,0.32,0.75) * skyPhase * 0.5;
|
||||
color += (hazeLighting - hazeLighting*exp(-hazeDensity*dd*dL)) * absorbance;
|
||||
|
||||
|
||||
#if defined FLASHLIGHT && defined FLASHLIGHT_FOG_ILLUMINATION
|
||||
vec3 shiftedViewPos = mat3(gbufferModelView)*progressP + vec3(-0.25, 0.2, 0.0);
|
||||
vec3 shiftedPlayerPos = mat3(gbufferModelViewInverse) * shiftedViewPos;
|
||||
vec2 scaledViewPos = shiftedViewPos.xy / max(-shiftedViewPos.z - 0.5, 1e-7);
|
||||
float linearDistance = length(shiftedPlayerPos);
|
||||
float shiftedLinearDistance = length(scaledViewPos);
|
||||
|
||||
float lightFalloff = 1.0 - clamp(1.0-linearDistance/FLASHLIGHT_RANGE, -0.999,1.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;
|
||||
|
||||
color += (flashlightGlow - flashlightGlow * exp(-max(stormDensity,0.005)*dd*dL)) * absorbance;
|
||||
#endif
|
||||
}
|
||||
return vec4(color, absorbance);
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ vec3 ApplySSRT(
|
||||
#endif
|
||||
#else
|
||||
#ifdef OVERWORLD_SHADER
|
||||
skycontribution = unchangedIndirect * (max(rayDir.y,pow(1.0-lightmap,2))*0.95+0.05);
|
||||
skycontribution = unchangedIndirect * (max(rayDir.y,pow(1.0-lightmap,2))*0.95+0.05) * 1.25;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ if(lightningBoltPosition.w > 0.0){
|
||||
float lightningLight = max(1.0 - length(LightningPos) / 50, 0.0);
|
||||
lightningLight = exp((1.0 - lightningLight) * -15.0) ;
|
||||
#else
|
||||
float lightDistance = 300.0;
|
||||
float lightDistance = 150.0;
|
||||
float lightningLight = max(1.0 - length(LightningPos) / lightDistance, 0.0) ;
|
||||
|
||||
lightningLight = exp((1.0 - lightningLight) * -15.0) ;
|
||||
|
||||
@@ -119,23 +119,6 @@ vec4 GetVolumetricFog(
|
||||
|
||||
color += (ceilingSmoke - ceilingSmoke*ceilingSmokeVolumeCoeff) * (absorbance*0.5+0.5);
|
||||
absorbance *= ceilingSmokeVolumeCoeff;
|
||||
|
||||
#if defined FLASHLIGHT && defined FLASHLIGHT_FOG_ILLUMINATION
|
||||
vec3 shiftedViewPos = mat3(gbufferModelView)*(dist3) + vec3(-0.25, 0.2, 0.0);
|
||||
vec3 shiftedPlayerPos = mat3(gbufferModelViewInverse) * shiftedViewPos;
|
||||
vec2 scaledViewPos = shiftedViewPos.xy / max(-shiftedViewPos.z - 0.5, 1e-7);
|
||||
float linearDistance = length(shiftedPlayerPos);
|
||||
float shiftedLinearDistance = length(scaledViewPos);
|
||||
|
||||
float lightFalloff = 1.0 - clamp(1.0-linearDistance/FLASHLIGHT_RANGE, -0.999,1.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;
|
||||
|
||||
color += (flashlightGlow - flashlightGlow * exp(-max(plumeDensity,0.005)*dd*dL)) * absorbance;
|
||||
#endif
|
||||
|
||||
}
|
||||
return vec4(color, absorbance);
|
||||
}
|
||||
@@ -15,15 +15,15 @@ float densityAtPosFog(in vec3 pos){
|
||||
|
||||
float cloudVol(in vec3 pos, float maxDistance ){
|
||||
|
||||
float fogYstart = FOG_START_HEIGHT+3;
|
||||
float fogYstart = FOG_START_HEIGHT + 3.0;
|
||||
vec3 samplePos = pos*vec3(1.0,1./24.,1.0);
|
||||
vec3 samplePos2 = pos*vec3(1.0,1./48.,1.0);
|
||||
|
||||
float uniformFog = 0.0;
|
||||
|
||||
float low_gradientFog = exp2(-0.3 * max(pos.y - fogYstart,0.0));
|
||||
float medium_gradientFog = exp2(-0.15 * max(pos.y - fogYstart,0.0));
|
||||
float high_gradientFog = exp2(-0.06 * max(pos.y - fogYstart,0.0));
|
||||
float low_gradientFog = exp2(-0.15 * max(pos.y - fogYstart,0.0));
|
||||
float medium_gradientFog = exp2(-0.06 * max(pos.y - fogYstart,0.0));
|
||||
float high_gradientFog = exp2(-0.001 * max(pos.y - fogYstart,0.0));
|
||||
|
||||
float fog_shape = 0.0;
|
||||
float fog_erosion = 0.0;
|
||||
@@ -33,18 +33,22 @@ float cloudVol(in vec3 pos, float maxDistance ){
|
||||
}
|
||||
|
||||
float cloudyFog = max(min(max(fog_shape - 0.6 ,0.0) * 2.0 ,1.0) - fog_erosion * 0.4 , 0.0) * exp(-0.05 * max(pos.y - (fogYstart+20),0.0));
|
||||
float rainyFog = (exp2(-0.008 * max(pos.y - fogYstart-500,0.0)) * 0.03 + high_gradientFog) * rainStrength * noPuddleAreas * (1.0 + thunderStrength);
|
||||
float rainyFog = (high_gradientFog * 0.0085 + medium_gradientFog) * rainStrength * noPuddleAreas * (1.0 + thunderStrength) * RainFog_amount;
|
||||
|
||||
#ifdef PER_BIOME_ENVIRONMENT
|
||||
rainyFog += high_gradientFog * isPaleGarden * PALE_GARDEN_UNIFORM_DENSITY;
|
||||
#endif
|
||||
|
||||
if(sandStorm > 0.0 || snowStorm > 0.0){
|
||||
float IntenseFogs = pow(1.0 - densityAtPosFog( (samplePos2 - vec3(frameTimeCounter,0,frameTimeCounter)*15.0) * 100.0),2.0) * mix(1.0, high_gradientFog, snowStorm);
|
||||
float IntenseFogs = pow(1.0 - densityAtPosFog( (samplePos2 - vec3(frameTimeCounter,0,frameTimeCounter)*15.0) * 100.0),2.0) * mix(1.0, medium_gradientFog, snowStorm);
|
||||
cloudyFog = mix(cloudyFog, IntenseFogs, sandStorm+snowStorm);
|
||||
|
||||
medium_gradientFog = mix(medium_gradientFog, 1.0, sandStorm+snowStorm);
|
||||
low_gradientFog = mix(low_gradientFog, 1.0, sandStorm+snowStorm);
|
||||
}
|
||||
|
||||
FogDensities(medium_gradientFog, cloudyFog, rainyFog, maxDistance, SC_fog.x, SC_fog.y);
|
||||
FogDensities(low_gradientFog, cloudyFog, maxDistance, SC_fog.x, SC_fog.y);
|
||||
|
||||
return uniformFog + medium_gradientFog + cloudyFog + rainyFog;
|
||||
return uniformFog + low_gradientFog + cloudyFog + rainyFog;
|
||||
}
|
||||
|
||||
float phaseRayleigh(float cosTheta) {
|
||||
@@ -63,10 +67,7 @@ float fogPhase(float lightPoint){
|
||||
|
||||
return exponential;
|
||||
}
|
||||
float phaseCloudFog(float x, float g){
|
||||
float gg = g * g;
|
||||
return (gg * -0.25 + 0.25) * pow(-2.0 * (g * x) + (gg + 1.0), -1.5) / 3.14;
|
||||
}
|
||||
|
||||
uniform ivec2 eyeBrightness;
|
||||
|
||||
vec4 GetVolumetricFog(
|
||||
@@ -85,7 +86,8 @@ vec4 GetVolumetricFog(
|
||||
int SAMPLECOUNT = VL_SAMPLES;
|
||||
|
||||
//project pixel position into projected shadowmap space
|
||||
vec3 playerPos = mat3(gbufferModelViewInverse) * viewPosition + gbufferModelViewInverse[3].xyz;
|
||||
vec3 dVWorld = mat3(gbufferModelViewInverse) * viewPosition;
|
||||
vec3 playerPos = dVWorld + gbufferModelViewInverse[3].xyz;
|
||||
// vec3 rayStartPos = playerPos - gbufferModelViewInverse[3].xyz;
|
||||
#ifdef CUSTOM_MOON_ROTATION
|
||||
vec3 fragposition = mat3(customShadowMatrixSSBO) * playerPos + customShadowMatrixSSBO[3].xyz;
|
||||
@@ -101,7 +103,6 @@ vec4 GetVolumetricFog(
|
||||
//we can use a projected vector because its orthographic projection
|
||||
//however we still have to send it to curved shadow map space every step
|
||||
vec3 dV = fragposition - start;
|
||||
vec3 dVWorld = playerPos - gbufferModelViewInverse[3].xyz;
|
||||
|
||||
// vec3 nPlayerPos = normalize(playerPos);
|
||||
|
||||
@@ -132,12 +133,11 @@ vec4 GetVolumetricFog(
|
||||
// float atmosphereAbsorbance = 1.0;
|
||||
vec3 atmosphereAbsorbance = vec3(1.0);
|
||||
|
||||
float SdotV = dot(sunVector, normalize(viewPosition));
|
||||
float SdotV = dot(sunVector, normalize(playerPos));
|
||||
|
||||
///// ----- 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 sunPhase = fogPhase(SdotV)*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);
|
||||
|
||||
@@ -216,15 +216,14 @@ vec4 GetVolumetricFog(
|
||||
|
||||
#ifdef PER_BIOME_ENVIRONMENT
|
||||
float maxDistance = inBiome * min(max(1.0 - length(d*dVWorld.xz)/(32*8),0.0)*2.0,1.0);
|
||||
float densityVol = cloudVol(progressW, maxDistance) * inACave;
|
||||
float fogDensity = cloudVol(progressW, maxDistance) * inACave;
|
||||
#else
|
||||
float densityVol = cloudVol(progressW, 0.0) * inACave;
|
||||
float fogDensity = cloudVol(progressW, 0.0) * inACave;
|
||||
#endif
|
||||
|
||||
//------------------------------------
|
||||
//------ MAIN FOG EFFECT
|
||||
//------------------------------------
|
||||
float fogDensity = densityVol;
|
||||
float fogVolumeCoeff = exp(-fogDensity*dd*dL); // this is like beer-lambert law or something
|
||||
|
||||
#ifdef PER_BIOME_ENVIRONMENT
|
||||
@@ -240,39 +239,6 @@ vec4 GetVolumetricFog(
|
||||
|
||||
color += (lighting - lighting * fogVolumeCoeff) * totalAbsorbance;
|
||||
|
||||
#if defined FLASHLIGHT && defined FLASHLIGHT_FOG_ILLUMINATION && !defined VL_CLOUDS_DEFERRED
|
||||
// vec3 shiftedViewPos = mat3(gbufferModelView)*(progressW-cameraPosition) + vec3(-0.25, 0.2, 0.0);
|
||||
// vec3 shiftedPlayerPos = mat3(gbufferModelViewInverse) * shiftedViewPos;
|
||||
vec3 shiftedViewPos;
|
||||
vec3 shiftedPlayerPos;
|
||||
float forwardOffset;
|
||||
|
||||
#ifdef VIVECRAFT
|
||||
if (vivecraftIsVR) {
|
||||
forwardOffset = 0.0;
|
||||
shiftedPlayerPos = (progressP) + ( vivecraftRelativeMainHandPos);
|
||||
shiftedViewPos = shiftedPlayerPos * mat3(vivecraftRelativeMainHandRot);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
forwardOffset = 0.5;
|
||||
shiftedViewPos = mat3(gbufferModelView)*(progressP) + vec3(-0.25, 0.2, 0.0);
|
||||
shiftedPlayerPos = mat3(gbufferModelViewInverse) * shiftedViewPos;
|
||||
}
|
||||
|
||||
vec2 scaledViewPos = shiftedViewPos.xy / max(-shiftedViewPos.z - forwardOffset, 1e-7);
|
||||
float linearDistance = length(shiftedPlayerPos);
|
||||
float shiftedLinearDistance = length(scaledViewPos);
|
||||
|
||||
float lightFalloff = 1.0 - clamp(1.0-linearDistance/FLASHLIGHT_RANGE, -0.999,1.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;
|
||||
|
||||
color += (flashlightGlow - flashlightGlow * exp(-max(fogDensity,0.005)*dd*dL)) * totalAbsorbance;
|
||||
#endif
|
||||
|
||||
// kill fog absorbance when in caves.
|
||||
totalAbsorbance *= mix(1.0, fogVolumeCoeff, lightLevelZero);
|
||||
if(totalAbsorbance < 0.01) break;
|
||||
@@ -289,7 +255,7 @@ vec4 GetVolumetricFog(
|
||||
|
||||
// Pbr for air, yolo mix between mie and rayleigh for water droplets
|
||||
vec3 rL = rC*airCoef.x;
|
||||
vec3 m = mC*(airCoef.y+densityVol*300.0);
|
||||
vec3 m = mC*(airCoef.y+fogDensity*300.0);
|
||||
|
||||
// calculate the atmosphere haze seperately and purely additive to color, do not contribute to absorbtion.
|
||||
vec3 atmosphereVolumeCoeff = exp(-(rL+m)*dd*dL);
|
||||
|
||||
@@ -212,7 +212,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 BLOOMY_FOG 0.5 // [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]
|
||||
|
||||
@@ -254,18 +254,25 @@ const float entityShadowDistanceMul = 0.25; // [0.01 0.02 0.03 0.04 0.05 0.10 0.
|
||||
|
||||
#define JUNGLE_ENV
|
||||
#define JUNGLE_UNIFORM_DENSITY 0.1 // [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 JUNGLE_CLOUDY_DENSITY 0.2 // [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 JUNGLE_CLOUDY_DENSITY 0.02 // [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 JUNGLE_R 0.5 // [0.00 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 JUNGLE_G 1.0 // [0.00 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 JUNGLE_B 0.5 // [0.00 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 JUNGLE_B 0.8 // [0.00 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 DARKFOREST_ENV
|
||||
#define DARKFOREST_UNIFORM_DENSITY 0.1 // [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 DARKFOREST_CLOUDY_DENSITY 0 // [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 DARKFOREST_CLOUDY_DENSITY 0.05 // [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 DARKFOREST_R 0.3 // [0.00 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 DARKFOREST_G 0.4 // [0.00 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 DARKFOREST_B 1.0 // [0.00 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 PALE_GARDEN_ENV
|
||||
#define PALE_GARDEN_UNIFORM_DENSITY 0.13 // [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 PALE_GARDEN_CLOUDY_DENSITY 0.4 // [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 PALE_GARDEN_R 0.4 // [0.00 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 PALE_GARDEN_G 0.4 // [0.00 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 PALE_GARDEN_B 0.6 // [0.00 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 SNOW_STORMS
|
||||
#define SAND_STORMS
|
||||
|
||||
@@ -276,6 +283,8 @@ const float entityShadowDistanceMul = 0.25; // [0.01 0.02 0.03 0.04 0.05 0.10 0.
|
||||
#endif
|
||||
#ifdef DARKFOREST_ENV
|
||||
#endif
|
||||
#ifdef PALE_GARDEN_ENV
|
||||
#endif
|
||||
#ifdef SNOW_STORMS
|
||||
#endif
|
||||
#ifdef SAND_STORMS
|
||||
@@ -464,7 +473,7 @@ uniform vec3 unsigned_WmoonVecSmooth;
|
||||
#define HQ_CLOUD_UPSAMPLE
|
||||
|
||||
#define CLOUD_MOVEMENT_TYPE 0 // [0 1]
|
||||
#define Cloud_Speed 2.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 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0]
|
||||
#define Cloud_Speed 1.2 // [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]
|
||||
|
||||
#ifdef VOLUMETRIC_CLOUDS
|
||||
#ifndef AMBIENT_LIGHT_ONLY
|
||||
@@ -989,7 +998,7 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
|
||||
#define SELECT_BOX_COL_B 0.0 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]
|
||||
|
||||
#define OLD_CAVE_DETECTION
|
||||
#define CAVE_DETECTION 1.0 // [0.0 1.0 2.0]
|
||||
#define CAVE_DETECTION 1 // [0 1 2]
|
||||
#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]
|
||||
@@ -1074,7 +1083,9 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
|
||||
#define LPV_REDSTONE_LIGHTS
|
||||
//#define LPV_COLORED_CANDLES
|
||||
#define LPV_VL_FOG_ILLUMINATION
|
||||
#define LPV_VL_FOG_ILLUMINATION_BRIGHTNESS 60 // [0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120 125 130 135 140 145 150 155 160 165 170 175 180 185 190 195 200]]
|
||||
#define LPV_VL_FOG_ILLUMINATION_BRIGHTNESS 50 // [0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120 125 130 135 140 145 150 155 160 165 170 175 180 185 190 195 200]]
|
||||
#define LPV_VL_FOG_ILLUMINATION_HANDHELD_WATER
|
||||
// #define LPV_VL_FOG_ILLUMINATION_HANDHELD
|
||||
|
||||
// Fix for making nether/end work until next Iris release to fix shadow matrices
|
||||
//#define LPV_NOSHADOW_HACK
|
||||
@@ -1174,6 +1185,8 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
|
||||
#endif
|
||||
#ifdef RENDER_PLAYER_SHADOWS
|
||||
#endif
|
||||
#ifdef LPV_VL_FOG_ILLUMINATION_HANDHELD_WATER
|
||||
#endif
|
||||
#ifdef LPV_VL_FOG_ILLUMINATION
|
||||
#endif
|
||||
#ifdef LPV_VL_FOG_ILLUMINATION_NETHER
|
||||
|
||||
@@ -112,7 +112,7 @@ float invertLinearizeDepthFast(const in float z) {
|
||||
|
||||
vec3 rayTraceSpeculars(vec3 dir, vec3 position, float dither, float quality, bool hand, inout float reflectionLength, inout bool depthCheck){
|
||||
|
||||
const float biasAmount = 0.00003;
|
||||
const float biasAmount = 0.0001;
|
||||
|
||||
float _near = near; float _far = far;
|
||||
|
||||
@@ -146,7 +146,7 @@ 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.00005;
|
||||
|
||||
|
||||
_near = dhVoxyNearPlane;
|
||||
@@ -293,7 +293,7 @@ vec4 screenSpaceReflections(
|
||||
|
||||
vec3 raytracePos = rayTraceSpeculars(reflectedVector, viewPos, noise, quality, isHand, reflectionLength, depthCheck);
|
||||
// if (raytracePos.z > 1.001 || distance(gl_FragCoord.xy*texelSize, raytracePos.xy) < 0.002) return reflection;
|
||||
if (raytracePos.z > 1.001) return reflection;
|
||||
if (raytracePos.z > 1.00001) return reflection;
|
||||
|
||||
// use higher LOD as the reflection goes on, to blur it. this helps denoise a little.
|
||||
|
||||
@@ -486,12 +486,10 @@ vec3 specularReflections(
|
||||
float reflectionVisibilty = getReflectionVisibility(f0, roughness);
|
||||
|
||||
vec4 enviornmentReflection = vec4(0.0);
|
||||
float backgroundReflectMask = lightmap;
|
||||
|
||||
#if (defined DEFERRED_BACKGROUND_REFLECTION || defined FORWARD_BACKGROUND_REFLECTION) || (DEFERRED_SSR_QUALITY > 0 || FORWARD_SSR_QUALITY > 0)
|
||||
if(reflectionVisibilty < 1.0){
|
||||
|
||||
float backgroundReflectMask = lightmap;
|
||||
|
||||
#if defined DEFERRED_BACKGROUND_REFLECTION || defined FORWARD_BACKGROUND_REFLECTION
|
||||
#if !defined OVERWORLD_SHADER
|
||||
vec3 backgroundReflection = volumetricsFromTex(reflectedVector_L, colortex4, roughness).rgb / 1200.0;
|
||||
@@ -531,12 +529,12 @@ vec3 specularReflections(
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined OVERWORLD_SHADER || SUN_SPECULAR_MULT > 0
|
||||
vec3 lightSourceReflection = SUN_SPECULAR_MULT * lightColor * GGX(normal, -playerPos, lightPos, roughness, reflectance, metalAlbedoTint);
|
||||
#if defined OVERWORLD_SHADER && SUN_SPECULAR_MULT > 0
|
||||
vec3 lightSourceReflection = backgroundReflectMask*SUN_SPECULAR_MULT * lightColor * GGX(normal, -playerPos, lightPos, roughness, reflectance, metalAlbedoTint);
|
||||
#if DEFERRED_SSR_QUALITY > 0 || FORWARD_SSR_QUALITY > 0
|
||||
specularReflections += mix(lightSourceReflection, vec3(0.0), enviornmentReflection.a);
|
||||
#else
|
||||
specularReflections += lightSourceReflection;
|
||||
specularReflections += lightSourceReflection*backgroundReflectMask;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -44,10 +44,6 @@ vec4 sampleRGSS(sampler2D source, vec2 uv, vec2 pixelSize) {
|
||||
|
||||
float mipLevelExact = max(0.0, log2(effectiveDerivative / minPixelSize));
|
||||
|
||||
float mipLevelLow = floor(mipLevelExact);
|
||||
float mipLevelHigh = mipLevelLow + 1.0;
|
||||
float mipBlend = fract(mipLevelExact);
|
||||
|
||||
const vec2 offsets[4] = vec2[](
|
||||
vec2(0.125, 0.375),
|
||||
vec2(-0.125, -0.375),
|
||||
@@ -55,17 +51,12 @@ vec4 sampleRGSS(sampler2D source, vec2 uv, vec2 pixelSize) {
|
||||
vec2(-0.375, 0.125)
|
||||
);
|
||||
|
||||
vec4 rgssColorLow = vec4(0.0);
|
||||
vec4 rgssColorHigh = vec4(0.0);
|
||||
vec4 rgssColor = vec4(0.0);
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
vec2 sampleUV = uv + offsets[i] * pixelSize;
|
||||
rgssColorLow += textureLod(source, sampleUV, mipLevelLow);
|
||||
rgssColorHigh += textureLod(source, sampleUV, mipLevelHigh);
|
||||
rgssColor += textureLod(source, sampleUV, mipLevelExact);
|
||||
}
|
||||
rgssColorLow *= 0.25;
|
||||
rgssColorHigh *= 0.25;
|
||||
|
||||
vec4 rgssColor = mix(rgssColorLow, rgssColorHigh, mipBlend);
|
||||
rgssColor *= 0.25;
|
||||
|
||||
vec4 nearestColor = sampleNearest(source, uv, pixelSize, du, dv, texelScreenSize);
|
||||
|
||||
|
||||
@@ -10,13 +10,14 @@ uniform int worldDay;
|
||||
uniform int worldTime;
|
||||
uniform float moonElevation;
|
||||
uniform float worldTimeSmooth;
|
||||
uniform float cloudTime;
|
||||
#endif
|
||||
|
||||
|
||||
#if CLOUD_MOVEMENT_TYPE == 0
|
||||
float cloud_movement = (worldTimeSmooth + mod(worldDay,100)*24000.0) / 24.0 * Cloud_Speed;
|
||||
#else
|
||||
float cloud_movement = frameTimeCounter * Cloud_Speed;
|
||||
float cloud_movement = cloudTime * Cloud_Speed;
|
||||
#endif
|
||||
|
||||
float lightningFlashTimer = floor(frameTimeCounter * 11.0);
|
||||
@@ -910,7 +911,7 @@ vec4 raymarchCloud(
|
||||
// normal lightning strikes
|
||||
float horizontalDist = length((newPos.xz) - lightningBoltPosition.xz);
|
||||
if (horizontalDist < 7500.0 && lightningBoltPosition.w > 0.0) {
|
||||
lightningIntensity = exp(-horizontalDist * 0.006) * density * smoothstep(0.0, 0.02, fract(frameTimeCounter)) * lightningFlash;
|
||||
lightningIntensity = exp(-horizontalDist * 0.006) * density * lightningFlash;
|
||||
lighting = mix(lighting, vec3(1.3,1.5,3.0), lightningIntensity);
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ void PopulateShadowVoxel(const in vec3 playerPos) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if WATER_INTERACTION == 2 && !defined COLORWHEEL
|
||||
#if WATER_INTERACTION == 2 && !defined COLORWHEEL && IRIS_VERSION < 11004
|
||||
if (
|
||||
((renderStage == MC_RENDER_STAGE_ENTITIES && (currentRenderedItemId > 0 || entityId > 0)) || renderStage == MC_RENDER_STAGE_BLOCK_ENTITIES)
|
||||
) {
|
||||
|
||||
+76
-56
File diff suppressed because one or more lines are too long
@@ -0,0 +1,12 @@
|
||||
#version 430 compatibility
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
#define AETHER_FLAG
|
||||
|
||||
#define WORLD
|
||||
|
||||
#define COLORWHEEL
|
||||
#define ENTITIES
|
||||
#define BLOCKENTITIES
|
||||
|
||||
#include "/dimensions/all_solid.fsh"
|
||||
@@ -0,0 +1,13 @@
|
||||
#version 430 compatibility
|
||||
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
#define AETHER_FLAG
|
||||
|
||||
#define WORLD
|
||||
|
||||
#define COLORWHEEL
|
||||
#define ENTITIES
|
||||
#define BLOCKENTITIES
|
||||
|
||||
#include "/dimensions/all_solid.vsh"
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
#version 430 compatibility
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
#define AETHER_FLAG
|
||||
|
||||
#define DAMAGE_BLOCK_EFFECT
|
||||
#define COLORWHEEL
|
||||
|
||||
#include "/dimensions/all_particles.fsh"
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
#version 430 compatibility
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
#define AETHER_FLAG
|
||||
|
||||
#define DAMAGE_BLOCK_EFFECT
|
||||
#define COLORWHEEL
|
||||
|
||||
#include "/dimensions/all_particles.vsh"
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
#version 430 compatibility
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
#define AETHER_FLAG
|
||||
|
||||
#define ENCHANT_GLINT
|
||||
#define COLORWHEEL
|
||||
|
||||
#include "/dimensions/all_vanilla_emissives.fsh"
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
#version 430 compatibility
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
#define AETHER_FLAG
|
||||
|
||||
#define ENCHANT_GLINT
|
||||
#define COLORWHEEL
|
||||
|
||||
#include "/dimensions/all_vanilla_emissives.vsh"
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
#version 430 compatibility
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
#define AETHER_FLAG
|
||||
|
||||
#define WORLD
|
||||
|
||||
#define COLORWHEEL
|
||||
#define ENTITIES
|
||||
#define BLOCKENTITIES
|
||||
|
||||
#include "/dimensions/all_translucent.fsh"
|
||||
@@ -0,0 +1,12 @@
|
||||
#version 430 compatibility
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
#define AETHER_FLAG
|
||||
|
||||
#define WORLD
|
||||
|
||||
#define COLORWHEEL
|
||||
#define ENTITIES
|
||||
#define BLOCKENTITIES
|
||||
|
||||
#include "/dimensions/all_translucent.vsh"
|
||||
@@ -0,0 +1,37 @@
|
||||
#version 430 compatibility
|
||||
|
||||
#include "/lib/settings.glsl"
|
||||
|
||||
in vec4 color;
|
||||
|
||||
in vec2 texcoord;
|
||||
uniform sampler2D gtexture;
|
||||
uniform sampler2D noisetex;
|
||||
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
|
||||
float blueNoise(){
|
||||
return fract(texelFetch(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 );
|
||||
}
|
||||
|
||||
/* RENDERTARGETS: 0 */
|
||||
|
||||
void main() {
|
||||
vec4 color = texture(gtexture,texcoord.xy);
|
||||
vec2 lmcoord;
|
||||
float ao;
|
||||
vec4 overlayColor;
|
||||
|
||||
clrwl_computeFragment(color, color, lmcoord, ao, overlayColor);
|
||||
color.rgb = mix(color.rgb, overlayColor.rgb, overlayColor.a);
|
||||
|
||||
gl_FragData[0] = color;
|
||||
|
||||
#ifdef Stochastic_Transparent_Shadows
|
||||
if(gl_FragData[0].a < blueNoise()) { discard; return;}
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,296 @@
|
||||
#version 430 compatibility
|
||||
|
||||
#if defined IS_LPV_ENABLED
|
||||
#extension GL_ARB_explicit_attrib_location: enable
|
||||
#extension GL_ARB_shader_image_load_store: enable
|
||||
#endif
|
||||
|
||||
#define RENDER_SHADOW
|
||||
|
||||
#define COLORWHEEL
|
||||
|
||||
#include "/lib/SSBOs.glsl"
|
||||
|
||||
#include "/lib/settings.glsl"
|
||||
|
||||
/*
|
||||
!! DO NOT REMOVE !!
|
||||
This code is from Chocapic13' shaders
|
||||
Read the terms of modification and sharing before changing something below please !
|
||||
!! DO NOT REMOVE !!
|
||||
*/
|
||||
|
||||
out vec2 texcoord;
|
||||
out vec4 color;
|
||||
|
||||
in vec4 mc_midTexCoord;
|
||||
in vec4 mc_Entity;
|
||||
|
||||
#define SHADOW_MAP_BIAS 0.5
|
||||
const float PI = 3.1415927;
|
||||
|
||||
uniform mat4 shadowProjectionInverse;
|
||||
uniform mat4 shadowProjection;
|
||||
uniform mat4 shadowModelViewInverse;
|
||||
uniform mat4 shadowModelView;
|
||||
uniform mat4 gbufferModelView;
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
uniform mat4 gbufferProjection;
|
||||
uniform mat4 gbufferProjectionInverse;
|
||||
uniform int hideGUI;
|
||||
uniform vec3 cameraPosition;
|
||||
uniform vec3 relativeEyePosition;
|
||||
uniform float frameTimeCounter;
|
||||
uniform int frameCounter;
|
||||
uniform float screenBrightness;
|
||||
uniform vec3 sunVec;
|
||||
uniform float aspectRatio;
|
||||
uniform float sunElevation;
|
||||
uniform vec3 sunPosition;
|
||||
uniform float lightSign;
|
||||
uniform float cosFov;
|
||||
uniform vec3 shadowViewDir;
|
||||
uniform vec3 shadowCamera;
|
||||
uniform vec3 shadowLightVec;
|
||||
uniform float shadowMaxProj;
|
||||
|
||||
uniform int blockEntityId;
|
||||
uniform int entityId;
|
||||
|
||||
#include "/lib/Shadow_Params.glsl"
|
||||
#include "/lib/bokeh.glsl"
|
||||
#include "/lib/blocks.glsl"
|
||||
#include "/lib/entities.glsl"
|
||||
|
||||
#if defined IS_LPV_ENABLED
|
||||
#ifdef IRIS_FEATURE_BLOCK_EMISSION_ATTRIBUTE
|
||||
in vec4 at_midBlock;
|
||||
#else
|
||||
in vec3 at_midBlock;
|
||||
#endif
|
||||
uniform int currentRenderedItemId;
|
||||
uniform int renderStage;
|
||||
|
||||
#include "/lib/voxel_common.glsl"
|
||||
#include "/lib/voxel_write.glsl"
|
||||
#endif
|
||||
|
||||
const float PI48 = 150.796447372*WAVY_SPEED;
|
||||
float pi2wt = PI48*frameTimeCounter;
|
||||
|
||||
out float LIGHTNING;
|
||||
|
||||
vec2 calcWave(in vec3 pos) {
|
||||
|
||||
float magnitude = abs(sin(dot(vec4(frameTimeCounter, pos),vec4(1.0,0.005,0.005,0.005)))*0.5+0.72)*0.013;
|
||||
vec2 ret = (sin(pi2wt*vec2(0.0063,0.0015)*4. - pos.xz + pos.y*0.05)+0.1)*magnitude;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
vec3 calcMovePlants(in vec3 pos) {
|
||||
vec2 move1 = calcWave(pos );
|
||||
float move1y = -length(move1);
|
||||
return vec3(move1.x,move1y,move1.y)*5.*WAVY_STRENGTH/255.0;
|
||||
}
|
||||
|
||||
vec3 calcWaveLeaves(in vec3 pos, in float fm, in float mm, in float ma, in float f0, in float f1, in float f2, in float f3, in float f4, in float f5) {
|
||||
|
||||
float magnitude = abs(sin(dot(vec4(frameTimeCounter, pos),vec4(1.0,0.005,0.005,0.005)))*0.5+0.72)*0.013;
|
||||
vec3 ret = (sin(pi2wt*vec3(0.0063,0.0224,0.0015)*1.5 - pos))*magnitude;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
vec3 calcMoveLeaves(in vec3 pos, in float f0, in float f1, in float f2, in float f3, in float f4, in float f5, in vec3 amp1, in vec3 amp2) {
|
||||
vec3 move1 = calcWaveLeaves(pos , 0.0054, 0.0400, 0.0400, 0.0127, 0.0089, 0.0114, 0.0063, 0.0224, 0.0015) * amp1;
|
||||
return move1*5.*WAVY_STRENGTH/255.;
|
||||
}
|
||||
bool intersectCone(float coneHalfAngle, vec3 coneTip , vec3 coneAxis, vec3 rayOrig, vec3 rayDir, float maxZ)
|
||||
{
|
||||
vec3 co = rayOrig - coneTip;
|
||||
float prod = dot(normalize(co),coneAxis);
|
||||
if (prod <= -coneHalfAngle) return true; //In view frustrum
|
||||
|
||||
float a = dot(rayDir,coneAxis)*dot(rayDir,coneAxis) - coneHalfAngle*coneHalfAngle;
|
||||
float b = 2. * (dot(rayDir,coneAxis)*dot(co,coneAxis) - dot(rayDir,co)*coneHalfAngle*coneHalfAngle);
|
||||
float c = dot(co,coneAxis)*dot(co,coneAxis) - dot(co,co)*coneHalfAngle*coneHalfAngle;
|
||||
|
||||
float det = b*b - 4.*a*c;
|
||||
if (det < 0.) return false; // No intersection with either forward cone and backward cone
|
||||
|
||||
det = sqrt(det);
|
||||
float t2 = (-b + det) / (2. * a);
|
||||
if (t2 <= 0.0 || t2 >= maxZ) return false; //Idk why it works
|
||||
|
||||
return true;
|
||||
}
|
||||
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
|
||||
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
|
||||
|
||||
|
||||
|
||||
// uniform float far;
|
||||
uniform float dhVoxyFarPlane;
|
||||
|
||||
#include "/lib/DistantHorizons_projections.glsl"
|
||||
|
||||
vec4 toClipSpace3(vec3 viewSpacePosition) {
|
||||
|
||||
// mat4 projection = DH_shadowProjectionTweak(gl_ProjectionMatrix);
|
||||
|
||||
return vec4(projMAD(gl_ProjectionMatrix, viewSpacePosition),1.0);
|
||||
}
|
||||
vec3 viewToWorld(vec3 viewPos) {
|
||||
vec4 pos;
|
||||
pos.xyz = viewPos;
|
||||
pos.w = 0.0;
|
||||
pos = shadowModelViewInverse * pos;
|
||||
return pos.xyz;
|
||||
}
|
||||
|
||||
// uniform int renderStage;
|
||||
|
||||
// uniform mat4 gbufferModelViewInverse;
|
||||
void main() {
|
||||
texcoord.xy = gl_MultiTexCoord0.xy;
|
||||
color = gl_Color;
|
||||
|
||||
vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
|
||||
|
||||
|
||||
// playerpos = vec4(0.0);
|
||||
// playerpos = gbufferModelViewInverse * (gl_ModelViewMatrix * gl_Vertex);
|
||||
|
||||
// mat4 Custom_ViewMatrix = BuildShadowViewMatrix(LightDir);
|
||||
// mat4 Custom_ProjectionMatrix = BuildShadowProjectionMatrix();
|
||||
|
||||
// position = gl_Vertex.xyz;
|
||||
|
||||
// if((renderStage == 10 || renderStage == 12) && mc_Entity.x != 3000) {
|
||||
// position = (shadowModelViewInverse * vec4(gl_Vertex.xyz,1.0)).xyz;
|
||||
// }
|
||||
|
||||
// position = mat3(Custom_ViewMatrix) * position + Custom_ViewMatrix[3].xyz;
|
||||
|
||||
// HHHHHHHHH ITS THE JITTER DOF HERE TO SAY HELLO
|
||||
// It turns out 'position' above is just viewPos lmao
|
||||
// #ifdef DOF_JITTER_SHADOW
|
||||
// // CLIP SPACE
|
||||
// vec2 jitter = clamp(jitter_offsets[frameCounter % 64], -1.0, 1.0);
|
||||
// jitter = rotate(radians(float(frameCounter))) * jitter;
|
||||
// jitter.y *= aspectRatio;
|
||||
// jitter.x *= DOF_ANAMORPHIC_RATIO;
|
||||
|
||||
// vec4 clipPos = gbufferProjection * vec4(position, 1.0);
|
||||
|
||||
// // CLIP SPACE -> VIEW SPACE
|
||||
// vec3 viewPos = (gbufferProjectionInverse * clipPos).xyz;
|
||||
|
||||
// // Focus distance
|
||||
// #if DOF_JITTER_FOCUS < 0
|
||||
// float focusMul = clipPos.z - mix(pow(512.0, screenBrightness), 512.0 * screenBrightness, 0.25);
|
||||
// #else
|
||||
// float focusMul = clipPos.z - DOF_JITTER_FOCUS;
|
||||
// #endif
|
||||
|
||||
// // CLIP SPACE -> SHADOW CLIP SPACE
|
||||
// vec3 jitterViewPos = (gbufferProjectionInverse * vec4(jitter, 1.0, 1.0)).xyz;
|
||||
// // vec3 jitterFeetPos = (gbufferModelViewInverse * vec4(jitterViewPos, 1.0)).xyz;
|
||||
// // vec3 jitterShadowViewPos = (shadowModelView * vec4(jitterFeetPos, 1.0)).xyz;
|
||||
// // vec4 jitterShadowClipPos = gl_ProjectionMatrix * vec4(jitterShadowViewPos, 1.0);
|
||||
|
||||
// // vec4 totalOffset = jitterShadowClipPos * JITTER_STRENGTH * focusMul * 1e-2;
|
||||
|
||||
// position += jitterViewPos * focusMul * 1e-2;
|
||||
// if(focusMul < 10.0) {
|
||||
// gl_Position = vec4(-1.0);
|
||||
// return;
|
||||
// }
|
||||
// #endif
|
||||
|
||||
// #if defined IS_LPV_ENABLED || defined WAVY_PLANTS || !defined PLANET_CURVATURE
|
||||
vec3 playerpos = mat3(shadowModelViewInverse) * position + shadowModelViewInverse[3].xyz;
|
||||
// #endif
|
||||
|
||||
#if defined IS_LPV_ENABLED && defined MC_GL_ARB_shader_image_load_store
|
||||
PopulateShadowVoxel(playerpos);
|
||||
#endif
|
||||
|
||||
// #ifdef WAVY_PLANTS
|
||||
// bool istopv = gl_MultiTexCoord0.t < mc_midTexCoord.t;
|
||||
// if (
|
||||
// (
|
||||
// blockId == BLOCK_GROUND_WAVING || blockId == BLOCK_GROUND_WAVING_VERTICAL ||
|
||||
// blockId == BLOCK_GRASS_SHORT || (blockId == BLOCK_GRASS_TALL_UPPER && istopv) ||
|
||||
// blockId == BLOCK_SAPLING
|
||||
// ) && length(position.xy) < 24.0
|
||||
// ) {
|
||||
// playerpos += calcMovePlants(playerpos + cameraPosition)*gl_MultiTexCoord1.y;
|
||||
// position = mat3(shadowModelView) * playerpos + shadowModelView[3].xyz;
|
||||
// }
|
||||
|
||||
// if (blockId == BLOCK_AIR_WAVING && length(position.xy) < 24.0) {
|
||||
// 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;
|
||||
// position = mat3(shadowModelView) * playerpos + shadowModelView[3].xyz;
|
||||
// }
|
||||
// #endif
|
||||
|
||||
int blockId = int(mc_Entity.x + 0.5);
|
||||
|
||||
vec3 worldpos = playerpos;
|
||||
#ifdef WAVY_PLANTS
|
||||
// also use normal, so up/down facing geometry does not get detatched from its model parts.
|
||||
bool InterpolateFromBase = gl_MultiTexCoord0.t < max(mc_midTexCoord.t, abs(viewToWorld(normalize(gl_NormalMatrix * gl_Normal)).y));
|
||||
|
||||
if(
|
||||
(
|
||||
// these wave off of the ground. the area connected to the ground does not wave.
|
||||
(InterpolateFromBase && (blockId == BLOCK_GRASS_TALL_LOWER || blockId == BLOCK_GROUND_WAVING || blockId == BLOCK_GRASS_SHORT || blockId == BLOCK_SAPLING || blockId == BLOCK_GROUND_WAVING_VERTICAL))
|
||||
|
||||
// these wave off of the ceiling. the area connected to the ceiling does not wave.
|
||||
|| (!InterpolateFromBase && (blockId == BLOCK_VINE_OTHER))
|
||||
|
||||
// these wave off of the air. they wave uniformly
|
||||
|| (blockId == BLOCK_GRASS_TALL_UPPER || blockId == BLOCK_AIR_WAVING)
|
||||
|
||||
) && length(position.xy) < 24.0
|
||||
){
|
||||
// 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 += 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
|
||||
|
||||
LIGHTNING = 0.0;
|
||||
if (entityId == ENTITY_LIGHTNING) LIGHTNING = 1.0;
|
||||
|
||||
#ifdef PLANET_CURVATURE
|
||||
float curvature = length(worldpos) / (16*8);
|
||||
worldpos.y -= curvature*curvature * CURVATURE_AMOUNT;
|
||||
#endif
|
||||
|
||||
#ifdef CUSTOM_MOON_ROTATION
|
||||
position = mat3(customShadowMatrixSSBO) * worldpos + customShadowMatrixSSBO[3].xyz;
|
||||
#else
|
||||
position = mat3(shadowModelView) * worldpos + shadowModelView[3].xyz;
|
||||
#endif
|
||||
|
||||
#ifdef DISTORT_SHADOWMAP
|
||||
if (entityId == ENTITY_SSS_MEDIUM || entityId == ENTITY_SLIME)
|
||||
position.xyz = position.xyz - normalize(gl_NormalMatrix * gl_Normal) * 0.25;
|
||||
|
||||
gl_Position = BiasShadowProjection(toClipSpace3(position));
|
||||
#else
|
||||
gl_Position = toClipSpace3(position);
|
||||
#endif
|
||||
|
||||
|
||||
if (blockId == BLOCK_WATER) gl_Position.w = -1.0;
|
||||
|
||||
gl_Position.z /= 6.0;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
#include "/dimensions/voxy.json"
|
||||
@@ -0,0 +1,3 @@
|
||||
#define OVERWORLD_SHADER
|
||||
#define AETHER_FLAG
|
||||
#include "/dimensions/voxy_solid.glsl"
|
||||
@@ -0,0 +1,3 @@
|
||||
#define OVERWORLD_SHADER
|
||||
#define AETHER_FLAG
|
||||
#include "/dimensions/voxy_translucent.glsl"
|
||||
@@ -0,0 +1,12 @@
|
||||
#version 430 compatibility
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
#define TWILIGHT_FOREST_FLAG
|
||||
|
||||
#define WORLD
|
||||
|
||||
#define COLORWHEEL
|
||||
#define ENTITIES
|
||||
#define BLOCKENTITIES
|
||||
|
||||
#include "/dimensions/all_solid.fsh"
|
||||
@@ -0,0 +1,13 @@
|
||||
#version 430 compatibility
|
||||
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
#define TWILIGHT_FOREST_FLAG
|
||||
|
||||
#define WORLD
|
||||
|
||||
#define COLORWHEEL
|
||||
#define ENTITIES
|
||||
#define BLOCKENTITIES
|
||||
|
||||
#include "/dimensions/all_solid.vsh"
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
#version 430 compatibility
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
#define TWILIGHT_FOREST_FLAG
|
||||
|
||||
#define DAMAGE_BLOCK_EFFECT
|
||||
#define COLORWHEEL
|
||||
|
||||
#include "/dimensions/all_particles.fsh"
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
#version 430 compatibility
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
#define TWILIGHT_FOREST_FLAG
|
||||
|
||||
#define DAMAGE_BLOCK_EFFECT
|
||||
#define COLORWHEEL
|
||||
|
||||
#include "/dimensions/all_particles.vsh"
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
#version 430 compatibility
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
#define TWILIGHT_FOREST_FLAG
|
||||
|
||||
#define ENCHANT_GLINT
|
||||
#define COLORWHEEL
|
||||
|
||||
#include "/dimensions/all_vanilla_emissives.fsh"
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
#version 430 compatibility
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
#define TWILIGHT_FOREST_FLAG
|
||||
|
||||
#define ENCHANT_GLINT
|
||||
#define COLORWHEEL
|
||||
|
||||
#include "/dimensions/all_vanilla_emissives.vsh"
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
#version 430 compatibility
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
#define TWILIGHT_FOREST_FLAG
|
||||
|
||||
#define WORLD
|
||||
|
||||
#define COLORWHEEL
|
||||
#define ENTITIES
|
||||
#define BLOCKENTITIES
|
||||
|
||||
#include "/dimensions/all_translucent.fsh"
|
||||
@@ -0,0 +1,12 @@
|
||||
#version 430 compatibility
|
||||
|
||||
#define OVERWORLD_SHADER
|
||||
#define TWILIGHT_FOREST_FLAG
|
||||
|
||||
#define WORLD
|
||||
|
||||
#define COLORWHEEL
|
||||
#define ENTITIES
|
||||
#define BLOCKENTITIES
|
||||
|
||||
#include "/dimensions/all_translucent.vsh"
|
||||
@@ -0,0 +1,37 @@
|
||||
#version 430 compatibility
|
||||
|
||||
#include "/lib/settings.glsl"
|
||||
|
||||
in vec4 color;
|
||||
|
||||
in vec2 texcoord;
|
||||
uniform sampler2D gtexture;
|
||||
uniform sampler2D noisetex;
|
||||
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
|
||||
float blueNoise(){
|
||||
return fract(texelFetch(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 );
|
||||
}
|
||||
|
||||
/* RENDERTARGETS: 0 */
|
||||
|
||||
void main() {
|
||||
vec4 color = texture(gtexture,texcoord.xy);
|
||||
vec2 lmcoord;
|
||||
float ao;
|
||||
vec4 overlayColor;
|
||||
|
||||
clrwl_computeFragment(color, color, lmcoord, ao, overlayColor);
|
||||
color.rgb = mix(color.rgb, overlayColor.rgb, overlayColor.a);
|
||||
|
||||
gl_FragData[0] = color;
|
||||
|
||||
#ifdef Stochastic_Transparent_Shadows
|
||||
if(gl_FragData[0].a < blueNoise()) { discard; return;}
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,296 @@
|
||||
#version 430 compatibility
|
||||
|
||||
#if defined IS_LPV_ENABLED
|
||||
#extension GL_ARB_explicit_attrib_location: enable
|
||||
#extension GL_ARB_shader_image_load_store: enable
|
||||
#endif
|
||||
|
||||
#define RENDER_SHADOW
|
||||
|
||||
#define COLORWHEEL
|
||||
|
||||
#include "/lib/SSBOs.glsl"
|
||||
|
||||
#include "/lib/settings.glsl"
|
||||
|
||||
/*
|
||||
!! DO NOT REMOVE !!
|
||||
This code is from Chocapic13' shaders
|
||||
Read the terms of modification and sharing before changing something below please !
|
||||
!! DO NOT REMOVE !!
|
||||
*/
|
||||
|
||||
out vec2 texcoord;
|
||||
out vec4 color;
|
||||
|
||||
in vec4 mc_midTexCoord;
|
||||
in vec4 mc_Entity;
|
||||
|
||||
#define SHADOW_MAP_BIAS 0.5
|
||||
const float PI = 3.1415927;
|
||||
|
||||
uniform mat4 shadowProjectionInverse;
|
||||
uniform mat4 shadowProjection;
|
||||
uniform mat4 shadowModelViewInverse;
|
||||
uniform mat4 shadowModelView;
|
||||
uniform mat4 gbufferModelView;
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
uniform mat4 gbufferProjection;
|
||||
uniform mat4 gbufferProjectionInverse;
|
||||
uniform int hideGUI;
|
||||
uniform vec3 cameraPosition;
|
||||
uniform vec3 relativeEyePosition;
|
||||
uniform float frameTimeCounter;
|
||||
uniform int frameCounter;
|
||||
uniform float screenBrightness;
|
||||
uniform vec3 sunVec;
|
||||
uniform float aspectRatio;
|
||||
uniform float sunElevation;
|
||||
uniform vec3 sunPosition;
|
||||
uniform float lightSign;
|
||||
uniform float cosFov;
|
||||
uniform vec3 shadowViewDir;
|
||||
uniform vec3 shadowCamera;
|
||||
uniform vec3 shadowLightVec;
|
||||
uniform float shadowMaxProj;
|
||||
|
||||
uniform int blockEntityId;
|
||||
uniform int entityId;
|
||||
|
||||
#include "/lib/Shadow_Params.glsl"
|
||||
#include "/lib/bokeh.glsl"
|
||||
#include "/lib/blocks.glsl"
|
||||
#include "/lib/entities.glsl"
|
||||
|
||||
#if defined IS_LPV_ENABLED
|
||||
#ifdef IRIS_FEATURE_BLOCK_EMISSION_ATTRIBUTE
|
||||
in vec4 at_midBlock;
|
||||
#else
|
||||
in vec3 at_midBlock;
|
||||
#endif
|
||||
uniform int currentRenderedItemId;
|
||||
uniform int renderStage;
|
||||
|
||||
#include "/lib/voxel_common.glsl"
|
||||
#include "/lib/voxel_write.glsl"
|
||||
#endif
|
||||
|
||||
const float PI48 = 150.796447372*WAVY_SPEED;
|
||||
float pi2wt = PI48*frameTimeCounter;
|
||||
|
||||
out float LIGHTNING;
|
||||
|
||||
vec2 calcWave(in vec3 pos) {
|
||||
|
||||
float magnitude = abs(sin(dot(vec4(frameTimeCounter, pos),vec4(1.0,0.005,0.005,0.005)))*0.5+0.72)*0.013;
|
||||
vec2 ret = (sin(pi2wt*vec2(0.0063,0.0015)*4. - pos.xz + pos.y*0.05)+0.1)*magnitude;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
vec3 calcMovePlants(in vec3 pos) {
|
||||
vec2 move1 = calcWave(pos );
|
||||
float move1y = -length(move1);
|
||||
return vec3(move1.x,move1y,move1.y)*5.*WAVY_STRENGTH/255.0;
|
||||
}
|
||||
|
||||
vec3 calcWaveLeaves(in vec3 pos, in float fm, in float mm, in float ma, in float f0, in float f1, in float f2, in float f3, in float f4, in float f5) {
|
||||
|
||||
float magnitude = abs(sin(dot(vec4(frameTimeCounter, pos),vec4(1.0,0.005,0.005,0.005)))*0.5+0.72)*0.013;
|
||||
vec3 ret = (sin(pi2wt*vec3(0.0063,0.0224,0.0015)*1.5 - pos))*magnitude;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
vec3 calcMoveLeaves(in vec3 pos, in float f0, in float f1, in float f2, in float f3, in float f4, in float f5, in vec3 amp1, in vec3 amp2) {
|
||||
vec3 move1 = calcWaveLeaves(pos , 0.0054, 0.0400, 0.0400, 0.0127, 0.0089, 0.0114, 0.0063, 0.0224, 0.0015) * amp1;
|
||||
return move1*5.*WAVY_STRENGTH/255.;
|
||||
}
|
||||
bool intersectCone(float coneHalfAngle, vec3 coneTip , vec3 coneAxis, vec3 rayOrig, vec3 rayDir, float maxZ)
|
||||
{
|
||||
vec3 co = rayOrig - coneTip;
|
||||
float prod = dot(normalize(co),coneAxis);
|
||||
if (prod <= -coneHalfAngle) return true; //In view frustrum
|
||||
|
||||
float a = dot(rayDir,coneAxis)*dot(rayDir,coneAxis) - coneHalfAngle*coneHalfAngle;
|
||||
float b = 2. * (dot(rayDir,coneAxis)*dot(co,coneAxis) - dot(rayDir,co)*coneHalfAngle*coneHalfAngle);
|
||||
float c = dot(co,coneAxis)*dot(co,coneAxis) - dot(co,co)*coneHalfAngle*coneHalfAngle;
|
||||
|
||||
float det = b*b - 4.*a*c;
|
||||
if (det < 0.) return false; // No intersection with either forward cone and backward cone
|
||||
|
||||
det = sqrt(det);
|
||||
float t2 = (-b + det) / (2. * a);
|
||||
if (t2 <= 0.0 || t2 >= maxZ) return false; //Idk why it works
|
||||
|
||||
return true;
|
||||
}
|
||||
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
|
||||
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
|
||||
|
||||
|
||||
|
||||
// uniform float far;
|
||||
uniform float dhVoxyFarPlane;
|
||||
|
||||
#include "/lib/DistantHorizons_projections.glsl"
|
||||
|
||||
vec4 toClipSpace3(vec3 viewSpacePosition) {
|
||||
|
||||
// mat4 projection = DH_shadowProjectionTweak(gl_ProjectionMatrix);
|
||||
|
||||
return vec4(projMAD(gl_ProjectionMatrix, viewSpacePosition),1.0);
|
||||
}
|
||||
vec3 viewToWorld(vec3 viewPos) {
|
||||
vec4 pos;
|
||||
pos.xyz = viewPos;
|
||||
pos.w = 0.0;
|
||||
pos = shadowModelViewInverse * pos;
|
||||
return pos.xyz;
|
||||
}
|
||||
|
||||
// uniform int renderStage;
|
||||
|
||||
// uniform mat4 gbufferModelViewInverse;
|
||||
void main() {
|
||||
texcoord.xy = gl_MultiTexCoord0.xy;
|
||||
color = gl_Color;
|
||||
|
||||
vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
|
||||
|
||||
|
||||
// playerpos = vec4(0.0);
|
||||
// playerpos = gbufferModelViewInverse * (gl_ModelViewMatrix * gl_Vertex);
|
||||
|
||||
// mat4 Custom_ViewMatrix = BuildShadowViewMatrix(LightDir);
|
||||
// mat4 Custom_ProjectionMatrix = BuildShadowProjectionMatrix();
|
||||
|
||||
// position = gl_Vertex.xyz;
|
||||
|
||||
// if((renderStage == 10 || renderStage == 12) && mc_Entity.x != 3000) {
|
||||
// position = (shadowModelViewInverse * vec4(gl_Vertex.xyz,1.0)).xyz;
|
||||
// }
|
||||
|
||||
// position = mat3(Custom_ViewMatrix) * position + Custom_ViewMatrix[3].xyz;
|
||||
|
||||
// HHHHHHHHH ITS THE JITTER DOF HERE TO SAY HELLO
|
||||
// It turns out 'position' above is just viewPos lmao
|
||||
// #ifdef DOF_JITTER_SHADOW
|
||||
// // CLIP SPACE
|
||||
// vec2 jitter = clamp(jitter_offsets[frameCounter % 64], -1.0, 1.0);
|
||||
// jitter = rotate(radians(float(frameCounter))) * jitter;
|
||||
// jitter.y *= aspectRatio;
|
||||
// jitter.x *= DOF_ANAMORPHIC_RATIO;
|
||||
|
||||
// vec4 clipPos = gbufferProjection * vec4(position, 1.0);
|
||||
|
||||
// // CLIP SPACE -> VIEW SPACE
|
||||
// vec3 viewPos = (gbufferProjectionInverse * clipPos).xyz;
|
||||
|
||||
// // Focus distance
|
||||
// #if DOF_JITTER_FOCUS < 0
|
||||
// float focusMul = clipPos.z - mix(pow(512.0, screenBrightness), 512.0 * screenBrightness, 0.25);
|
||||
// #else
|
||||
// float focusMul = clipPos.z - DOF_JITTER_FOCUS;
|
||||
// #endif
|
||||
|
||||
// // CLIP SPACE -> SHADOW CLIP SPACE
|
||||
// vec3 jitterViewPos = (gbufferProjectionInverse * vec4(jitter, 1.0, 1.0)).xyz;
|
||||
// // vec3 jitterFeetPos = (gbufferModelViewInverse * vec4(jitterViewPos, 1.0)).xyz;
|
||||
// // vec3 jitterShadowViewPos = (shadowModelView * vec4(jitterFeetPos, 1.0)).xyz;
|
||||
// // vec4 jitterShadowClipPos = gl_ProjectionMatrix * vec4(jitterShadowViewPos, 1.0);
|
||||
|
||||
// // vec4 totalOffset = jitterShadowClipPos * JITTER_STRENGTH * focusMul * 1e-2;
|
||||
|
||||
// position += jitterViewPos * focusMul * 1e-2;
|
||||
// if(focusMul < 10.0) {
|
||||
// gl_Position = vec4(-1.0);
|
||||
// return;
|
||||
// }
|
||||
// #endif
|
||||
|
||||
// #if defined IS_LPV_ENABLED || defined WAVY_PLANTS || !defined PLANET_CURVATURE
|
||||
vec3 playerpos = mat3(shadowModelViewInverse) * position + shadowModelViewInverse[3].xyz;
|
||||
// #endif
|
||||
|
||||
#if defined IS_LPV_ENABLED && defined MC_GL_ARB_shader_image_load_store
|
||||
PopulateShadowVoxel(playerpos);
|
||||
#endif
|
||||
|
||||
// #ifdef WAVY_PLANTS
|
||||
// bool istopv = gl_MultiTexCoord0.t < mc_midTexCoord.t;
|
||||
// if (
|
||||
// (
|
||||
// blockId == BLOCK_GROUND_WAVING || blockId == BLOCK_GROUND_WAVING_VERTICAL ||
|
||||
// blockId == BLOCK_GRASS_SHORT || (blockId == BLOCK_GRASS_TALL_UPPER && istopv) ||
|
||||
// blockId == BLOCK_SAPLING
|
||||
// ) && length(position.xy) < 24.0
|
||||
// ) {
|
||||
// playerpos += calcMovePlants(playerpos + cameraPosition)*gl_MultiTexCoord1.y;
|
||||
// position = mat3(shadowModelView) * playerpos + shadowModelView[3].xyz;
|
||||
// }
|
||||
|
||||
// if (blockId == BLOCK_AIR_WAVING && length(position.xy) < 24.0) {
|
||||
// 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;
|
||||
// position = mat3(shadowModelView) * playerpos + shadowModelView[3].xyz;
|
||||
// }
|
||||
// #endif
|
||||
|
||||
int blockId = int(mc_Entity.x + 0.5);
|
||||
|
||||
vec3 worldpos = playerpos;
|
||||
#ifdef WAVY_PLANTS
|
||||
// also use normal, so up/down facing geometry does not get detatched from its model parts.
|
||||
bool InterpolateFromBase = gl_MultiTexCoord0.t < max(mc_midTexCoord.t, abs(viewToWorld(normalize(gl_NormalMatrix * gl_Normal)).y));
|
||||
|
||||
if(
|
||||
(
|
||||
// these wave off of the ground. the area connected to the ground does not wave.
|
||||
(InterpolateFromBase && (blockId == BLOCK_GRASS_TALL_LOWER || blockId == BLOCK_GROUND_WAVING || blockId == BLOCK_GRASS_SHORT || blockId == BLOCK_SAPLING || blockId == BLOCK_GROUND_WAVING_VERTICAL))
|
||||
|
||||
// these wave off of the ceiling. the area connected to the ceiling does not wave.
|
||||
|| (!InterpolateFromBase && (blockId == BLOCK_VINE_OTHER))
|
||||
|
||||
// these wave off of the air. they wave uniformly
|
||||
|| (blockId == BLOCK_GRASS_TALL_UPPER || blockId == BLOCK_AIR_WAVING)
|
||||
|
||||
) && length(position.xy) < 24.0
|
||||
){
|
||||
// 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 += 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
|
||||
|
||||
LIGHTNING = 0.0;
|
||||
if (entityId == ENTITY_LIGHTNING) LIGHTNING = 1.0;
|
||||
|
||||
#ifdef PLANET_CURVATURE
|
||||
float curvature = length(worldpos) / (16*8);
|
||||
worldpos.y -= curvature*curvature * CURVATURE_AMOUNT;
|
||||
#endif
|
||||
|
||||
#ifdef CUSTOM_MOON_ROTATION
|
||||
position = mat3(customShadowMatrixSSBO) * worldpos + customShadowMatrixSSBO[3].xyz;
|
||||
#else
|
||||
position = mat3(shadowModelView) * worldpos + shadowModelView[3].xyz;
|
||||
#endif
|
||||
|
||||
#ifdef DISTORT_SHADOWMAP
|
||||
if (entityId == ENTITY_SSS_MEDIUM || entityId == ENTITY_SLIME)
|
||||
position.xyz = position.xyz - normalize(gl_NormalMatrix * gl_Normal) * 0.25;
|
||||
|
||||
gl_Position = BiasShadowProjection(toClipSpace3(position));
|
||||
#else
|
||||
gl_Position = toClipSpace3(position);
|
||||
#endif
|
||||
|
||||
|
||||
if (blockId == BLOCK_WATER) gl_Position.w = -1.0;
|
||||
|
||||
gl_Position.z /= 6.0;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
#include "/dimensions/voxy.json"
|
||||
@@ -0,0 +1,3 @@
|
||||
#define OVERWORLD_SHADER
|
||||
#define TWILIGHT_FOREST_FLAG
|
||||
#include "/dimensions/voxy_solid.glsl"
|
||||
@@ -0,0 +1,3 @@
|
||||
#define OVERWORLD_SHADER
|
||||
#define TWILIGHT_FOREST_FLAG
|
||||
#include "/dimensions/voxy_translucent.glsl"
|
||||
Reference in New Issue
Block a user