O.K.
First, If you see what looks like your code in here, then it probably is.
So, to all those guys who shared their code (of whom there are too many to thank individually)..
Thanks a big pile! (specially to Cute Alien, Elvman, Devsh and tbw)..
It started off as an experiment in Deferred Rendering but then quickly evolved
into a Water Renderer.
I then added Three Layers of Animated Clouds and Lensflares from a Synthetic Sun.
I added a few Screen Quad Post Processing Passes (eight of em) for Both GL's GLSL and DX's HLSL. (they both work)
(most notably NVIDIA's FXAA T.L. for BOTH GLSL & HLSL)
One night I paged through some old stuff and found a little layer I wrote
for the "Audiere" Sound System to make using it a bit easier. (there was an undocumented issue somewhere)
I pasted it in to see how it would work and.. Now we've got sound! Cool!
(for compiling I had included the "*.lib" and header for your IDE, but get the whole thing yourself)
The sound system plays "Wave Samples" like water splashes in Ogg Vorbis Format
and plays "Sequenced" Track Music like "*.it", "*.mod", "s3m" and the rest.
I think it worked quite well! Audierre is very powerfull and often overlooked.
Clever controlling of the "Pan" (balance) versus Sound Source Position could even give
you "3D Directional Sound". (definitely something I'm looking into later)
I also tried changeing the "mood" between above water and below water using different music
trigerred by a single frame flag in "Enter Water" or "Exit Water" state..
The noise of the water above differs from the water flow below..
The Water renderer which is actualy what this is all about does some unique things.
For depth, plane calculations were dropped in favour of fragment distance from the ZERO Point
on the Y axis.. Planes are cool but for this world where water is at X Y Z Zero with Nornal at Y: 1,
distance on Y will do.
This distance is split into RGB for different parts which act on different attributes of the water
like Normal Damping, Colour Intensity and Murk.
Opacity is lerped into the render near the end of the Water Shader.
Opacity is a new thing that could be explained as the difference between blue spirits
and matte blue paint. They are both the same colour but have different ways in which light is
allowed to pass through.
Water is a really complex thing and comes in many different colours, opacities and murkyness.
An example would be a pool into which chlorine was thrown. First the green water looks
"milky blue green" then slowly turns clear low saturation blue.
The water in a river, just after rain is a Matte Brown colour but still reflects under fresnel rules.
Play around with the settings using the relevant keyboard controlls and you'll soon see that you
can emulate almost any kind of liquid.
I implemented "Global Alert Pointers", something that would allow the water renderer to share it's
"states" with the rest of the world so that objects that touch the water would have
their shaders be aware of the state in which the water renderer is in at the moment of rendering
these world objects.
Darkening via gradient of surfaces that are underwater is an example.
Now, the project is ongoing and obviously will be improved but I don't have time right now
and I'm still a bit of an Irrlicht noob.
It might look big and ugly, but it is reasonably modular for you to try your own Things on.
Smart Shaders havent been incorporated into the PP system yet, but you can see it working on the
two static objects. PP Shaders still acts independently.
The start of this conversion process was left in the code so continuing shouldn't be too hard..
This is no quick lesson like you'd find in the examples package, so if you like it hold on to it
and look at it when you've got time. ("Tiny Upload" holds material for 90 days before deleting it)
Smart shaders simply lets you "add" shaders and their feed variables sothat the Callback automatically
knows what variables to send. It also avoids D3D bombarding your console with warnings when you
send a variable that is not in your shader code. (glsl doesn't have this issue)
The main reason I posted this is sothat so people can let me know if there are
any serious problems in the coding.
Id really appreciate critique, so let me have it..
Feel free to use any of the code in your own stuff!
Software used: Irrlicht, Blender, ModPlugTracker, Audacity, Cool Edit, Coolspeech, ZBrush (wavenormals) and Photoshop..
At some point I had to stop beautifying the code, sorry..
Put on your earphones..
Here is the full project:
http://s000.tinyupload.com/?file_id=053 ... 2700644252