Hello, I’m trying to make a particle multiply shader that can simply blend between two textures. I have looked into unity’s docs on shaders, but I was unable to find much regarding how I might incorporate a slider into controlling the opacity of a texture in a multiply shader. Does anyone know how I might go around creating such a shader? I really don’t have much experience in shaders and would be appreciative of any help I can get. I have included the code of the shader I would like to modify below. Thanks for any help!
Edit: I am sorry, I did not make myself clear enough. The trouble I’m running into comes from the fact that to my knowledge particle shaders (which I think are vertex shaders) – like multiply – cannot be coded as surface shaders.
Using a surface shader, its very possible to make a shader such that a slider can control the opacity of two textures. The idea is that a slider when at its min shows one texture, at its max shows a second texture and in-between shows both textures simultaneously at varying opacities.
I’m trying to mimic this effect in a vertex multiply shader such that I can use the shader to ultimately which can blend between two different texture maps in realtime. How can I create such a shader? Any pointers would be wonderful!
See if this works for you, i simply copied the internal multiply particle shader and added a second texture that lerps from the alpha of the color (color of lifetime) the problem with this is that now you lose the ability to change the alpha of the particle (because it now controls the lerp), so my question still stands, how do you want to blend between the two?
Thanks so much for taking the time to write that. However, it’s still not working quite the way I want. It looks like the lerp function is taking in the alpha of the main texture, would there be any way for it to instead take in the value on the slider? I suppose I’m not fully understanding your question. I’m looking for a shader to do a linear blend between the two textures so that you could slide the sider from 0 to 1 and see the material’s view texture change from the first texture to the second. What ways are there to blend between two textures? Thanks so much for your help.
Edit: Awesome! Literally just did what I said – changed the input on the lerp function to take in the slider’s value instead of the texture alpha and was able to achieve what I was aiming for! Thanks so much!
If its working for you i’m cool but what i gave you was already lerping using the slider alpha value of color over lifetime, it wasn’t lerping using the texture alpha at all
i.color.a is the vertex color and the lerp is doing a lerp between _MainTex and _FinalTex using i.color.a to do so, i then multiply it by the vertex color without alpha to tint the textures normally