0

Have an idea to set the texture to 3D material slowly. It would be like some animation, that change previous texture to new sloowly from bottom to top.
I need it to my game... Can't find the solution...
Can you help me with this problem?

GuardFromUA
  • 139
  • 1
  • 2
  • 13

1 Answers1

1

Create a new transition material that would use 2 textures and some 'transition amount' float in a [0-1] range. Use your custom shader to do the transition in a way you want.

Then, when you want to start animation replace initial material with your new one and start animating your 'amount' parameter. When you end the animation then set the basic material back, but with 2nd texture.

This way you'll avoid costly modifications of texture pixels and move all the work to GPU shaders.

kolenda
  • 1,370
  • 9
  • 12
  • Writing a custom shader to do this--assuming your base material is simple and can be easily replicated--is fairly easy and straight forward. It's very close to what the first shader I ever wrote was. – Draco18s no longer trusts SE Apr 26 '17 at 13:38
  • Yes yes yes - this is infinitely a better use of processing power than using Texture2D.SetPixel. It might take a little more effort up front, but it'll pay off in the long run. – Jesse Williams Apr 26 '17 at 18:35