{{htmlmetatags>metatag-keywords=(pac3,wiki,animated,texture,tutorial,guide,help,convert,gif)
metatag-description=(Creating and using animated textures in PAC.)
metatag-og:title=(Animated Textures)
metatag-og:description=(Creating and using animated textures in PAC.)
metatag-media-og:image=(:tutorial:animated-textures:rock.gif)
}}
{{tag>tutorial texture animated material}}
====== Animated Textures ======
Creating and using animated textures in PAC.
===== Requirements =====
==== VTFEdit ====
Download {{ :tutorial:simple_mdl:materials:vtfedit133.zip|VTFEdit}}, open the archive and extract the **x64** folder. ((It might not work on some systems, in that case use **x86**.))
===== Creating Textures =====
==== Getting image files ====
To create an animated texture file you'll need a sequence of image files, you can get them by converting existing animation files such as .GIFs or creating them yourself. There are multiple methods of acquiring those files, some of them will be listed here but you can use your own methods if you prefer.
If you already have the image files you can skip to [[#Creating animated .VTFs]]
* [[#tab-gif|Converting .GIF to images]]
* [[#tab-webm|???]]
- Go to [[https://ezgif.com/split/|EZGIF.COM]]
- Click on Browse/Choose Files and select your file
- Click Upload!
- On the next page you'll see a bunch of tools that you can use to edit your .GIF, they are optional and won't be covered here but feel free to use them {{:tutorial:animated-textures:ezgif_tools.jpg?direct|}}
- Once you're done editing, select the **Split** tool
- Scroll down to **Split options**:
- If your .GIF is transparent select Output images in PNG format
- If your .GIF is **NOT** transparent select Output images in JPG format
- Click Split to frames!
- Click Download frames as ZIP
- Open the .ZIP file and extract all the files to a folder
????
==== Creating animated .VTFs ====
This section explains creating animating .VTF files from image sequences. If you already know how to do this and just want to know how to use those files in PAC, go to [[#Using animated .VTF files in PAC]]
- Open **VTFEdit** and click on File -> Import
- Navigate to the folder with your images, select all of them and click Open
- In the **VTF Options** window
- Set **Normal Format** to DXT1
- Set **Alpha Format** to DXT5
- Set Texture Type to Animated Texture
- //(Optional) If you want to reduce the size of your texture, you can use the **Clamp** option and set the **Maximum Width and Height**//
- Click OK
- Go to File -> Save As...
- Name your file and click Save
===== Using animated .VTF files in PAC =====
- Upload the **.VTF** file -> [[tutorial:hosting]]
- Add a [[:part:model]] to your outfit
- If you're looking for a flat, one-sided model -> {{ :tutorial:animated-textures:flat.zip|Use this .ZIP as your model}}
- Attach a [[:part:material]] to the model
- Paste the **.VTF** link into the basetexture field
- Attach a [[:part:proxy]] to the material
- Set variable to frame
- Set expression to time()*fps where fps is the number of frames per second
===== Examples =====
==== Expression: Reset when shown ====
Expression: **timeex()*fps**
----
**fps** - frames per second
----
Example: timeex()*24
==== Expression: Frame range ====
Expression: **start_frame+(timeex()*fps)%range**
----
**start_frame** - the frame that you want the animation to start on
**fps** - frames per second
**range** - how many frames you want to play
----
Example: 5+(timeex()*24)%10 --- Starts on frame 5 and plays 10 frames
==== Expression: Play once ====
Expression: **min(timeex()*fps,end_frame)**
----
**fps** - frames per second
**end_frame** - the frame that you want the animation to stop on
----
Example: min(timeex()*24,68) --- Plays until frame 68
{{:tutorial:animated-textures:rock.gif?direct|}}
==== Simple Animated Texture ====
Texture used: {{ :tutorial:animated-textures:rock.vtf |}}
Expression: time()*24
{{fa>download?color=#7ab353&fw&lg}} **Download:** {{:tutorial:animated-textures:animated-texture.txt}}
===== Additional Information =====
Replacing materials -> [[:tutorial:replacing materials]]
Proxy expressions -> [[:part:proxy]]