-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
depth texture gets distorted at different angles or distance from the camera #77798
Comments
In short, not a bug, can be closed. If you feel like Godot could use better foam (distance fields), you can give thumbs up to this proposal: godotengine/godot-proposals#5984. |
Yeah today I tried the same effect with Unreal and had the same distortion, so it's not an issue. Was actually gonna see if SDF were supported because people in Unreal forums came to the same conclusion. I'll try your solution and see what I can do. Thank you very much! this was driving me crazy |
The distortion on the water's edge has been eliminated. Credit to Lielay9 for some of the shader code (godotengine/godot#77798 (comment))
Godot version
4.0.3
System information
Windows 10
Issue description
Sorry in advance if this is a misunderstanding, but I haven't found a solution anywhere.
I tried to use the depth texture for edge detection in a water shader. It doesn't stay consistent, wherever I put the camera it will get distorted or curved, specially when doing a close up. Made sure to use the correct linear depth function, it's the same one on all shaders I could find. In fact, I'm using the one from the proximity fade node in the visual shader.
From a distance seems fine:
However, on close up it starts to distort:
To be honest I didn't really mind it, until I tested a beach:
That second angle is pretty common in a playable scene I have, it's painfully obvious so I can't use it.
I'm not really sure if this is just a side effect of the function or a bug, but at this point I tried every single water shader I could find and all have the same issue.
StayAtHomeDev uses another method: https://www.youtube.com/watch?v=7L6ZUYj1hs8
But produces the same issue:
This this is the regular linear depth (-view.z+VERTEX.z):
Same thing. Also tried
float depth = texture(DEPTH_TEXTURE, FRAGCOORD.xy / VIEWPORT_SIZE).r;
with the same resultsIs this an issue with the depth texture or am I misunderstanding how to use it?
Steps to reproduce
Minimal reproduction project
min_water.zip
The text was updated successfully, but these errors were encountered: