Skip to content

Map Settings

#xoxor4d edited this page Dec 23, 2024 · 16 revisions

Note

I'll try to keep this wiki updated. This wiki does not cover each and every subsetting.
Please always refer to the comments in the map_settings.toml file. It will always reflect the latest functionality.




Tweakable Fog

To change or configure fog for a specific map, open the map_settings.toml file in root/portal2-rtx and add or edit an existing entry under [FOG]

[FOG]
    sp_a1_intro1 = { distance = 150000, color = [180, 160, 120] }
    sp_a1_intro2 = { distance = 20000, color = [250, 250, 250] }
  • distance: larger distance == less fog
  • color: R G B (0-255) transmission

You can further tweak fog visuals by modifying remix runtime settings. This can also be done per map under the [CONFIGVARS] section.




Tweakable Water UV Scale

To change or configure water scale for a specific map, open the map_settings.toml file in root/portal2-rtx and add or edit an existing entry under [WATER]

[WATER]
    sp_a1_wakeup = 5.0
    sp_a2_column_blocker = 2.0
  • eg. this decreases the water scale on sp_a1_wakeup by a factor of 5 (increases tiling)
  • Values below 1.0 will scale up the water UV's, thus increase tiling



Tweakable Culling

To make culling related changes for a specific map, open the map_settings.toml file in root/portal2-rtx and add or edit an existing entry under [CULL]

We need some form of culling in this game to improve the performance. The current system forces visibility for everything inside the current area. Everything outside the player area can get culled by frustum culling (and other game mechanics). This will lead so some issues in a fully pathtraced game.

There will be:

  • light bleed
  • lights turning off due to culling
  • missing objects when looking through portals (really rare)

Fix light bleed / culled lights

  • Go to the spot where you can see the results of culling and use cvar r_lockPvs 1 to lock culling updates
  • Use cmd xo_debug_toggle_node_vis
  • Note the current area you are in (eg. 4)
  • Move into the leaf (green cube) that is getting culled (eg. 55 & 712)
  • Add or edit the area entry (4) and add all the leafs (green cubes) you want to force to leafs
[CULL]
    sp_a1_intro2 = [
        { area = 4, leafs = [55, 712] },
    ]

This will force render everything inside leaf 55 & 712 whenever the player is in area 4

  • Use cmd xo_mapsettings_update to reload the map_settings file to see the changes
  • You might need to enter a new area for it to update
  • Disable r_lockPvs

Force Area Visibility

There are a few other parameters that you can use. You can even hide areas if the auto-culling system fails:

