X

THANK YOU!

Post has been reported succesfully.

Minecraft RTX Fog in Resource Packs Documentation

Fog values now use json files to determine their values. Creators can now define their own sets of fog values in their resource packs. A new folder can be made at the root of a resource packs called fogs. Any json files within this folder will be registered as new fog definitions that can be used by the game.

JSON 

Example 

A fog json will look something like this.

{
  "format_version": "1.16.100",
  "minecraft:fog_settings": {
    "description": {
      "identifier": "custom_pack:example"
    },
    "distance": {
      "air": {
        "fog_start": 0.92,
        "fog_end": 1.0,
        "fog_color": "#ABD2FF",
        "render_distance_type": "render"
      }
    },
    "volumetric": {
      "max_density": {
        "air": {
          "max_density": 0.1,
          "max_density_height": 56,
          "zero_density_height": 70
        }
      },
      "media_coefficients": {
        "air": {
          "scattering": [ 0.02, 0.02, 0.02 ],
          "absorption": [ 0.0, 0.0, 0.0 ]
        }
      }
    }
  }
}

Variables 

"format_version" 

The resource pack version that this fog setting was built for. Will be used for determining upgrade paths and back compatibility in newer versions of the game.

"minecraft:fog_settings" 

Defines that the set of values within will be read in as a set of fog setting values.

"description" 

Holds the description for this fog setting.

"identifier" 

Held within the "description".

The unique name to refer to this fog setting. Each identifier requires a namespace. You also must have each identifier be unique or you will get an error. The "minecraft" namespace is only allowed to be used by the vanilla resource packs.

"distance" 

This contains the values for the distance fog. This is the fog that limits the player's view from seeing anything beyond a specific distance from them. Each entry within this contains one type of distance values.

You can set the following types by name:

  • "air" : Used when the player's camera is in the air.
  • "weather" : Used when the player's camera is in the air and weather is currently active.
  • "water" : Used when the player's camera is in water.
  • "lava" : Used when the player's camera is in lava.
  • "lava_resistance" : Used when the player's camera is in lava and they have the "lava resistance" mob effect active.

These types are all optional for your fog setting. If you do not set it, it will instead use the value for the fog setting lower priority then it. Described more in detail later in the "Active Fog Stack" section.

In each distance setting type, you can set the following variables:

  • "fog_start" : The distance where the fog will begin to appear.
  • "fog_end" : The distance where the fog will become completely opaque.
  • "render_distance_type" : Setting this will determine how the start and end values are used for calculating the fog distances.

"fixed" : The distance is measured in the number of blocks away.

"render" : The distance is multiplied against the current render distance.

  • "fog_color" : The color that the fog will take on.

"volumetric" 

This contains the values for the volumetric fog. This fog will be displayed as a calculation from light passing through blocks. Currently this is only used for PBR (Ray Tracing) and is planned to be added to non-PBR later.

"density" 

Held within the "volumetric" object.

Each entry within this contains one type of density values.

You can set the following types by name:

  • "air" : Used when the player's camera is in the air.
  • "weather" : Used when the player's camera is in the air and weather is currently active.
  • "water" : Used when the player's camera is in water.
  • "lava" : Used when the player's camera is in lava.
  • "lava_resistance" : Used when the player's camera is in lava and they have the "lava resistance" mob effect active.

These types are all optional for your fog setting. If you do not set it, it will instead use the value for the fog setting lower priority then it. Described more in detail later in the "Active Fog Stack" section.

In each density setting type, you can set the following variables:

  • "max_density" : The multiplier on how much the fog disrupts the light. 0.0 will have no fog, and 1.0 will be near opaque.
  • "uniform" : When set to true, the fog density will occur evenly across all heights.
  • "zero_density_height" : The height in blocks that the fog will begin to appear. This can only be set if "uniform" is set to false.
  • "max_density_height" : The height in blocks that the fog will become it's max_density. This can only be set if "uniform" is set to false.

"media_coefficients" 

Held within the "volumetric" object.

Each entry within this contains one type of coefficient values. These are used to determine how the light is dispersed or refracted by the fog as rays travel through different mediums/blocks.

You can set the following types by name:

  • "air" : Used when light is passing through air.
  • "water" : Used when light is passing through water.
  • "cloud" : Used when light is passing through clouds.

These types are all optional for your fog setting. If you do not set it, it will instead use the value for the fog setting lower priority then it. Described more in detail later in the "Active Fog Stack" section.

In each coefficient setting type, you can set the following variables:

  • "scattering" : How much of will the fog spread the RGB of the light. Either can be set as an array of 3 multipliers from [0.0, 1.0] or a Hex color value.
  • "absorption" : How much of will the fog absorb the RGB of the light. Either can be set as an array of 3 multipliers from [0.0, 1.0] or a Hex color value.

Active Fog Stack 

The active fog stack is used to determine which fog setting to use at any given time in the game. Each player has a unique fog stack.

Whenever the game needs to determine the values for the fog, it will start at the top of the fog stack and check down it until it has found a value for the current setting type. So, if a fog setting on the stack does not not have the setting it's looking for, then it will continue down the stack and check in. If it finds no such setting, it will instead use the defaults defined by the engine.

The fog stack initially is setup as follows. Starting at the bottom:

  • Engine Default: hard code values.
  • Data Default : The default data driven settings
  • Biomes : The settings defined to be on each biome.
  • Command : The settings set on the player by server commands.

Engine Default 

Hard coded values in case there are no data driven values; the implicit bottom of the stack.

Data Default 

Defined in "biomes_client.json" under "default" if it references a fog definition via "fog_identifier".

Biomes 

The biome layer is an average of all the settings defined by the biomes around the player's position. The biome settings are defined in "biomes_client.json" as well for each individual biome.

Command 

The command layer is all the settings set by the "/fog" command and evaluated it as one stack from top to bottom. More detail in the "Fog Command" section.

Biomes 

Fog settings can be determined for the biomes with "biomes_client.json". In each biome entry, you can have a variable called "fog_identifier" and set a name that matches the fog setting you want to use with this biome.

The "default" entry can also be set this way and will be used underneath the biomes entries in the active fog stack. So, a biome's fog setting does not completely replace the default's setting, but instead the biome is read on top of the default as described in the "Active Fog Stack" section.

Fog Command 

"/fog" can be used to manage fog settings in this layer of the active fog stack for each player.

Fog settings in this layer are ordered via the "push", "pop", "remove" modes of the "/fog" command described below. Fog Settings are evaluated top-to bottom in the active fog stack which includes top-to-bottom in this layer first.

Fog settings in this layer are saved and then restored on world load per player. In this way a fog setting that is pushed before a world save, will still apply after a world load and can then be popped.

Push 

Pushes a new fog setting, to specified player(s), along with a user provided ID, onto the top of the Fog Command layers of the players' active fog stacks.

Pop 

Removes the top-most fog setting, from selected player(s), that matches the user provided ID (i.e. as provided previously via a "/fog push" command).

Remove 

Removes all matching fog settings, from the selected player(s), that matches the user-provided ID (i.e. as provided previously via one or more "/fog push" commands).

Last Updated - 2020-12-01 18:48:47 UTC

Was this article helpful?