Closed Calinou closed 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.
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.
In master now :). Closing https://user-images.githubusercontent.com/4955051/102798357-e32ee480-43a8-11eb-9c23-ca8882062d55.mp4
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.