Animated VTF textures not implemented #47

Open
opened 2026-03-20 06:16:59 +00:00 by kit · 0 comments
Owner

Problem

Source VTF textures can contain multiple frames for animation (flag TEXTUREFLAGS_ANIMATED or simply multiple frames in the VTF header). We currently decode only frame 0 and never update, so animated textures appear static.

Visible in

shader_test_01 — several cubes use animated materials (energy effects, scrolling textures) that should be visually active.

What's needed

  1. VTF decoder (vtf.js): Already parses the frame count from the VTF header but only decodes frame 0. Need to decode all frames and store them.
  2. Texture animation system: A per-material animation driver that cycles through frames at the correct rate. Source uses AnimatedTextureVar proxies with $animatedtexturevar, $animatedtextureframenumvar, and $animatedtextureframerate.
  3. Render loop integration: Update animated texture frames each frame based on elapsed time.

Additional considerations

  • Some materials use texture scrolling ($texturescrollvar) rather than frame animation — different mechanism, similar visual effect.
  • Material proxies in general are a larger system we'll eventually need to support for dynamic material effects.
## Problem Source VTF textures can contain multiple frames for animation (flag `TEXTUREFLAGS_ANIMATED` or simply multiple frames in the VTF header). We currently decode only frame 0 and never update, so animated textures appear static. ## Visible in `shader_test_01` — several cubes use animated materials (energy effects, scrolling textures) that should be visually active. ## What's needed 1. **VTF decoder** (`vtf.js`): Already parses the frame count from the VTF header but only decodes frame 0. Need to decode all frames and store them. 2. **Texture animation system**: A per-material animation driver that cycles through frames at the correct rate. Source uses `AnimatedTextureVar` proxies with `$animatedtexturevar`, `$animatedtextureframenumvar`, and `$animatedtextureframerate`. 3. **Render loop integration**: Update animated texture frames each frame based on elapsed time. ## Additional considerations - Some materials use texture scrolling (`$texturescrollvar`) rather than frame animation — different mechanism, similar visual effect. - Material proxies in general are a larger system we'll eventually need to support for dynamic material effects.
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#47
No description provided.