playMaker

Author Topic: Material lerp action?  (Read 817 times)

twerkface

  • Playmaker Newbie
  • *
  • Posts: 8
    • View Profile
Material lerp action?
« on: November 25, 2017, 05:54:06 PM »
Is there an action or is it possible to use existing actions to emulate Material.lerp to blend between two materials over time?

https://docs.unity3d.com/ScriptReference/Material.Lerp.html

Arnoob

  • Junior Playmaker
  • **
  • Posts: 63
    • View Profile
Re: Material lerp action?
« Reply #1 on: November 26, 2017, 04:08:21 AM »
Not directly, but you can already get/set material floats, colors and vector4.
Simply get the values you need to be lerped from your material. Then lerp them with the usual value interpolation actions (interpolate color, animate float etc...) and set the result to the destination material every frame.

twerkface

  • Playmaker Newbie
  • *
  • Posts: 8
    • View Profile
Re: Material lerp action?
« Reply #2 on: November 26, 2017, 10:24:53 AM »
Ah, thanks. This won’t work with changing between two different textures, will it?

Arnoob

  • Junior Playmaker
  • **
  • Posts: 63
    • View Profile
Re: Material lerp action?
« Reply #3 on: November 26, 2017, 06:55:02 PM »
Sadly no, it is impossible to do it by script, you need to do it with a shader that lerp between two textures.

The closest thing to do that would be to modify the texture itself at runtime, and that's frankly very complicated, especially with playmaker (I am currently trying to create some texture modification actions, but due to fact that you need to use standard arrays,it is really a pain).

I advise you to take a look at Amplify Shader in order to have a visual scripting interface (like playmaker) for the shaders, that's what I use personally, and it's really good for that IMO.