Arnklit / Waterways

A tool to generate river meshes with flow and foam maps based on bezier curves.
https://github.com/Arnklit/WaterGenGodotDemo
MIT License
1.05k stars 72 forks source link

Use SpatialMaterial's Proximity Fade feature to smoothly fade out water edges #4

Closed Calinou closed 3 years ago

Calinou commented 3 years ago

SpatialMaterial has a Proximity Fade feature which can be used to smoothly fade out a material when it intersects with a solid material. This is useful for soft water transitions and soft particles.

Perhaps you could copy it into your own shader? It has some performance cost, so it should be made optional.

Arnklit commented 3 years ago

I don't think it would have much of a performance cost, since I'm already doing the depth check for making the water murky when deep enough.

But I'm not sure it's actually the right way of solving the issue. I've been looking at a lot of water while making this and it doesn't really fade out at the edges, especially when seen at a glancing angle where it's mostly reflective.

I feel like mostly what's needed is screen space reflections so the colour at the edge blends right into the environment, I'd like to see if I could get that to work if I added it into my own shader, since the environment one doesn't support transparent objects.

Arnklit commented 3 years ago

OK, doing some tests with the proximity fade its much more subtle and looks way better than I expected. I'll definitely be adding in this option. Thanks Calinou.

Arnklit commented 3 years ago

In master now :). Closing https://user-images.githubusercontent.com/4955051/102798357-e32ee480-43a8-11eb-9c23-ca8882062d55.mp4