Does unity support or do vertex blending of textures?
I’ve been searching the forums and wiki for a good while now and all I seem to find is info relating to the terrain tools and alpha blending - which are admittedly two other ways to blend textures. But I’ll be a monkeys nephew if I can’t seem to find any info on using the vertex blending. Is it actually possible?
I wrote one yesterday. (At least, I think this is what you’re talking about. It’s still alpha blending, but the alpha channel comes from the vertices, not a texture.) This is the simplest possible case, but maybe you can cut and paste the shader code if you need it to be more powerful. Or if you need it to be more interesting, and it can run on the iPhone, I’ll help you out so that we both can use it in the future.
Interesting, going to reply in your topic… I did manage to find another code snippet (actual post) after reading a few pages of posts but not being familiar with Unity’s shader language means not knowing at a glance what works.
[EDIT]forgot to add… what I’m basically looking for is a way to create a two texture blend based on vertex colours painted to a mesh. Say you have a brick wall and you want to add a variable ‘dirt layer’ where it touches the ground, you’d apply a default ‘white’ vertex colour over the mesh for the bricks and ‘black’ as the dirt, the two mixed depending on the intensity of the white/black mix.
As far as I understand Unity ‘alpha blends’ work by using either a ‘splat mask’ or the ‘alpha layer’ (alpha channel) of the texture asset itself. The former relies on a mask, which is difficult to match to objects and the latter effectively works like a ‘noise’ filter, tiling the mixture as the texture tiles.
I’m sort of surprised Unity doesn’t appear to have a vertex blend shader as a default; except when used in principle on terrains.
Wow. I wrote that shader and put it on the wiki, after I had mentioned to someone else in another thread how to do it. I remember seeing the thread you linked, but when I saw it, I didn’t know how to use ShaderLab and skimmed right over. :o
However, that’s neither based on vertex colors nor a texture. It’s just a float/slider.
Edit…
That’s exactly what I linked you to.
There isn’t a “Unity alpha blend”. You just need a shader that gives you what you want, and Unity can only provide so many built-in shaders before it’s completely cluttered. (I think it is already.)
I find writing shaders to be a lot easier than general-purpose programming, but I had to pick all this stuff up on my own; I think it’s a matter of computer scientists not being educated in writing shaders the way they are with general-purpose code. It certainly is harder to find resources on writing shaders, but shading languages are so simplistic by comparison to anything else, I find it odd that more people around here aren’t into shader writing, considering how programming- and math-educated so much of this forum seems to be.
I’m not sure what you’re saying here. These function the same way, but a splat map tends to be 4 channels instead of one. You can use tiling textures and an alpha mask. You just need to use two UV sets for practicality.
Ah yes, just tested it, all it does when applied to a mesh is transition from one texture to another using the slider, exactly as you mention, not exactly the kind of “blending” I’m after… heh.
Will try yours next
Interesting side points about this forum being ‘math’ orientated… you usually find that on ‘engine’ forums; places that have a per chant to creating games rather than assets or content tend to have a ‘left brained bent’ which is not as easy for artists to pick up on - it’s as abstract to ‘artists’ as creating good 3D models is to a ‘programmer’.
With regards to the ‘alpha’ blends, I come from a different background with game editing so “alpha blends” may mean something slightly different in functionality in Unity than it does elsewhere. I don’t know that difference yet