Skip to content
Swifter edited this page Nov 3, 2024 · 24 revisions

Prerequisites

Parameters

Beat Saber's fog component is split into 2 parts:

  • Height fog that dissolves lower objects
  • Distance fog that engulfs objects based on how far they are from the viewer

The component has 4 parameters:

  • attenuation The rate of distance fog accumulation (could be thought of as "visibility", where 0 is completely visible and 1 is where no light reaches you)
  • offset The distance from the player that distance fog starts
  • startY The Y value at which objects get completely dissolved by height fog
  • height The height of the region where objects are effected by height fog

These are explained more thoroughly and visually here, but the code snippets are out of date.

Fog Events

Without ReMapper, the process for changing fog parameters is not very straight-forward. It requires a mix of capturing the base environment, changing it's fog component, adding a track to it, and then animating it's fog component with an AnimateComponent event if you want to change it again later. The process is also entirely different in V2.

In order to simplify this process, all fog related changes are simplified to FogEvents on a difficulty's fogEvents array. They simply store the parameter changes/animation, the duration, and the beat of the change. On save, these events are unpacked to the corresponding environment statement and animation events.


The rm.adjustFog function creates a FogEvent.

rm.adjustFog(map, {
    beat: 10,
    duration: 3,
    attenuation: [[0.0001, 0], [1, 1]],
    height: [[10, 0], [20, 1]],
    offset: [[0, 0], [10, 1]],
    startY: [[-20, 0], [-10, 1]]
})

There are also additional options to move beat and duration to the function parameters instead of being inside the object literal.

// These 3 statements all create the same fog event.

rm.adjustFog(map, {
    beat: 10,
    duration: 3,
    attenuation: [[0.0001, 0], [1, 1]],
    height: [[10, 0], [20, 1]],
    offset: [[0, 0], [10, 1]],
    startY: [[-20, 0], [-10, 1]]
})

rm.adjustFog(map, 10, {
    duration: 3,
    attenuation: [[0.0001, 0], [1, 1]],
    height: [[10, 0], [20, 1]],
    offset: [[0, 0], [10, 1]],
    startY: [[-20, 0], [-10, 1]]
})

rm.adjustFog(map, 10, 3, {
    attenuation: [[0.0001, 0], [1, 1]],
    height: [[10, 0], [20, 1]],
    offset: [[0, 0], [10, 1]],
    startY: [[-20, 0], [-10, 1]]
})

Static fog values must be notated as single numbers as opposed to a simple point.

rm.adjustFog(map, {
    attenuation: 0.0001
})

This is caused by the fog event being ambiguous between a static environment statement and an animation event. If it becomes an animation event, it will be converted to a simple point on save.

Clone this wiki locally