Skip to content

Commit

Permalink
[rtx] various gui tweaks, map settings, readme
Browse files Browse the repository at this point in the history
  • Loading branch information
xoxor4d committed Apr 6, 2024
1 parent 431c7ea commit fc2f85a
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 54 deletions.
89 changes: 56 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

<h1 align="center">iw3xo/rtx - a call of duty 4 modification</h3>
<h1 align="center">iw3xo/rtx - a Call of Duty 4 modification</h3>

<div align="center" markdown="1">

This client mod brings various modifications and additions to the base game
and also includes support for nvidia's [rtx-remix](https://github.com/NVIDIAGameWorks/rtx-remix).
and also includes support for nvidia's [RTX Remix](https://github.com/NVIDIAGameWorks/rtx-remix).

__[ Most noteworthy features of iw3xo ]__
map exporting -- live link between the game and radiant -- sp map loading in mp --
Expand All @@ -28,17 +28,18 @@ no custom models, no normal-maps, no fancy pbr materials or lights.

<img src="https://raw.githubusercontent.com/xoxor4d/xoxor4d.github.io/master/assets/img/daynight/small_gif.gif"/>


### > Features / Guides / In-Depth <
https://xoxor4d.github.io/projects/iw3xo/
</div>
<br>

<div align="center" markdown="1">

![img](assets/img/01.jpg)

### > Features / Guides / In-Depth <
https://xoxor4d.github.io/projects/iw3xo/
</div>
<br>



# Usage

