Improve solid particles, fix voxy translucents in nether/end

This commit is contained in:
Merlin1809
2026-04-13 16:57:25 +02:00
parent b0177c08b9
commit b153f92168
34 changed files with 321 additions and 32 deletions
+95 -4
View File
@@ -240,6 +240,9 @@ float ComputeShadowMap(inout vec3 directLightColor, vec3 playerPos, float maxDis
}
#endif
uniform sampler2D normals;
uniform sampler2D specular;
#if defined DAMAGE_BLOCK_EFFECT && defined POM
mat3 inverseMatrix(mat3 m) {
float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];
@@ -269,8 +272,6 @@ float ComputeShadowMap(inout vec3 directLightColor, vec3 playerPos, float maxDis
const float mincoord = 1.0/4096.0;
const float maxcoord = 1.0-mincoord;
uniform sampler2D normals;
vec4 readNormal(in vec2 coord)
{
return textureGrad(normals,fract(coord)*texcoordam.pq+texcoordam.st,dcdx,dcdy);
@@ -308,6 +309,35 @@ float luma(vec3 color) {
}
#endif
vec2 encodeNormal(vec3 n){
n.xy = n.xy / dot(abs(n), vec3(1.0));
n.xy = n.z <= 0.0 ? (1.0 - abs(n.yx)) * sign(n.xy) : n.xy;
vec2 encn = clamp(n.xy * 0.5 + 0.5,-1.0,1.0);
return encn;
}
vec3 viewToWorld(vec3 viewPosition) {
vec4 pos;
pos.xyz = viewPosition;
pos.w = 0.0;
pos = gbufferModelViewInverse * pos;
return pos.xyz;
}
vec3 worldToView(vec3 worldPos) {
vec4 pos = vec4(worldPos, 0.0);
pos = gbufferModelView * pos;
return pos.xyz;
}
vec3 applyBump(mat3 tbnMatrix, vec3 bump){
float bumpmult = NORMAL_MAP_MULT;
bump = bump * vec3(bumpmult, bumpmult, bumpmult) + vec3(0.0f, 0.0f, 1.0f - bumpmult);
return normalize(bump*tbnMatrix);
}
uniform float alphaTestRef;
uniform vec3 playerLookVector;
//////////////////////////////VOID MAIN//////////////////////////////
//////////////////////////////VOID MAIN//////////////////////////////
@@ -317,6 +347,10 @@ float luma(vec3 color) {
#ifdef DAMAGE_BLOCK_EFFECT
/* RENDERTARGETS:11 */
#elif defined PARTICLES_SOLID
/* RENDERTARGETS:1,8 */
layout(location = 0) out vec4 OutAlbedo;
layout(location = 1) out vec4 OutSpecular;
#else
/* RENDERTARGETS:2,9,11,7 */
#endif
@@ -326,7 +360,7 @@ void main() {
#ifdef DAMAGE_BLOCK_EFFECT
vec2 adjustedTexCoord = lmtexcoord.xy;
#ifdef POM
vec3 fragpos = toScreenSpace(gl_FragCoord.xyz*vec3(texelSize/RENDER_SCALE,1.0)-vec3(0.0));
vec3 fragpos = toScreenSpace(gl_FragCoord.xyz*vec3(texelSize/RENDER_SCALE,1.0));
// vec3 worldpos = mat3(gbufferModelViewInverse) * fragpos + gbufferModelViewInverse[3].xyz + cameraPosition;
@@ -400,7 +434,7 @@ void main() {
gl_FragData[0] = vec4(encodeVec2(vec2(0.5)), encodeVec2(Albedo.rg), encodeVec2(vec2(Albedo.b,0.02)), 1.0);
#endif
#if !defined DAMAGE_BLOCK_EFFECT
#if !defined DAMAGE_BLOCK_EFFECT && !defined PARTICLES_SOLID
gl_FragData[2] = vec4(0.0);
#ifdef LINES
@@ -611,4 +645,61 @@ void main() {
#endif
#endif
#endif
#ifdef PARTICLES_SOLID
vec4 Albedo = texture(gtexture, lmtexcoord.xy) * color;
if(Albedo.a < alphaTestRef){discard; return;}
vec3 tangent = normalize(mat3(gbufferModelViewInverse) * vec3(1.0, 0.0, 0.0));
vec3 binormal = normalize(mat3(gbufferModelViewInverse) * vec3(0.0, 1.0, 0.0));
vec3 normal = normalize(mat3(gbufferModelViewInverse) * vec3(0.0, 0.0, 1.0));
mat3 tbnMatrix = mat3(tangent.x, binormal.x, normal.x,
tangent.y, binormal.y, normal.y,
tangent.z, binormal.z, normal.z);
vec4 NormalTex = texture(normals, lmtexcoord.xy);
#if defined MATERIAL_AO && defined MC_TEXTURE_FORMAT_LAB_PBR
Albedo.rgb *= NormalTex.b*0.5+0.5;
#endif
NormalTex.xy = NormalTex.xy * 2.0-1.0;
NormalTex.z = sqrt(max(1.0 - dot(NormalTex.xy, NormalTex.xy), 0.0));
normal = applyBump(tbnMatrix, NormalTex.xyz);
vec2 lightmap = clamp(lmtexcoord.zw,0.0,1.0);
vec4 data1 = vec4(encodeNormal(normal), lightmap);
Albedo = clamp(vec4(Albedo.rgb,0.85),0.0,1.0);
data1 = clamp(data1,0.0,1.0);
if(tangent.x == 0.0 && tangent.y == 0.0 && tangent.z == 0.0) discard;
OutAlbedo = vec4(
encodeVec2(Albedo.x,data1.x),
encodeVec2(Albedo.y,data1.y),
encodeVec2(Albedo.z,data1.z),
encodeVec2(data1.w,Albedo.w)
);
#if EMISSIVE_TYPE >= 2 || SSS_TYPE >= 2
vec4 specularData = texture(specular, lmtexcoord.xy);
#else
vec4 specularData = vec4(0.0);
#endif
vec4 otherData = clamp(vec4(normal*0.5+0.5, 1.0),0.0,1.0);
OutSpecular = vec4(
encodeVec2(specularData.x, otherData.x),
encodeVec2(specularData.y, otherData.y),
encodeVec2(specularData.z, otherData.z),
encodeVec2(specularData.w, otherData.w)
);
#endif
}
+3 -2
View File
@@ -423,7 +423,7 @@ void main() {
// bool translucent4 = abs(dataUnpacked1.w-0.65) <0.01; // Weak translucency
// bool entities = abs(dataUnpacked1.w-0.45) < 0.01;
bool hand = abs(dataUnpacked1.w-0.75) < 0.01;
// bool blocklights = abs(dataUnpacked1.w-0.8) <0.01;
bool opaqueParticles = abs(dataUnpacked1.w-0.85) <0.01;
float z = texelFetch(depthtex1,ivec2(gl_FragCoord.xy),0).x;
float z0 = texelFetch(depthtex0,ivec2(gl_FragCoord.xy),0).x;
@@ -494,7 +494,7 @@ void main() {
vec2 SSAO_SSS = vec2(1.0,0.0);
if(!isSky) {
if(!isSky && !opaqueParticles) {
SSAO_SSS = SSAO(viewPos, worldToView(normal), worldToView(FlatNormals), hand, noise);
SSAO_SSS.y = clamp(SSAO_SSS.y + 0.5 * lightmap.y*lightmap.y,0.0,1.0);
}
@@ -516,6 +516,7 @@ void main() {
float LabSSS = clamp((-64.0 + SpecularTex.z * 255.0) / 191.0 ,0.0,1.0);
float NdotL = clamp(dot(normal, sunVec),0.0,1.0);
if(opaqueParticles) NdotL = mix(0.5, 1.0, NdotL);
#ifdef END_SHADER
float minshadowfilt = Min_Shadow_Filter_Radius_END;
+6 -2
View File
@@ -1139,7 +1139,7 @@ void main() {
const float POM_DEEPNESS = 0.0;
#endif
// bool handwater = abs(translucentMasks-0.3) < 0.01 ;
// bool blocklights = abs(opaqueMasks-0.8) <0.01;
bool opaqueParticles = abs(opaqueMasks-0.85) <0.01;
if(hand){
convertHandDepth(z);
@@ -1339,6 +1339,10 @@ void main() {
// NdotL = 1;
float flatNormNdotL = clamp((-15 + dot((FlatNormals), WsunVec)*255.0) / 240.0 ,0.0,1.0);
if(opaqueParticles) {
flatNormNdotL = mix(0.5, 1.0, flatNormNdotL);
NdotL = mix(0.5, 1.0, NdotL);
}
//////////////////////////////// SHADOWMAP ////////////////////////////////
// setup shadow projection
@@ -1441,7 +1445,7 @@ void main() {
SS_directLight.r = mix(1.0, SS_directLight.r, 1.0-shadowMapFalloff);
#endif
shadowColor *= SS_directLight.r;
if(!opaqueParticles) shadowColor *= SS_directLight.r;
#else
vec2 SS_directLight = vec2(1,0);
ShadowBlockerDepth = max(ShadowBlockerDepth, (1.0-shadowMapFalloff2) * 10.0);
+2 -1
View File
@@ -460,6 +460,7 @@ void main() {
float opaqueMasks = dataUnpacked1.w;
bool hand = abs(opaqueMasks-0.75) < 0.01;
bool entities = abs(opaqueMasks-0.45) < 0.01;
bool opaqueParticles = abs(opaqueMasks-0.85) <0.01;
#ifdef SHADER_GRASS
bool isShaderGrass = abs(opaqueMasks-0.80) < 0.01;
#else
@@ -523,7 +524,7 @@ void main() {
vec3 denoisedReflections = currentFrame.rgb;
if(roughness > 0.005 && alpha < 0.9999 && !hand && !entities
if(roughness > 0.005 && alpha < 0.9999 && !hand && !entities && !opaqueParticles
#if defined DISTANT_HORIZONS || defined VOXY
&& z < 1.0
#endif
+35 -5
View File
@@ -30,6 +30,10 @@ layout (location = 3) out vec4 gbuffer_data_3;
#undef WATER_SUN_SPECULAR
#endif
#ifdef END_SHADER
#include "/lib/end_fog.glsl"
#endif
float GGX(vec3 n, vec3 v, vec3 l, float r, float f0) {
r = max(pow(r,2.5), 0.0001);
@@ -252,14 +256,40 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
float skylight = mix(0.08, 1.0, SkylightDir);
AmbientLightColor *= skylight;
vec3 MinimumLightColor = vec3(1.0);
Indirect_lighting = doIndirectLighting(AmbientLightColor, MinimumLightColor, parameters.lightMap.y);
#endif
#ifndef OVERWORLD_SHADER
vec3 AmbientLightColor = vec3(0.5);
#ifdef NETHER_SHADER
Indirect_lighting = volumetricsFromTex(normal, colortex4, 0).rgb / 1200.0 / 1.5;
#endif
vec3 MinimumLightColor = vec3(1.0);
Indirect_lighting = doIndirectLighting(AmbientLightColor, MinimumLightColor, parameters.lightMap.y);
#ifdef END_SHADER
#ifdef END_LIGHTNING
float vortexBounds = clamp(vortexBoundRange - length(feetPlayerPos+cameraPosition), 0.0,1.0);
#else
float vortexBounds = 1.0;
#endif
vec3 lightPos = LightSourcePosition(feetPlayerPos+cameraPosition, cameraPosition,vortexBounds);
float lightningflash = texelFetch(colortex4,ivec2(1,1),0).x/150.0;
vec3 lightColors = LightSourceColors(vortexBounds, lightningflash);
float end_NdotL = clamp(dot(normal, normalize(-lightPos))*0.5+0.5,0.0,1.0);
end_NdotL *= end_NdotL;
float fogShadow = GetEndFogShadow(feetPlayerPos+cameraPosition, lightPos);
float endPhase = endFogPhase(lightPos);
Direct_lighting = lightColors * endPhase * end_NdotL * fogShadow;
vec3 AmbientLightColor = vec3(AmbientLightEnd_R,AmbientLightEnd_G,AmbientLightEnd_B) ;
Indirect_lighting = AmbientLightColor + 0.7 * AmbientLightColor * dot(normal, normalize(feetPlayerPos));
Indirect_lighting *= 0.1;
#endif
float indoors = min(max(parameters.lightMap.y-0.5,0.0)/0.4,1.0);
+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 = 8.0.5
value.SHADER_VERSION_LABEL.482 = 8.1.0
iris_extension.keybind.key0.name=Flashlight
+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 = 8.0.5
value.SHADER_VERSION_LABEL.482 = 8.1.0
# 如果你是来翻译的,这不是玩笑,这些选项的功能正如其名
profile.POTATO=§4土豆 (极低配置)
@@ -11,16 +11,14 @@ vec3 modify_attenuation(
// Fix light on handheld light sources being weird
if (light.index < 0 && ph_is_hand()) return light.color;
#ifdef SHADER_GRASS
vec4 data = texelFetch(colortex1, ivec2(gl_FragCoord.xy), 0);
// vec4 dataUnpacked0 = vec4(decodeVec2(data.x),decodeVec2(data.y)); // albedo, masks
// vec4 dataUnpacked1 = vec4(decodeVec2(data.z),decodeVec2(data.w)); // normals, lightmaps
float opaqueMasks = decodeVec2(data.w).y;
bool isShaderGrass = abs(opaqueMasks-0.80) < 0.01;
#else
const bool isShaderGrass = false;
#endif
vec4 data = texelFetch(colortex1, ivec2(gl_FragCoord.xy), 0);
// vec4 dataUnpacked0 = vec4(decodeVec2(data.x),decodeVec2(data.y)); // albedo, masks
// vec4 dataUnpacked1 = vec4(decodeVec2(data.z),decodeVec2(data.w)); // normals, lightmaps
float opaqueMasks = decodeVec2(data.w).y;
bool isShaderGrass = abs(opaqueMasks-0.80) < 0.01;
bool opaqueParticles = abs(opaqueMasks-0.85) < 0.01;
vec4 SpecularData = texelFetch(colortex8, ivec2(gl_FragCoord.xy), 0);
// vec4 specdataUnpacked0 = vec4(decodeVec2(SpecularData.x),decodeVec2(SpecularData.y));
@@ -32,7 +30,7 @@ vec3 modify_attenuation(
float light_dist_inv = inversesqrt(distance_squared);
vec3 light_dir = to_light * light_dist_inv;
if(!isShaderGrass && LabSSS < 0.025) {
if(!isShaderGrass && LabSSS < 0.025 && !opaqueParticles) {
float NdotGN = dot(light_dir, geometry_normal);
if (NdotGN < 0.01f) return vec3(0f);
}
@@ -40,7 +38,9 @@ vec3 modify_attenuation(
float att = 1f / (distance_squared * light.falloff * light.attenuation.y + light.attenuation.x);
if(!isShaderGrass) {
att *= clamp(dot(ph_frag_is_hand ? geometry_normal : texture_normal, light_dir), pow(LabSSS, 1.5), 1f);
float attMult = clamp(dot(ph_frag_is_hand ? geometry_normal : texture_normal, light_dir), pow(LabSSS, 1.5), 1f);
if(opaqueParticles) attMult = mix(0.35, 1.0, attMult);
att *= attMult;
}
return att * light.color;
+3 -2
View File
@@ -152,8 +152,7 @@ iext.geometry.gbuffers_terrain=false
stars=false
#endif
particles.before.deferred=false
particles.ordering=after
particles.ordering=mixed
#if !(defined TRANSLUCENT_ENTITIES && defined IS_IRIS || defined IRIS_REQUIRES_SEPARATE_ENTITY_DRAWS)
program.world0/gbuffers_entities_translucent.enabled = false
@@ -220,6 +219,7 @@ blend.gbuffers_basic = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE
blend.gbuffers_weather = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE
blend.gbuffers_block_translucent = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE
blend.gbuffers_entities_translucent = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE
blend.gbuffers_particles_translucent = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE
blend.gbuffers_lightning = ONE ONE ONE ZERO
blend.gbuffers_spidereyes = ONE ONE ONE ONE
blend.gbuffers_armor_glint = ONE ONE ONE ZERO
@@ -231,6 +231,7 @@ blend.shadow = ONE ZERO ONE ZERO
blend.shadow_entities = ONE ZERO ONE ZERO
# Disable blending
blend.gbuffers_terrain = off
blend.gbuffers_particles = off
blend.gbuffers_hand = off
blend.gbuffers_block = off
blend.gbuffers_entities = off
+5
View File
@@ -0,0 +1,5 @@
#version 430 compatibility
#define NETHER_SHADER
#include "/dimensions/deferred2.fsh"
+5
View File
@@ -0,0 +1,5 @@
#version 430 compatibility
#define NETHER_SHADER
#include "/dimensions/deferred2.vsh"
+6
View File
@@ -0,0 +1,6 @@
#version 430 compatibility
#define PARTICLES_SOLID
#define NETHER_SHADER
#include "/dimensions/all_particles.fsh"
+6
View File
@@ -0,0 +1,6 @@
#version 430 compatibility
#define PARTICLES_SOLID
#define NETHER_SHADER
#include "/dimensions/all_particles.vsh"
@@ -0,0 +1,7 @@
#version 430 compatibility
#define PARTICLES
#define PARTICLES_TRANSLUCENT
#define NETHER_SHADER
#include "/dimensions/all_particles.fsh"
@@ -0,0 +1,7 @@
#version 430 compatibility
#define PARTICLES
#define PARTICLES_TRANSLUCENT
#define NETHER_SHADER
#include "/dimensions/all_particles.vsh"
+6
View File
@@ -0,0 +1,6 @@
#version 430 compatibility
#define PARTICLES_SOLID
#define OVERWORLD_SHADER
#include "/dimensions/all_particles.fsh"
+6
View File
@@ -0,0 +1,6 @@
#version 430 compatibility
#define PARTICLES_SOLID
#define OVERWORLD_SHADER
#include "/dimensions/all_particles.vsh"
@@ -0,0 +1,7 @@
#version 430 compatibility
#define PARTICLES
#define PARTICLES_TRANSLUCENT
#define OVERWORLD_SHADER
#include "/dimensions/all_particles.fsh"
@@ -0,0 +1,7 @@
#version 430 compatibility
#define PARTICLES
#define PARTICLES_TRANSLUCENT
#define OVERWORLD_SHADER
#include "/dimensions/all_particles.vsh"
@@ -0,0 +1,7 @@
#version 430 compatibility
#define PARTICLES_SOLID
#define OVERWORLD_SHADER
#define AETHER_FLAG
#include "/dimensions/all_particles.fsh"
@@ -0,0 +1,7 @@
#version 430 compatibility
#define PARTICLES_SOLID
#define OVERWORLD_SHADER
#define AETHER_FLAG
#include "/dimensions/all_particles.vsh"
@@ -0,0 +1,8 @@
#version 430 compatibility
#define PARTICLES
#define PARTICLES_TRANSLUCENT
#define OVERWORLD_SHADER
#define AETHER_FLAG
#include "/dimensions/all_particles.fsh"
@@ -0,0 +1,8 @@
#version 430 compatibility
#define PARTICLES
#define PARTICLES_TRANSLUCENT
#define OVERWORLD_SHADER
#define AETHER_FLAG
#include "/dimensions/all_particles.vsh"
@@ -0,0 +1,7 @@
#version 430 compatibility
#define PARTICLES_SOLID
#define OVERWORLD_SHADER
#define TWILIGHT_FOREST_FLAG
#include "/dimensions/all_particles.fsh"
@@ -0,0 +1,7 @@
#version 430 compatibility
#define PARTICLES_SOLID
#define OVERWORLD_SHADER
#define TWILIGHT_FOREST_FLAG
#include "/dimensions/all_particles.vsh"
@@ -0,0 +1,8 @@
#version 430 compatibility
#define PARTICLES
#define PARTICLES_TRANSLUCENT
#define OVERWORLD_SHADER
#define TWILIGHT_FOREST_FLAG
#include "/dimensions/all_particles.fsh"
@@ -0,0 +1,8 @@
#version 430 compatibility
#define PARTICLES
#define PARTICLES_TRANSLUCENT
#define OVERWORLD_SHADER
#define TWILIGHT_FOREST_FLAG
#include "/dimensions/all_particles.vsh"
+5
View File
@@ -0,0 +1,5 @@
#version 430 compatibility
#define END_SHADER
#include "/dimensions/deferred2.fsh"
+5
View File
@@ -0,0 +1,5 @@
#version 430 compatibility
#define END_SHADER
#include "/dimensions/deferred2.vsh"
+6
View File
@@ -0,0 +1,6 @@
#version 430 compatibility
#define PARTICLES_SOLID
#define END_SHADER
#include "/dimensions/all_particles.fsh"
+6
View File
@@ -0,0 +1,6 @@
#version 430 compatibility
#define PARTICLES_SOLID
#define END_SHADER
#include "/dimensions/all_particles.vsh"
@@ -0,0 +1,7 @@
#version 430 compatibility
#define PARTICLES
#define PARTICLES_TRANSLUCENT
#define END_SHADER
#include "/dimensions/all_particles.fsh"
@@ -0,0 +1,7 @@
#version 430 compatibility
#define PARTICLES
#define PARTICLES_TRANSLUCENT
#define END_SHADER
#include "/dimensions/all_particles.vsh"
+5 -2
View File
@@ -31,6 +31,9 @@ out DATA {
#include "/lib/entities.glsl"
#endif
#include "/lib/blocks.glsl"
#if defined IS_LPV_ENABLED || (WATER_INTERACTION == 2 && IRIS_VERSION < 11004) || defined SHADER_GRASS
in vec4 mc_Entity;
#ifdef IRIS_FEATURE_BLOCK_EMISSION_ATTRIBUTE
@@ -46,12 +49,10 @@ out DATA {
uniform int currentRenderedItemId;
uniform int blockEntityId;
#include "/lib/blocks.glsl"
#include "/lib/voxel_common.glsl"
#include "/lib/voxel_write.glsl"
#endif
//#include "/lib/Shadow_Params.glsl"
// uniform int entityId;
@@ -90,6 +91,8 @@ void main() {
gl_Position = customShadowPerspectiveSSBO * customShadowMatrixSSBO * vec4(feetPlayerPos, 1.0);
gl_Position.z /= 6.0;
if(mc_Entity.x == BLOCK_WATER) gl_Position = vec4(-1.0);
#else
gl_Position = vec4(-1.0);
#endif