Skip to content

Shaders/SkinnedMesh/Diffuse_Rotate

UV rotation shader for animated texture rotation (e.g., Arcana Zilean clock dial).

Parameters

  • Rotation center: Rotation_Center - [x, y] pivot point (0.5, 0.5 = texture center)
  • Rotation speed: Rotation_Speed - radians per second (negative = counter-clockwise)
  • UV scale: UV_Scale
  • Texture: Diffuse_Texture
  • Bloom: disabled

Extractor Handling

  • Profile exports rotationCenter and rotationSpeed in material extras.
  • UV scale is handled via standard UvTileParam.

Frontend Expectations

  • handleUvRotation converts game's texture-space center to mesh UV space: meshCenter = gameCenter / repeat
  • Offset is compensated to preserve texture position when center changes: newOffset = originalOffset + meshCenter * (repeat - 1)
  • updateRotatingMaterials animates texture.rotation each frame using speed and delta time.
  • Rotation respects animation time scale and pause state.

Center Space Conversion

Three.js texture.center operates in mesh UV space (before repeat), not texture space. The conversion:

meshCenter.x = gameCenter[0] / repeat.x
meshCenter.y = gameCenter[1] / repeat.y
adjustedOffset.x = originalOffset.x + meshCenter.x * (repeat.x - 1)
adjustedOffset.y = originalOffset.y + meshCenter.y * (repeat.y - 1)

Chroma Support

When applying chromas, center and rotation are copied to the new texture to preserve rotation state.

Testing

  • Confirm rotation is centered correctly (texture spins in place, not orbiting).
  • Verify speed matches game (radians/sec, not degrees).
  • Test chroma application - rotation should continue seamlessly.

Known Models

  • Arcana Zilean (skin 26024) - "Rotate" mesh clock dial

Built for engineers and AI assistants working on Khada.