Общността за модификации на игри от 2001 насам

Prevent looping an animated texture?

A Forum Thread for Team Fortress 2

Hello!

Does anyone know how to prevent an animated texture from looping in a .vmt?


Thanks in advance.
/DevBat

Posts

  • 2y
    Zwip-Zwap Zapony avatar
    Zwip-Zwap Zapony username pic Joined 6y ago
    Offline
    3,769 points Ranked 1312th
    14 medals 1 legendary 1 rare
    • Returned 5000 times Medal icon
    • Returned 1000 times Medal icon
    • Reached 1,000 Points Medal icon
    • One month a member Medal icon
    • 6 months a member Medal icon
    • 1 year a member Medal icon
    I might (I probably) know how, but it'd help to see a VMT you'd like to do this with, and also if you explain what you'd like it for.
    *Insert User Title here*
  • 2y
    DevBat avatar
    DevBat username pic Joined 7y ago
    ?
    740 points Ranked 6698th
    15 medals 1 rare
    • 6 years a member Medal icon
    • Became a Studio Leader Medal icon
    • One month a member Medal icon
    • 6 months a member Medal icon
    • 1 year a member Medal icon
    • 2 years a member Medal icon
    Posted by Zwip-Zwap Zapony

    I might (I probably) know how, but it'd help to see a VMT you'd like to do this with, and also if you explain what you'd like it for.
    Here's my .vmt:
    "UnlitGeneric"
    {
    "$basetexture" "mmm/chatbox/motzand1"
    "$nodecal" 1
    "$nolod" 1
    "$translucent" 1

    "Proxies"
    {
    "AnimatedTexture"
    {
    "animatedTextureVar" $basetexture
    "animatedTextureFrameNumVar" $frame
    "animatedTextureFrameRate" 20
    }
    }
    }
    This vmt is intended for a screen overlay.
    The overlay is sent to the player through a client_command entity when the player enter a trigger volume.

  • 2y
    Zwip-Zwap Zapony avatar
    Zwip-Zwap Zapony username pic Joined 6y ago
    Offline
    3,769 points Ranked 1312th
    14 medals 1 legendary 1 rare
    • Returned 5000 times Medal icon
    • Returned 1000 times Medal icon
    • Reached 1,000 Points Medal icon
    • One month a member Medal icon
    • 6 months a member Medal icon
    • 1 year a member Medal icon
    Untested example VMT of a non-looping animated texture:
    UnlitGeneric
    {
    $BaseTexture mmm/chatbox/motzand1
    $NoDecal 1
    $NoLod 1
    $Translucent 1

    Proxies
    {
    LinearRamp
    {
    Rate 20
    InitialValue 0
    ResultVar $Frame
    }
    Clamp
    {
    Min 0
    Max 19
    SrcVar1 $Frame
    ResultVar $Frame
    }
    }
    The LinearRamp's "Rate" value should be the amount of frames per second (however, again, it's untested), and the Clamp's "Max" value should be the amount of frames you want it to play for, minus 1. (You can't have more frames here than the amount of frames in the VTF, but you can have less if you want.)
    *Insert User Title here*
  • 2y
    DevBat avatar
    DevBat username pic Joined 7y ago
    ?
    740 points Ranked 6698th
    15 medals 1 rare
    • 6 years a member Medal icon
    • Became a Studio Leader Medal icon
    • One month a member Medal icon
    • 6 months a member Medal icon
    • 1 year a member Medal icon
    • 2 years a member Medal icon
    Posted by Zwip-Zwap Zapony

    Untested example VMT of a non-looping animated texture:
    UnlitGeneric
    {
    $BaseTexture mmm/chatbox/motzand1
    $NoDecal 1
    $NoLod 1
    $Translucent 1

    Proxies
    {
    LinearRamp
    {
    Rate 20
    InitialValue 0
    ResultVar $Frame
    }
    Clamp
    {
    Min 0
    Max 19
    SrcVar1 $Frame
    ResultVar $Frame
    }
    }
    The LinearRamp's "Rate" value should be the amount of frames per second (however, again, it's untested), and the Clamp's "Max" value should be the amount of frames you want it to play for, minus 1. (You can't have more frames here than the amount of frames in the VTF, but you can have less if you want.)
    Thank you for your reply! I just tested your solution, but it seems that the overlay does not work with LinearRamp.

    In most materials this would work since we can change stuff dynamically. The screen overlay stays static after it's been drawn and cannot change its starting values after it's been drawn. (Hence why AnimatedTexture works but not LinearRamp)

    I've read some similar threads which suggest to create multiple .vmts to change with I/O.

    But is this the only way?

    Just trying to optimizing the material as much as I can. : )

  • 2y
    Zwip-Zwap Zapony avatar
    Zwip-Zwap Zapony username pic Joined 6y ago
    Offline
    3,769 points Ranked 1312th
    14 medals 1 legendary 1 rare
    • Returned 5000 times Medal icon
    • Returned 1000 times Medal icon
    • Reached 1,000 Points Medal icon
    • One month a member Medal icon
    • 6 months a member Medal icon
    • 1 year a member Medal icon
    You could try replacing the LinearRamp proxy with a basic AnimatedTexture proxy, while keeping in the Clamp proxy below it... but make sure to add a couple extra copies of the last frame at the end of the VTF (preferably enough for at least 0.2 seconds), so the client has to lag a lot for the animated texture variable to wrap around back to the start. If this doesn't work (provided you have more than 5 frames per second), there's not much else that would work, if anything at all.
    *Insert User Title here*
  • 2y
    DevBat avatar
    DevBat username pic Joined 7y ago
    ?
    740 points Ranked 6698th
    15 medals 1 rare
    • 6 years a member Medal icon
    • Became a Studio Leader Medal icon
    • One month a member Medal icon
    • 6 months a member Medal icon
    • 1 year a member Medal icon
    • 2 years a member Medal icon
    Posted by Zwip-Zwap Zapony

    You could try replacing the LinearRamp proxy with a basic AnimatedTexture proxy, while keeping in the Clamp proxy below it... but make sure to add a couple extra copies of the last frame at the end of the VTF (preferably enough for at least 0.2 seconds), so the client has to lag a lot for the animated texture variable to wrap around back to the start. If this doesn't work (provided you have more than 5 frames per second), there's not much else that would work, if anything at all.
    I've thought about adding more frames, but due to file size constrains, (image is 1024x1024!) I cannot do that. I'll have to see if I can figure something out.

    Thanks for the help!

