Small performance improvement when using DH/Voxy (big one if additionally using HQ SSAO)

This commit is contained in:
Merlin1809
2025-11-30 00:48:01 +01:00
parent e363a9b08c
commit 761fc310ab
5 changed files with 35 additions and 8 deletions
+1 -1
View File
@@ -526,7 +526,7 @@ void main() {
#if REPLACE_SHORT_GRASS < 2 && !defined BLOCKENTITIES && !defined ENTITIES && !defined HAND && defined SHADER_GRASS && !defined COLORWHEEL && defined WORLD
// darken the top of grass blocks a bit
if(data_in.blockID == 85 && flatNormals.y > abs(0.9) && !ShaderGrass) Albedo *= smoothstep(-30.0, 25.0, length(playerpos));
if(data_in.blockID == 85 && flatNormals.y > abs(0.9) && !ShaderGrass) Albedo.rgb *= smoothstep(-30.0, 25.0, length(playerpos));
#endif
#if defined DISTANT_HORIZONS && DH_CHUNK_FADING > 0
+31 -4
View File
@@ -262,6 +262,35 @@ float convertHandDepth_2(in float depth, bool hand) {
ndcDepth /= MC_HAND_DEPTH;
return ndcDepth * 0.5 + 0.5;
}
#if defined DISTANT_HORIZONS || defined VOXY
vec4 iProjDiag = vec4(gbufferProjectionInverse[0].x, gbufferProjectionInverse[1].y, gbufferProjectionInverse[2].zw);
vec4 iProjDiag_DH = vec4(dhVoxyProjectionInverse[0].x, dhVoxyProjectionInverse[1].y, dhVoxyProjectionInverse[2].zw);
vec3 toScreenSpace_DH_SSAO(vec2 texcoord, ivec2 samplecoord, bool hand) {
vec4 viewPos = vec4(0.0);
vec3 feetPlayerPos = vec3(0.0);
float depth = convertHandDepth_2(texelFetch2D(depthtex1, samplecoord, 0).x, hand);
if (depth < 1.0) {
feetPlayerPos = vec3(texcoord, depth) * 2.0 - 1.0;
viewPos = iProjDiag * feetPlayerPos.xyzz + gbufferProjectionInverse[3];
viewPos.xyz /= viewPos.w;
} else {
depth = texelFetch2D(dhVoxyDepthTex1, samplecoord, 0).x;
feetPlayerPos = vec3(texcoord, depth) * 2.0 - 1.0;
viewPos = iProjDiag_DH * feetPlayerPos.xyzz + dhVoxyProjectionInverse[3];
viewPos.xyz /= viewPos.w;
}
return viewPos.xyz;
}
#endif
vec2 SSAO(
vec3 viewPos, vec3 normal, vec3 flatnormal, bool hand, float noise
@@ -292,13 +321,11 @@ vec2 SSAO(
ivec2 offsetUV = ivec2(clamp((gl_FragCoord.xy + offsets*vec2(viewWidth, viewHeight*aspectRatio)*RENDER_SCALE)*texelSize,screenEdges,1.0-screenEdges)/texelSize);
if (offsetUV.x >= 0 && offsetUV.y >= 0 && offsetUV.x < viewWidth*RENDER_SCALE.x && offsetUV.y < viewHeight*RENDER_SCALE.y ) {
float sampleDepth = convertHandDepth_2(texelFetch2D(depthtex1, offsetUV, 0).x, hand);
#if defined DISTANT_HORIZONS || defined VOXY
float sampleDHDepth = texelFetch2D(dhVoxyDepthTex1, offsetUV, 0).x;
vec3 offsetViewPos = toScreenSpace_DH((offsetUV*texelSize - jitterOffsets) * (1.0/RENDER_SCALE), sampleDepth, sampleDHDepth);
vec3 offsetViewPos = toScreenSpace_DH_SSAO((offsetUV*texelSize - jitterOffsets) * (1.0/RENDER_SCALE), offsetUV, hand);
#else
float sampleDepth = convertHandDepth_2(texelFetch2D(depthtex1, offsetUV, 0).x, hand);
vec3 offsetViewPos = toScreenSpace(vec3((offsetUV*texelSize - jitterOffsets) * (1.0/RENDER_SCALE), sampleDepth));
#endif
+1 -1
View File
@@ -1,6 +1,6 @@
option.SHADER_VERSION_LABEL = §d§lECLIPSE§r - A Bliss Edit
prefix.SHADER_VERSION_LABEL = V
value.SHADER_VERSION_LABEL.482 = 5.4.1
value.SHADER_VERSION_LABEL.482 = 5.4.2
# if you're here to translate, this is not a joke, these do what they say
profile.POTATO=§4Potato
+1 -1
View File
@@ -1,6 +1,6 @@
option.SHADER_VERSION_LABEL = §d§lECLIPSE§r - Bliss 编辑版
prefix.SHADER_VERSION_LABEL = 版本
value.SHADER_VERSION_LABEL.482 = 5.4.1
value.SHADER_VERSION_LABEL.482 = 5.4.2
# 如果你是来翻译的,这不是玩笑,这些选项的功能正如其名
profile.POTATO=§4土豆 (极低配置)
+1 -1
View File
@@ -85,7 +85,7 @@ vec4 GetVolumetricFog(
//project pixel position into projected shadowmap space
vec3 playerPos = mat3(gbufferModelViewInverse) * viewPosition + gbufferModelViewInverse[3].xyz;
vec3 rayStartPos = playerPos - gbufferModelViewInverse[3].xyz;
// vec3 rayStartPos = playerPos - gbufferModelViewInverse[3].xyz;
#ifdef CUSTOM_MOON_ROTATION
vec3 fragposition = mat3(customShadowMatrixSSBO) * playerPos + customShadowMatrixSSBO[3].xyz;
#else