Introducción a las nieblas

Las nieblas son una función de renderizado que se puede utilizar para ocultar la distancia de visión del jugador. Puedes utilizar nieblas para ocluir límites, como piezas no descargadas más allá de la distancia de renderizado, o para producir un efecto atmosférico. Hay varios tipos de nieblas que se pueden utilizar en muchas circunstancias diferentes.

Las nieblas se configuran en archivos JSON individuales en el pack de recursos, dentro del directorio nieblas.

Esquema de niebla

{
    version "format_version"
    object "minecraft:fog_settings"
    {
        object "description"
        {
            string "identifier" // The identifier for these fog settings. The identifier must include a namespace.
        }
        object "distance" : opt // The distance fog settings for different camera locations.
        {
            object "air" : opt // The fog settings when the camera is in the air.
            {
                color "fog_color" // The color that the fog will take on.
                float "fog_start"<0.000000-*> // The distance from the player that the fog will begin to appear. 'fog_start' must be less than or equal to 'fog_end'.
                float "fog_end"<0.000000-*> // The distance from the player that the fog will become fully opaque. 'fog_end' must be greater than or equal to 'fog_start'.
                string "render_distance_type"<"fixed", "render"> // Determines how distance value is used. Fixed distance is measured in blocks. Dynamic distance is multiplied by the current render distance.
            }
            object "weather" : opt // The fog settings for when the camera is in the air with active weather (rain, snow, etc..).
            {
                color "fog_color" // The color that the fog will take on.
                float "fog_start"<0.000000-*> // The distance from the player that the fog will begin to appear. 'fog_start' must be less than or equal to 'fog_end'.
                float "fog_end"<0.000000-*> // The distance from the player that the fog will become fully opaque. 'fog_end' must be greater than or equal to 'fog_start'.
                string "render_distance_type"<"fixed", "render"> // Determines how distance value is used. Fixed distance is measured in blocks. Dynamic distance is multiplied by the current render distance.
            }
            object "water" : opt // The fog settings when the camera is in water.
            {
                color "fog_color" // The color that the fog will take on.
                float "fog_start"<0.000000-*> // The distance from the player that the fog will begin to appear. 'fog_start' must be less than or equal to 'fog_end'.
                float "fog_end"<0.000000-*> // The distance from the player that the fog will become fully opaque. 'fog_end' must be greater than or equal to 'fog_start'.
                string "render_distance_type"<"fixed", "render"> // Determines how distance value is used. Fixed distance is measured in blocks. Dynamic distance is multiplied by the current render distance.
            }
            object "lava" : opt // The fog settings when the camera is in lava.
            {
                color "fog_color" // The color that the fog will take on.
                float "fog_start"<0.000000-*> // The distance from the player that the fog will begin to appear. 'fog_start' must be less than or equal to 'fog_end'.
                float "fog_end"<0.000000-*> // The distance from the player that the fog will become fully opaque. 'fog_end' must be greater than or equal to 'fog_start'.
                string "render_distance_type"<"fixed", "render"> // Determines how distance value is used. Fixed distance is measured in blocks. Dynamic distance is multiplied by the current render distance.
            }
            object "lava_resistance" : opt // The fog settings when the camera is in lava and the player has the lava resistance effect active.
            {
                color "fog_color" // The color that the fog will take on.
                float "fog_start"<0.000000-*> // The distance from the player that the fog will begin to appear. 'fog_start' must be less than or equal to 'fog_end'.
                float "fog_end"<0.000000-*> // The distance from the player that the fog will become fully opaque. 'fog_end' must be greater than or equal to 'fog_start'.
                string "render_distance_type"<"fixed", "render"> // Determines how distance value is used. Fixed distance is measured in blocks. Dynamic distance is multiplied by the current render distance.
            }
            object "powder_snow" : opt // The fog settings when the camera is inside a Powder Snow block.
            {
                color "fog_color" // The color that the fog will take on.
                float "fog_start"<0.000000-*> // The distance from the player that the fog will begin to appear. 'fog_start' must be less than or equal to 'fog_end'.
                float "fog_end"<0.000000-*> // The distance from the player that the fog will become fully opaque. 'fog_end' must be greater than or equal to 'fog_start'.
                string "render_distance_type"<"fixed", "render"> // Determines how distance value is used. Fixed distance is measured in blocks. Dynamic distance is multiplied by the current render distance.
            }
        }
        object "volumetric" : opt // The volumetric fog settings.
        {
            object "density" : opt // The density settings for different camera locations.
            {
                object "air" : opt // Fog density values as light passes through air blocks.
                {
                    float "max_density"<0.000000-1.000000> // The maximum amount of opaqueness that the ground fog will take on. A value from [0.0, 1.0].
                    float "max_density_height"<0.000000-320.000000> : opt // The height in blocks that the ground fog will become it's maximum density.
                    float "zero_density_height"<0.000000-320.000000> : opt // The height in blocks that the ground fog will be completely transparent and begin to appear. This value needs to be at least 1 higher than 'max_density_height'.
                    bool "uniform" : opt // When set to true, the density will be uniform across all heights.
                }
                object "water" : opt // Fog density values as light passes through water blocks.
                {
                    float "max_density"<0.000000-1.000000> // The maximum amount of opaqueness that the ground fog will take on. A value from [0.0, 1.0].
                    float "max_density_height"<0.000000-320.000000> : opt // The height in blocks that the ground fog will become it's maximum density.
                    float "zero_density_height"<0.000000-320.000000> : opt // The height in blocks that the ground fog will be completely transparent and begin to appear. This value needs to be at least 1 higher than 'max_density_height'.
                    bool "uniform" : opt // When set to true, the density will be uniform across all heights.
                }
                object "lava" : opt // Fog density values as light passes through lava blocks.
                {
                    float "max_density"<0.000000-1.000000> // The maximum amount of opaqueness that the ground fog will take on. A value from [0.0, 1.0].
                    float "max_density_height"<0.000000-320.000000> : opt // The height in blocks that the ground fog will become it's maximum density.
                    float "zero_density_height"<0.000000-320.000000> : opt // The height in blocks that the ground fog will be completely transparent and begin to appear. This value needs to be at least 1 higher than 'max_density_height'.
                    bool "uniform" : opt // When set to true, the density will be uniform across all heights.
                }
                object "lava_resistance" : opt // Fog density values as light passes through lava blocks while the player has lava resistance.
                {
                    float "max_density"<0.000000-1.000000> // The maximum amount of opaqueness that the ground fog will take on. A value from [0.0, 1.0].
                    float "max_density_height"<0.000000-320.000000> : opt // The height in blocks that the ground fog will become it's maximum density.
                    float "zero_density_height"<0.000000-320.000000> : opt // The height in blocks that the ground fog will be completely transparent and begin to appear. This value needs to be at least 1 higher than 'max_density_height'.
                    bool "uniform" : opt // When set to true, the density will be uniform across all heights.
                }
            }
            object "media_coefficients" : opt // The coefficient settings for the volumetric fog in different blocks.
            {
                object "air" : opt // Fog coefficient values while light passes through air.
                {
                    color "scattering" // Proportion of light that is scattered per block.
                    color "absorption" // Proportion of light that is absorbed (lost) per block.
                }
                object "water" : opt // Fog coefficient values while light passes through water.
                {
                    color "scattering" // Proportion of light that is scattered per block.
                    color "absorption" // Proportion of light that is absorbed (lost) per block.
                }
                object "cloud" : opt // Fog coefficient values while light passes through clouds.
                {
                    color "scattering" // Proportion of light that is scattered per block.
                    color "absorption" // Proportion of light that is absorbed (lost) per block.
                }
            }
        }
    }
}