[CULL]
    sp_a4_laser_platform = [
        { area = 1, areas = [6], cull = 0 },
        { area = 2, hide_leafs = [89, 99], hide_areas = [
            { areas = [3], N_leafs = [55, 100] }
        ]},
  1. Area 1 has cull = 0 which will disable all frustum culling when the player is inside this area. It also forces everything inside area 6 to be visible.
  2. This hides leaf 89 & 99 when the player is inside area 2.
    It also hides everything inside area 3 when the player is NOT inside leaf 55 OR 100. This can be useful if:
  • Player is in area 2 and area 3 is rendered even tho it's only visible from the above mentioned leafs.

All parameters are explained in-depth above the [CULL] section.




Hide Models

To change or configure model hiding for a specific map, open the map_settings.toml file in root/portal2-rtx and add or edit an existing entry under [HIDEMODEL]

This can be used to hide models. Eg. when a certain model is used a lot, it can make sense to hide them and manually re-add the models by adding them as references to Map Markers via the remix toolkit. This will help with CPU Bottlenecks on larger maps.

[HIDEMODEL]
    sp_a4_finale2 = { name = [
            "tube", "arm"
        ], radius = [
            896.805298, #models/a4_destruction/arm_ext_halfres_rows_4x1.mdl
        ]}
  • name: hides every model containing the specified substring
  • radius: hides every model with this radius (checking for radii is generally faster and the preferred way to filter models)

Use in-game console command xo_debug_toggle_model_info to draw model debug visualizations (name, pos, radius).




Map Marker Spawning

To change or configure map marker spawning for a specific map, open the map_settings.toml file in root/portal2-rtx and add or edit an existing entry under [MARKER]

This can be used to spawn unique marker meshes which can be used to attach unique meshes or lights to.

  • This is useful if you want to add additional meshes or lights to a certain spot that has no unique anchors
  • Another idea: Attach a quad mesh to a marker, make it look like water and then spawn that marker wherever you need a puddle
  • Use cvar cl_showPos 1 to see your current position
  • You can spawn the same marker multiple times
[MARKER]
    sp_a1_intro3 = [
        { marker = 7, position = [-500, -500, 1150] },
        { nocull = 3, position = [-800, 0, 1710] }
    ]
  • marker: number of marker mesh (0-99) - can get culled BUT that can be controlled
  • nocull: number of marker mesh (0-inf.) - never gets culled and spawns on map load (eg: useful for distant lights)
  • If your marker is getting culled unexpectedly, you can tweak its visibility by forcing the leaf the marker is in. See: Tweakable Culling
  • Use in-game console command xo_mapsettings_update to reload the map_settings file



Remix Config Loading / Transitions

All parameters are explained in-depth above the [CONFIGVARS] section.

Load configs on map start

  • Create a mapname.conf in portal2-rtx/map_configs/ and include all the remix variables you want to change when the map with that name loads. This file will be loaded automatically if it exists. Eg. xyz.conf will be loaded if map xyz.bsp loads.
  • You can load additional config files by adding the map name under [CONFIGVARS]
[CONFIGVARS]
    sp_a1_intro2 = { startup = ["chromatic.conf", "asd.conf"] }
  • This will first load sp_a1_intro2.conf (if it exists) followed by chromatic.conf & asd.conf

Transitions / Events

  • You can also load config's on certain events like:
    • Player enters a specified leaf (area of the map)
    • A specified choreography (.vcd) starts to play
      • Use in-game console cvar scene_print to print the start and end of a choreography to the console.
      • Grab the name of the choreography that should spawn your light (substrings are fine - entire name was npc/announcer/prehub28.vcd)
[CONFIGVARS]
    sp_a1_intro2 = { transitions = [
        { conf = "chromatic_explosion.conf", leafs = [424], mode = 2, ease = 8, duration = 0.5, delay_in = 0.5, delay_out = 0.2 },
        { conf = "asd.conf", choreo = "prehub28.vcd", mode = 0, ease = 8, duration = 2.5 }
    ]}
  1. chromatic_explosion.conf will be loaded with a 0.5s delay (delay_in) when the player enters leaf number 424.
    Setting mode = 2 will always re-trigger this upon re-entering the leaf. Using ease = 8 sets the easing mode to EXPO_OUT.
    Having defined delay_out with any number greater then 0.0 will automatically transition back to the original settings after the specified delay.
    This results in --> 0.5s transition to chromatic_explosion.conf values, wait 0.2s & transition back to the original values.
  2. asd.conf will be loaded when a choreography that contains prehub28.vcd in the name starts playing. It will only trigger once on enter (mode) and take 2.5s to transition to asd.conf values. Not having set delay_out results in the values staying until another map is loaded



Spawning / Animating of Lights via the RemixApi

All parameters are explained in-depth above the [LIGHTS] section.

Creating lights using the remix toolset is not always trivial.

  1. Requires stable hashes
  2. Requires stable & unique meshes if you want to do per map lighting (if you want to create lights in a specific area that should not replicate to other maps).
  3. Animating lights is not yet possible

Introduction

  • To create lights via the compatibility mod, open the map_settings.toml file in root/portal2-rtx
  • Add your map as a new entry under [LIGHTS]:
[LIGHTS]
    sp_a1_intro2 = [
           # lights
        ]

  • To define a single, static light that spawns when the map loads and persist until the next map loads:
    sp_a1_intro2 = [
            { points = [
                { position = [100.0, 200.0, 300.0], radiance = [50.0, 50.0, 50.0], scalar = 1.5, radius = 5.0 },
            ]}
        ]
  • scalar scales the over-all radiance

  • If you want to animate the lights properties:
    sp_a1_intro2 = [
            { points = [
                { position = [100.0, 200.0, 300.0], radiance = [50.0, 50.0, 50.0], scalar = 1.5, radius = 5.0 },

                # add a second point
                # no need to define a position if you dont want to move it
                # the very last point always needs a 'timepoint' to define the time it takes to reach this point (in sec.)
                { radiance = [50.0, 0.0, 0.0], scalar = 4.0, radius = 5.0, timepoint = 2 }, 

            ], loop = 1 } # add loop = 1
        ]
  • The light gets brighter and will become fully red after 2 seconds.
  • It will immediately switch back to it's initial state and re-start the loop (loop = 1)

  • If you want a smooth and closed loop:
    sp_a1_intro2 = [
            { points = [
                { ... },
                { ... , timepoint = 2 }, 
            ], loop = 1, loop_smoothing = 1 } # add loop_smoothing = 1
        ]
  • This will make the light smoothly transition back to it's initial state after becoming fully red
  • Note that this will add an additional segment. The complete loop time will still be 2 seconds meaning that the first transition gets quicker

Movement

    sp_a1_intro2 = [
            { points = [
                { position = [0.0, 0.0, 0.0],    radiance = [50.0, 50.0, 50.0], radius = 5.0, smoothness = 1.0 },
                { position = [-50.0, 0.0, 50.0], radiance = [50.0, 0.0, 50.0],  radius = 4.0, smoothness = 1.0 },
                { position = [0.0, 0.0, 100.0],  radiance = [50.0, 50.0, 0.0],  radius = 3.0, smoothness = 1.0, timepoint = 5.0 },
                { position = [50.0, 0.0, 50.0],  radiance = [0.0, 50.0, 50.0],  radius = 4.0, smoothness = 0.0, timepoint = 6.0 },
            ], loop = 1, loop_smoothing = 0 }
        ]
  • This moves the light along a smooth cubic spline until point 3 is reached. The segment from pt3 to pt4 will be linear because smoothness is set to 0
  • The 1st segment (pt1 to pt2) will take 2.5 seconds and the 2nd segment (pt2 to pt3) will also take 2.5 seconds
  • Durations will be automatically calculated for points with no defined timepoints. There are 2 segments until point 3 that defines a timepoint,
    so 5s / 2 segments = 2.5 seconds --> Point 3 will be reached after a total duration of 5 seconds
  • Point 4 will then be reached after another second, thus reaching it after a total of 6 seconds
  • Note that this only applies when loop_smoothing is set to 0. Setting it to true evenly reduces all timepoints so that the complete loop finishes in the time specified by the last point (6 seconds in this case)

Trigger / Kill

  • Lights can be spawned on events like a starting choreography (.vcd) or when sounds start to play
  • Choosing a fitting event can be a little tricky.

Choreographies

  • Use in-game console cvar scene_print to print the start and end of a choreography to the console.
  • Grab the name of the choreography that should spawn your light (substrings are fine - entire name was npc/announcer/prehub28.vcd)
    sp_a1_intro2 = [
            { trigger = { choreo = "prehub27.vcd", delay = 1.5 }, points = [
                { ... },
                { ... , timepoint = 5.0 },
            ], run_once = 1 },
        ]
  • This will spawn the light 1.5 seconds after npc/announcer/prehub27.vcd starts playing.
  • run_once = 1 will automatically destroy the light after it reached it's end point after 5 seconds (this requires at least 2 points)
    sp_a1_intro2 = [
            { trigger = { choreo = "prehub27.vcd" }, kill = { choreo = "prehub28.vcd" }, points = [
                { ... },
                { ... , timepoint = 2.0 },
            ], loop = 1 }, # loop
        ]
  • This will spawn the light when prehub27.vcd starts and loop until it gets destroyed by the start of prehub28.vcd

Sounds

  • Use in-game console command xo_debug_toggle_sound_print to print info about sounds to the console.
  • You want to look for a unique hash to spawn your light. Make sure that this hash does not appear before you actually want to spawn your light.
    sp_a3_01 = [
            { trigger = { sound = 0x7803b2f2, delay = 0.5 }, points = [
                { ... },
            ], loop = 1 }
        ]
  • console output: # HASH: ( 0x7803b2f2 ) -- world\light_power_on_01.wav -- delay: 0.00 -- vol: 1.00 -- origin: [5392.00000 4616.00000 -432.00000]
  • Spawns the light after world\light_power_on_01.wav play's at 5392.0 4616.0 -432.0 and loops until a new map is loaded

  • Destroying a light via sound is analogous to destroying it via choreography.
  • You can spawn a light using a choreo and destroy it via sound or vice-versa
  • If you only define kill, the light will spawn on map load and be alive until the kill event triggers

Light Shaping

  • The system only supports sphere lights currently. Sphere lights can be shaped to form spotlights.
  • Anything below degrees = 180.0 will enable light shaping.
    sp_a3_01 = [
            { trigger = { sound = 0x431b8441, delay = 0.0 }, kill = { sound = 0x7803b2f2, delay = 0.0 }, points = [
                { position = [5155.0, 4120.0, -600.0], radiance = [500.0, 200.0, 50.0],  radius = 0.0, smoothness = 1.0, degrees = 20.0, direction = [0, -0.75, 0.25]  },
                { position = [5155.0, 4105.0, -580.0], radiance = [10000.0, 6000.0, 3000.0], scalar = 800.0, radius = 0.05, smoothness = 1.0, degrees = 33.0, direction = [0, 0, 1], softness = 0.005, exponent = 0.0, timepoint = 0.6  },
                { position = [5155.0, 4105.0, -600.0], radiance = [10000.0, 6000.0, 3000.0], scalar = 800.0, radius = 0.05, smoothness = 1.0, degrees = 33.0, direction = [0,  1,  0], softness = 0.005, exponent = 0.0, timepoint = 1.6 },
                { radiance = [500.0, 200.0, 50.0],  radius = 0.0, smoothness = 1.0, degrees = 20.0, direction = [0,  0, -1], timepoint = 2.6 },
            ], run_once = 0, loop = 1, loop_smoothing = 0 },
        ]
  • Spawns the light when sound playonce\level\animation_sfx\vault_door_open.wav starts playing
  • This moves and rotates the light in a circular way. direction is a unit vector and will be normalized for use in code.