From c15a74d39f87c73a35ca420450e2876db2c37deb Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 4 Nov 2026 19:09:31 +0100 Subject: Chams: use the model solid shader for flat, drop vgui/white vgui/white is an UnlitGeneric with $vertexcolor/$vertexalpha, no basetexture and no $model, so it renders nothing on model vertices; Flat was invisible on the viewmodel and would be invisible on NPCs too. Flat now uses the solid model shader with the FLAT flag. Remove the vgui/white probe. --- CONTEXT.md | 21 ++++++++++----------- src/studio.cpp | 14 ++------------ 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/CONTEXT.md b/CONTEXT.md index f7fdecb..ad9ce2d 100644 --- a/CONTEXT.md +++ b/CONTEXT.md @@ -295,17 +295,16 @@ vocabulary / decisions. `IMaterial::SetMaterialVarFlag` (slot 29); colours use `$color`/`$color2` (IMaterialVar slot 11, SetVecValue 3-float slot 11) and `ColorModulate` (slot 28). Shared materials are restored after each draw. -- Styles are built from the resident materials and material flags: - 0 Flat (`vgui/white` with FLAT on NPCs; the solid model shader with FLAT on - the viewmodel, because VGUI materials do not draw skinned models), - 1 Wireframe (`debug/debugwireframe`), 2 Additive - (`debug/debugtranslucentsinglecolor` + ADDITIVE), 3 Solid, 4 White (solid, - colour forced white), 5 Fullbright (solid + ADDITIVE|SELFILLUM with the - colour lifted toward white), 6 Glow outline (solid plus a - `debug/debugwireframe` contour pass drawn with ZNEARER (1 << 10) and a - brightened colour so the base cannot bury it). `models/debug/debugwhite` is - EP2-only and the old VGUI additive material is invisible on NPCs; the styles - no longer depend on them. +- Styles are built from `debug/debugtranslucentsinglecolor` (UnlitGeneric, + `$color`) and material flags: + 0 Flat (solid + FLAT), 1 Wireframe (`debug/debugwireframe`), 2 Additive + (+ ADDITIVE), 3 Solid, 4 White (colour forced white), 5 Fullbright + (ADDITIVE|SELFILLUM with the colour lifted toward white), 6 Glow outline + (solid plus a `debug/debugwireframe` contour pass drawn with ZNEARER + (1 << 10) and a brightened colour so the base cannot bury it). + `vgui/white` is vertex-colour based and has no `$model`/`$basetexture`, so it + is never used for chams; `models/debug/debugwhite` is EP2-only and the old + VGUI additive material was invisible on NPCs. - Style materials are preloaded from `outer_draw` (throttled) and cached; the render hook never calls FindMaterial itself. A missing style uses solid. - Feature is off by default. Config sections: `[chams]` (active/bind), diff --git a/src/studio.cpp b/src/studio.cpp index 301e781..4941142 100644 --- a/src/studio.cpp +++ b/src/studio.cpp @@ -208,8 +208,8 @@ const char *chams_material_name(int idx) { case 3: case 4: case 5: - case 6: return "debug/debugtranslucentsinglecolor"; - default: return "vgui/white"; // models/debug/debugwhite is EP2-only + case 6: + default: return "debug/debugtranslucentsinglecolor"; } } @@ -300,10 +300,6 @@ void hkdModelExecute(void *self, const void *state, const void *info, if (style < 0) style = 0; if (style > 6) style = 6; void *mat = style_material(style); - // vgui/white (Flat) does not draw skinned models, so the viewmodel - // uses the solid model shader with the same FLAT flag. - if (is_vm && style == 0) - mat = viewmodel_material(); if (!mat) return false; bool white = style == 4; @@ -367,16 +363,10 @@ static double chams_now() { // the style VMTs. The render hook only reads the cached pointers. void chams_preload() { static double last = 0.0; - static bool probed = false; double now = chams_now(); if (now - last < 1.5) return; last = now; - if (!probed) { - probed = true; - void *probe = world_find_material("vgui/white"); - logf("chams: probe vgui/white = %p", probe); - } for (int i = 0; i < 7; i++) { if (g_style_mats[i]) continue; -- cgit v1.2.3