From 5ddc9eb9d02ddc84e4c3a45bdcb2941513fb0346 Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 4 Nov 2026 18:58:13 +0100 Subject: Chams: per-relationship, visible/invisible styles and viewmodel - Hostile/neutral/friendly each have independent visible and through-wall settings: enable, style and colour. Viewmodel has its own enable/style/colour. - Styles: Flat, Wireframe, Additive, Solid, White, Fullbright, Glow outline. Additive uses the model solid material + ADDITIVE flag (the VGUI additive was invisible on NPCs). White/fullbright are solid-based, so the viewmodel no longer disappears/checkerboards. Glow outline adds a wireframe contour pass for depth. - Config: [chams] active/bind, [chams_hostile|neutral|friendly] vis/inv settings, [chams_vm]. GUI sections for each group. --- CONTEXT.md | 53 ++++++++++++++++++++++++----------------------------- 1 file changed, 24 insertions(+), 29 deletions(-) (limited to 'CONTEXT.md') diff --git a/CONTEXT.md b/CONTEXT.md index e323588..be526fc 100644 --- a/CONTEXT.md +++ b/CONTEXT.md @@ -285,35 +285,30 @@ vocabulary / decisions. ## Chams - Hooks `IVModelRender::DrawModelExecute` (slot 19 in `VEngineModel016`). - The model's entity is `ModelRenderInfo_t::entity_index` (32-bit offset 0x30); - only entities for which `esp_is_npc_index` says the client class is an NPC - are affected. -- Uses `IVModelRender::ForcedMaterialOverride` (slot 1) with - `models/debug/debugwhite` and draws twice: first with - `MATERIAL_VAR_IGNOREZ` (1 << 15) set through `IMaterial::SetMaterialVarFlag` - (slot 29) for the through-wall pass, then without it. Colour is applied via - `IMaterial::ColorModulate` (slot 28) **and** the shader's `$color`/`$color2` - vars (IMaterialVar slot 11, SetVecValue 3-float slot 11), because some forced - materials ignore ColorModulate. The shared material's flag and colour are - restored to (false, white) after the draw. -- The base game does not mount `models/debug/debugwhite` (EP2-only) or - `debug/additivevertexcolorvertexalpha`; the style material is preloaded from - `outer_draw` (throttled) and cached. Styles: 0 Flat (`vgui/white`), - 1 Wireframe (`debug/debugwireframe`), 2 Additive (`vgui/white_additive`), - 3 Solid (`debug/debugtranslucentsinglecolor`), 4 White - (`debug/debugtranslucentvertexcolor`), 5 Fullbright - (`debug/debugmrmfullbright2`). A missing style falls back to the solid one; - the render hook never calls FindMaterial itself. -- `Viewmodel (hands/weapon)` applies the override to entities whose class - contains `viewmodel` or whose model path is `.../v_...`. Viewmodels always - use the solid style (no style flags) with the selected colour; VGUI/white - materials do not draw skinned models and made the hands/weapon disappear. - Only the normal-depth pass is used. -- Feature is off by default; `[chams] active/bind/walls/viewmodel/material/r/g/b`, - with Through walls, Viewmodel, a Material dropdown and colour in the Visuals - card. -- This is a flat material override, not stencil outlines; depth handling is - the simple ignorez/normal two-pass. + The model's entity is `ModelRenderInfo_t::entity_index` (32-bit offset 0x30). + NPCs are grouped by `esp_npc_relation` (hostile / neutral / friendly); + viewmodel entities (class contains `viewmodel` or model path `.../v_...`) + are a fourth group. +- Each relationship has independent **visible** and **through-wall** settings: + on/off, style, and colour. The viewmodel has on/off, style and colour only. + The through-wall pass uses `MATERIAL_VAR_IGNOREZ` (1 << 15) through + `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), 1 Wireframe (`debug/debugwireframe`), + 2 Additive (`debug/debugtranslucentsinglecolor` + ADDITIVE), 3 Solid, + 4 White (solid, colour forced white), 5 Fullbright (solid + FLAT|SELFILLUM), + 6 Glow outline (solid plus a `debug/debugwireframe` contour pass). + `models/debug/debugwhite` is EP2-only and the old VGUI additive material is + invisible on NPCs; the styles no longer depend on them. +- 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), + `[chams_hostile|neutral|friendly]` (`vis`, `vis_mat`, `vis_r/g/b`, `inv`, + `inv_mat`, `inv_r/g/b`) and `[chams_vm]` (`on`, `mat`, `r/g/b`). The GUI has + a Hostile/Neutral/Friendly section each, plus Viewmodel. +- This is a material override, not stencil outlines. ## Bones / ESP -- cgit v1.2.3