3 Defining custom lightings
mikeprimm edited this page 2012-02-09 23:13:37 -08:00

Custom lighting definitions can be made by modifying the standard lighting definitions, found in lightings.txt, or by adding new or updated definitions to the custom-lightings.txt file (the preferred method).

There are currently two type of lighting classes - the DefaultHDLighting class and the ShadowHDLighting class.

The DefaultHDLighting class does not modify the color data from the shader - yielding the equivalent of full daylight with no shadows - and has no configurable settings.

The ShadowHDLighting class supports several configuration settings, allowing control of ambient light levels, shadow strength, and the option of generating both night and day versions of tiles for a single map.

A typical lighting configuration is shown below:

lightings:
  - class: org.dynmap.hdmap.ShadowHDLighting
    name: my-custom-lighting
    shadowstrength: 1.0
    ambientlight: 4
    night-and-day: true
    smooth-lighting: false

The settings defined for the ShadowHDLighting class include the following:

  • name : unique name of the lighting. If a custom lighting in the custom-lightings.txt file matches a standard lighting definition's name, the standard lighting definition is replaced by the custom definition.

  • shadowstrength : this controls how strongly shadow data is applied when determining the brightness of shadowed areas. The default is 0.0 (shadow data is ignored), while normal shadows correspond to 1.0. Values above 1.0 will result in artificially severe shadows, while less that 1.0 will result in softening of shadows.

  • ambientlight : this controls the relative amount of light coming from the sky. Full daylight corresponds to 15 (the default), while normal moon-lit night is 4.

  • night-and-day : Enabling this setting (by setting the value to true) results in the generation of both night and day versions of each tile, and in the map view automatically switching between them, based on the time-of-day of the corresponding world. The difference between the 'night' tiles and the 'day' tiles is that the day tiles are rendered with ambientlight set to 15, while the night tiles use the provided ambientlight setting. The default value is false.

  • smooth-lighting : this setting, a boolean, controls the enabling of the smooth lighting option. Enabling this feature will add approximately 10% to rendering processing cost, but will result in much smoother shadows and lighting. If not defined, the smooth-lighting setting from configuration.txt is used.