Water Exclusion Surface
With the release of the 7.1.12 Second Life Viewer, a new Water Exclusion Surface feature has been introduced. This feature enables the creation of a Water Exclusion Surface object, which renders both itself and the water surface within or behind it transparent when viewed from above. This is useful for hiding the water inside a boat when the inside hull of the boat is below the waterline.
When viewed from below, the Water Exclusion Surface object removes any water refraction effects that would typically be visible. However, it does not hide the water surface itself.
Usage notes:
- A Water Exclusion Surface object that has a PBR material applied will not hide water.
- A Water Exclusion Surface object that is worn as an attachment will not hide water.
- A Water Exclusion Surface object made from a rigged mesh will not hide water.
Creating a water exclusion surface object
Below is some simple LSL code for making an water exclusion surface. To use, create a new script in your inventory and paste the code below into it. Then drag the script onto a prim to turn it into an water exclusion surface object.
default
{
state_entry()
{
// Make this prim an water exclusion surface.
llSetPrimitiveParams([PRIM_BUMP_SHINY, ALL_SIDES, PRIM_SHINY_NONE, PRIM_BUMP_NONE,
PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, 1.0, PRIM_TEXGEN, ALL_SIDES, PRIM_TEXGEN_DEFAULT,
PRIM_TEXTURE, ALL_SIDES, "e97cf410-8e61-7005-ec06-629eba4cd1fb", ZERO_VECTOR, ZERO_VECTOR, 0.0]);
// Delete ourselves from the prim; we are no longer needed.
llRemoveInventory(llGetScriptName());
}
}
For coders who wish to understand how this works, the same code as above is reproduced below, thoroughly commented to show what the code is doing.
default
{
state_entry()
{
// Here we explain the whys and wherefores of making an water exclusion surface.
// We use an llSetPrimitiveParams call to set a lot of options at once.
llSetPrimitiveParams([
// Turn off bump mapping and shiny. If either of these options are on,
// they will have their usual effects, causing the water exclusion surface to be seen
// even though the special effects of hiding alpha textures continues.
PRIM_BUMP_SHINY, ALL_SIDES, PRIM_SHINY_NONE, PRIM_BUMP_NONE,
// Set the color and alpha to white and full opacity, respectively.
// Color has no effect on the water exclusion surface, but the prim must be FULLY opaque,
// or the special effect is lost.
PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, 1.0,
// For completeness we set mapping to default, even though it has no effect.
PRIM_TEXGEN, ALL_SIDES, PRIM_TEXGEN_DEFAULT,
// Now we set the actual texture, which makes this an water exclusion surface. We set it on
// all sides, but there is nothing stopping you setting it only on certain faces.
// We also set repeat, offset and rotation to zero.
PRIM_TEXTURE, ALL_SIDES, "e97cf410-8e61-7005-ec06-629eba4cd1fb", ZERO_VECTOR, ZERO_VECTOR, 0.0
]);
// Now remove this script from the prim to save on server resources. The script is only
// required in order to set the texture; it does not need to stay in the prim for the
// water exclusion surface's special effects to continue.
llRemoveInventory(llGetScriptName());
}
}
Trivia: This is the same basic script as the old Invisiprim. Any existing invisiprims will now work as water exclusion surface objects.