I don’t normally do a lot of work with shaders, but I’m interested in making a (cheap) shader that can morph between two diffuse textures by using a numeric input (0 to 1). That number could be manipulated from a dynamic element within the game such as a slider, time delta, etc.
If anyone could get me pointed in the right direction I would greatly appreciate it.
A month later and I’ve finally gotten ready to implement this specific part of my app. This shader works great (thanks by the way) but it doesn’t currently receive any light. How would I go about making this vertex lit?
Tell me how this works out for you. As it is, there is a difference around the edges of the specular highlights, at least when switching between the graphics emulation modes in the Editor. I doubt that’s going to make any noticeable difference in-game, but I am starting a new thread about it; I think it might be a bug.
(I don’t believe this shader can be done in a single pass on the old devices. So it will run faster on the 3GS and later.)
Edit: As displayed in that other thread, there can be a VERY noticeable difference in terms of specular lighting between the Editor and the device! Hopefully this is a bug that can be squashed soon.
For anyone else looking at this thread, Mattimus and I have been PMing a bit. He wanted the shader to match the brightness of the default Unity Vertex Lit shader instead of being at half strength. Here are a few shaders (all of them only use ambient and diffuse lighting, because Mattimus did not need specular or color tinting):
Blend Textures to Match matches the lighting exactly but adds the ability to blend textures.
Personally, I don’t like the way that the built-in shaders allow for blown highlights on textures, so Better Vertex Lit matches the brightness of the built-in shaders, but textures can only get as bright as you paint them, not 2x as much.
Blend Textures matches the lighting of Better Vertex Lit but adds the ability to blend textures.
Finally, Vertex Lit is a replica of the built-in Unity VertexLit shader, but it takes out all the stuff that Mattimus doesn’t need. This will at least make it simpler to modify materials, but it might also make the shader run faster. (I don’t know enough about GPUs to know that for sure, however, but it certainly won’t hurt.)