GODOT VERSION:
4.3.dev6
==================
Hello all,
I have been facing some issues with shader development. Specifically, I have been developing two major shaders simultaneously. The one that I am facing trouble with is the ocean shader I am developing. It works great, and after weeks of progress I finally have a result I am happy with. One issue though is my Object - Foam System. In my shader I read from the DEPTH_TEXTURE ( in the form of hint_depth_texture of course) I then use the depth to make some water darker, but more noticeably, foam around the edges of objects which are partially submerged. here is a picture of the foam, on a simple 5x5x5 box mesh:
Pictures: (Imgur due to first post restrictions) Box Meshes and Foam - Album on Imgur
And here is an exact duplicate of the BoxMesh, fully out of the water:
Refer to Imgur link.
All is well in this picture, expect of course that anti aliasing is off. Now here are the exact same two boxes, in the same order, but with MSAA 2X enabled:
Refer to Imgur link.
As you can pretty clearly see, with MSAA enabled to any degree (2x, 4x, 8x) the depth texture âbleedsâ onto objects which would otherwise not be included in said depth texture.
My water shader code is as follows, in full:
https://pastebin.com/wUasg5Bd
A similar topic, two years old at this point in time is listed:
GOOGLE SEARCH: âIs there a way to disable anti-aliasing on just the depth texture?â
Now this issue is easily solved a couple different ways, with there drawback listed as well:
- No anti aliasing / different anti aliasing method (FXAA, TAA, etc.) Best solution for me currently, but you know the drawbacks of these methods, blurred screen, less precise edge blurring, etc.
- Leave it, not that noticeable. First off, in other games foam may be a major factor. Second off, I have terrain (hills, specifically) that when looking over the terrain unto the water, you can see a clear line of white (foam) on the border between the apex of the terrain and the distant plane of water. THAT is a lot more noticeable than some small objects.
- Ditch the foam entirely. I like to think that I can keep a graphics feature that I love that I worked hard on, and that there is a fix or fix in the future. But maybe not.
Alas, I am not frustrated at anything, not the engine, nor the devs, nor graphics shenanigans. Because this is a relatively small issue, and not any one personâs fault. I just wanted to bring it to light, or rather back to light (given the two year old post) since I would love to use MSAA with my ocean shader. Other than that Godot is working amazing!
Thanks.