@Override
    public void write(JmeExporter ex) throws IOException {
        super.write(ex);

        OutputCapsule oc = ex.getCapsule(this);

        final Spatial reflectionScene = getReflectionScene();
        final boolean needSaveReflectionScene = isNeedSaveReflectionScene();

        final AssetKey causticsTextureKey = causticsTexture.getKey();
        final AssetKey heightTextureKey = heightTexture.getKey();
        final AssetKey normalTextureKey = normalTexture.getKey();
        final AssetKey foamTextureKey = foamTexture.getKey();

        if (causticsTextureKey != null && !DEFAULT_CAUSTICS.equals(causticsTextureKey.getName())) {
            oc.write(causticsTextureKey, "causticsTexture", null);
        }
        if (heightTextureKey != null && !DEFAULT_HEIGHT_MAP.equals(heightTextureKey.getName())) {
            oc.write(heightTextureKey, "heightTexture", null);
        }
        if (normalTextureKey != null && !DEFAULT_NORMAL_MAP.equals(normalTextureKey.getName())) {
            oc.write(normalTextureKey, "normalTexture", null);
        }
        if (foamTextureKey != null && !DEFAULT_FOAM.equals(foamTextureKey.getName())) {
            oc.write(foamTextureKey, "foamTexture", null);
        }

        oc.write(needSaveReflectionScene, "needSaveReflectionScene", false);

        if (needSaveReflectionScene) {
            oc.write(reflectionScene, "reflectionScene", null);
        }

        oc.write(speed, "speed", 1f);
        oc.write(lightDirection, "lightDirection", new Vector3f(0, -1, 0));
        oc.write(lightColor, "lightColor", ColorRGBA.White);
        oc.write(waterHeight, "waterHeight", 0.0f);
        oc.write(waterColor, "waterColor", new ColorRGBA(0.0078f, 0.3176f, 0.5f, 1.0f));
        oc.write(deepWaterColor, "deepWaterColor", new ColorRGBA(0.0039f, 0.00196f, 0.145f, 1.0f));

        oc.write(colorExtinction, "colorExtinction", new Vector3f(5.0f, 20.0f, 30.0f));
        oc.write(waterTransparency, "waterTransparency", 0.1f);
        oc.write(maxAmplitude, "maxAmplitude", 1.5f);
        oc.write(shoreHardness, "shoreHardness", 0.1f);
        oc.write(useFoam, "useFoam", true);

        oc.write(foamIntensity, "foamIntensity", 0.5f);
        oc.write(foamHardness, "foamHardness", 1.0f);

        oc.write(foamExistence, "foamExistence", new Vector3f(0.45f, 4.35f, 1.5f));
        oc.write(waveScale, "waveScale", 0.005f);

        oc.write(sunScale, "sunScale", 3.0f);
        oc.write(shininess, "shininess", 0.7f);
        oc.write(windDirection, "windDirection", new Vector2f(0.0f, -1.0f));
        oc.write(reflectionMapSize, "reflectionMapSize", 512);
        oc.write(useRipples, "useRipples", true);

        oc.write(normalScale, "normalScale", 3.0f);
        oc.write(useHQShoreline, "useHQShoreline", true);

        oc.write(useSpecular, "useSpecular", true);

        oc.write(useRefraction, "useRefraction", true);
        oc.write(refractionStrength, "refractionStrength", 0.0f);
        oc.write(refractionConstant, "refractionConstant", 0.5f);
        oc.write(reflectionDisplace, "reflectionDisplace", 30f);
        oc.write(underWaterFogDistance, "underWaterFogDistance", 120f);
        oc.write(causticsIntensity, "causticsIntensity", 0.5f);

        oc.write(useCaustics, "useCaustics", true);
        
        //positional attributes
        oc.write(center, "center", null);
        oc.write(radius, "radius", 0f);
        oc.write(shapeType.ordinal(), "shapeType", AreaShape.Circular.ordinal());
    }
@return true to try using directional light from a scene
jme3-effects/src/main/java/com/jme3/water/WaterFilter.java