- Home /
How do you create an animated texture for a UV'd Mesh and apply it?
Hello UnityAnswers! I've been searching around the internet for a potential solution to my problem for the past 6 hours now, and to no avail.
Here's the problem
I've created a ceiling lamp model, and from that model I have 2 textures and 2 materials, one set used for an "On" lamp and the other set for an "Off" lamp based on their respective prefabs. (You can see my file structure here). These two lamps are working nicely so far, but there's something I'd like to do with the "On" lamp, which involves a very subtle animation. I decided that the way I was going to do this was by having separate images for the different frames of the animation, the ol' traditional way.
This is my problem in particular, there seems to be no obvious way of having a looping frame by frame texture animation for a 3D mesh so far that I can perceive in Unity. I do understand that there may be potential of having some code that runs the images in a for loop, or perhaps a Shader that can do the whole animation; except that there seems to be no clear or present step-by-step walkthrough on how to do so.
Long story short, how would I go about turning these:
into this, but in 3D space inside Unity on a Mesh (warning, the animation is very subtle):
http://wiki.unity3d.com/index.php?title=Animating_Tiled_texture
http://wiki.unity3d.com/index.php/Animating_Tiled_texture_-_Extended
The "best" way to do this would be to animate the mesh UV's (which is not what the above two scripts do). Third-party programs make this easier.
Answer by Eric5h5 · Jun 01, 2013 at 05:33 PM
Ideally you would combine those textures into a single texture, then you can just change renderer.material.mainTextureOffset as appropriate. This would involve remapping the UVs of the model to accommodate the larger texture, but that only has to be done once.
Thank you very much! I now have a light with a nice glow after tweaking around and making a texture atlas. Very pleased with the result
Your answer
Follow this Question
Related Questions
How to distort background images? 0 Answers
How to change textures over time? 0 Answers
reset 2d animation(sprite sheet texture) 0 Answers
How do I create my own character in Unity 3-D? 2 Answers
Specific texturing 1 Answer