Stream entity material overrides and color changes #11

Closed
opened 2026-03-17 00:51:32 +00:00 by kit · 1 comment
Owner

Entities can have their render color and material overridden at runtime (e.g., Entity:SetColor(), Entity:SetMaterial(), Entity:SetSubMaterial()). These aren't currently streamed or rendered.

What needs to be streamed

Render color

  • RGBA color tint applied multiplicatively to the entity's materials
  • Entity:GetColor() returns Color(r, g, b, a)
  • Alpha < 255 means the entity is translucent
  • This is very common — many addons tint props

Material override

  • Entity:GetMaterial() — replaces all materials on the entity with a single material path
  • Entity:GetSubMaterial(index) — replaces a specific material slot
  • Used for effects like wireframe, glow, camo skins, etc.

Implementation

Server side

  • Add render color (RGBA, 4 bytes) to EntityState
  • Add material override string to entity data (could use a string table like models/classnames)
  • SubMaterial overrides are less common — could be a follow-up

Client side

  • Apply color tint to entity materials (multiply vertex color or uniform)
  • When material override is set, load and apply the replacement VMT/VTF
  • Handle alpha < 255 with transparent rendering

Relates to

  • #8 (VMT shader types — material overrides need proper shader support)
Entities can have their render color and material overridden at runtime (e.g., `Entity:SetColor()`, `Entity:SetMaterial()`, `Entity:SetSubMaterial()`). These aren't currently streamed or rendered. ## What needs to be streamed ### Render color - RGBA color tint applied multiplicatively to the entity's materials - `Entity:GetColor()` returns `Color(r, g, b, a)` - Alpha < 255 means the entity is translucent - This is very common — many addons tint props ### Material override - `Entity:GetMaterial()` — replaces all materials on the entity with a single material path - `Entity:GetSubMaterial(index)` — replaces a specific material slot - Used for effects like wireframe, glow, camo skins, etc. ## Implementation ### Server side - Add render color (RGBA, 4 bytes) to `EntityState` - Add material override string to entity data (could use a string table like models/classnames) - SubMaterial overrides are less common — could be a follow-up ### Client side - Apply color tint to entity materials (multiply vertex color or uniform) - When material override is set, load and apply the replacement VMT/VTF - Handle alpha < 255 with transparent rendering ## Relates to - #8 (VMT shader types — material overrides need proper shader support)
Author
Owner

Related: #8 (VMT shader types). Entity-level material overrides depend on having a shader system that can accept per-entity parameters. #8 provides the base material pipeline, this issue adds the runtime override layer on top.

Also part of the broader asset rendering effort tracked in #5.

Related: #8 (VMT shader types). Entity-level material overrides depend on having a shader system that can accept per-entity parameters. #8 provides the base material pipeline, this issue adds the runtime override layer on top. Also part of the broader asset rendering effort tracked in #5.
kit closed this issue 2026-03-19 13:25:09 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kit/gmod-web-stream#11
No description provided.