fix(mod): SpatialGui transparent inventory (no dim overlay in capture, premultiplied composite)

This commit is contained in:
loki5512344 2026-10-02 13:55:27 +02:00
parent e82efb74e7
commit a4638d386d
Signed by: boba
GPG key ID: 253067914055423B
5 changed files with 37 additions and 5 deletions

View file

@ -62,6 +62,9 @@
граней частей, UV скина, яркость искр); ProjectileTrails (вид ленты, глубина); Hero/orbs-меню.
- HoldMyItems Scripted: знаки осей `M:rotate`, видимость Lua-частиц, анимация квадов на реальной модели.
- GuiPresence: нужен запущенный стек (`backend/scripts/dev-stack.sh`) и два клиента с привязанными аккаунтами на одном сервере.
- SpatialGui (инвентарь был прозрачным): сверено с `ref/mods/Spatial-GUI`; убрано ванильное затемнение в захвате (`ScreenSpatialBackgroundMixin`) и
композитинг плоскости переведён на premultiplied-alpha пайплайн `WORLD_TEXTURED_PREMULTIPLIED`. Проверить в игре; если всё ещё прозрачно,
следующий подозреваемый: глубина захвата (clear 1.0) и HUD внутри захвата (у эталона захватывается только экран, отдельным GuiRenderer).
- Войсчат с настоящим SVC 2.6.24 (события mute/speaking, значок шапки HUD).
- Размер плашки описания в ClickGUI и авто-масштаб тултипа при GUI Scale 2/3/4.

View file

@ -260,14 +260,16 @@ public class SpatialGui extends Module {
cachedSampler = RenderSystem.getSamplerCache().getClampToEdge(FilterMode.LINEAR);
}
MeshBuilder mesh = renderer.batchTextured(LoVisualRenderPipelines.WORLD_TEXTURED, textureView, cachedSampler, Renderer3D.DepthMode.NONE);
MeshBuilder mesh = renderer.batchTextured(LoVisualRenderPipelines.WORLD_TEXTURED_PREMULTIPLIED, textureView, cachedSampler, Renderer3D.DepthMode.NONE);
if (mesh != null) {
// The capture holds premultiplied colour (GUI draws blended onto a transparent target), so the fade
// factor must scale RGB together with alpha.
int a = (int) (drawAlpha * 255.0F);
mesh.ensureQuadCapacity();
int i1 = mesh.vec3(p1.x, p1.y, p1.z).vec2(0, 1).color(255, 255, 255, a).next();
int i2 = mesh.vec3(p2.x, p2.y, p2.z).vec2(1, 1).color(255, 255, 255, a).next();
int i3 = mesh.vec3(p3.x, p3.y, p3.z).vec2(1, 0).color(255, 255, 255, a).next();
int i4 = mesh.vec3(p4.x, p4.y, p4.z).vec2(0, 0).color(255, 255, 255, a).next();
int i1 = mesh.vec3(p1.x, p1.y, p1.z).vec2(0, 1).color(a, a, a, a).next();
int i2 = mesh.vec3(p2.x, p2.y, p2.z).vec2(1, 1).color(a, a, a, a).next();
int i3 = mesh.vec3(p3.x, p3.y, p3.z).vec2(1, 0).color(a, a, a, a).next();
int i4 = mesh.vec3(p4.x, p4.y, p4.z).vec2(0, 0).color(a, a, a, a).next();
mesh.quad(i1, i2, i3, i4);
}

View file

@ -0,0 +1,24 @@
package dev.loki.lovisual.mixins.render.spatialgui;
import dev.loki.lovisual.features.module.modules.visuals.spatialgui.SpatialGui;
import net.minecraft.client.gui.GuiGraphicsExtractor;
import net.minecraft.client.gui.screens.Screen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
/**
* While SpatialGui floats the screen in the world, the vanilla full-screen dimming gradient must not be drawn into
* the capture: it would turn the whole plane into a dark translucent sheet around (and behind) the inventory.
* Same fix as the reference Spatial-GUI mod's {@code ScreenMixin}.
*/
@Mixin(Screen.class)
public abstract class ScreenSpatialBackgroundMixin {
@Inject(method = "extractTransparentBackground", at = @At("HEAD"), cancellable = true)
private void lovisual$noDimInSpatialCapture(GuiGraphicsExtractor graphics, CallbackInfo ci) {
SpatialGui module = SpatialGui.getInstance();
if (module != null && module.isCapturing()) ci.cancel();
}
}

View file

@ -72,6 +72,8 @@ public enum LoVisualRenderPipelines {
public static final RenderPipeline WORLD_TEXT_MSDF_DEPTH = add(WorldPipelines.worldText("world_text_msdf_depth", true, SHADER_TEXT_MSDF_FRAG, true));
/** No depth test; additive; textured triangles. */
public static final RenderPipeline WORLD_TEXTURED_ADDITIVE = add(WorldPipelines.textured("world_textured_additive", false, PipelineTemplates.ADDITIVE));
/** No depth test; premultiplied-alpha blend; textured triangles (off-screen GUI captures drawn into the world). */
public static final RenderPipeline WORLD_TEXTURED_PREMULTIPLIED = add(WorldPipelines.textured("world_textured_premultiplied", false, BlendFunction.TRANSLUCENT_PREMULTIPLIED_ALPHA));
/** No depth test; additive; textured triangles with shader-side tint. */
public static final RenderPipeline WORLD_TEXTURED_TINT_ADDITIVE = add(WorldPipelines.tintedTextured("world_textured_tint_additive", false));
/** Depth test (GEQUAL); additive; textured triangles. */

View file

@ -171,6 +171,7 @@
"render.main.MinecraftMixin",
"render.main.ScreenEffectRendererMixin",
"render.spatialgui.GuiRendererCaptureMixin",
"render.spatialgui.ScreenSpatialBackgroundMixin",
"render.sound.LibraryMixin",
"render.sound.SoundEngineMixin",
"render.text.FontManagerMixin",