Project 130: Computational Fluid Dynamics: Water with custom Shader effect

 

I have managed to port over one of the Water shader examples from Ati's RenderMonkey to T3d. I was right, porting over additional shaders was basically the same as porting over the simple glitter shader, once I learned how the shader constants, samplers, etc work in T3D I was able to port over the Water shader fairly easily.

I think the shader looks relatively good, although there is one issue, which I identified earlier. The texture coordinates on the metablob are not correct. I used a vastly simplified method of calculating the texture coordinates, and it has led to noticeable stretching. I don't have time to create a full Triplanar texturing solution, but I may try to improve the existing texture coordinate system by using spherical mapping later in the week.

One of the main things that makes the shader look as good as it does is a cubemap. This allows the surface of the metablob to reflect the sky above. I had never used cubemaps in shaders before, only as skyboxes, you can create some very realistic looking effects with them.

I also implemented transparency on the Material, giving the water a see-through effect, which wasn't present in the original RenderMonkey Shader.

The next step in this project is toadd all of the variables used in the configuration of the simulation (number of metaballs created, size of the simulation, speed, gravity constant, etc) to the T3D gui editory, so that the simulation can be edited in real time. To do this, I need to make some logical changes to the system, to allow for real-time updating and multiple fluid simulations to be used at the same time (A lot of the variables are either constants or globals at the moment).

I also intend to create three more Materials: Lava, Mud, and Tar, in addition to Water. I found a great example in RenderMonkey which I intend to use for the lava shader, and I believe I can use a standard Material for the Mud and Tar. I think if I use a texture with animation I can simulate flowing mud or tar quite well without having to write a custom shader.

 

You must be a member of this blog to see the comments. Log in now!

If you have no account yet, you can register now! (It only takes a few seconds)