Conversation
There was a problem hiding this comment.
Pull request overview
This pull request addresses issue #251 by adding a customizable color option for thermal/IR entity rendering in the Rail Driver scanner. Previously, entities were always displayed using a red color derived from distance and body temperature, which was difficult for some users to see. This change allows users to customize the thermal entity color via a console command and settings file.
Changes:
- Added
thermal_entity_color_overrideconfiguration field and supporting infrastructure - Implemented console command
ui_color_thermalto allow runtime color customization - Modified IR scanner rendering logic to use custom color when specified
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| game_patch/misc/alpine_settings.h | Added thermal_entity_color_override field to AlpineGameSettings structure |
| game_patch/misc/alpine_settings.cpp | Added loading and saving logic for ThermalEntityColor setting |
| game_patch/hud/hud_colors.cpp | Added ui_color_thermal console command registration |
| game_patch/graphics/d3d11/gr_d3d11_mesh.cpp | Implemented thermal entity color override in IR scanner rendering path |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add console command to set thermal scanner entity color.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| color.alpha = static_cast<ubyte>(params.alpha); | ||
| } |
There was a problem hiding this comment.
In the IR-scanner path, when thermal_entity_color_override is set for character meshes, color.alpha is taken from the override and params.alpha is no longer applied (previously alpha was always forced to params.alpha). This can change scanner fade/blending behavior and makes the override behave differently than the non-override path. Consider always applying params.alpha after choosing the RGB (or modulating override alpha with params.alpha, e.g., multiply and renormalize).
| color.alpha = static_cast<ubyte>(params.alpha); | |
| } | |
| } | |
| // Always apply scanner alpha after determining RGB to keep fade/blending behavior consistent. | |
| color.alpha = static_cast<ubyte>(params.alpha); |
| color = is_character_mesh ? params.self_illum : rf::Color{255, 255, 255, 255}; | ||
| if (is_character_mesh && g_alpine_game_config.thermal_entity_color_override) { | ||
| auto [r, g, b, a] = extract_color_components(*g_alpine_game_config.thermal_entity_color_override); | ||
| color = rf::Color{static_cast<ubyte>(r), static_cast<ubyte>(g), static_cast<ubyte>(b), static_cast<ubyte>(a)}; |
There was a problem hiding this comment.
When the thermal override is set, the code fully replaces params.self_illum (noted as derived from distance/body-temp) with a constant color. If self_illum encodes per-entity intensity, this will remove the heat/intensity effect and make characters render at a flat brightness. Consider treating the override as a tint (preserve self_illum intensity and apply it to the override RGB) instead of a full replacement.
| color = rf::Color{static_cast<ubyte>(r), static_cast<ubyte>(g), static_cast<ubyte>(b), static_cast<ubyte>(a)}; | |
| // Treat thermal override as a tint: preserve per-entity intensity from self_illum | |
| // and apply it to the override RGB. Assume self_illum is grayscale (same in all channels) | |
| // and use the red channel as the intensity source. | |
| const float intensity = static_cast<float>(params.self_illum.red) / 255.0f; | |
| const auto scaled_r = static_cast<int>(static_cast<float>(r) * intensity); | |
| const auto scaled_g = static_cast<int>(static_cast<float>(g) * intensity); | |
| const auto scaled_b = static_cast<int>(static_cast<float>(b) * intensity); | |
| color.red = static_cast<ubyte>(std::clamp(scaled_r, 0, 255)); | |
| color.green = static_cast<ubyte>(std::clamp(scaled_g, 0, 255)); | |
| color.blue = static_cast<ubyte>(std::clamp(scaled_b, 0, 255)); | |
| color.alpha = static_cast<ubyte>(params.alpha); |
game_patch/hud/hud_colors.cpp
Outdated
| "Thermal entity color override", | ||
| g_alpine_game_config.thermal_entity_color_override); | ||
| }, | ||
| "Set thermal/IR entity color override for the Rail Driver scanner.", |
There was a problem hiding this comment.
ui_color_thermal is presented as a general Rail Driver scanner setting, but thermal_entity_color_override is only referenced in the Direct3D 11 mesh renderer code. With the legacy renderer selected, this command/setting appears to have no effect. Either implement the override for the legacy renderer as well, or clarify the help text to indicate it only applies to the D3D11 renderer.
| "Set thermal/IR entity color override for the Rail Driver scanner.", | |
| "Set thermal/IR entity color override for the Rail Driver scanner (D3D11 renderer only).", |
Change rail scanner thermal color re: #251