mirror of
https://github.com/Merlin1809/Eclipse-Shader.git
synced 2026-10-10 13:03:06 +08:00
Add dither fallback for translucent entities, tiny optimizations
This commit is contained in:
@@ -133,9 +133,13 @@ float R2_dither(){
|
||||
}
|
||||
|
||||
#ifdef TAA
|
||||
#define blueNoise fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter)
|
||||
float blueNoise() {
|
||||
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter);
|
||||
}
|
||||
#else
|
||||
#define blueNoise fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887)
|
||||
float blueNoise() {
|
||||
return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -374,6 +378,8 @@ void main() {
|
||||
data_in.tangent.z, binormal.z, normal.z);
|
||||
#endif
|
||||
|
||||
float BN = blueNoise();
|
||||
|
||||
vec2 tempOffset = offsets[framemod8];
|
||||
|
||||
vec3 fragpos = toScreenSpace(FragCoord*vec3(texelSize/RENDER_SCALE,1.0)-vec3(vec2(tempOffset)*texelSize*0.5, 0.0));
|
||||
@@ -419,7 +425,7 @@ void main() {
|
||||
float pomdepth = POM_DEPTH*falloff;
|
||||
|
||||
if ( viewVector.z < 0.0 && depthmap < 0.9999 && depthmap > 0.00001) {
|
||||
float noise = blueNoise;
|
||||
float noise = BN;
|
||||
#ifdef Adaptive_Step_length
|
||||
vec3 interval = (viewVector.xyz / -viewVector.z / MAX_OCCLUSION_POINTS * pomdepth) * clamp(1.0-pow(depthmap,2),0.1,1.0);
|
||||
used_POM_DEPTH = 1.0;
|
||||
@@ -540,6 +546,14 @@ void main() {
|
||||
if (Albedo.a < alphaTestRef) discard;
|
||||
#endif
|
||||
|
||||
#if (defined BLOCKENTITIES || defined ENTITIES) && !defined TRANSLUCENT_ENTITIES && defined TRANSLUCENT_ENTITIES_DITHER_FALLBACK
|
||||
#ifdef TAA
|
||||
if(step(1.0-Albedo.a, BN) == 0.0) discard;
|
||||
#else
|
||||
if(step(1.0-Albedo.a, R2_dither()) == 0.0) discard;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
float torchlightmap = lmcoord.x;
|
||||
|
||||
#if defined Hand_Held_lights && !defined LPV_ENABLED
|
||||
@@ -600,14 +614,14 @@ void main() {
|
||||
|
||||
vec2 rayDir = ((correctedViewVec.xy) / -correctedViewVec.z) / steps * 5.0 ;
|
||||
|
||||
vec2 uv = correctedWorldPos + rayDir * blueNoise;
|
||||
vec2 uv = correctedWorldPos + rayDir * BN;
|
||||
uv += rayDir * 10.0;
|
||||
|
||||
vec2 animation = vec2(frameTimeCounter, -frameTimeCounter)*0.01;
|
||||
|
||||
for (int i = 0; i < int(steps); i++) {
|
||||
|
||||
float verticalGradient = (i + blueNoise)/steps ;
|
||||
float verticalGradient = (i + BN)/steps ;
|
||||
float verticalGradient2 = exp(-7*(1-verticalGradient*verticalGradient));
|
||||
|
||||
float density = max(max(verticalGradient - texture2D(noisetex, uv/256.0 + animation.xy).b*0.5,0.0) - (1.0-texture2D(noisetex, uv/32.0 + animation.xx).r) * (0.4 + 0.1 * (texture2D(noisetex, uv/10.0 - animation.yy).b)),0.0);
|
||||
|
||||
@@ -789,7 +789,7 @@ void main() {
|
||||
#ifdef OVERWORLD_SHADER
|
||||
vec2 lightmap = decodeVec2(texelFetch2D(colortex14,texcoord,0).z);
|
||||
#else
|
||||
vec2 lightmap = decodeVec2(texelFetch2D(colortex14,texcoord,0).a);
|
||||
vec2 lightmap = decodeVec2(texelFetch2D(colortex14,texcoord,0).z);
|
||||
lightmap.y = 1.0;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -409,16 +409,16 @@ vec4 VLTemporalFiltering(vec3 viewPos, in float referenceDepth, sampler2D depth,
|
||||
|
||||
vec4 currentFrame = texture2D(colortex0, VLtexCoord);
|
||||
|
||||
// return vec4(outerEdgeResults,0,0,1);
|
||||
// return upsampledCurrentFrame;
|
||||
|
||||
if (previousPosition.x < 0.0 || previousPosition.y < 0.0 || previousPosition.x > 1.0 || previousPosition.y > 1.0) return currentFrame;
|
||||
|
||||
// to fill pixel gaps in geometry edges, do a bilateral upsample.
|
||||
// pass a mask to only show upsampled color around the edges of blocks. this is so it doesnt blur reprojected results.
|
||||
float outerEdgeResults = 0.0;
|
||||
vec4 upsampledCurrentFrame = bilateralUpsample(gl_FragCoord.xy , colortex0, outerEdgeResults, referenceDepth, depth, hand, false);
|
||||
// vec4 upsampledCurrentFrame = BilateralUpscale(colortex0, depth, gl_FragCoord.xy - 1.5, referenceDepth);
|
||||
|
||||
// return vec4(outerEdgeResults,0,0,1);
|
||||
// return upsampledCurrentFrame;
|
||||
|
||||
if (previousPosition.x < 0.0 || previousPosition.y < 0.0 || previousPosition.x > 1.0 || previousPosition.y > 1.0) return currentFrame;
|
||||
|
||||
vec4 col1 = texture2D(colortex0, VLtexCoord + vec2( texelSize.x, texelSize.y));
|
||||
vec4 col2 = texture2D(colortex0, VLtexCoord + vec2( texelSize.x, -texelSize.y));
|
||||
@@ -838,7 +838,8 @@ void main() {
|
||||
|
||||
// blend border fog. be sure to blend before and after forward rendered color blends.
|
||||
#if defined BorderFog && defined OVERWORLD_SHADER
|
||||
vec4 borderFog = vec4(skyGroundColor, getBorderFogDensity(linearDistance_cylinder, playerPos_normalized, swappedDepth >= 1.0));
|
||||
float borderFogDensity = getBorderFogDensity(linearDistance_cylinder, playerPos_normalized, isSky);
|
||||
vec4 borderFog = vec4(skyGroundColor, borderFogDensity);
|
||||
|
||||
#if !defined SKY_GROUND
|
||||
borderFog.rgb = skyFromTex(playerPos_normalized, colortex4)/1200.0 * Sky_Brightness;
|
||||
@@ -863,7 +864,7 @@ void main() {
|
||||
blendForwardRendering(color, TranslucentShader);
|
||||
|
||||
#if defined BorderFog && defined OVERWORLD_SHADER
|
||||
color = mix(color, borderFog.rgb, getBorderFogDensity(linearDistance_cylinder, playerPos_normalized, isSky));
|
||||
color = mix(color, borderFog.rgb, borderFogDensity);
|
||||
#endif
|
||||
|
||||
// tweaks to VL for nametag rendering
|
||||
|
||||
@@ -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.4.4
|
||||
value.SHADER_VERSION_LABEL.482 = 5.5.0
|
||||
|
||||
# if you're here to translate, this is not a joke, these do what they say
|
||||
profile.POTATO=§4Potato
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
option.SHADER_VERSION_LABEL = §d§lECLIPSE§r - Bliss 编辑版
|
||||
prefix.SHADER_VERSION_LABEL = 版本
|
||||
value.SHADER_VERSION_LABEL.482 = 5.4.4
|
||||
value.SHADER_VERSION_LABEL.482 = 5.5.0
|
||||
|
||||
# 如果你是来翻译的,这不是玩笑,这些选项的功能正如其名
|
||||
profile.POTATO=§4土豆 (极低配置)
|
||||
|
||||
@@ -128,7 +128,7 @@ vec3 calculateAtmosphere(vec3 background, vec3 viewVector, vec3 upVector, vec3 s
|
||||
vec2 phaseMoon = sky_phase(dot(viewVector, moonVector), 0.8);
|
||||
|
||||
#ifdef CUSTOM_MOON_ROTATION
|
||||
float eclipseDarkeness = smoothstep(0.005, 0.09, length(sunVector-moonVector));
|
||||
float eclipseDarkeness = smoothstep(0.005, 0.08, length(sunVector-moonVector));
|
||||
phaseSun *= mix(1.0, eclipseDarkeness, smoothstep(-1.0, 0.175, viewVector.y));
|
||||
#endif
|
||||
|
||||
|
||||
@@ -113,8 +113,6 @@ vec4 GetVolumetricFog(
|
||||
|
||||
float dL = length(dVWorld)/8.0;
|
||||
|
||||
vec3 progress = start.xyz;
|
||||
vec3 progressW = vec3(0.0);
|
||||
const float expFactor = 11.0;
|
||||
|
||||
/// ------------- COLOR/LIGHTING STUFF ------------- \\\
|
||||
@@ -122,8 +120,7 @@ vec4 GetVolumetricFog(
|
||||
vec3 color = vec3(0.0);
|
||||
vec3 finalAbsorbance = vec3(1.0);
|
||||
|
||||
// float totalAbsorbance = 1.0;
|
||||
vec3 totalAbsorbance = vec3(1.0);
|
||||
float totalAbsorbance = 1.0;
|
||||
|
||||
// float fogAbsorbance = 1.0;
|
||||
// float atmosphereAbsorbance = 1.0;
|
||||
@@ -170,17 +167,22 @@ vec4 GetVolumetricFog(
|
||||
|
||||
|
||||
for (int i = 0; i < SAMPLECOUNT; i++) {
|
||||
// if(totalAbsorbance.r < 0.01 && totalAbsorbance.g < 0.01 && totalAbsorbance.b < 0.01) break;
|
||||
float d = (pow(expFactor, float(i+dither.x)/float(SAMPLECOUNT))/expFactor - 1.0/expFactor)/(1-1.0/expFactor);
|
||||
float dd = pow(expFactor, float(i+dither.y)/float(SAMPLECOUNT)) * log(expFactor) / float(SAMPLECOUNT)/(expFactor-1.0);
|
||||
|
||||
progress = start.xyz + d*dV;
|
||||
progressW = gbufferModelViewInverse[3].xyz + cameraPosition + d*dVWorld;
|
||||
// #ifdef VOLUMETRIC_CLOUDS
|
||||
// // check if the fog intersects clouds
|
||||
// if(length(d*dVWorld) > cloudPlaneDistance) break;
|
||||
// #endif
|
||||
|
||||
vec3 progress = start.xyz + d*dV;
|
||||
vec3 progressP = gbufferModelViewInverse[3].xyz + d*dVWorld;
|
||||
vec3 progressW = progressP + cameraPosition;
|
||||
|
||||
//------------------------------------
|
||||
//------ SAMPLE SHADOWS FOR FOG EFFECTS
|
||||
//------------------------------------
|
||||
#if defined DISTORT_SHADOWMAP && defined OVERWORLD_SHADER
|
||||
#if defined DISTORT_SHADOWMAP
|
||||
float distortFactor = calcDistort(progress.xy);
|
||||
#else
|
||||
float distortFactor = 1.0;
|
||||
@@ -227,7 +229,7 @@ vec4 GetVolumetricFog(
|
||||
vec3 DirectLight = LightSourcePhased * sh;
|
||||
#endif
|
||||
|
||||
vec3 Lightning = Iris_Lightningflash_VLfog(progressW-cameraPosition);
|
||||
vec3 Lightning = Iris_Lightningflash_VLfog(progressP);
|
||||
vec3 lighting = DirectLight + indirectLight + 0.1 * Lightning;
|
||||
|
||||
color += (lighting - lighting * fogVolumeCoeff) * totalAbsorbance;
|
||||
@@ -242,13 +244,13 @@ vec4 GetVolumetricFog(
|
||||
#ifdef VIVECRAFT
|
||||
if (vivecraftIsVR) {
|
||||
forwardOffset = 0.0;
|
||||
shiftedPlayerPos = (progressW - cameraPosition) + ( vivecraftRelativeMainHandPos);
|
||||
shiftedPlayerPos = (progressP) + ( vivecraftRelativeMainHandPos);
|
||||
shiftedViewPos = shiftedPlayerPos * mat3(vivecraftRelativeMainHandRot);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
forwardOffset = 0.5;
|
||||
shiftedViewPos = mat3(gbufferModelView)*(progressW-cameraPosition) + vec3(-0.25, 0.2, 0.0);
|
||||
shiftedViewPos = mat3(gbufferModelView)*(progressP) + vec3(-0.25, 0.2, 0.0);
|
||||
shiftedPlayerPos = mat3(gbufferModelViewInverse) * shiftedViewPos;
|
||||
}
|
||||
|
||||
@@ -267,12 +269,14 @@ vec4 GetVolumetricFog(
|
||||
|
||||
// kill fog absorbance when in caves.
|
||||
totalAbsorbance *= mix(1.0, fogVolumeCoeff, lightLevelZero);
|
||||
if(totalAbsorbance < 0.01) break;
|
||||
|
||||
//------------------------------------
|
||||
//------ ATMOSPHERE HAZE EFFECT
|
||||
//------------------------------------
|
||||
|
||||
// maximum range for atmosphere haze, basically.
|
||||
float planetVolume = smoothstep(1.0 - exp(clamp(1.0 - length(progressW-cameraPosition) / (16.0*150.0), 0.0,1.0) * -10.0), 0.0, progressW.y-cameraPosition.y-500.0);
|
||||
float planetVolume = smoothstep(1.0 - exp(clamp(1.0 - length(progressP) / (16.0*150.0), 0.0,1.0) * -10.0), 0.0, progressP.y-500.0);
|
||||
|
||||
// just air
|
||||
vec2 airCoef = exp2(-max(progressW.y-SEA_LEVEL,0.0)/vec2(8.0e3, 1.2e3)*vec2(6.0,7.0)) * 192.0 * Haze_amount * planetVolume;
|
||||
|
||||
@@ -951,6 +951,11 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
|
||||
// #define TRANSLUCENT_ENTITIES
|
||||
#endif
|
||||
|
||||
#define TRANSLUCENT_ENTITIES_DITHER_FALLBACK
|
||||
|
||||
#ifdef TRANSLUCENT_ENTITIES_DITHER_FALLBACK
|
||||
#endif
|
||||
|
||||
#define WATER_CAUSTICS_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 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0]
|
||||
#define WATER_CAUSTICS_POWER 1.0 // [0.0 0.1 0.2 0.3 0.4 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 0.95 1.0 1.05 1.1 1.15 1.2 1.25 1.3 1.35 1.4 1.45 1.5 1.55 1.6 1.65 1.7 1.75 1.8 1.85 1.9 1.95 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 3.2 3.4 3.6 3.8 4.0 4.5 5.0 6.0 7.0 8.0 9.0 10.0]
|
||||
#define DENOISE_SSS_AND_SSAO
|
||||
|
||||
@@ -515,7 +515,7 @@ SHADER_VERSION_LABEL <profile> \
|
||||
screen.Misc_Settings = [EXPERIMENTAL_STUFF] [DEBUG_STUFF] [LEGACY_STUFF] TRANSLUCENT_ENTITIES [selection_box_outline] [scene_controller] <empty> <empty> AEROCHROME_MODE AEROCHROME_PINKNESS AEROCHROME_WOOL_ENABLED
|
||||
|
||||
screen.EXPERIMENTAL_STUFF.columns = 2
|
||||
screen.EXPERIMENTAL_STUFF = BLOOMY_PARTICLES BIOME_TINT_WATER HYPER_DETAILED_WAVES LIT_PARTICLE_BRIGHTNESS WATER_CAUSTICS_BRIGHTNESS WATER_CAUSTICS_POWER FORCE_TRANSLUCENT_GLASS LARGE_WAVE_DISPLACEMENT Vanilla_like_water INCLUDE_UNLISTED_ENTITIES PIXELATED PIXELIZATION_STRENGTH MAX_COLORS_PER_CHANNEL HARDCODED_EMISSIVES_APPROX
|
||||
screen.EXPERIMENTAL_STUFF = BLOOMY_PARTICLES BIOME_TINT_WATER HYPER_DETAILED_WAVES LIT_PARTICLE_BRIGHTNESS WATER_CAUSTICS_BRIGHTNESS WATER_CAUSTICS_POWER FORCE_TRANSLUCENT_GLASS LARGE_WAVE_DISPLACEMENT Vanilla_like_water INCLUDE_UNLISTED_ENTITIES PIXELATED PIXELIZATION_STRENGTH MAX_COLORS_PER_CHANNEL HARDCODED_EMISSIVES_APPROX TRANSLUCENT_ENTITIES_DITHER_FALLBACK
|
||||
|
||||
screen.DEBUG_STUFF.columns = 2
|
||||
screen.DEBUG_STUFF = [the_end_orb] DEBUG_VIEW display_LUT WhiteWorld SSS_view ambientLight_only LIGHTNING_FLASH DISABLE_ENCHANT_GLINT DISABLE_VANILLA_EMISSIVES PARTICLE_RENDERING_FIX ISOLATE_RESOURCEPACK_SKY CAVE_DETECTION
|
||||
|
||||
Reference in New Issue
Block a user