Mapdev:water

From Spring
Revision as of 07:42, 20 February 2013 by Enetheru (talk | contribs) (started figuring out the various aspects of water.. but have to leave now.. will continue later.)
Jump to navigationJump to search

Water

The 'water' engine feature can be used for more than just water, it can be Lava, Slime, and completely invisible for maps in space.

Water has five different rendering modes which can be set ingame by the command:

/water
  1. basic
  2. reflective
  3. dynamic
  4. reflective&refractive
  5. bumpmapped

The relevant soure code files


Specification

Now because of the various graphical modes, and some options being shared, were going to list them separately.

Options that are always relevant

mapinfo.lua

local mapinfo = {
   ...
   tidalStrength = 0,
   voidWater = false,
   ...
   water = {
      damage =  0.0,
      windSpeed = 1.0, --// does nothing yet
    },
   ...
}

Basic

Example
FIXME: need to place an image here

mapinfo.lua

local mapinfo = {
   ...
   water = {
      repeatX = 0.0,
      repeatY = 0.0,

      --texture = "",
   },
   ...
}

float repeatX  default: 0 

control the texture repetition

float repeatY  default: 0 

control the texture repetition

string texture  default: 0 

the texture image to use, searches the ./maps/ directory of the map archive.

Reflective

Dynamic

Reflective and Refractive

Bump Mapped

All Options(to be deleted later)

Example
FIXME: need to place an image here

mapinfo.lua

local mapinfo = {
   ...
   tidalStrength = 0,
   voidWater = false,
   ...
   water = {
      damage =  0.0,

      repeatX = 0.0,
      repeatY = 0.0,

      absorb    = {0.0, 0.0, 0.0},
      baseColor = {0.0, 0.0, 0.0},
      minColor  = {0.0, 0.0, 0.0},

      ambientFactor  = 1.0,
      diffuseFactor  = 1.0,
      specularFactor = 1.0,
      specularPower  = 20.0,

      planeColor = {0.0, 0.4, 0.0},

      surfaceColor  = {0.75, 0.8, 0.85},
      surfaceAlpha  = 0.55,
      diffuseColor  = {1.0, 1.0, 1.0},
      specularColor = {0.5, 0.5, 0.5},

      fresnelMin   = 0.2,
      fresnelMax   = 0.8,
      fresnelPower = 4.0,

      reflectionDistortion = 1.0,

      blurBase      = 2.0,
      blurExponent = 1.5,

      perlinStartFreq  =  8.0,
      perlinLacunarity = 3.0,
      perlinAmplitude  =  0.9,
      windSpeed = 1.0, --// does nothing yet

      shoreWaves = true,
      forceRendering = false,

      --// undefined == load them from resources.lua!
      --texture =       "",
      --foamTexture =   "",
      --normalTexture = "",
      --caustics = {
      --   "",
      --   "",
      --},

   },
   ...
}

Void Water

FIXME: discussion on void water and use cases

Example
FIXME: need to place an image here

Tidal Strength

FIXME: Discussion on resourcing again.


Shore Waves

FIXME: so much to put in here that i cant test and such because my hardware doesn't support it :|

The Water Plane

The water plane is a rectangle the same size as the entire map with a position of y = 0, anything underneath the water plane is underwater. The terrain is positioned above and below the water plane using its minHeight and maxHeight values(see Mapdev:height).

To derive the exact value of grey on the heightmap that will be at the water plane use:

  • FIXME: equation

To derive the maxHeight given a grey value and a minheight use:

  • FIXME: equation

To derive the minHeight given a grey value and a maxheight use:

  • FIXME: equation

To derive the maxHeight and minHeight given a grey value and a total height use:

  • FIXME: equation

Forum Discussions