Use environment presets

Attention

This feature is intended for use with our maritime worlds:

  • World("lake")

  • World("ocean")

  • World("port_city")

Applying presets

Apply presets to quickly match the look and feel of the scene to your reference imagery.

From the bottom drawer, click on Environment to access various presets.

Select environment presets from the bottom drawer

Selecting a preset will copy it to your clipboard. Paste it into your notebook and run the cell to apply the preset.

For example, to apply the “Partly Cloudy B” preset:

Apply the “Partly Cloudy B” preset
world.env.apply_preset("clear_sky_b")
Effect of applying the ``clear_sky_b`` preset

and the “Rainy A” preset:

Apply the “Rainy A” preset
world.env.apply_preset("rainy_a")
Effect of applying the ``rainy_a`` preset

Note

Applying an environment preset affects both world.env.weather and world.env.ocean settings.

For instance, rainier presets will have rougher seas in addition to cloudier and darker skies.

Tip

If your use case requires presets outside of the available ones, contact Bifrost support and we’ll be glad to help.

Randomize presets across frames

To create diverse and varied scenarios, you can randomize environment presets across frames.

Passing randomized parameters to keyframes

Since scenario.set_keyframe accepts keyword arguments of the form attribute=value, we can use Python’s unpack operator ** to unpack a dictionary of attribute keys and randomized values.

Here, we also use BBI’s rng instance, which is a global Python Random object.

Randomize environment presets
# Function to return randomized env presets
def rand_preset() -> dict:
    return {
        "preset_id": rng.choice([
            "clear_sky_a",
            "clear_sky_b",
            "clear_sky_c",
            "cloudy_a",
            "cloudy_b",
            "cloudy_c",
            "foggy_a",
            "foggy_b",
            "foggy_c"
            "overcast_a",
            "overcast_b",
            "overcast_c",
            "partly_cloudy_a",
            "partly_cloudy_b",
            "partly_cloudy_c",
            "rainy_a",
            "rainy_b",
        ])
    }

scenario = world.new_scenario(num_frames=5)

for i in range(scenario.num_frames):
    scenario.set_keyframe(world.env, i, **rand_preset())
    # Your other keyframes here