gdquest-demos / godot-shaders

A large library of free and open-source shaders for the Godot game engine. Here, you'll get 2D and 3D shaders with playable demos.
Other
3.17k stars 192 forks source link

Port project to Godot 4 #48

Closed JAWS81 closed 1 month ago

IceflowRE commented 1 year ago

Duplicate #47.

Zifai commented 1 year ago

Please update

Reneator commented 10 months ago

I am using an old version of the outline shader and it stopped working with godot 4, i stumbled on a solution that should work with many of the shaders from this repo (mostly regarding fragment functions):

https://github.com/godotengine/godot/issues/49781

TL;DR: Many of the shaders can be fixed when setting color by using a "COLOR *=" instead of "COLOR =", because it seems the values are different now.

Maybe leaving this one up so people could stumble upon this could be helpful.

Reneator commented 10 months ago

The tip above is mostly meant to fix the "modulate set on a canvasItem gets ignored when shader is applied" and to then also be able to draw outside the texture you might need something along the lines of:

if (color.a <= 0.0) {
  COLOR = mix(color, line_color, outline - color.a);
}
else {
  COLOR *= mix(color, line_color, outline - color.a);
}
NathanLovato commented 2 months ago

If someone would like to contribute, this would be most welcome. I won't have time to port this myself anytime soon.

tetrapod00 commented 1 month ago

I can try porting some of these. I'd recommend choosing 4.3 as the lowest supported version, if you have any shaders that read from the depth texture, since 4.3 is the first version after Reverse-Z.

Looks like these shaders at least may be affected by the clip space changes: https://github.com/gdquest-demos/godot-shaders/blob/master/godot/Shaders/water_3d.shader https://github.com/gdquest-demos/godot-shaders/blob/master/godot/Shaders/force_field.shader

NathanLovato commented 1 month ago

Closing in favor of #53 to help coordinate work