I’ve recently been enjoying this engine and I am excited with the move to open source. Something that I’ve been working on recently is figuring out how to implement a water shader. Water is one of those things that really stands out and I was not happy with just a simple flat texture and basic displacement effect.
I went into the process without knowledge of shaders. I had also just started really playing with Xenko. It was a bit of a fight to figure this out but I think I have the basics for a larger feature. With the lack of documentation and examples available for this engine, I thought I would share what I’ve got so far even if it’s rough around the edges. So here it is: https://github.com/TomGroner/XenkoFlowingWater
This is by no means an elaborate example and I have a suspicion that how I’ve done things might not be the best strategy. However it shows all of the pieces needed to render flowing water. I will probably keep working on this example as I discover further improvement. Some of the things that I will be playing with:
- The textures used have a dramatic effect on how it looks. I played with a lot of them, and was starting to spend more on finding textures than I was on the code for the sample. I will keep looking for better ones and hopefully give a really nice effect. The sky in particular I want to replace, it’s too green. The sky is what gives most of the color to the water surface.
- The sample does not implement varying water height and associated transparency. The example is a simple plane and a depth map sort of setup didn’t make much sense. I might put together a larger scene, perhaps a river or beach, with a shoreline and gradually decreasing transparency on the shore. I think that will look really nice.
A short video of the feature can be see here. I hope this is helpful!