Mapdev:water: Difference between revisions

From Spring
Jump to navigationJump to search
began page, so much to do..
 
m started figuring out the various aspects of water.. but have to leave now.. will continue later.
Line 1: Line 1:
= Water =
= 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.
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:
<code><pre>/water</pre></code>
<ol start=0>
<li> basic
<li> reflective
<li> dynamic
<li> reflective&refractive
<li> bumpmapped
</ol>
The relevant soure code [https://github.com/spring/spring/tree/bfc21aada48a6a606b039819ba55017fe3d4f29d/rts/Rendering/Env 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 ===
<code><pre>local mapinfo = {
  ...
  tidalStrength = 0,
  voidWater = false,
  ...
  water = {
      damage =  0.0,
      windSpeed = 1.0, --// does nothing yet
    },
  ...
}</pre></code>
== Basic ==
<center>
{| class="wikitable"
|+ Example
| {{FIXME}}need to place an image here
|}</center>
=== mapinfo.lua ===
<code><pre>local mapinfo = {
  ...
  water = {
      repeatX = 0.0,
      repeatY = 0.0,
      --texture = "",
  },
  ...
}</pre></code>
{{tag|name=repeatX|type=float|default=0|description=control the texture repetition}}
{{tag|name=repeatY|type=float|default=0|description=control the texture repetition}}
{{tag|name=texture|type=string|default=0|description=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) ==
<center>
<center>
{| class="wikitable"  
{| class="wikitable"  
Line 6: Line 67:
| {{FIXME}}need to place an image here
| {{FIXME}}need to place an image here
|}</center>
|}</center>
= Specification =
== mapinfo.lua ==
== mapinfo.lua ==
<code><pre>local mapinfo = {
<code><pre>local mapinfo = {
Line 76: Line 136:
{{FIXME}}Discussion on resourcing again.
{{FIXME}}Discussion on resourcing again.


=== repeatX and repeatY ===
=== Shading ===


=== Shore Waves ===
=== Shore Waves ===
{{FIXME}}so much to put in here that i cant test and such because my hardware doesn't support it :|
{{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 ==
The water plane is always <code>y = 0</code>, anything underneath the water plane is underwater. The terrain is positioned above and below the water plane using its <code>minHeight</code> and <code>maxHeight</code> values(see [[Mapdev:height]]).
The water plane is a rectangle the same size as the entire map with a position of <code>y = 0</code>, anything underneath the water plane is underwater. The terrain is positioned above and below the water plane using its <code>minHeight</code> and <code>maxHeight</code> values(see [[Mapdev:height]]).


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

Revision as of 07:42, 20 February 2013

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