Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions shaders/dimensions/shadowcomp.csh
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,63 @@ void main() {
}

// Mix neighbor voxel light values
// Apply glass tint color mixing via RYB hue blending
if (any(greaterThan(tintColor, vec3(0.0)))) {
vec4 lightMixed = mixNeighbours(ivec3(gl_LocalInvocationID), mixMask);

#if LPV_COLOR_STYLE == 1
float maxTint = max(max(tintColor.r, tintColor.g), tintColor.b);
float minTint = min(min(tintColor.r, tintColor.g), tintColor.b);

// Only apply hue mixing for chromatic (non-gray) glass
if (maxTint - minTint > 0.01) {
vec3 normalizedTint = tintColor / maxTint;
float peakBefore = max(max(lightMixed.r, lightMixed.g), lightMixed.b);

if (peakBefore > 1e-6) {
vec3 normLight = lightMixed.rgb / peakBefore;
float transmittance = dot(normLight, normalizedTint) / dot(normLight, vec3(1.0));

vec3 lightHsv = RgbToHsv(lightMixed.rgb);
vec3 tintHsv = RgbToHsv(normalizedTint);

// Remap RGB hue → RYB hue for color mixing (e.g. blue+yellow=green)
// Piecewise linear: stretches red-yellow, compresses green-blue
float lightRybH = lightHsv.x < (1.0/6.0) ? lightHsv.x * 2.0 :
lightHsv.x < (1.0/3.0) ? (1.0/3.0) + (lightHsv.x - (1.0/6.0)) :
lightHsv.x < (2.0/3.0) ? 0.5 + (lightHsv.x - (1.0/3.0)) * 0.5 :
lightHsv.x;
float tintRybH = tintHsv.x < (1.0/6.0) ? tintHsv.x * 2.0 :
tintHsv.x < (1.0/3.0) ? (1.0/3.0) + (tintHsv.x - (1.0/6.0)) :
tintHsv.x < (2.0/3.0) ? 0.5 + (tintHsv.x - (1.0/3.0)) * 0.5 :
tintHsv.x;

// Light weight ramps from 0→1 via smoothstep so torch light (low sat) defers to glass,
// while already-tinted light (high sat) gets equal weight for symmetric midpoint mixing
float lw = smoothstep(0.0, 0.5, lightHsv.y);
float tw = 1.0;
float cx = lw * cos(lightRybH * 6.2831853) + tw * cos(tintRybH * 6.2831853);
float cy = lw * sin(lightRybH * 6.2831853) + tw * sin(tintRybH * 6.2831853);
float newRybH = (abs(cx) + abs(cy) > 1e-6) ? fract(atan(cy, cx) / 6.2831853) : tintRybH;

// Inverse map: RYB hue → RGB hue
lightHsv.x = newRybH < (1.0/3.0) ? newRybH * 0.5 :
newRybH < 0.5 ? (1.0/6.0) + (newRybH - (1.0/3.0)) :
newRybH < (2.0/3.0) ? (1.0/3.0) + (newRybH - 0.5) * 2.0 :
newRybH;

lightHsv.y = max(lightHsv.y, tintHsv.y);
lightHsv.y *= LPV_SATURATION / 100.0;
lightHsv.z *= sqrt(transmittance);

lightMixed.rgb = HsvToRgb(lightHsv);
}
}

lightMixed *= sqrt(maxTint);
#else
lightMixed.rgb *= tintColor;
#endif
lightValue += lightMixed;
}

Expand Down
4 changes: 4 additions & 0 deletions shaders/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ screen.Direct_Light = Direct Light

screen.LPV = FloodFill (Colored Lights)
option.LPV_ENABLED = Enabled
option.LPV_COLOR_STYLE = Propagation Style
value.LPV_COLOR_STYLE.1 = Colourful
value.LPV_COLOR_STYLE.2 = Default
option.LPV_SIZE = Size
value.LPV_SIZE.6 = Small [64]
value.LPV_SIZE.7 = Medium [128]
Expand Down Expand Up @@ -1042,6 +1045,7 @@ screen.Ambient_light.comment = Configure settings related to the lighting in sha
screen.Ambient_Colors.comment = Configure the color of light in shaded areas.
screen.Torch_Colors.comment = Configure the color of light from torches or other placed lightsources.

option.LPV_COLOR_STYLE.comment = Configures the color mixing logic during floodfill light propagation. Colourful uses a more vibrant RYB blending method. It is highly recommended to use a Light Saturation of 100% or more when Colourful is selected.
option.LPV_SIZE.comment = Configures the size (in blocks) of the volume for colored lighting.
option.LPV_SATURATION.comment = Configures the intensity of colored lighting.
option.LPV_TINT_SATURATION.comment = Configures the intensity of tinting by translucent blocks on colored lighting.
Expand Down
8 changes: 7 additions & 1 deletion shaders/lang/ru_RU.lang
Original file line number Diff line number Diff line change
Expand Up @@ -741,4 +741,10 @@ value.DH_KNOWN_ISSUES.1 = §a GTAO, RTAO, и SSGI прерываются на LO
option.DISTANT_HORIZONS_SHADOWMAP = §c(НЕ ИСПОЛЬЗУЙТЕ, ЕСЛИ ВЫ НЕ ЗНАЕТЕ, ЧТО ЭТО ТАКОЕ)§r Поддержка карты теней DH
option.DISTANT_HORIZONS_SHADOWMAP.comment = §cЭТОТ ПАРАМЕТР СНИЗИТ ПРОИЗВОДИТЕЛЬНОСТЬ, ИЗ-ЗА ЧЕГО ТЕНИ БУДУТ ВЫГЛЯДЕТЬ БЛОЧНЫМИ, МЕРЦАЮЩИМИ И С НИЗКОЙ ДЕТАЛИЗАЦИЕЙ§r. установите дистанцию теней равную 32 фрагментам (или больше). установите разрешение теней равную 4096 (или больше)
option.TOGGLE_VL_FOG = Объемный туман
option.TOGGLE_VL_FOG.comment = одна большая кнопка, чтобы просто отключить весь туман
option.TOGGLE_VL_FOG.comment = одна большая кнопка, чтобы просто отключить весь туман

screen.LPV = FloodFill (Цветное освещение)
option.LPV_COLOR_STYLE = Стиль распространения
value.LPV_COLOR_STYLE.1 = Красочный
value.LPV_COLOR_STYLE.2 = Стандартный
option.LPV_COLOR_STYLE.comment = Настраивает логику смешивания цветов при распространении света Floodfill. «Красочный» использует более насыщенный метод смешивания RYB. При выборе «Красочный» настоятельно рекомендуется установить насыщенность света на 100% или больше.
1 change: 1 addition & 0 deletions shaders/lib/settings.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -1109,6 +1109,7 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
///////////////////////////////////////////

#define LPV_ENABLED
#define LPV_COLOR_STYLE 2 // [1 2]
#define LPV_SIZE 7 // [6 7 8]
#define LPV_SATURATION 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_TINT_SATURATION 100 // [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]
Expand Down
1 change: 1 addition & 0 deletions shaders/shaders.properties
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ SHADER_VERSION_LABEL <profile> \
### FloodFill
screen.LPV.columns = 2
screen.LPV = LPV_ENABLED LPV_SIZE \
LPV_COLOR_STYLE \
LPV_SATURATION LPV_COLORED_CANDLES \
LPV_TINT_SATURATION LPV_REDSTONE_LIGHTS \
LPV_NORMAL_STRENGTH LPV_ENTITY_LIGHTS \
Expand Down