add floodfill to beacon beam

This commit is contained in:
Merlin1809
2026-08-24 00:08:50 +02:00
parent 6d73d98640
commit 3fa917b07f
24 changed files with 304 additions and 60 deletions
+2 -2
View File
@@ -334,7 +334,7 @@ void main() {
data_out.centerPosition = worldpos + at_midBlock.xyz / 64.0;
vec3 LPVpos = GetLpvPosition(data_out.centerPosition);
vec3 LPVpos = GetLpvPosition2(data_out.centerPosition);
#if REPLACE_SHORT_GRASS > 0
uint blockTop = GetVoxelBlock(ivec3(LPVpos.x, LPVpos.y + 0.6, LPVpos.z));
@@ -504,7 +504,7 @@ void main() {
if(length(worldpos) < maxShortGrassRange && data_out.blockID == 12) {
vec3 centerPosition = worldpos + at_midBlock.xyz / 64.0;
vec3 LPVpos = GetLpvPosition(centerPosition);
vec3 LPVpos = GetLpvPosition2(centerPosition);
uint blockBelow = GetVoxelBlock(ivec3(LPVpos.x, LPVpos.y - 0.6, LPVpos.z));
if(blockBelow == 85) gl_Position.z -= 10000.0;
}
+14 -14
View File
@@ -41,25 +41,25 @@ void main() {
vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
vec3 worldpos = mat3(gbufferModelViewInverse) * position + gbufferModelViewInverse[3].xyz;
vec3 playerPos = mat3(gbufferModelViewInverse) * position + gbufferModelViewInverse[3].xyz;
#if defined PLANET_CURVATURE
float curvature = length(worldpos.xz) / (16.0*8.0);
worldpos.y -= curvature*curvature * CURVATURE_AMOUNT;
float curvature = length(playerPos.xz) / (16.0*8.0);
playerPos.y -= curvature*curvature * CURVATURE_AMOUNT;
#endif
position = mat3(gbufferModelView) * worldpos + gbufferModelView[3].xyz;
gl_Position = toClipSpace3(position);
#ifdef BEACON_BEAM
if(gl_Color.a < 1.0) gl_Position = vec4(10,10,10,0);
#endif
gl_Position = vec4(playerPos, 1.0);
#else
position = mat3(gbufferModelView) * playerPos + gbufferModelView[3].xyz;
#ifdef TAA_UPSCALING
gl_Position.xy = gl_Position.xy * RENDER_SCALE + RENDER_SCALE * gl_Position.w - gl_Position.w;
#endif
#ifdef TAA
gl_Position.xy += offsets[framemod8] * gl_Position.w*texelSize;
gl_Position = toClipSpace3(position);
#ifdef TAA_UPSCALING
gl_Position.xy = gl_Position.xy * RENDER_SCALE + RENDER_SCALE * gl_Position.w - gl_Position.w;
#endif
#ifdef TAA
gl_Position.xy += offsets[framemod8] * gl_Position.w*texelSize;
#endif
#endif
}
+155
View File
@@ -0,0 +1,155 @@
layout(triangles) in;
layout(triangle_strip, max_vertices = 3) out;
#include "/lib/settings.glsl"
#include "/lib/res_params.glsl"
#include "/lib/SSBOs.glsl"
uniform vec2 texelSize;
uniform int framemod8;
uniform mat4 gbufferModelView;
uniform mat4 gbufferModelViewInverse;
#include "/lib/TAA_jitter.glsl"
in DATA {
vec4 color;
vec2 texcoord;
} data_in[];
out DATA {
vec4 color;
vec2 texcoord;
} data_out;
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)
vec4 toClipSpace3(vec3 viewSpacePosition) {
return vec4(projMAD(gl_ProjectionMatrix, viewSpacePosition),-viewSpacePosition.z);
}
uniform vec3 cameraPosition;
uniform vec3 relativeEyePosition;
#define RENDER_SHADOW
#include "/lib/voxel_common.glsl"
ivec3 GetVoxelIndex(const in vec3 playerPos) {
#if !defined IS_LPV_ENABLED && !defined SHADER_GRASS
vec3 cameraOffset = fract(cameraPosition-relativeEyePosition);
#else
vec3 cameraOffset = fract(cameraPosition);
#endif
return ivec3(floor(playerPos + cameraOffset) + VoxelSize3/2u);
}
void SetVoxelBlock(const in ivec3 voxelPos, const in uint blockId) {
if (clamp(voxelPos.y, int(0), int(VoxelSize-1u)) != voxelPos.y) return;
// imageStore(imgQuarterVoxelMask, voxelPos / 4, uvec4(1u));
imageStore(imgVoxelMask, voxelPos, uvec4(blockId));
}
int packColor(vec3 color) {
int ri = int(round(clamp(color.r, 0.0, 1.0) * 100.0));
int gi = int(round(clamp(color.g, 0.0, 1.0) * 100.0));
int bi = int(round(clamp(color.b, 0.0, 1.0) * 100.0));
int index = (ri * 101 + gi) * 101 + bi;
return 50000 + index;
}
vec3 UnpackColor(int packedC) {
int idx = packedC - 50000;
if (idx < 0) return vec3(-1.0);
int b = idx % 101;
idx /= 101;
int g = idx % 101;
idx /= 101;
int r = idx % 101;
return vec3(r / 100.0, g / 100.0, b / 100.0);
}
void main() {
#if defined BEACON_FLOODFILL && defined IS_LPV_ENABLED
float h0 = gl_in[0].gl_Position.y;
float h1 = gl_in[1].gl_Position.y;
float h2 = gl_in[2].gl_Position.y;
float yStart = min(h0, min(h1, h2));
bool isBottom0 = abs(h0 - yStart) < 1e-5;
bool isBottom1 = abs(h1 - yStart) < 1e-5;
bool isBottom2 = abs(h2 - yStart) < 1e-5;
if(int(isBottom0) + int(isBottom1) + int(isBottom2) == 1) {
int bottomIndex = isBottom0 ? 0 : (isBottom1 ? 1 : 2);
if(data_in[bottomIndex].color.a < 1.0) {
vec3 playerPos = gl_in[bottomIndex].gl_Position.xyz;
vec3 edge1 = gl_in[1].gl_Position.xyz - gl_in[0].gl_Position.xyz;
vec3 edge2 = gl_in[2].gl_Position.xyz - gl_in[0].gl_Position.xyz;
vec3 flatNormals = normalize(cross(edge1, edge2));
if(flatNormals.x > 0.5) {
playerPos.y += 0.5;
ivec3 voxelPos = GetVoxelIndex(playerPos);
if (clamp(voxelPos.xz, ivec2(0), ivec2(VoxelSize-1u)) == voxelPos.xz) {
float yEnd = max(h0, max(h1, h2));
int blocks = int(yEnd - yStart - 0.5);
vec4 vcolor = data_in[bottomIndex].color;
vec3 color = vcolor.rgb * vcolor.rgb;
int j;
for (j = 0; j < blocks; j++) {
SetVoxelBlock(voxelPos, packColor(color));
voxelPos.y += 1;
if(voxelPos.y > int(VoxelSize) - 1) break;
}
}
}
}
}
#endif
int i;
for (i = 0; i < 3; i++) {
vec4 vertex = gl_in[i].gl_Position;
data_out.color = data_in[i].color;
data_out.texcoord = data_in[i].texcoord;
gl_Position = vertex;
vertex.rgb = mat3(gbufferModelView) * vertex.rgb + gbufferModelView[3].xyz;
gl_Position = toClipSpace3(vertex.rgb);
if(data_in[i].color.a < 1.0) gl_Position = vec4(10,10,10,0);
#ifdef TAA_UPSCALING
gl_Position.xy = gl_Position.xy * RENDER_SCALE + RENDER_SCALE * gl_Position.w - gl_Position.w;
#endif
#ifdef TAA
gl_Position.xy += offsets[framemod8] * gl_Position.w*texelSize;
#endif
EmitVertex();
}
EndPrimitive();
}
+28 -28
View File
@@ -318,37 +318,37 @@ void main() {
#endif
#if defined SHADER_GRASS_SETTING && MC_VERSION >= 260200 && defined IEXT_ENABLED && IRIS_VERSION <= 11102
const float textSize2 = 4.0;
beginText(ivec2(gl_FragCoord.xy/textSize2), ivec2(0.05*viewWidth/textSize2, 0.75*viewHeight/textSize2));
text.fgCol = vec4(1.0, 0.0, 0.0, 1.0);
printString((_S, _h, _a, _d, _e, _r, _space, _G, _r, _a, _s, _s, _space, _i, _s, _space, _b, _r, _o, _k, _e, _n, _space, _o, _n, _space, _2, _6, _dot, _2, _space, _o, _r, _space, _h, _i, _g, _h, _e, _r, _exclm));
printLine();
printString((_D, _i, _s, _a, _b, _l, _e, _space, _i, _t, _exclm));
endText(gl_FragColor.rgb);
const float textSize2 = 4.0;
beginText(ivec2(gl_FragCoord.xy/textSize2), ivec2(0.05*viewWidth/textSize2, 0.75*viewHeight/textSize2));
text.fgCol = vec4(1.0, 0.0, 0.0, 1.0);
printString((_S, _h, _a, _d, _e, _r, _space, _G, _r, _a, _s, _s, _space, _i, _s, _space, _b, _r, _o, _k, _e, _n, _space, _o, _n, _space, _2, _6, _dot, _2, _space, _o, _r, _space, _h, _i, _g, _h, _e, _r, _exclm));
printLine();
printString((_D, _i, _s, _a, _b, _l, _e, _space, _i, _t, _exclm));
endText(gl_FragColor.rgb);
#endif
#if MC_VERSION >= 260200 && !defined IEXT_ENABLED && IRIS_VERSION <= 11102
const float textSize2 = 4.0;
beginText(ivec2(gl_FragCoord.xy/textSize2), ivec2(0.05*viewWidth/textSize2, 0.75*viewHeight/textSize2));
text.fgCol = vec4(1.0, 0.0, 0.0, 1.0);
printString((_T, _h, _e, _space, _i, _n, _v, _i, _s, _i, _b, _l, _e, _space, _t, _e, _r, _r, _a, _i, _n, _space, _i, _s, _space, _a, _n, _space, _I, _r, _i, _s, _space, _b, _u, _g, _exclm));
printLine();
printLine();
printString((_I, _n, _s, _t, _a, _l, _l, _space, _m, _y, _space));
text.fgCol = vec4(0.0, 1.0, 0.0, 1.0);
printString((_I, _r, _i, _s, _space, _E, _x, _t, _e, _n, _s, _i, _o, _n));
text.fgCol = vec4(1.0, 0.0, 0.0, 1.0);
printString((_space, _m, _o, _d, _space, _t, _o, _space, _f, _i, _x, _space, _i, _t, _exclm));
endText(gl_FragColor.rgb);
const float textSize2 = 4.0;
beginText(ivec2(gl_FragCoord.xy/textSize2), ivec2(0.05*viewWidth/textSize2, 0.75*viewHeight/textSize2));
text.fgCol = vec4(1.0, 0.0, 0.0, 1.0);
printString((_T, _h, _e, _space, _i, _n, _v, _i, _s, _i, _b, _l, _e, _space, _t, _e, _r, _r, _a, _i, _n, _space, _i, _s, _space, _a, _n, _space, _I, _r, _i, _s, _space, _b, _u, _g, _exclm));
printLine();
printLine();
printString((_I, _n, _s, _t, _a, _l, _l, _space, _m, _y, _space));
text.fgCol = vec4(0.0, 1.0, 0.0, 1.0);
printString((_I, _r, _i, _s, _space, _E, _x, _t, _e, _n, _s, _i, _o, _n));
text.fgCol = vec4(1.0, 0.0, 0.0, 1.0);
printString((_space, _m, _o, _d, _space, _t, _o, _space, _f, _i, _x, _space, _i, _t, _exclm));
endText(gl_FragColor.rgb);
#endif
#if defined SHADER_GRASS_SETTING && defined CREATE_AERONAUTICS
const float textSize3 = 4.0;
beginText(ivec2(gl_FragCoord.xy/textSize3), ivec2(0.05*viewWidth/textSize3, 0.75*viewHeight/textSize3));
text.fgCol = vec4(1.0, 0.0, 0.0, 1.0);
printString((_S, _h, _a, _d, _e, _r, _space, _G, _r, _a, _s, _s, _space, _i, _s, _space, _b, _r, _o, _k, _e, _n, _space, _b, _y, _space, _C, _r, _e, _a, _t, _e, _space, _A, _e, _r, _o, _n, _a, _u, _t, _i, _c, _s, _exclm));
printLine();
printString((_D, _i, _s, _a, _b, _l, _e, _space, _i, _t, _exclm));
endText(gl_FragColor.rgb);
#endif
#if defined SHADER_GRASS_SETTING && defined CREATE_AERONAUTICS
const float textSize3 = 4.0;
beginText(ivec2(gl_FragCoord.xy/textSize3), ivec2(0.05*viewWidth/textSize3, 0.75*viewHeight/textSize3));
text.fgCol = vec4(1.0, 0.0, 0.0, 1.0);
printString((_S, _h, _a, _d, _e, _r, _space, _G, _r, _a, _s, _s, _space, _i, _s, _space, _b, _r, _o, _k, _e, _n, _space, _b, _y, _space, _C, _r, _e, _a, _t, _e, _space, _A, _e, _r, _o, _n, _a, _u, _t, _i, _c, _s, _exclm));
printLine();
printString((_D, _i, _s, _a, _b, _l, _e, _space, _i, _t, _exclm));
endText(gl_FragColor.rgb);
#endif
}
+3 -1
View File
@@ -3,6 +3,8 @@ layout (local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
const ivec3 workGroups = ivec3(1, 1, 1);
uniform vec3 previousCameraPosition;
#include "/lib/util.glsl"
uniform vec3 cameraPosition;
uniform vec3 relativeEyePosition;
@@ -75,7 +77,7 @@ void main() {
#else
vec3 rayStart = vec3(-relativeEyePosition);
#endif
vec3 LPVpos = GetLpvPosition(rayStart);
vec3 LPVpos = GetLpvPosition2(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));
+2 -2
View File
@@ -117,8 +117,8 @@ void main() {
}
if (blockId == BLOCK_BEACON || blockId == ITEM_BEACON) {
lightColor = vec3(1.0);
lightRange = 15.0;
lightColor = vec3(0.7, 0.85, 1.0);
lightRange = 10.0;
}
if (blockId == BLOCK_BREWING_STAND) {
+32 -3
View File
@@ -56,6 +56,10 @@ layout (local_size_x = 8, local_size_y = 8, local_size_z = 8) in;
uint blockId = imageLoad(imgVoxelMask, voxelPos).r;
#ifdef BEACON_FLOODFILL
if(blockId >= 50000u) return blockId;
#endif
blockId = blockId % 2000u;
#if IRIS_VERSION < 11004
@@ -79,7 +83,7 @@ layout (local_size_x = 8, local_size_y = 8, local_size_z = 8) in;
uint mask = 0xFFFF;
uint blockId = voxelSharedData[shared_index];
if (blockId > 0 && blockId != BLOCK_EMPTY) {
if (blockId > 0 && blockId < 2048) {
uvec2 blockData = imageLoad(imgBlockData, int(blockId)).rg;
mask = (blockData.g >> 24) & 0xFFFF;
}
@@ -103,6 +107,17 @@ layout (local_size_x = 8, local_size_y = 8, local_size_z = 8) in;
}
#endif
vec3 UnpackColor(uint packedC) {
int idx = int(packedC) - 50000;
int b = idx % 101;
idx /= 101;
int g = idx % 101;
idx /= 101;
int r = idx % 101;
return vec3(r / 100.0, g / 100.0, b / 100.0);
}
////////////////////////////// VOID MAIN //////////////////////////////
@@ -136,7 +151,7 @@ void main() {
// Decode light data for current voxel
uint blockId = voxelSharedData[getSharedIndex(ivec3(gl_LocalInvocationID) + 1)];
if (blockId > 0u) {
if (blockId > 0u && blockId < 2048u) {
uvec2 blockData = imageLoad(imgBlockData, int(blockId)).rg;
vec4 lightColorRange = unpackUnorm4x8(blockData.r);
lightColor = srgbToLinear(lightColorRange.rgb);
@@ -145,6 +160,15 @@ void main() {
tintColor = srgbToLinear(tintColorMask.rgb);
mixMask = (blockData.g >> 24) & 0xFFFF;
}
#ifdef BEACON_FLOODFILL
else if(blockId >= 50000u) {
lightColor = BEACON_FLOODFILL_BRIGHTNESS * 17.0 * srgbToLinear(UnpackColor(blockId));
lightRange = 0.0425 * 255.0;
tintColor = vec3(1.0);
mixMask = 0xFFFF;
}
#endif
// Mix neighbor voxel light values
if (any(greaterThan(tintColor, vec3(0.0)))) {
@@ -156,7 +180,12 @@ void main() {
// Add light for current voxel
if (lightRange > 0.0) {
vec3 hsv = RgbToHsv(lightColor);
hsv.z = exp2(lightRange) - 1.0;
#ifdef BEACON_FLOODFILL
if(blockId < 50000u)
#endif
{
hsv.z = exp2(lightRange) - 1.0;
}
lightValue.rgb += HsvToRgb(hsv);
}
+6 -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.3.4
value.SHADER_VERSION_LABEL.482 = 8.4.0
iris_extension.keybind.key0.name=Flashlight
@@ -260,6 +260,11 @@ screen.Direct_Light = Direct Light
value.LPV_HANDHELD_SHADOWS_QUALITY.1 = High
option.HANDHELD_LIGHT_REFLECTIONS = Handheld Lights in Reflections
suffix.HANDHELD_LIGHT_REFLECTIONS=%
option.BEACON_FLOODFILL = Beacon Beam Floodfill
option.BEACON_FLOODFILL.comment = Whether Beacon Beams should emit colored lighting. §aPERFORMANCE COST:§r Low
option.BEACON_FLOODFILL_BRIGHTNESS = Beacon Beam Floodfill Brightness
suffix.BEACON_FLOODFILL_BRIGHTNESS=%
screen.Ambient_light = Ambient Light
+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.3.4
value.SHADER_VERSION_LABEL.482 = 8.4.0
# 如果你是来翻译的,这不是玩笑,这些选项的功能正如其名
profile.POTATO=§4土豆 (极低配置)
+5
View File
@@ -10,6 +10,11 @@ const vec2 LpvBlockSkyRange = vec2(15.0, 24.0);
#endif
vec3 GetLpvPosition(const in vec3 playerPos) {
vec3 cameraOffset = cameraPosition - floor(previousCameraPosition);
return playerPos + cameraOffset + LpvSize3/2u;
}
vec3 GetLpvPosition2(const in vec3 playerPos) {
#if !defined IS_LPV_ENABLED && !defined SHADER_GRASS
vec3 cameraOffset = fract(cameraPosition-relativeEyePosition);
#else
+2 -2
View File
@@ -14,8 +14,8 @@ vec4 SampleLpvLinear(const in vec3 lpvPos) {
vec3 texcoord = lpvPos / LpvSize3;
vec4 lpvSample = (frameCounter % 2) == 0
? textureLod(texLpv1, texcoord, 0)
: textureLod(texLpv2, texcoord, 0);
? textureLod(texLpv2, texcoord, 0)
: textureLod(texLpv1, texcoord, 0);
vec3 hsv = RgbToHsv(lpvSample.rgb);
hsv.z = lpvCurve(hsv.b) * LpvBlockSkyRange.x;
+2
View File
@@ -1122,6 +1122,8 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
#define LPV_NORMAL_STRENGTH 50 // [0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100]
#define LPV_NORMAL_OFFSET
#define LPV_ENTITY_LIGHTS
#define BEACON_FLOODFILL
#define BEACON_FLOODFILL_BRIGHTNESS 100 // [1 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_REDSTONE_LIGHTS
//#define LPV_COLORED_CANDLES
#define LPV_VL_FOG_ILLUMINATION
+10 -2
View File
@@ -1,12 +1,20 @@
#ifdef RENDER_SHADOW
layout(r16ui) uniform uimage3D imgVoxelMask;
#if defined BEACON_FLOODFILL && defined IS_LPV_ENABLED
layout(r32ui) uniform uimage3D imgVoxelMask;
#else
layout(r16ui) uniform uimage3D imgVoxelMask;
#endif
// layout(r8ui) uniform uimage3D imgQuarterVoxelMask;
//
// layout(std430, binding = 5) buffer voxelSSBO {
// vec4[6] voxelData[];
// };
#else
layout(r16ui) uniform readonly uimage3D imgVoxelMask;
#if defined BEACON_FLOODFILL && defined IS_LPV_ENABLED
layout(r32ui) uniform readonly uimage3D imgVoxelMask;
#else
layout(r16ui) uniform readonly uimage3D imgVoxelMask;
#endif
// layout(r8ui) uniform readonly uimage3D imgQuarterVoxelMask;
//
// layout(std430, binding = 5) readonly buffer voxelSSBO {
File diff suppressed because one or more lines are too long
+5
View File
@@ -0,0 +1,5 @@
#version 430 compatibility
#define BEACON_BEAM
#include "/dimensions/beacon.gsh"
+5
View File
@@ -0,0 +1,5 @@
#version 430 compatibility
#define BEACON_BEAM
#include "/dimensions/beacon.gsh"
@@ -0,0 +1,5 @@
#version 430 compatibility
#define BEACON_BEAM
#include "/dimensions/beacon.gsh"
@@ -0,0 +1,5 @@
#version 430 compatibility
#define BEACON_BEAM
#include "/dimensions/beacon.gsh"
+5
View File
@@ -0,0 +1,5 @@
#version 430 compatibility
#define BEACON_BEAM
#include "/dimensions/beacon.gsh"