Shader weavers are intimidating at first mainly because it is difficult to debug them and connections are quite confusing.
The basic idea of weaver can be learned from here. However, the code written in it is outdated... better to go with code.
Following are some weaver debugging techniques that I learned.
1. Debugging by altering the output color. ex
if(something_happens) bug=1.0; op_col.r+=bug;
2. CS flag to Disable shader cache : -cfgset=Video.ShaderManager.EnableShaderCache=false
3. CS flag to Dump shader program at %temp%\shader : -cfgfile=/config/shader-debug.cfg
4. Dump textures at %temp%\textures
a. CS flag : -plugin=bugplug b. ctrl+d c. ctrl+shift+t
5. Switching between CG/GLSL
a. simplest way is to delete the shader plugin that isn't needed. b. Disable GLSL only : -cfgset=Video.OpenGL.UseExtension.GL_ARB_shader_objects=false c. remove/edit the GLSL/CG technique in main entry weaver.
6. CS flag to check syntax error: -verbose
Entire water's shader code has been ported to weaver which will enable to add post effects easily. Plus heightmaps to generate natural water waves and larger ocean size.
Now it looks like this...
So I had prepared couple of thing that had to be done before actually starting with interactivity.
1). Porting XmlShaders to ShaderWeaver.
2). Mismatching of texturemaps.
3). Large Size of Oceans
4). FFT in oceans
As for 1). I tried to port the code, but I'm kinda still struggling to get it right. Thanks to res, Rlydontknow and Sueastside I'm able to understand them quite well but still weird errors priest.
The Mismatching actually didn't existed in temporary weaver code. so I guess the complete weavers should fix this issue.
The values of CELL_WID, CELL_LEN and MAX_OCEAN_DISTANCE are increased to spread the ocean even wider. but they increased the pre-computation of LODs thus the "gran" (vertex per tile) had to altered accordingly. gran = pow(2.0,LOD_type)/64.0f;
FFT needed VS texture mapping, but weavers weren't complete at the moment. So I decided to give it a shot in old shaders. If you look at the FFT implementation then you'll find that FFT is essentially creats a complex "texture". FFT calculations are very heavy. Thus it would rather be easier to just take a heightmap and use for ocean waves. It actually gives pretty decent result.
Along the way I found that the ocean water move along the camera which shouldn't happen because in a game water usually stays at one particular position. It does that due to LOD calculations. So along with taking waves parameters from the world file, the plugin will also take position and radius to which the user wants it to extend.
This Summer is going to be really exciting. I'm gonna beat the heat by mutating the CS water system. Thanks to CS community for considering my proposal on water simulation. Watch out for Wet CS!
starting with shaders. ;)