diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-04 19:17:12 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-04 19:17:12 +0100 |
| commit | ea4b9d1f6de4c0c781a48999e793a5bf976c2b38 (patch) | |
| tree | 24d7af7c91d740076cf9c5ca932a0ed2a0d51cea /src | |
| parent | Chams: use the model solid shader for flat, drop vgui/white (diff) | |
| download | hl2h-ea4b9d1f6de4c0c781a48999e793a5bf976c2b38.tar.gz hl2h-ea4b9d1f6de4c0c781a48999e793a5bf976c2b38.zip | |
Chams: keep additive viewmodel visible on bright backgrounds
Viewmodels are collated as RENDER_GROUP_VIEW_MODEL_OPAQUE, so an additive
forced material can vanish against a bright sky/wall (additive adds nothing to
an already-bright surface). Draw a dim opaque solid base before the additive
viewmodel pass so the first-person model always has a visible silhouette; the
additive layer still provides the glow.
Diffstat (limited to 'src')
| -rw-r--r-- | src/studio.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/studio.cpp b/src/studio.cpp index 4941142..bee6db5 100644 --- a/src/studio.cpp +++ b/src/studio.cpp | |||
| @@ -313,6 +313,18 @@ void hkdModelExecute(void *self, const void *state, const void *info, | |||
| 313 | brgb[i] = rgb[i] + (255 - rgb[i]) / 2; | 313 | brgb[i] = rgb[i] + (255 - rgb[i]) / 2; |
| 314 | use_rgb = brgb; | 314 | use_rgb = brgb; |
| 315 | } | 315 | } |
| 316 | // Additive blending vanishes against bright backgrounds (sky, | ||
| 317 | // white walls, strong fog), which made the viewmodel disappear in | ||
| 318 | // some places. Lay down a dim opaque base first so the first-person | ||
| 319 | // model always has a visible silhouette; the additive pass still | ||
| 320 | // adds the glow on top. | ||
| 321 | if (is_vm && (style == 2 || style == 5)) { | ||
| 322 | int drgb[3] = {rgb[0] / 2, rgb[1] / 2, rgb[2] / 2}; | ||
| 323 | chams_apply(mat, ignorez, 3, false, drgb, false); | ||
| 324 | g_force_override(self, mat, 0 /* OVERRIDE_NORMAL */); | ||
| 325 | g_orig_model_exec(self, state, info, bone); | ||
| 326 | chams_reset(mat); | ||
| 327 | } | ||
| 316 | chams_apply(mat, ignorez, style, white, use_rgb, false); | 328 | chams_apply(mat, ignorez, style, white, use_rgb, false); |
| 317 | g_force_override(self, mat, 0 /* OVERRIDE_NORMAL */); | 329 | g_force_override(self, mat, 0 /* OVERRIDE_NORMAL */); |
| 318 | g_orig_model_exec(self, state, info, bone); | 330 | g_orig_model_exec(self, state, info, bone); |
