From 27aecbfed6ee280eec7fef660e662138b96c7054 Mon Sep 17 00:00:00 2001 From: Eclipse Date: Mon, 27 Oct 2025 16:23:21 +0000 Subject: [PATCH] Increase max supported texture size when stitching textures for 3D models --- .../geysermc/rainbow/mapping/texture/StitchedTextures.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rainbow/src/main/java/org/geysermc/rainbow/mapping/texture/StitchedTextures.java b/rainbow/src/main/java/org/geysermc/rainbow/mapping/texture/StitchedTextures.java index 8923a17..2052459 100644 --- a/rainbow/src/main/java/org/geysermc/rainbow/mapping/texture/StitchedTextures.java +++ b/rainbow/src/main/java/org/geysermc/rainbow/mapping/texture/StitchedTextures.java @@ -23,6 +23,10 @@ import java.util.function.Supplier; import java.util.stream.Stream; public record StitchedTextures(Map sprites, Supplier stitched, int width, int height) { + // Not sure if 16384 should be the max supported texture size, but it seems to work well enough. + // Max supported texture size seems to mostly be a driver thing, to not let the stitched texture get too big for uploading it to the GPU + // This is not an issue for us + private static final int MAX_TEXTURE_SIZE = 1 << 14; public Optional getSprite(String key) { if (TextureSlotsAccessor.invokeIsTextureReference(key)) { @@ -48,8 +52,7 @@ public record StitchedTextures(Map sprites, Supplier private static SpriteLoader.Preparations prepareStitching(Stream textures, PackContext context) { // Atlas ID doesn't matter much here, but BLOCKS is the most appropriate - // Not sure if 1024 should be the max supported texture size, but it seems to work - SpriteLoader spriteLoader = new SpriteLoader(AtlasIds.BLOCKS, 1024, 16, 16); + SpriteLoader spriteLoader = new SpriteLoader(AtlasIds.BLOCKS, MAX_TEXTURE_SIZE, 16, 16); List sprites = textures.distinct() .map(texture -> readSpriteContents(texture, context)) .mapMulti(Optional::ifPresent)