World - Fog Module
anvil.api.pbr.fog
FogSettings
Bases: JsonFile[_FogSettingsFile]
Represents a Minecraft Fog resource pack definition.
Generates a .fog.json file in the pack's fogs/ directory. Fog settings define
both distance-based fog properties and volumetric (PBR/Ray Tracing) settings.
Settings are resolved in the game via the Active Fog Stack:
Command (highest precedence) -> Biomes -> Data Default -> Engine Default (lowest).
Documentation reference
Documentation reference
identifier
property
The file's identifier.
name
property
The identifier's name, without its namespace.
__export__()
Exports the addon object after potentially shortening its content and replacing backslashes. Logs the event and writes the object to a file.
__init__(name='fog', is_vanilla=False)
Initializes a Fog definition instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The identifier and filename of the fog setting. Defaults to "fog". |
'fog'
|
is_vanilla
|
bool
|
True if referencing/overriding a vanilla fog definition
(under the |
False
|
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this file: the schema of its _document_type, with
the file's type as title and where it is written under x-anvil-file.
Raises:
| Type | Description |
|---|---|
TypeError
|
When the class is an abstract file base, with no document type. |
add_distance_location(color, fog_start, fog_end, render_distance_type=RenderDistanceType.Render, camera_location=FogCameraLocation.Air)
Adds and configures distance-based fog settings for a specific camera location environment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
color
|
HexRGB
|
Hex color code of the fog (e.g. |
required |
fog_start
|
float | int
|
Relative ratio or absolute block distance where fog begins to appear.
Maps to |
required |
fog_end
|
float | int
|
Relative ratio or absolute block distance where fog becomes fully opaque.
Maps to |
required |
render_distance_type
|
RenderDistanceType
|
Determines how start and end values are used.
- |
Render
|
camera_location
|
FogCameraLocation
|
The camera location environment (e.g., Air, Water, Weather, Lava, LavaResistance) matching the corresponding key in the JSON schema. Defaults to FogCameraLocation.Air. |
Air
|
Returns:
| Name | Type | Description |
|---|---|---|
_FogDistance |
_FogDistance
|
The configured distance settings object for method chaining. |
air_density(max_density, uniform=False, zero_density_height=0.0, max_density_height=0.0)
Sets the volumetric density parameters for air. Used for Ray Tracing / PBR rendering.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_density
|
float
|
Density multiplier disrupting light passing through air. Range: [0.0 (no fog), 1.0 (near opaque)]. |
required |
uniform
|
bool
|
If True, fog density is uniform at all heights. Defaults to False. |
False
|
zero_density_height
|
float
|
Y-level height in blocks where air fog density fades to 0.0.
Only active when |
0.0
|
max_density_height
|
float
|
Y-level height in blocks where air fog density starts at max_density.
Only active when |
0.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If PBR is not enabled in CONFIG. |
ValueError
|
If zero_density_height is less than max_density_height. |
henyey_greenstein_g(air_g=0.0, water_g=0.0)
Sets Henyey-Greenstein phase function asymmetry parameters for air and water. Supported in format_version 1.21.90+ and only applicable in Vibrant Visuals (PBR) packs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
air_g
|
float
|
Asymmetry factor for air scattering. Range [-1.0 (back-scattering), 1.0 (forward-scattering)]. Default is 0.75. |
0.0
|
water_g
|
float
|
Asymmetry factor for water scattering. Range [-1.0 (back-scattering), 1.0 (forward-scattering)]. Default is 0.6. |
0.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If PBR is not enabled in CONFIG. |
media_coefficients(water_scattering=None, water_absorption=None, air_scattering=None, air_absorption=None)
Sets media scattering and absorption RGB coefficients for water and air volumetric mediums.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
water_scattering
|
HexRGB | HexRGBA | RGB | RGBA | RGB255 | RGBA255
|
RGB scattering multipliers. |
None
|
water_absorption
|
HexRGB | HexRGBA | RGB | RGBA | RGB255 | RGBA255
|
RGB absorption multipliers. |
None
|
air_scattering
|
HexRGB | HexRGBA | RGB | RGBA | RGB255 | RGBA255
|
RGB scattering multipliers. |
None
|
air_absorption
|
HexRGB | HexRGBA | RGB | RGBA | RGB255 | RGBA255
|
RGB absorption multipliers. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If PBR is not enabled in CONFIG. |
queue(directory=None)
Queues the addon object for processing and logs the event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory
|
str
|
The directory of the addon object. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
self |
'JsonFile[D]'
|
The instance of the current JsonFile. |
water_density(max_density, uniform=True, zero_density_height=0.0, max_density_height=0.0)
Sets the volumetric density parameters for water. Used for Ray Tracing / PBR rendering.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_density
|
float
|
Density multiplier disrupting light passing through water. Range: [0.0 (no fog), 1.0 (near opaque)]. |
required |
uniform
|
bool
|
If True, fog density is uniform at all heights. Defaults to True. |
True
|
zero_density_height
|
float
|
Y-level height in blocks where water fog density fades to 0.0.
Only active when |
0.0
|
max_density_height
|
float
|
Y-level height in blocks where water fog density starts at max_density.
Only active when |
0.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If PBR is not enabled in CONFIG. |
ValueError
|
If zero_density_height is less than max_density_height. |