how do i add an Y offset to the water pallete #342
|
basically im new to godot. i want to make an accurate recreation of s3 for my project. i tried looking stuff up on the internet, but the water pallete either just dissapears entirely or floods the entire screen no matter the Y position. can any1 help me w this? huge thanks in advance |
Replies: 3 comments 4 replies
|
Shaders are far from my strong suite, but I'll explain it to the best of my ability. Someone like @Renhoex can maybe pipe in on whether or not my explanation is at all accurate. HUD.tscn contains a WaterOverlay ColorRect. This is what actually is responsible for coloring everything below the water. It employs our PaletteSwap shader and is configured to transform colors based on the closest match it can find in OriginalPalette (which looks like this: And for each pixel it will basically find the closest matching color by iterating through all of the colors in that pallete texture and taking the one that has the best match score (which is basically just the color with lowest combined difference between all three color channels from the pixel that would have been rendered if the ColorRect weren't there). From there it takes the pixel from that mapped and replaces it with the pixel in the same place from the SwapPalette texture (and our default swap palette texture is WetPal.png below. This functionality should work out of the box without you needing to do anything. It might not have the best color granularity though, particularly if you are using more colorful sprites than what we provide. Another exception worth noting is that the WaterOverlay is only 320x224 pixels by default, so if you enlarge the playing resolution of the game, you'll run into another issue where the colorrect doesn't cover with width of the playfield (and maybe not the height either if you expand the veritcal resolution too). But as for what would cause the whole screen to disappear, I have no idea. That sounds goofy. Can you provide a video and a list of what you've done that might have impacted rendering of water? I assume this isn't just out of the box stuff, because I don't think think we've had issues with our palette shaders on any given platform. Speaking of platform, that'd also be helpful. If I hear you are playing on some old phone that has no shader support I might just tell you to pound sand. |
|
On thing I'll say early is, if I remember, Ice Cap has a water ripple effects similar to Labyrinth zone. If I'm wrong, disregard this part: However, onto the bigger point, it looks like the effect you're talking about is the background layer being affected before sprites. Sadly, that isn't really possibly as is, because the Worlds Next water shader just takes color in -> color out, it doesn't know what's what. The closest you can get is, in hud.gd, find where the WaterOverlay is updated, and changed the reference to WaterLevel to WaterLevel+8 |
|
One way or another, youre going to be adding some entirely different
functionality to the engine. You will be changing scripts or shader code,
and exactly what way you want to do this is up to you as a programmer.
If the problem is shader code, you can read these shaders, or read the
godot docs to have full-on tutorials. Remember that "fuck around and find
out" works here too. If you really get stuck, you can try to avoid it
altogether with using two rects for each seperate water palette.
…On Sun, Feb 8, 2026, 6:01 AM Hyp0the ***@***.***> wrote:
no, but basically, what i mean is, i want to replicate the OG issue with
sonic 3, where the water changes pallete eight pixels under the actual
water box. (screenshot below.)
image.png (view on web)
<https://github.com/user-attachments/assets/f79c4486-c876-4f3d-8f2b-4b4c114f4f8f>
what i tried to do and it didnt work was to add uniform y offset and use
the 'vertex y += y offset' (lines of code i tried to add to the shader
included below)
shader_type canvas_item;
uniform float Y_offset = 0.0;
void vertex() {
VERTEX.y += Y_offset;
}
after what i'd done, changing the Y offset to a higher value than 0 made
the water pallete never show up, while setting it to a negative number
forced water pallete everywhere. (screenshots provided below, with positive
and negative Y offset values accordingly)
image.png (view on web)
<https://github.com/user-attachments/assets/9866225c-cf2d-40bd-a489-e924c6682a84>
image.png (view on web)
<https://github.com/user-attachments/assets/980c9060-8f86-4969-ae85-a4541b89087b>
and the initial question was asked with a purpose of getting the water to
work like it does in original sonic 3 game, cause im trying to replicate s3
for my project with highest accuracy possible.
in short, on the original game it works thanks to the screen division
thing, similar to the one competition mode uses, but with a few changes.
basically sort of like a viewport i guess. same way for the water
distortion afair.
and while i dont know if its possible to do it the same way in godot (im
more than sure it is), i know that there should be a way to make water
pallete apply 8 pixels offset on Y axis than the actual water layer starts.
which is what i meant to learn when asking. im sorry if my initial question
sounded just dumb its just that i spent 3 days trying to figure that out
and im hopeless at this point
—
Reply to this email directly, view it on GitHub
<#342 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A4JOMPIPG4NMJAESEQL5PXL4K4JQPAVCNFSM6AAAAACUL5DT52VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTKNZTGMZDENI>
.
You are receiving this because you are subscribed to this thread.Message
ID: <Techokami/SonicWorldsNext/repo-discussions/342/comments/15733225@
github.com>
|






I think all you'd need to accomplish that in particular is to move the ColorRect from before that I was talking about down by 8 pixels and add another color rect above it with the same palette shader which is smaller (only 8 pixels tall) that renders below the player.
For what it's worth, I'm only seeing an offset of like 2 pixels in S3... at least in Carnival Night. There's an interesting thing going on in S3 where you can spend a frame or two with part of yourself underwater without the palette effect being applied and that ends up being closer to the 8 pixels you mentioned, but I think that's a bug. I guess
EDIT: I just spent a few minutes analyzing what you are describing in Angel Is…