Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
a29afc5
Added Support for TextureBuffer to use RGBA when available
RuffledPlume May 10, 2026
6ac386f
Fix Legacy Renderer shader compile issue
RuffledPlume Jun 29, 2026
e5e7fd6
Zone Renderer Wind Support
RuffledPlume Jul 10, 2026
2db6726
Tag Wind Displacement on Pandemonium Plam Trees
RuffledPlume Jul 10, 2026
8de59c6
Added Wavefront Scalarization support to Texture Buffer Parser
RuffledPlume Jul 10, 2026
05ace5f
Disable Character Positions when on a boat
RuffledPlume Jul 10, 2026
16bdaea
Merge All WorldViewContext Dynamic Vaos together
RuffledPlume Jul 11, 2026
63c0024
Re-Add support for Coalescing when Staging Buffer is present
RuffledPlume Jul 12, 2026
d38d7e9
More FrameContext Unmap to postDrawTopLevel
RuffledPlume Jul 12, 2026
dbd87c0
Added Boat Displacement Support
RuffledPlume Jul 12, 2026
1bc01a9
Cache all boat gameobjects at startup instead of using gameval at run…
RuffledPlume Jul 13, 2026
54f5970
Dont dither sail if detail culling is disabled
RuffledPlume Jul 13, 2026
3b0076e
Reduce Calls to `processPendingClientCallbacks` & Concurrent Streamin…
RuffledPlume Jul 13, 2026
84bf5e6
Reduce thrashing of the JobSystem
RuffledPlume Jul 13, 2026
eeaae1e
Fix BoatIds
RuffledPlume Jul 13, 2026
31029ec
PlayerModels use fixed size as their radius
RuffledPlume Jul 13, 2026
1055da4
Fix wind displacement on many flowers as well as add and adjust it on…
Jin-Jiyunsun Jul 14, 2026
ca0a67e
Fix Legacy
RuffledPlume Jul 14, 2026
a57ebcd
Add displacement to sailing kelp
Jin-Jiyunsun Jul 14, 2026
7b201eb
Slightly adjust some objects wind displacement
Jin-Jiyunsun Jul 14, 2026
b834d9e
Switch NPCDisplacementCache to use Int Collections
RuffledPlume Jul 14, 2026
718779e
Switch from AABB to Boat Contours
RuffledPlume Jul 16, 2026
6ea68ff
Added `unpackFloat2x16`
RuffledPlume Jul 16, 2026
0782177
Move Boat Contour Generation to `loadSubScene`
RuffledPlume Jul 16, 2026
4d193ab
Allow JobHandle Await to pickup work synchronously
RuffledPlume Jul 17, 2026
2c1e4c0
Round Robin the Streaming in Zones to avoid saturating Job Queue
RuffledPlume Jul 17, 2026
06b0713
Optimise DynamicModelVAO mergeRanges
RuffledPlume Jul 17, 2026
9510f05
Moved FRAME_CONTEXT_UNMAP to an earlier point in the frame
RuffledPlume Jul 17, 2026
a5053e1
Perform Lookup for existing Model Face Data for static models
RuffledPlume Jul 18, 2026
cb612d1
Dedup Static Faces
RuffledPlume Jul 18, 2026
86dcff5
Fix Underwater Chunk Edge Clamp
RuffledPlume Jul 18, 2026
bd8d079
Tag Tents & increase Varrock Castle displacement
RuffledPlume Jul 18, 2026
bea0b52
Allow TileItems to apply displacement
RuffledPlume Jul 18, 2026
afddad9
Reduce Dynamic Model Vertex Size
RuffledPlume Jul 19, 2026
5ca2486
Provide Stub metadata buffer for DynamicModelVAO
RuffledPlume Jul 19, 2026
b609918
Add wind displacement to various banners, training dummies and adjust…
Jin-Jiyunsun Jul 21, 2026
afec42d
Cleanup
RuffledPlume Jul 21, 2026
6f90ca0
Added `positionTileSnapping` to snap a models position to a grid by n…
RuffledPlume Jul 22, 2026
9a83ee6
Add wind to more banners
Jin-Jiyunsun Jul 22, 2026
08c71a5
Snap X & Z only
RuffledPlume Jul 22, 2026
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
12 changes: 12 additions & 0 deletions schemas/model_overrides.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@
"type": "boolean",
"description": "Will invert the strength blend applied to the model, where vertices near the top will be effected less."
},
"positionTileSnapping": {
"type": "integer",
"description": "Specify the amount of tiles that the models position should be snapped to"
},
"depthBias": {
"type": "integer",
"description": "Specify our own depth bias, replacing the bias set by Jagex. Between 0-255."
Expand Down Expand Up @@ -403,6 +407,10 @@
"type": "boolean",
"description": "Will invert the strength blend applied to the model, where vertices near the top will be effected less."
},
"positionTileSnapping": {
"type": "integer",
"description": "Specify the amount of tiles that the models position should be snapped to"
},
"depthBias": {
"type": "integer",
"description": "Specify our own depth bias, replacing the bias set by Jagex. Between 0-255."
Expand Down Expand Up @@ -602,6 +610,10 @@
"type": "integer",
"description": "Modifier value between -3 and 3 to control how strongly wind should displace the model."
},
"positionTileSnapping": {
"type": "integer",
"description": "Specify the amount of tiles that the models position should be snapped to"
},
"invertDisplacementStrength": {
"type": "boolean",
"description": "Will invert the strength blend applied to the model, where vertices near the top will be effected less."
Expand Down
15 changes: 13 additions & 2 deletions src/main/java/rs117/hd/HdPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@
import rs117.hd.opengl.shader.ShaderIncludes;
import rs117.hd.opengl.shader.TiledLightingShaderProgram;
import rs117.hd.opengl.shader.UIShaderProgram;
import rs117.hd.opengl.uniforms.UBOCompute;
import rs117.hd.opengl.uniforms.UBOGlobal;
import rs117.hd.opengl.uniforms.UBOLights;
import rs117.hd.opengl.uniforms.UBOUI;
Expand All @@ -103,6 +102,7 @@
import rs117.hd.renderer.zone.SceneManager;
import rs117.hd.renderer.zone.ZoneRenderer;
import rs117.hd.scene.AreaManager;
import rs117.hd.scene.DisplacementManager;
import rs117.hd.scene.EnvironmentManager;
import rs117.hd.scene.FishingSpotReplacer;
import rs117.hd.scene.GamevalManager;
Expand All @@ -129,6 +129,7 @@
import rs117.hd.utils.ResourcePath;
import rs117.hd.utils.ShaderRecompile;
import rs117.hd.utils.buffer.GLBuffer;
import rs117.hd.utils.buffer.GLTextureBuffer;
import rs117.hd.utils.collections.ConcurrentPool;
import rs117.hd.utils.collections.PooledArrayType;
import rs117.hd.utils.jobs.GenericJob;
Expand All @@ -137,6 +138,8 @@
import static net.runelite.api.Constants.*;
import static org.lwjgl.opengl.GL33C.*;
import static rs117.hd.HdPluginConfig.*;
import static rs117.hd.scene.DisplacementManager.MAX_BOAT_COUNT;
import static rs117.hd.scene.DisplacementManager.MAX_CHARACTER_POSITION_COUNT;
import static rs117.hd.utils.MathUtils.*;
import static rs117.hd.utils.ResourcePath.path;
import static rs117.hd.utils.buffer.GLBuffer.DEBUG_MAC_OS;
Expand Down Expand Up @@ -323,6 +326,9 @@ public class HdPlugin extends Plugin {
@Inject
public HDVariables vars;

@Inject
private DisplacementManager displacementManager;

public Renderer renderer;

public static boolean SKIP_GL_ERROR_CHECKS;
Expand Down Expand Up @@ -722,6 +728,7 @@ protected void startUp() {
fishingSpotReplacer.startUp();
gammaCalibrationOverlay.initialize();
npcDisplacementCache.initialize();
displacementManager.initialize();

hasLoggedIn = client.getGameState().getState() > GameState.LOGGING_IN.getState();
redrawPreviousFrame = false;
Expand Down Expand Up @@ -907,8 +914,10 @@ public ShaderIncludes getShaderIncludes() {
var includes = new ShaderIncludes()
.addIncludePath(SHADER_PATH)
.addInclude("VERSION_HEADER", OSType.getOSType() == OSType.Linux ? LINUX_VERSION_HEADER : WINDOWS_VERSION_HEADER)
.define("TEXEL_SIZE", GLTextureBuffer.isRGBASupported() ? 4 : 3)
.define("UI_SCALING_MODE", config.uiScalingMode())
.define("COLOR_BLINDNESS", config.colorBlindness())
.define("DITHER_FADE", config.ditherFading())
.define("APPLY_COLOR_FILTER", configColorFilter != ColorFilter.NONE)
.define("MATERIAL_COUNT", MaterialManager.MATERIALS.length)
.define("WATER_TYPE_COUNT", waterTypeManager.uboWaterTypes.getCount())
Expand All @@ -931,7 +940,8 @@ public ShaderIncludes getShaderIncludes() {
.define("WIND_DISPLACEMENT", configWindDisplacement)
.define("WIND_DISPLACEMENT_NOISE_RESOLUTION", WIND_DISPLACEMENT_NOISE_RESOLUTION)
.define("CHARACTER_DISPLACEMENT", configCharacterDisplacement)
.define("MAX_CHARACTER_POSITION_COUNT", max(1, UBOCompute.MAX_CHARACTER_POSITION_COUNT))
.define("MAX_CHARACTER_POSITION_COUNT", max(1, MAX_CHARACTER_POSITION_COUNT))
.define("MAX_BOAT_COUNT", max(1, MAX_BOAT_COUNT))
.define("WIREFRAME", config.wireframe())
.define("WINDOWS_HDR_CORRECTION", config.windowsHdrCorrection())
.define("LEGACY_RENDERER", renderer instanceof LegacyRenderer)
Expand Down Expand Up @@ -1825,6 +1835,7 @@ public void processPendingConfigChanges() {
case KEY_WIREFRAME:
case KEY_SHADOW_FILTERING:
case KEY_WINDOWS_HDR_CORRECTION:
case KEY_DITHER_FADING:
recompilePrograms = true;
break;
case KEY_ANTI_ALIASING_MODE:
Expand Down
14 changes: 12 additions & 2 deletions src/main/java/rs117/hd/HdPluginConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -795,12 +795,22 @@ default boolean characterDisplacement() {
return true;
}

String KEY_DITHER_FADING = "ditherFading";
@ConfigItem(
keyName = KEY_DITHER_FADING,
name = "Dither Fading",
description = "Whether to dither fade near plane geometry that would normally clip.",
position = 15,
section = environmentSettings
)
default boolean ditherFading() { return true; }

String KEY_HIDE_VANILLA_WATER_EFFECTS = "hideVanillaWaterEffects";
@ConfigItem(
keyName = KEY_HIDE_VANILLA_WATER_EFFECTS,
name = "Hide vanilla water ripples",
description = "Hide vanilla ripples found around objects floating in the water.",
position = 15,
position = 16,
section = environmentSettings
)
default boolean hideVanillaWaterEffects() { return true; }
Expand All @@ -810,7 +820,7 @@ default boolean characterDisplacement() {
keyName = KEY_POH_THEME_ENVIRONMENTS,
name = "Player-owned house themes",
description = "Change the environmental lighting based on the POH style.",
position = 16,
position = 17,
section = environmentSettings
)
default boolean pohThemeEnvironments() { return true; }
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/rs117/hd/opengl/compute/OpenCLManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
import rs117.hd.HdPlugin;
import rs117.hd.opengl.shader.ShaderException;
import rs117.hd.opengl.shader.ShaderIncludes;
import rs117.hd.opengl.uniforms.UBOCompute;
import rs117.hd.renderer.legacy.LegacyRenderer;
import rs117.hd.utils.buffer.SharedGLBuffer;

Expand All @@ -61,6 +60,7 @@
import static org.lwjgl.system.MemoryUtil.NULL;
import static org.lwjgl.system.MemoryUtil.memASCII;
import static org.lwjgl.system.MemoryUtil.memUTF8;
import static rs117.hd.scene.DisplacementManager.MAX_CHARACTER_POSITION_COUNT;
import static rs117.hd.utils.MathUtils.*;

@Slf4j
Expand Down Expand Up @@ -324,7 +324,7 @@ public void initializePrograms() throws ShaderException, IOException {
.define("WIND_DISPLACEMENT", plugin.configWindDisplacement)
.define("WIND_DISPLACEMENT_NOISE_RESOLUTION", HdPlugin.WIND_DISPLACEMENT_NOISE_RESOLUTION)
.define("CHARACTER_DISPLACEMENT", plugin.configCharacterDisplacement)
.define("MAX_CHARACTER_POSITION_COUNT", UBOCompute.MAX_CHARACTER_POSITION_COUNT)
.define("MAX_CHARACTER_POSITION_COUNT", MAX_CHARACTER_POSITION_COUNT)
.addIncludePath(OpenCLManager.class);
passthroughProgram = compileProgram(stack, "comp_unordered.cl", includes);
passthroughKernel = getKernel(stack, passthroughProgram, KERNEL_NAME_PASSTHROUGH);
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/rs117/hd/opengl/shader/SceneShaderProgram.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
import static rs117.hd.HdPlugin.TEXTURE_UNIT_GAME;
import static rs117.hd.HdPlugin.TEXTURE_UNIT_SHADOW_MAP;
import static rs117.hd.HdPlugin.TEXTURE_UNIT_TILED_LIGHTING_MAP;
import static rs117.hd.renderer.zone.ZoneRenderer.TEXTURE_UNIT_MODEL_DATA;
import static rs117.hd.renderer.zone.ZoneRenderer.TEXTURE_UNIT_TEXTURED_FACES;

public class SceneShaderProgram extends ShaderProgram {
protected final UniformTexture uniTextureArray = addUniformTexture("textureArray");
protected final UniformTexture uniShadowMap = addUniformTexture("shadowMap");
protected final UniformTexture uniTiledLightingTextureArray = addUniformTexture("tiledLightingArray");
protected final UniformTexture uniTextureFaces = addUniformTexture("textureFaces");
protected final UniformTexture uniModelData = addUniformTexture("modelData");

public SceneShaderProgram() {
super(t -> t
Expand All @@ -25,12 +27,14 @@ protected void initialize() {
uniShadowMap.set(TEXTURE_UNIT_SHADOW_MAP);
uniTiledLightingTextureArray.set(TEXTURE_UNIT_TILED_LIGHTING_MAP);
uniTextureFaces.set(TEXTURE_UNIT_TEXTURED_FACES);
uniModelData.set(TEXTURE_UNIT_MODEL_DATA);
}

public static class Legacy extends SceneShaderProgram {
Legacy() {
shaderTemplate.add(GL_GEOMETRY_SHADER, "scene_geom.glsl");
uniTextureFaces.ignoreMissing = true;
uniModelData.ignoreMissing = true;
}
}
}
5 changes: 5 additions & 0 deletions src/main/java/rs117/hd/opengl/shader/ShadowShaderProgram.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@

import static org.lwjgl.opengl.GL33C.*;
import static rs117.hd.HdPlugin.TEXTURE_UNIT_GAME;
import static rs117.hd.renderer.zone.ZoneRenderer.TEXTURE_UNIT_MODEL_DATA;
import static rs117.hd.renderer.zone.ZoneRenderer.TEXTURE_UNIT_TEXTURED_FACES;

public abstract class ShadowShaderProgram extends ShaderProgram {
protected final UniformTexture uniTextureArray = addUniformTexture("textureArray");
protected final UniformTexture uniTextureFaces = addUniformTexture("textureFaces");
protected final UniformTexture uniModelData = addUniformTexture("modelData");

protected ShadowMode mode;

Expand All @@ -23,6 +25,7 @@ public abstract class ShadowShaderProgram extends ShaderProgram {
protected void initialize() {
uniTextureArray.set(TEXTURE_UNIT_GAME);
uniTextureFaces.set(TEXTURE_UNIT_TEXTURED_FACES);
uniModelData.set(TEXTURE_UNIT_MODEL_DATA);
}

@Override
Expand All @@ -47,6 +50,8 @@ public static class Legacy extends ShadowShaderProgram {
public Legacy setMode(ShadowMode mode) {
this.mode = mode;
uniTextureArray.ignoreMissing = mode != ShadowMode.DETAILED;
uniTextureFaces.ignoreMissing = true;
uniModelData.ignoreMissing = true;
return this;
}

Expand Down
75 changes: 6 additions & 69 deletions src/main/java/rs117/hd/opengl/uniforms/UBOCompute.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
package rs117.hd.opengl.uniforms;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import javax.inject.Inject;
import rs117.hd.scene.DisplacementManager;
import rs117.hd.utils.buffer.SharedGLBuffer;

import static org.lwjgl.opencl.CL10.*;
import static org.lwjgl.opengl.GL33C.*;
import static rs117.hd.utils.MathUtils.*;
import static rs117.hd.scene.DisplacementManager.MAX_CHARACTER_POSITION_COUNT;

public class UBOCompute extends UniformBuffer<SharedGLBuffer> {
public static final int MAX_CHARACTER_POSITION_COUNT = 50;

private static final Comparator<CharacterPositionPair> CHARACTER_POSITION_PAIR_COMPARATOR =
Comparator.comparingDouble(p -> p.dist);

// Camera uniforms
public Property yaw = addProperty(PropertyType.Float, "yaw");
public Property pitch = addProperty(PropertyType.Float, "pitch");
Expand All @@ -35,72 +29,15 @@ public class UBOCompute extends UniformBuffer<SharedGLBuffer> {
private final Property characterPositionCount = addProperty(PropertyType.Int, "characterPositionCount");
private final Property[] characterPositions = addPropertyArray(PropertyType.FVec3, "characterPositions", MAX_CHARACTER_POSITION_COUNT);

private final ArrayList<CharacterPositionPair> characterPositionsPairs = new ArrayList<>(characterPositions.length);
private int writtenCharacterPositions;
private float playerPosX, playerPosZ;

private static class CharacterPositionPair {
public float x;
public float z;
public float radius;
public float dist = Float.MAX_VALUE;
}
@Inject
private DisplacementManager displacementManager;

public UBOCompute() {
super(GL_DYNAMIC_DRAW, CL_MEM_READ_ONLY);
}

private CharacterPositionPair getCharacterPositionPair() {
if (writtenCharacterPositions >= characterPositionsPairs.size()) {
CharacterPositionPair newPair = new CharacterPositionPair();
characterPositionsPairs.add(newPair);
return newPair;
}

return characterPositionsPairs.get(writtenCharacterPositions);
}

public void addCharacterPosition(int localX, int localZ, int modelRadius) {
int writeIndex = writtenCharacterPositions;
CharacterPositionPair pair = getCharacterPositionPair();
characterPositionsPairs.remove(writeIndex);

pair.x = localX;
pair.z = localZ;
pair.radius = modelRadius * 1.25f;

if (writeIndex == 0) {
playerPosX = pair.x;
playerPosZ = pair.z;
pair.dist = 0.0f;
} else {
pair.dist = abs(playerPosX - pair.x) + abs(playerPosZ - pair.z);

if (writeIndex > 1) {
int index = Collections.binarySearch(
characterPositionsPairs.subList(1, writeIndex),
pair,
CHARACTER_POSITION_PAIR_COMPARATOR
);

writeIndex = index >= 0 ? index : -index - 1;
}
}

characterPositionsPairs.add(writeIndex, pair);
writtenCharacterPositions++;
}

@Override
protected void preUpload() {
for (int i = 0; i < writtenCharacterPositions; i++) {
CharacterPositionPair pair = characterPositionsPairs.get(i);
pair.dist = Float.MAX_VALUE;

if (i < characterPositions.length)
characterPositions[i].set(pair.x, pair.z, pair.radius);
}
characterPositionCount.set(min(writtenCharacterPositions, characterPositions.length));
writtenCharacterPositions = 0;
displacementManager.writeCharacterPositions(characterPositions, characterPositionCount);
}
}
41 changes: 41 additions & 0 deletions src/main/java/rs117/hd/opengl/uniforms/UBODisplacement.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package rs117.hd.opengl.uniforms;

import javax.inject.Inject;
import rs117.hd.scene.DisplacementManager;
import rs117.hd.utils.buffer.GLBuffer;

import static org.lwjgl.opengl.GL15C.GL_DYNAMIC_DRAW;
import static rs117.hd.scene.DisplacementManager.MAX_BOAT_COUNT;
import static rs117.hd.scene.DisplacementManager.MAX_CHARACTER_POSITION_COUNT;

public class UBODisplacement extends UniformBuffer<GLBuffer> {
public Property windDirectionX = addProperty(PropertyType.Float, "windDirectionX");
public Property windDirectionZ = addProperty(PropertyType.Float, "windDirectionZ");
public Property windStrength = addProperty(PropertyType.Float, "windStrength");
public Property windCeiling = addProperty(PropertyType.Float, "windCeiling");
public Property windOffset = addProperty(PropertyType.Float, "windOffset");

private final Property characterPositionCount = addProperty(PropertyType.Int, "characterPositionCount");
private final Property boatAABBCount = addProperty(PropertyType.Int, "boatCount");

private final Property[] characterPositions = addPropertyArray(PropertyType.FVec4, "characterPositions", MAX_CHARACTER_POSITION_COUNT);
private final BoatStruct[] boatData = addStructs(new BoatStruct[MAX_BOAT_COUNT], BoatStruct::new);

@Inject
private DisplacementManager displacementManager;

public UBODisplacement() {
super(GL_DYNAMIC_DRAW);
}

@Override
protected void preUpload() {
displacementManager.writeCharacterPositions(characterPositions, characterPositionCount);
displacementManager.writeBoatData(boatData, boatAABBCount);
}

public class BoatStruct extends StructProperty {
// Encoded Half16
Comment thread
aHooder marked this conversation as resolved.
public Property[] contour = addPropertyArray(PropertyType.IVec4, "contour", 2);
}
}
Loading