Improve water sim during slow movements

This commit is contained in:
Merlin1809 committed 2025-12-07 00:51:46 +01:00
1 parent f866ae5424
commit 88925dcb38
6 files changed
+32 -14

No files matched your search

+21
View File
@@ -26,6 +26,17 @@ uint GetVoxelBlock(const in ivec3 voxelPos) {
uniform bool is_sneaking;
uniform float frameTimeCounter;
vec2 getPlayerMovementOffset() {
vec2 currentPos = cameraPosition.xz-relativeEyePosition.xz;
vec2 previousPos = previousCameraPositionWave2.xz;
vec2 movement = currentPos - previousPos;
#if WATER_SIM_SCALE == 0
return -20.0 * movement;
#else
return -40.0 * movement * WATER_SIM_SCALE;
#endif
}
void main() {
#if WATER_INTERACTION == 2
if (abs(frameTimeCounter - lastFrameTimeCount) > WATER_SIM_FRAMETIME) {
@@ -69,6 +80,16 @@ void main() {
if(inBoatCurrentFrame || inBoatLastFrame || inBoat2Frames) inBoat = true;
if(inShipCurrentFrame || inShipLastFrame || inShip2Frames) inShip = true;
vec2 playerMovement = getPlayerMovementOffset();
water_move_ompensation_counter_SSBO += playerMovement;
water_move_compensationSSBO = ivec2(0);
ivec2 offset = ivec2(trunc(water_move_ompensation_counter_SSBO));
if (any(notEqual(offset, ivec2(0)))) {
water_move_compensationSSBO = offset;
water_move_ompensation_counter_SSBO -= vec2(offset);
}
}
#endif
}
+1 -12
View File
@@ -51,17 +51,6 @@ uniform vec3 relativeEyePosition;
#include "/lib/SSBOs.glsl"
vec2 getPlayerMovementOffset() {
vec2 currentPos = cameraPosition.xz-relativeEyePosition.xz;
vec2 previousPos = previousCameraPositionWave2.xz;
vec2 movement = currentPos - previousPos;
#if WATER_SIM_SCALE == 0
return -20.0 * movement;
#else
return -40.0 * movement * WATER_SIM_SCALE;
#endif
}
// Make this a smaller number for a smaller timestep.
// Don't make it bigger than 1.4 or the universe will explode.
#if WATER_SIM_SCALE == 0
@@ -80,7 +69,7 @@ void main() {
float dist = length(imgCoord-0.5*resolution);
if (dist >= resolution.x) return;
ivec2 movementOffset = ivec2(round(getPlayerMovementOffset()));
ivec2 movementOffset = water_move_compensationSSBO;
ivec2 sampledCoord = imgCoord - movementOffset;
sampledCoord = clamp(sampledCoord, ivec2(1), resolution - ivec2(1));
+4
View File
@@ -56,6 +56,10 @@
bool noSimOngoing;
bool noSimOngoingCheck;
ivec2 water_move_compensationSSBO;
vec2 water_move_ompensation_counter_SSBO;
}"},
"useViewportDims": true,
+1 -1
View File
@@ -1,6 +1,6 @@
option.SHADER_VERSION_LABEL = §d§lECLIPSE§r - A Bliss Edit
prefix.SHADER_VERSION_LABEL = V
value.SHADER_VERSION_LABEL.482 = 5.6.0
value.SHADER_VERSION_LABEL.482 = 5.6.1
# if you're here to translate, this is not a joke, these do what they say
profile.POTATO=§4Potato
+1 -1
View File
@@ -1,6 +1,6 @@
option.SHADER_VERSION_LABEL = §d§lECLIPSE§r - Bliss 编辑版
prefix.SHADER_VERSION_LABEL = 版本
value.SHADER_VERSION_LABEL.482 = 5.6.0
value.SHADER_VERSION_LABEL.482 = 5.6.1
# 如果你是来翻译的,这不是玩笑,这些选项的功能正如其名
profile.POTATO=§4土豆 (极低配置)
+4
View File
@@ -32,4 +32,8 @@ layout(binding = 0) buffer SSBO1 {
bool noSimOngoing; // 1 byte
bool noSimOngoingCheck; // 1 byte
ivec2 water_move_compensationSSBO; // idk
vec2 water_move_ompensation_counter_SSBO; // 8 bytes
};