Pila de niebla activa

La pila de niebla activa se usa para determinar qué configuración de niebla emplear en un momento dado del juego. Cada jugador tiene una pila de niebla única.

Siempre que el juego necesite determinar los valores para la niebla, comenzará en la parte superior de la pila de niebla e irá revisando hacia abajo hasta encontrar un valor para el tipo de configuración actual. Si ninguna configuración de niebla de la pila coincide, el juego continuará bajando por la pila para seguir buscando. Si no encuentra una configuración coincidente, utilizará, en cambio, los valores predeterminados definidos por el motor.

La pila de niebla inicialmente está configurada de la siguiente manera. Empezando desde abajo:

  • Engine Default (Valores predeterminados del motor): Son los valores preestablecidos.
  • Data Default (Valores predeterminados basados en los datos): Es la configuración predeterminada basada en los datos.
  • Biomes (Biomas): Es la configuración definida para cada bioma.
  • Command (Comando): Es la configuración que se le aplica al jugador por los comandos del servidor.

Valores predeterminados del motor

Si no hay valores impulsados por los datos, se usan valores preestablecidos. Se cargarán los valores predeterminados del motor si no hay una configuración de niebla coincidente cuando el juego llegue al final de la pila de niebla.

Valores predeterminados basados en los datos

Se define en el archivo biomes_client.json en default si hace referencia a una definición de niebla mediante fog_identifier.