Embed

Сподели банер
URL на изображението:
HTML код за вграждане:
BB код за вграждане:
Markdown код за вграждане:

Author

DevBat avatar
DevBat username pic Joined 7y ago
?
740 points Ranked 6698th
15 medals 1 rare
  • 6 years a member Medal icon
  • Became a Studio Leader Medal icon
  • One month a member Medal icon
  • 6 months a member Medal icon
  • 1 year a member Medal icon
  • 2 years a member Medal icon

DevBat avatar
DevBat
Sign up to access this!
Sign up to access this!
Sign up to access this!
Sign up to access this!

Category

Attributes

Miscellaneous

Share

  • Share on Reddit
  • Share on Twitter
  • Share on Facebook
  • Share on Google+

Stats

  • 501 Views
  • 6 Posts
  • 2y Submitted

Внимание, геймъре! Mascot

GameBanana is one of the oldest mod sites on the net. Sign up and maximize your browsing experience.

  • Subscribe: Get notified of new submissions like this.
  • Say Thanks: Show your appreciation - send modders points.
  • Post: Give modders your thoughts on their work.
  • Vote: Help your favorite modders win monthly awards.
  • Flag: Alert moderators and warn members of problems with mods.
  • Watch: Get notified when mods are updated.

Звучи ли забавно? Sign up now!

Already a Bananite? Впиши се

bcp.crwdcntrl.net tracking pixel