Partager via


Introduction aux brouillards

Les brouillards sont une caractéristique de rendu qui peut être utilisée pour masquer la distance de vision du joueur. Vous pouvez utiliser des brouillards pour masquer des bordures, telles que des tronçons non chargés au-delà de la distance de rendu, ou pour produire un effet atmosphérique. Il existe plusieurs types de brouillards qui peuvent être utilisés dans de nombreuses circonstances différentes.

Les brouillards sont configurés dans des fichiers JSON individuels de votre pack de ressources sous le répertoire brouillards.

Schéma de brouillard

{
    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.
                }
            }
        }
    }
}

Pile de brouillard actif

La pile de brouillard actif est utilisée pour déterminer quel paramètre de brouillard utiliser à un moment donné du jeu. Chaque joueur a une pile de brouillard unique.

Chaque fois que le jeu doit déterminer les valeurs du brouillard, il commencera en haut de la pile de brouillard et la vérifiera en allant vers le bas, jusqu'à ce qu'il trouve une valeur pour le type de paramètre actuel. Si aucun paramètre de brouillard sur la pile ne correspond, le jeu continuera vers le bas de la pile et s'inscrira. S'il ne trouve pas de paramètre correspondant, il utilisera à la place les valeurs par défaut définies par le moteur.

La pile de brouillard est initialement configurée de la manière suivante. En commençant par le bas:

  • Moteur par défaut: valeurs de code en dur.
  • Données par défaut: les paramètres par défaut basés sur les données.
  • Biomes: les paramètres définis pour être sur chaque biome.
  • Commande: les paramètres définis sur le joueur par les commandes du serveur.

Moteur par défaut

Les valeurs codées en dur dans le cas où il n'y aurait pas de valeurs basées sur les données. Le moteur par défaut sera chargé s'il n'y a pas de paramètre de brouillard correspondant lorsque le jeu a atteint le bas de la pile de brouillard.

Données par défaut

Définies dans biomes_client.json sous default s'il est fait référence à une définition de brouillard via fog_identifier.

Biomes

La couche de biome est une moyenne de tous les paramètres définis par les biomes autour de la position du joueur. Les paramètres du biome sont définis dans biomes_client.json ainsi pour chaque biome individuel.

Commande

La couche de commande contient tous les paramètres définis par la commande /fog et évalués comme une seule pile de haut en bas. Pour en savoir plus, consultez la section Commande de brouillard.

Biomes

Les paramètres de brouillard peuvent être déterminés pour les biomes avec le fichier biomes_client.json. Dans chaque entrée de biome, vous pouvez avoir une variable appelée fog_identifier et définir un nom qui correspond au paramètre de brouillard que vous souhaitez utiliser avec ce biome.

L'entrée default peut également être définie de cette façon et sera utilisée sous les entrées de biomes dans la pile de brouillard actif. Le paramètre de brouillard d'un biome ne remplace pas complètement le paramètre par défaut, mais le biome est lu au-dessus du paramètre par défaut comme décrit dans la section Pile de brouillard actif.

L'entrée du biome default a l'étiquette remove_all_prior_fog qui est définie sur false par défaut. En étant définies sur false (ou si l'étiquette n'est pas saisie), les définitions de brouillard manquantes seront remplies par tout pack de ressources inférieur ayant leur définition remplie. En étant définies sur true, toutes les définitions de brouillard précédentes dans les packs de ressources existant avant le pack actuel qui les ont activées, seront effacées. Le pack de ressources actuel deviendra ainsi le nouveau point de départ pour tous les brouillards.

Dans chaque biome (y compris default) il y a l'étiquette inherit_from_prior_fog qui est définie sur false par défaut. En étant défini sur false (ou si l'étiquette n'est pas saisie), le biome du pack de ressources actuel écrasera l'étiquette fog_identifier actuellement stockée avec la sienne. Si définies sur true , les étiquettes fog_identifier de tous les biomes correspondants seront ajoutées et créeront une nouvelle définition de brouillard fusionnée pour ce biome.

Commande brouillard

La commande /fog peut être utilisée pour gérer les paramètres de brouillard dans la couche actuelle de la pile de brouillard actif de chaque joueur.

Les paramètres de brouillard dans cette couche sont activés à l'aide des modes push, pop et remove de la commande /fog.

Les paramètres de brouillard sont évalués de haut en bas dans la pile de brouillard actif avec un ordre prioritaire de haut en bas dans la couche actuelle.

Les paramètres de brouillard dans cette couche sont enregistrés puis restaurés lors de le chargement du monde par joueur. Un paramètre de brouillard qui est poussé avant une sauvegarde du monde s'appliquera toujours après un chargement de monde et peut ensuite être supprimé.

Mode push

Lance un nouveau paramètre de brouillard avec un identifiant fourni par l'utilisateur aux joueurs spécifiés, sur le dessus des couches de commande de brouillard des piles de brouillard actif des joueurs.

Mode pop

Supprime le paramètre de brouillard le plus haut des joueurs sélectionnés qui correspond à l'ID fourni par l'utilisateur.

Mode remove

Supprime tous les paramètres de brouillard adéquats des joueurs sélectionnés qui correspondent à l'ID fourni par l'utilisateur.