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
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,7 @@ private int[] uploadHDTileModelSurface(
boolean allowBlending =
plugin.configGroundBlending &&
textureId == -1 &&
!(isOverlay && proceduralGenerator.useDefaultColor(tile, override));
!proceduralGenerator.skipFaceBlending(tile, override, isOverlay);
boolean blendColors = plugin.configGroundBlendingColors && allowBlending;
boolean blendTextures = plugin.configGroundBlendingTextures && allowBlending;

Expand Down Expand Up @@ -1061,17 +1061,17 @@ private int[] uploadHDTileModelSurface(
} else if (groundMaterial != null) {
materialA = groundMaterial.getRandomMaterial(
worldPos[0] + (localVertices[0][0] >> LOCAL_COORD_BITS),
worldPos[1] + (localVertices[0][1] >> LOCAL_COORD_BITS),
worldPos[1] + (localVertices[0][2] >> LOCAL_COORD_BITS),
worldPos[2]
);
materialB = groundMaterial.getRandomMaterial(
worldPos[0] + (localVertices[1][0] >> LOCAL_COORD_BITS),
worldPos[1] + (localVertices[1][1] >> LOCAL_COORD_BITS),
worldPos[1] + (localVertices[1][2] >> LOCAL_COORD_BITS),
worldPos[2]
);
materialC = groundMaterial.getRandomMaterial(
worldPos[0] + (localVertices[2][0] >> LOCAL_COORD_BITS),
worldPos[1] + (localVertices[2][1] >> LOCAL_COORD_BITS),
worldPos[1] + (localVertices[2][2] >> LOCAL_COORD_BITS),
worldPos[2]
);
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/rs117/hd/renderer/zone/SceneUploader.java
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,7 @@ private void uploadTileModel(
boolean allowBlending =
plugin.configGroundBlending &&
textureId == -1 &&
!(isOverlay && proceduralGenerator.useDefaultColor(tile, override));
!proceduralGenerator.skipFaceBlending(tile, override, isOverlay);
boolean blendColors = plugin.configGroundBlendingColors && allowBlending;
boolean blendTextures = plugin.configGroundBlendingTextures && allowBlending;

Expand Down Expand Up @@ -1374,17 +1374,17 @@ private void uploadTileModel(
} else if (groundMaterial != null) {
materialA = groundMaterial.getRandomMaterial(
worldPos[0] + (vertices[0][0] >> LOCAL_COORD_BITS),
worldPos[1] + (vertices[0][1] >> LOCAL_COORD_BITS),
worldPos[1] + (vertices[0][2] >> LOCAL_COORD_BITS),
worldPos[2]
);
materialB = groundMaterial.getRandomMaterial(
worldPos[0] + (vertices[1][0] >> LOCAL_COORD_BITS),
worldPos[1] + (vertices[1][1] >> LOCAL_COORD_BITS),
worldPos[1] + (vertices[1][2] >> LOCAL_COORD_BITS),
worldPos[2]
);
materialC = groundMaterial.getRandomMaterial(
worldPos[0] + (vertices[2][0] >> LOCAL_COORD_BITS),
worldPos[1] + (vertices[2][1] >> LOCAL_COORD_BITS),
worldPos[1] + (vertices[2][2] >> LOCAL_COORD_BITS),
worldPos[2]
);
}
Expand Down
18 changes: 17 additions & 1 deletion src/main/java/rs117/hd/scene/ProceduralGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.*;
import rs117.hd.HdPlugin;
import rs117.hd.renderer.legacy.LegacySceneContext;
import rs117.hd.scene.materials.Material;
import rs117.hd.scene.model_overrides.ModelOverride;
Expand Down Expand Up @@ -78,6 +79,9 @@ public class ProceduralGenerator {
/* 11 */ { true, true, false, false, false, false },
};

@Inject
private HdPlugin plugin;

@Inject
private TileOverrideManager tileOverrideManager;

Expand Down Expand Up @@ -323,6 +327,18 @@ public boolean useDefaultColor(Tile tile, TileOverride override) {
return !override.blended;
}

/**
* Whether a model tile face should skip ground blending. Vanilla textures only apply to
* overlay faces, so underlay faces normally keep blending. When colors don't blend, underlay
* faces also respect {@code blended: false}, so their texture can't spread onto neighbours
* which keep their own unblended colors.
*/
public boolean skipFaceBlending(Tile tile, TileOverride override, boolean isOverlay) {
if (isOverlay)
return useDefaultColor(tile, override);
return !plugin.configGroundBlendingColors && override != TileOverride.NONE && !override.blended;
}

public WaterType seasonalWaterType(TileOverride override, int textureId) {
var waterType = override.waterType;

Expand Down Expand Up @@ -704,7 +720,7 @@ private void generateDataForTile(SceneContext sceneContext, Tile tile, int tileE
vertexOverrides[base] = override;
vertexIsOverlay[base] = isOverlay;

if (isOverlay && useDefaultColor(tile, override))
if (skipFaceBlending(tile, override, isOverlay))
vertexDefaultColor[base] = true;
}
}
Expand Down