It's pretty simple. Have you ever animated something in Unity?
Create a new animation track in the Project window, drag it onto your model, open the Animation window, press Record, move the timebar forward in time somewhere, adjust the Offset in the material, the press Play. Presto!
Edit... I'm moving this to the Unity subforum for you. You'll usually get faster replies if you post in the right forum.
well, yes, I have animated in unity. And used mecanim, etc. But was looking for an in-depth tut Animated UVs and why they are better than texture offsetting, like less drawcalls, etc, and more tips and tricks. I am thinking of using this technique in production and hence wanted as much pros and cons as possible.
Animating UVs in Unity is probably more expensive than just using a texture offset in the shader.
You've basically got to update and write the UVs to the mesh every frame in your script. That's still going to create a unique mesh instance so it's an extra draw call anyway.
If you just want 2D sprite animation, you can just select the sprites that make up the animation and drag them into the hierachy. A prompt to save your animation should pop up. Just hit save and you are done.
What if I'm not actually interested in Sprite animation, but want a sprite-esque style of animation applied to a 3D model? It is an approach that was used during the 32-bit era to animate basic expressions on 3D characters faces.
Of course, if I really wanted to do that, I could separate the character's face into a different material, and handle it that way. (and handle the texture offset per area that needs animating) You would have to get a little creative, and probably have to dig into some custom Materials and Shaders, but it's doable.
What if I'm not actually interested in Sprite animation, but want a sprite-esque style of animation applied to a 3D model? It is an approach that was used during the 32-bit era to animate basic expressions on 3D characters faces.
In Unity you can still use a sprite for this. Unity's sprites are not only 2D but can also work in 3D space.
Unity's sprites are not only 2D but can also work in 3D space.
Yes, but I'm not talking about just hovering a single sprite over a model, I'm talking about more of a render-to-texture approach.
Though, I suppose you could actually use the render-to-texture feature in conjunction with a sprite to do exactly what you're describing. It would be a bit of a round-about approach to the problem, but if performance wasn't a huge issue, it would certainly work.
In previous versions of Unity you would have to have Pro in order to try something like that. But now with the more feature-complete personal edition in version 5.0, render-to-texture is available. If you wanted to composite a model's texture out of some sprites and an orthographic camera, you totally could.
Replies
Create a new animation track in the Project window, drag it onto your model, open the Animation window, press Record, move the timebar forward in time somewhere, adjust the Offset in the material, the press Play. Presto!
Edit... I'm moving this to the Unity subforum for you. You'll usually get faster replies if you post in the right forum.
You've basically got to update and write the UVs to the mesh every frame in your script. That's still going to create a unique mesh instance so it's an extra draw call anyway.
the above vid piqued my interest and succinctly explains why animating UVs is better than texture offsetting.
You should have said you're talking about sprite animation.
If you're searching for more info, try "unity sprite animation uv". The third hit on Google is for SpriteManager, might be what you want.
aahh, good point. Just dont have too much experience with 2D. Have always developed for 3D. First, small projects. Now semi-big indie game.
Of course, if I really wanted to do that, I could separate the character's face into a different material, and handle it that way. (and handle the texture offset per area that needs animating) You would have to get a little creative, and probably have to dig into some custom Materials and Shaders, but it's doable.
In Unity you can still use a sprite for this. Unity's sprites are not only 2D but can also work in 3D space.
Yes, but I'm not talking about just hovering a single sprite over a model, I'm talking about more of a render-to-texture approach.
Though, I suppose you could actually use the render-to-texture feature in conjunction with a sprite to do exactly what you're describing. It would be a bit of a round-about approach to the problem, but if performance wasn't a huge issue, it would certainly work.
In previous versions of Unity you would have to have Pro in order to try something like that. But now with the more feature-complete personal edition in version 5.0, render-to-texture is available. If you wanted to composite a model's texture out of some sprites and an orthographic camera, you totally could.
http://wiki.unity3d.com/index.php?title=Animating_Tiled_texture
I use the same technique for looping animations of pre-rendered particle effects that I place on a single quad. It's useful in particular situations.