Biomas

La capa de bioma es un promedio de todas las configuraciones definidas por los biomas en relación con la posición del jugador. La configuración del bioma se define en el archivo biomes_client.json también para cada bioma individual.

Comando

La capa de comando son todas las configuraciones establecidas por el comando /fog, las cuales se evalúan como una pila, desde arriba hacia abajo. Para obtener más información, consulta la sección Comando de niebla.

Biomas

La configuración de niebla se puede determinar para los biomas en el archivo biomes_client.json. En cada entrada de bioma, puedes tener una variable llamada fog_identifier y establecer un nombre que coincida con la configuración de niebla que deseas usar con este bioma.

La entrada default también se puede configurar de esta manera y se usará debajo de las entradas de biomas en la pila de niebla activa. La configuración de niebla de un bioma no reemplaza completamente la configuración predeterminada, sino que el bioma se lee por encima de la predeterminada, tal como se describe en la sección Pila de niebla activa.

La entrada del bioma default tiene la etiqueta remove_all_prior_fog, la cual está configurada en false de forma predeterminada. Mientras está en false (o si no se ingresa la etiqueta), las definiciones de niebla que falten se completarán con cualquier pack de recursos inferior que tenga la definición completa. Si se establece en true, se borrarán todas las definiciones de niebla anteriores de los packs de recursos antes del pack actual que la habilitó, lo que hará que el pack de recursos actual sea el nuevo punto de partida para todas las nieblas.

En cada bioma (incluido default) está la etiqueta inherit_from_prior_fog, la cual viene configurada en false de forma predeterminada. Si está en false (o si no se ingresa la etiqueta), el bioma del pack de recursos actual sobrescribirá la etiqueta fog_identifier almacenada actualmente con la suya propia. Si se establece en true, las etiquetas fog_identifier de todos los biomas coincidentes se agregarán y crearán una nueva definición de niebla combinada para ese bioma.

Comando de niebla

El comando /fog se puede utilizar para administrar la configuración de niebla en la capa actual de la pila de niebla activa para cada jugador.

Los ajustes de la niebla en esta capa se ordenan mediante los modos push, pop y remove del comando /fog.

La configuración de la niebla se evalúan desde arriba hacia abajo en la pila de niebla activa, lo que incluye primero los valores de la capa actual, desde arriba hacia abajo.

La configuración de la niebla especificada en esta capa se guarda y, luego, se restablece cuando cada jugador vuelve a cargar el mundo. Una configuración de niebla que se envía antes de que se guarde el mundo se seguirá aplicando después de que se cargue el mundo y, luego, se puede descartar mediante el comando pop.

Push

Envía una nueva configuración de niebla para jugadores específicos, junto con un ID proporcionado por el usuario, por encima de las capas del comando de niebla de las pilas de niebla activas de los jugadores.

Pop

Elimina la configuración de niebla más alta de los jugadores seleccionados que coincida con el ID proporcionado por el usuario.

Remove

Elimina toda la configuración de niebla coincidente de los jugadores seleccionados que coincida con el ID proporcionado por el usuario.