Godot 4.3 water shader to 4.4

Godot Version

4.4

Question

Convert MIT 4.3 water shader to 4.4. Godot migration doc not complete because it is not mentioned why the shader looks completely different in 4.4. One or more differences between Godot 4.3 and 4.4 are not recorded in the migration docs.

Does someone know what changed between 4.3 and 4.4 to make this shader work properly?

I looked up all the methods that changed, but they are not present. Also res changed to uid, those code lines I changed all to uid. But that is ofcourse not the problem. The water waves changed to long strokes instead of short seperate waves.

If you share code, please wrap it inside three backticks or replace the code in the next block:

func _ready() -> void:
    print("hello world")

Woah, that’s REALLY cool!

@normalized might know what changed.

If the godot official migration would mention it, then converting it to 4.4 or even higher would be easier. Now it is trial and error.

Can you post the visuals of how the shader changed between versions.

Hello Normalized,

Many thanks for just having a quick look.

Godot 4.3 screenshot:

And godot 4.4 screen shot:

As you an see the 4.4 version has changed the wave model showing on screen. So my guess is 4.4 changed much more in the engine than written down.

Please pay attention to the 4.4 screenshot all to the right, one long wave, very blocky to.

Could be compute shaders, specifically interfacing with them from script.

You run imgui in Godot? Blasphemy! :smile:

1 Like

hihihi. eh I am just a greenhorn in Godot trying to make a 3D game. I have no knowledge of any high level things. I am innocent. :sweat_smile: The MIT project indeed loads imgui.

Try to decompose into individual parts and test each part individually.

1 Like

ok. Many thanks. I understand. This will be a good exercise for sure! :innocent: Thank you again for your time appreciate it!

This seems to be a known problem with this shader:

Someone created a forked version that seems to work better with Godot 4.5:

3 Likes

Theres another fork with buoyancy that says 4.3 only because of async GPU readback ???

I dont even use that anyway. I assume its 4.3 only because of how the height data is transferred back from GPU for the buoyancy calculation. Maybe the data readback is different in 4.5/6/7 now.

I just get a blank screen for all of these.

So my hunch was correct? It is script/compute interfacing?

I think the one with buoyancy is using an obsolete gpu readback function in the renderserver.

Summary

This text will be hidden

This actually worked for me in Godot 4.6.2 stable. I cant see any particles, the mesh and texture are HD.

Hey, I looked and tried some things. Visual observation, combined with looking through the code a bit where the problem could be. In the UI I changed the Cascade tile length to 1 and then to 10, the waves are all straight. Somehow the code or code pieces for the tile is processed differently.

In the Godot 4.3 the tile are very wavy.

My knowledge is limited, but any pointers to Godot advanced shader learning?

It is GLSL based but with it’s own twist?

If you check the scripts theres a bunch of compute shaders

Compute shaders that Godot uses are pure GLSL. Godot’s rendering shader language is exactly like GLSL, with some engine-specific additions.

1 Like

Thank you, that means I can just open it with any text basec editor and have a go.

Oh my, what an adventure. Is like starting a fight with Arnold Schwarzenegger in it’s prime years and say: I will get ya! Let’s fight.

I saw the version from someone else, it has the same problem, the waves are uctually straight.

The way this ocean is created is like a focus point in the horizon with many lines towards the viewer, then the lines have a certain wave pattern.

I am cross posting this also in Reddit Godot. Maybe someone can help me also with learning Godot shaders and GLSL. And maybe some day I can solve this. I am open for suggestions if you know a place to learn. If possible free, if not paying some money is also ok.

Crosspost link:

https://www.reddit.com/r/godot/comments/1szauan/godot_mit_water_shader_not_work_in_44_request/

Thanks to everyone who had a look.

1 Like

I can see the wave shapes and the whiteness at the peaks, the mesh looks ok (when its moving), i just cant see the foam spray particles.

In my previous post #5, the difference is the wave pattern. In 4.3 is it very oscillating? In 4.4 it is more like a shallow curve. I am reading through some posts.

4.4 has a normal problem as well:

https://www.reddit.com/r/godot/comments/1j36ows/godot_44_normal_builtin_value_in_shaders_is_no/

And in the code of the water shader I see they used the keyword: hint_normal

Hint_normal is used by the shader to extract the red and blue channel from the texture, then use it as a normal. But since the normal in version 4.3 has an error. It is possible that it is related?