KDScriptRendering effects

KDSyncGlobalFog

ParameterTypeDescriptionDefault value
sync_fog_colorbooleanwhether to synchronize the global fog colortrue
sync_fog_distbooleanwhether to synchronize the global fog distancetrue
fog_dist_multrealvalue to multiply zonal fog distance by1.0
fog_dist_addrealvalue to add to zonal fog distance after multiplying0.0
sync_fog_disabledbooleanwhether to disable global fog if room's is disabledfalse

When placed on the Player object (via the starting point), KDSyncGlobalFog keeps the color and/or distance of the global fog synchronized with that of the current room's fog zone. Since only global fog can apply to the various NewSky layers, this allows the sky fog to match the (near-)ground fog. (The initial fog, both global and per zone, is defined in the Mission Variables → Fog Zones dialog.)

If the sync_fog_color parameter is true, the fog color will be synchronized; if sync_fog_dist is true, the fog distance will be synchronized. The fog distance used globally is equal to the zonal fog distance, multiplied by fog_dist_mult, added to fog_dist_add.

This script supports smooth transitions; see that section for details.

When looking at the sky from indoor areas (ones without fog), it is expected that the outdoor fog levels should apply. As such, this script ignores rooms where fog is set to Disabled, leaving the global fog unchanged from the last (outdoor) zone. If the sync_fog_disabled parameter is true, however, global fog will instead be disabled in rooms where fog is disabled. Regardless of this setting, global fog will be disabled in fog zones where fog is disabled (distance is set to 0.0).

Since this script continuously alters the global fog settings, no room in a mission using this script should be set to use global fog; use only the zones (1–8) or Disabled. This script is compatible with KDTrapFog when that script's fog_zone parameter is not 0; that script will notify this one automatically of changes. This script is not compatible, of course, with KDTrapFog with a fog_zone of 0 (global).

This script is part of the KDScript module. Copyright © 2012–2013 Kevin Daughtridge. See introduction for details.