Expand Down Expand Up @@ -72,7 +73,6 @@ remix runtime - https://github.com/NVIDIAGameWorks/dxvk-remix/actions
or directly run `iw3xo.exe`
> `iw3xo.exe` (modified to load `iw3x.dll` instead of `d3d9.dll`)
> | -> `iw3x.dll` is a proxy d3d9.dll
> | -> if you want to use the original `iw3mp.exe` then you have to find other ways to load the dll (eg: [asiloader](https://github.com/ThirteenAG/Ultimate-ASI-Loader))
<br>

Expand All @@ -83,54 +83,77 @@ or directly run `iw3xo.exe`


# Remix section
- Note: general functionallity of iw3xo is documented here: https://xoxor4d.github.io/projects/iw3xo

## Dvars / Console Commands to further tweak the game to your liking:
> 🔸 skybox and fog settings can be tweaked per map by using `map_settings.ini` :: `iw3xo/rtx` folder 🔸
🔸 sun, skybox and fog settings can be tweaked by using `map_settings.ini` :: `iw3xo/rtx` folder 🔸
- use console command `/devgui` to open a developer gui -> __RTX__ tab
- I suggest binding the `/devgui` command to a key, eg: `bind F5 devgui`
- most of the following dvars can be accessed via the gui

- `r_forceLod` :: force all models to a specific LOD - _(highest by default)_
- `r_forceLod_second_lowest` :: prevent game from using the lowest LOD - (sometimes used to hide the model)
- `r_lodScaleRigid` :: adjust static model draw distances - (lower values increase draw distance)
- `rtx_disable_world_culling` :: tweak culling - _(set to less (1) by default)_

<br>
<br>

## Advanced Settings:

- A. Commandline Arguments:

- `-rtx` :: enable rtx modules (⚠️ required for rtx-remix)
- `-no_default_sky` :: disable spawning of a default sky on each map (if not set via `map_settings.ini`)
- `-no_default_sky` :: disable sky spawning (map settings)
- `-no_sun` :: disable sun spawning (map settings)
- `-no_fog` :: disable fog (map settings)
- `-stock_effects` :: render effects using shaders
- `-no_fog` :: disable fog
- `-old_anti_culling` :: use the old anti culling system
- `-no_forced_lod` :: do not set `r_forceLod` to `high` by default
- `-load_normal_spec` :: enable loading of specular and normal maps (if you need to for some reason)
- `-thirdperson` :: using the `thirdperson` flag will render the thirdperson playermodel into the firstperson view (for shadow casting. Assign the _Player Model_ material category to hide it from your view while keeping it casting shadows. (Still WIP - also spawns a triangle with a unique texture used as the bounding box origin to hide meshes using textures marked as player model)
- `-thirdperson` :: using the `thirdperson` flag will render the thirdperson playermodel into the firstperson view (for shadow casting. Assign the _Player Model_ material category to hide it from your view (keeps casting shadows) (WIP - also spawns a triangle with a unique texture used as the bounding box origin to hide meshes using textures marked as player model)

> - commandline example: &ensp;`c:\path\iw3xo.exe -rtx -no_default_sky -stock_effects`
- B. Dvars:
- `rtx_disable_entity_culling` :: tweak culling of script objects (entities) - _(enabled by default)_
- `rtx_warm_smodels` :: build model buffers on map load - _(enabled by default)_
- `rtx_extend_smodel_drawing` :: disable static model draw limit (max amount of static models drawn at once)
- `rtx_hacks` :: replace the skybox with a blue-gray texture - _(enabled by default)_
- `rtx_sky_hacks` :: allows manually declaring textures as sky (via dvar `rtx_sky_materials`)
- `rtx_sky_follow_player` :: sky will follow the player (might help with culling in some cases)
<br>

- B. Dvars (I recommend tweaking these via the `/devgui`) :

🟩 encouraged to be tweaked
🟦 can be useful in edge case scenarios
🟧 shouldn't be touched

#### Culling dvars:
🟩 `rtx_culling_tweak_mins` :: prevents a bit of culling
🟩 `rtx_culling_tweak_maxs` :: prevents a lot of culling
🟩 `rtx_culling_tweak_frustum` :: disables frustum culling
🟩 `rtx_culling_tweak_smodel` :: disables static model culling

#### General dvars:
🟩 `r_forceLod` :: force all models to a specific LOD
🟩 `r_forceLod_second_lowest` :: prevent game from using the lowest LOD (sometimes used to hide the model)
🟩 `r_lodScaleRigid` :: adjust static model draw distances (lower values increase draw distance)
🟩 `r_showTess` :: draws material info (incl. all image names) of surfaces (geometry / models)
🟩 `r_showTessDist` :: adjust draw distance of ^ info text
🟩 `r_showCellIndex` :: show portal index info (useful for manual culling overrides via map settings)
🟦 `rtx_sky_hacks` :: allows manually declaring textures as sky (maps w. multiple skies)
🟦 `rtx_sky_materials` :: materials iw3xo flags as 'sky' materials (logic that replaces the default sky)

#### Dvars that should only be changed if you know what you are doing:
🟧 `rtx_warm_smodels` :: build model buffers on map load (enabled by default)
🟧 `rtx_hacks` :: replace the skybox with a blue-gray texture
🟧 `rtx_extend_smodel_drawing` :: disable static model draw limit (max amount of static models drawn at once)
🟧 `rtx_sky_follow_player` :: sky will follow the player (might help with culling in some cases)

#### Culling dvars when `old_anti_culling` flag is set:
🟩 `rtx_disable_world_culling` :: tweak overall culling
🟩 `rtx_disable_entity_culling` :: tweak culling of script objects (entities)

<br>

- C. Console Commands :
- `mapsettings_update` :: reload map settings
- `mapsettings_get_defaults` :: prints sun direction, color and intensity in map_settings format based on the stock map settings to the consle

<br>

## ⚠️ Current Issues
- Swift changes in geometry (eg. teleporting) can crash the game.
- Set dvar `rtx_disable_world_culling` to `less (1)` and increase dvar `r_lodScaleRigid` to make it more stable.

- Effects will slow down the game (really depends on the effect and the amount - use `fx_enable 0` to disable effects completely)
- Decrease geometry drawing by increasing culling or play with `r_lodScaleRigid`

- Remix might try to use your onboard gpu (that is a general CoD issue), so its best to disable it in the bios or within the device manager

- Some effects will slow down the game (really depends on the effect and the amount)


<br>

<div align="center" markdown="1">
Expand Down
1 change: 1 addition & 0 deletions assets-remix/iw3xo/rtx/map_settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ mp_mw3_hardhat, 2600, 200,200,200, 0.406,0.406,-0.819, 254.6,255.0,249.0,

#CULL // [X: CELL to tweak](indices of cells always rendered when in X) -> display cell indices using dvar 'r_showCellIndex'
mp_backlot, [1](0 2), [2](1), [3](0), [4](0), [7](0 6 9 10), [9](0 10), [10](0), [11](0), [12](0), [14](0 11 16), [34](0 22 32)
mp_showdown, [4](6 7)
2 changes: 2 additions & 0 deletions src/components/modules/gui_devgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ namespace components
}
}

ImGui::SetNextWindowSizeConstraints(ImVec2(580.0f, 400.0f), ImVec2(580.0f, FLT_MAX));

// early out if the window is collapsed, as an optimization.
if (!ImGui::Begin("Devgui", &menu.menustate, ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoCollapse))
{
Expand Down
5 changes: 3 additions & 2 deletions src/components/modules/rtx/rtx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -967,10 +967,10 @@ namespace components
}

// draw portal cells if r_showCellIndex is true
if (dvars::r_showCellIndex)
/*if (dvars::r_showCellIndex)
{
dvars::int_override("r_showPortals", dvars::r_showCellIndex->current.enabled);
}
}*/

// #
// #
Expand Down Expand Up @@ -1388,6 +1388,7 @@ namespace components
/* default */ false,
/* flags */ game::dvar_flags::none);


#if DEBUG
command::add("dump_modes", "", "", [this](command::params)
{
Expand Down
64 changes: 46 additions & 18 deletions src/components/modules/rtx/rtx_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,17 @@ namespace components

void rtx_gui::gui()
{
ImGui::Indent(8.0f);

if (ImGui::CollapsingHeader("General Settings", ImGuiTreeNodeFlags_DefaultOpen))
{
ImGui::Indent(8.0f); SPACING(0.0f, 4.0f);

if (ImGui::Button("Reload Mapsettings.ini", ImVec2(ImGui::GetContentRegionAvail().x - 8.0f, 0)))
{
rtx_map_settings::get()->set_settings_for_loaded_map(true);
}

SPACING(0.0f, 4.0f);

const auto& fx_enable = game::Dvar_FindVar("fx_enable");
ImGui::Checkbox("Enable FX", &fx_enable->current.enabled);

Expand All @@ -65,42 +70,59 @@ namespace components
TT("The game has a hard limit on how many static models it can draw at once (warning print in console).\n"
"Enabling this setting will disable that limit but might cause instability.");

SPACING(0.0f, 4.0f);
if (ImGui::Button("Reload Mapsettings.ini", ImVec2(ImGui::GetContentRegionAvail().x - 8.0f, 0)))
{
rtx_map_settings::get()->set_settings_for_loaded_map(true);
// -------------------
title_inside_seperator("Material Info", true, 0.0f, true, 2.0f);

if (dvars::r_showTess) {
ImGui::PushItemWidth(240.0f);
const char* TESS_TYPES[] = { "OFF", "Model Tech", "Model Material", "BSP Tech", "BSP Material", "BModel Tech", "BModel Material" };
ImGui::SliderInt("##material_info", &dvars::r_showTess->current.integer, 0, 6, TESS_TYPES[dvars::r_showTess->current.integer]);
ImGui::PopItemWidth();
}

if (dvars::r_showTessDist) {
ImGui::SameLine(280, 0);
ImGui::PushItemWidth(140.0f);
ImGui::SliderFloat("Distance", &dvars::r_showTessDist->current.value, 1.0f, 1000.0f, "%.0f"); TT(dvars::r_showTessDist->description);
ImGui::PopItemWidth();
}

// ------------------
title_inside_seperator("Culling", true, 0.0f, true, 2.0f);

if (rtx::OLD_CULLING_ACTIVE)
{
if (dvars::rtx_disable_entity_culling)
if (dvars::rtx_disable_entity_culling) {
ImGui::Checkbox("Disable Entity Culling", &dvars::rtx_disable_entity_culling->current.enabled);TT(dvars::rtx_disable_entity_culling->description);
}

if (dvars::rtx_disable_world_culling)
if (dvars::rtx_disable_world_culling) {
ImGui::SliderInt("World Culling", &dvars::rtx_disable_world_culling->current.integer, 0, 3,
rtx::rtx_disable_world_culling_enum[dvars::rtx_disable_world_culling->current.integer]); TT(dvars::rtx_disable_world_culling->description);
}
}
else
{
if (dvars::rtx_culling_tweak_mins)
if (dvars::rtx_culling_tweak_mins) {
ImGui::Checkbox("Tweak Culling (Mins)", &dvars::rtx_culling_tweak_mins->current.enabled); TT(dvars::rtx_culling_tweak_mins->description);
}

ImGui::SameLine(280, 0);
if (dvars::rtx_culling_tweak_maxs)
if (dvars::rtx_culling_tweak_maxs) {
ImGui::Checkbox("Tweak Culling (Maxs)", &dvars::rtx_culling_tweak_maxs->current.enabled); TT(dvars::rtx_culling_tweak_maxs->description);
}

if (dvars::rtx_culling_tweak_frustum)
if (dvars::rtx_culling_tweak_frustum) {
ImGui::Checkbox("Tweak Culling (Frustum)", &dvars::rtx_culling_tweak_frustum->current.enabled); TT(dvars::rtx_culling_tweak_frustum->description);
}

ImGui::SameLine(280, 0);
if (dvars::rtx_culling_tweak_smodel)
if (dvars::rtx_culling_tweak_smodel) {
ImGui::Checkbox("Tweak Culling (Static Models)", &dvars::rtx_culling_tweak_smodel->current.enabled); TT(dvars::rtx_culling_tweak_smodel->description);
}

SPACING(0.0f, 4.0f);
if (ImGui::CollapsingHeader("Frustumplanes"))
if (ImGui::CollapsingHeader("Frustumplanes (Default = 0)"))
{
for (auto i = 0u; i < rtx::FRUSTUM_PLANE_OFFSETS_COUNT; i++)
{
Expand All @@ -113,8 +135,14 @@ namespace components
// ------------------
title_inside_seperator("Dev Settings", true, 0.0f, true, 2.0f);

if (dvars::r_showCellIndex)
ImGui::Checkbox("Show Cell Indices (Portal)", &dvars::r_showCellIndex->current.enabled); TT(dvars::r_showCellIndex->description);
if (dvars::r_showCellIndex) {
ImGui::Checkbox("Show Cell Indices", &dvars::r_showCellIndex->current.enabled); TT(dvars::r_showCellIndex->description);
}

if (const auto var = game::Dvar_FindVar("r_showPortals"); var) {
ImGui::SameLine(280, 0);
ImGui::Checkbox("Show Cell Bounds", &var->current.enabled); TT(var->description);
}

#if DEBUG
ImGui::DragInt("D3D Alpha Blend Setting", &rtx_gui::d3d_alpha_blend, 0.025f, 0, 16);
Expand Down Expand Up @@ -496,9 +524,9 @@ namespace components
const auto& r_lodBiasRigid = game::Dvar_FindVar("r_lodBiasRigid");
const auto& r_lodScaleSkinned = game::Dvar_FindVar("r_lodScaleSkinned");
const auto& r_lodBiasSkinned = game::Dvar_FindVar("r_lodBiasSkinned");
ImGui::DragFloat("r_lodScaleRigid", &r_lodScaleRigid->current.value, 0.1f, 0.0f);
ImGui::DragFloat("r_lodBiasRigid", &r_lodBiasRigid->current.value, 0.1f, 0.0f);
ImGui::DragFloat("r_lodScaleSkinned", &r_lodScaleSkinned->current.value, 0.1f);
ImGui::SliderFloat("r_lodScaleRigid", &r_lodScaleRigid->current.value, 0.0f, 8.0f);
ImGui::DragFloat("r_lodBiasRigid", &r_lodBiasRigid->current.value, 0.1f);
ImGui::SliderFloat("r_lodScaleSkinned", &r_lodScaleSkinned->current.value, 0.0f, 8.0f);
ImGui::DragFloat("r_lodBiasSkinned", &r_lodBiasSkinned->current.value, 0.1f);

//
Expand Down
1 change: 0 additions & 1 deletion src/game/dvars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ namespace dvars
game::dvar_s* r_showTessDist = nullptr;
game::dvar_s* r_showCellIndex = nullptr;


game::dvar_s* r_fogTweaks = nullptr;
game::dvar_s* r_fogTweaksColor = nullptr;
game::dvar_s* r_fogTweaksStart = nullptr;
Expand Down

0 comments on commit fc2f85a

Please sign in to comment.