I had originally wanted to use a shader to create a pool of clouds and
stand the performers in it with the clouds lapping around  their  feet
or legs.  However, my initial efforts were not very satisfactory and I
began to experiment leading to this set of experiments.

There are currently four series of experiments using clouds

   A - An attempt to stand a performer in a cloud.

   B - In which a performer is enveloped in smoke.

   C - Outside scenes featuring fog or mist.

These are all based on the FSS,  Fast  Adaptive  Stationary  Sampling,
shader by Huw Bowles which I had downloaded ShaderToy.com site. In its
original form it created a low moving cloud bank and had the advantage
of being fast while realistic cloud shaders are often very slow. 

----------------------------------------------------------------------

The A1 series represent my original attempts to have a performer stand
in a cloud but the results are not statifactory. The idea was to use a
cloud shader twice,  once at the top part of the screen to provide the
background clouds and a second time in at the bottom of the screen  to
provide the foreground clouds. This had worked well enough, though not
perfectly,  when used with water rather than clouds,  see  "Hombre Sin
Sombra = Scenes - Seascape - 04",  but it leaves a sharp straight line
between the performer and the foreground which while barely acceptable
with water  just does not work with clouds.  The best that can be done
is to place the performer at the very bottom of the  screen  so  there
are no clouds in the foreground,  or else to use some sort of platform
with a thin supporting leg so that the straight line is very short.  

The A2 shader is a minor modification of the A1 shader  in  which  the
clouds are gradualy suppressed as they near the  nominal  position  of
the performer.  This  looks  somewhat better than just standing her on
the moving clouds, but is not really convincing.

The A3 series of scenes are a variation of the A1 series where instead
of using the same shader to generate both foreground and background  a
modified version is used for the foreground.  The  clouds generated by
the foreground shader are now gradualy faded in  as  they  decend  the
screen.  This eliminates the hard line seen in the A1 scenes replacing
them with a transition zone of misty clouds. It is not perfect, if you
look closely you can see that in the transition zone the performer  is
slightly transparent,  but the effect is almost satisfactory and it is
improved somewhat by making the foreground clouds differ from those in
the background by flipping and stretching them.

----------------------------------------------------------------------

Because the A1 series did not lead to satisfactory results this shader
was used in a different manner to that initialy envisaged and this led
to the B series in which the shader is used in a different manner.  In 
this series a shader is used to generate the background and  the  same
shader is used to render the clip itself together with the  foreground
smoke.

The shader differs from that used for the A1  series  by  merging  its
output with image provided by its input texture (which may be nothing,
a background image or a clip) rather than just overwriting it.

As a result of a initial error when correcting the orientation of  the
input image the clouds of original shader became clouds of smoke. This
was an accident, but I liked the effect.

The results are quite satisfying,  adding  either  a touch of romantic
mystery or increased steamyness to a simple scene  or,  perhaps,  just
obscuring the details depending on your point of view.

The B shaders can be tweaked by means of a set of tailoring parameters
declared near the start of each .fsh file allowing you to adjust  them
to your particular preferences.

It is possible to add foreground elements in front of the  smoke,  but
there appears to be a small bug in the VGHD software - see the note at
the end of this file.

----------------------------------------------------------------------

The C series are similar to the B series but include background images
of outdoor scenes, so the smoke is now interpreted as fog.

In these scenes the shaders have been slightly modified to detect when
a pixel in the input image is transparent,  in  particular  those that
surround the performer in a clip, and not to operate on them.  If this
is not done then clip shows up as a black box against  any  background
that is used.  With  the B series this did not matter because the only
background was generated by the same shader operating on a plain quad,
but in the C series the background shader now operates on a background
image.

This works quite well,  but  the results do not always look as good as
the equivalent scenes without any background. Some tweaking may help.

----------------------------------------------------------------------

When these scenes and shaders were first developed there was no way to
pass parameters from the scene file to a shader so almost every  scene
had its own shader which differed from those for related  scenes  only
by the values of parameters defined by #define statements. Once it was
possible to pass the values from the scene file this was done and  the
number of shaders reduced. However, it has been noticed that when this
is done there are often some initial glitches in the scene,  but these
disappear after about a second. 

In addition to the initial glitches it was found  that  attempting  to 
pass more parameters,  those  controlling the "cloud wave",  caused  a
dark box to appear around the performer.  Because  of this the shaders
are not as fully configurable from the scene file as I would like.

I have no idea why these problems exist.  They may be due to faults or
limitations in the VGHD software or in my system's graphics drivers.

It should be possible to unify the Smoke and Fog shaders,  but  due to
the above problems I have not attempted to do so.

----------------------------------------------------------------------

A note regarding the use of foreground elements.

It is possible to use images as foreground elements in  these  scenes,
but the results of this have been poor.  When  such an element is used
then it discolours the smoke provided by the background shader but has
no affect on that provided by the performers shader. The result is the
performer being surrounded by an ugly moving black box.  I do not know
the cause of this, but I rather suspect a bug in the VGHD program.  As
the discolouration seems to match the foreground it is  possible  that 
some color variable is not being properly initialised and  is  picking
up an icorrect initial value from the foreground image.

This problem was seen in version 1.2.0.60 of the VGHD software, it may
be fixed in later versions.

The theory of an improperly initialised colour variable is to blame is
supported by the two scenes

    B1 - Smoke+Foreground - Buggy

and

    B1 - Smoke+Foreground - Fixed

which differ from

    B1 - Light Smoke

only by the addition of foregound elements. In the "buggy" example the
problem is seen with the red colour of the chairs polluting the smoke,
but in the "fixed" example the addition of a second fully  transparent
foregound element fixes the problem. Comments in these .scn files give 
more detail of the problem and the work around.

----------------------------------------------------------------------