From 2285d5b8769122fc766e3c6d1946f053ceae66ff Mon Sep 17 00:00:00 2001 From: John Schultz Date: Sun, 17 May 2026 21:02:52 -0400 Subject: [PATCH] We do be shifting --- .../rs117/hd/renderer/zone/SceneUploader.java | 20 ++++++- .../scene/model_overrides/ModelOverride.java | 56 +++++++++++++++++++ .../rs117/hd/scene/model_overrides.json | 10 ++++ 3 files changed, 85 insertions(+), 1 deletion(-) diff --git a/src/main/java/rs117/hd/renderer/zone/SceneUploader.java b/src/main/java/rs117/hd/renderer/zone/SceneUploader.java index ba79134987..3ff41739bb 100644 --- a/src/main/java/rs117/hd/renderer/zone/SceneUploader.java +++ b/src/main/java/rs117/hd/renderer/zone/SceneUploader.java @@ -1608,6 +1608,12 @@ private int uploadStaticModel( } } + if (faceOverride.shiftsColor()) { + color1 = faceOverride.modifyColor(color1); + color2 = faceOverride.modifyColor(color2); + color3 = faceOverride.modifyColor(color3); + } + int textureFace = textureFaces != null ? textureFaces[face] : -1; if (material != Material.NONE) { uvType = faceOverride.uvType; @@ -1657,6 +1663,9 @@ private int uploadStaticModel( if (shouldRotateNormals) rotateNormals(modelNormals, orientSin, orientCos); + if (faceOverride.shiftsAlpha()) + transparency = faceOverride.modifyAlpha(transparency); + int depthBias = faceOverride.depthBias != -1 ? faceOverride.depthBias : bias == null ? 0 : bias[face] & 0xFF; int packedAlphaBiasHsl = transparency << 24 | depthBias << 16; @@ -1993,7 +2002,7 @@ public void uploadTempModel( else if (color3 == -1) color2 = color3 = color1; - final int transparency = transparencies != null ? transparencies[face] & 0xFF : 0; + int transparency = transparencies != null ? transparencies[face] & 0xFF : 0; final int textureFace = textureFaces != null ? textureFaces[face] : -1; final int textureId = isVanillaTextured ? faceTextures[face] : -1; final UvType uvType = faceUVTypes[face]; @@ -2003,6 +2012,12 @@ else if (color3 == -1) if (textureId != -1) color1 = color2 = color3 = 90; + if (faceOverride.shiftsColor()) { + color1 = faceOverride.modifyColor(color1); + color2 = faceOverride.modifyColor(color2); + color3 = faceOverride.modifyColor(color3); + } + final int materialData = material.packMaterialData(faceOverride, uvType, false); final int triangleA = indices1[face]; @@ -2068,6 +2083,9 @@ else if (color3 == -1) color3 = interpolateHSL(color3, overrideHue, overrideSat, overrideLum, overrideAmount); } + if (faceOverride.shiftsAlpha()) + transparency = faceOverride.modifyAlpha(transparency); + final int depthBias = faceOverride.depthBias != -1 ? faceOverride.depthBias : hasBias ? bias[face] & 0xFF : 0; final int packedAlphaBiasHsl = transparency << 24 | depthBias << 16; diff --git a/src/main/java/rs117/hd/scene/model_overrides/ModelOverride.java b/src/main/java/rs117/hd/scene/model_overrides/ModelOverride.java index 3b03fe3281..e629f985e8 100644 --- a/src/main/java/rs117/hd/scene/model_overrides/ModelOverride.java +++ b/src/main/java/rs117/hd/scene/model_overrides/ModelOverride.java @@ -76,6 +76,18 @@ public class ModelOverride public float shadowOpacityThreshold = 0; public TzHaarRecolorType tzHaarRecolorType = TzHaarRecolorType.NONE; public InheritTileColorType inheritTileColorType = InheritTileColorType.NONE; + private int shiftHue; + private int minHue; + private int maxHue = 63; + private int shiftSaturation; + private int minSaturation; + private int maxSaturation = 7; + private int shiftLightness; + private int minLightness; + private int maxLightness = 127; + private int shiftAlpha; + private int minAlpha; + private int maxAlpha = 255; public WindDisplacement windDisplacementMode = WindDisplacement.DISABLED; public int windDisplacementModifier = 0; public boolean invertDisplacementStrength = false; @@ -244,6 +256,18 @@ public ModelOverride copy() { shadowOpacityThreshold, tzHaarRecolorType, inheritTileColorType, + shiftHue, + minHue, + maxHue, + shiftSaturation, + minSaturation, + maxSaturation, + shiftLightness, + minLightness, + maxLightness, + shiftAlpha, + minAlpha, + maxAlpha, windDisplacementMode, windDisplacementModifier, invertDisplacementStrength, @@ -625,6 +649,38 @@ public void revertRotation(Model model) { } } + public boolean shiftsColor() { + return shiftHue != 0 || shiftSaturation != 0 || shiftLightness != 0 + || minHue != 0 || maxHue != 63 + || minSaturation != 0 || maxSaturation != 7 + || minLightness != 0 || maxLightness != 127; + } + + public boolean shiftsAlpha() { + return shiftAlpha != 0 || minAlpha != 0 || maxAlpha != 255; + } + + public int modifyAlpha(int alpha) { + alpha += shiftAlpha; + return clamp(alpha, minAlpha, maxAlpha); + } + + public int modifyColor(int jagexHsl) { + int h = jagexHsl >> 10 & 0x3F; + h += shiftHue; + h = clamp(h, minHue, maxHue); + + int s = jagexHsl >> 7 & 7; + s += shiftSaturation; + s = clamp(s, minSaturation, maxSaturation); + + int l = jagexHsl & 0x7F; + l += shiftLightness; + l = clamp(l, minLightness, maxLightness); + + return h << 10 | s << 7 | l; + } + @Nullable public final ModelOverride testColorOverrides(int ahsl) { ModelOverride override = null; diff --git a/src/main/resources/rs117/hd/scene/model_overrides.json b/src/main/resources/rs117/hd/scene/model_overrides.json index 23626496ae..4fb847caf6 100644 --- a/src/main/resources/rs117/hd/scene/model_overrides.json +++ b/src/main/resources/rs117/hd/scene/model_overrides.json @@ -78819,6 +78819,10 @@ "baseMaterial": "GEM_STONE", "uvScale": 1.1, "uvOrientation": 512, + "shiftSaturation": -7, + "shiftLightness": 30, + "maxLightness": 100, + "shiftAlpha": 175, "areas": [ "SHILO_VILLAGE_MINE", "SHILO_VILLAGE_MINE_SURFACE" @@ -78909,6 +78913,9 @@ "description": "Rock - Gems - Gem rocks - Small", "baseMaterial": "GRUNGE_3_SHINY", "uvType": "BOX", + "shiftSaturation": -7, + "shiftLightness": 30, + "maxLightness": 100, "colorOverrides": [ { "description": "Rock", @@ -78928,6 +78935,9 @@ "description": "Rock - Gems - Gem rocks - Large", "baseMaterial": "GRUNGE_3_SHINY", "uvType": "BOX", + "shiftSaturation": -70, + "shiftLightness": 30, + "maxLightness": 100, "colorOverrides": [ { "description": "Rock",