Can stencils be utilized for material blending?

So I don’t (yet) know much about stencils, and was wondering if they can be utilized to visually blend two models (with different VertexLitGeneric materials) together, resulting in material blending:

Do you think this is possible? Or do they not allow for this sort of gradual masking? Would appreciate any insight!

I know this is incredibly unhelpful and pointless, but I just wanted to say that in Hammer, there are certain materials that are a combination of two textures that let you use displacements to create a similar result to what is seen in the image above:

http://twhl.info/tutpics/creating_blend_textures_for_displacements_2.jpg

Of course, you probably already knew this, or you want to do it with Lua, not Hammer.
Sadly, I don’t know how this could be done (unless you somehow spawn a displaced surface).

[editline]1st September 2017[/editline]

I think the shader used for this is World Vertex Transition, or maybe Lightmapped 4 Way Blend

Thanks, if I’m not mistaken this option is indeed only supported for [del]LightMappedGeneric[/del] ^whatyousaid materials. As to displaced surfaces, I don’t think they’re necessary, I’d be happy with a simple gradual fade as well.

Yeah, actually source 1 uses a kind of vertex alpha to decide between wich texture should use, now source 2 uses vertex color to use multiple layers of textures

I’m not entirely sure what you’re asking - what do you have and what do you want to get? It sounds to me like you might have some luck if you look for a shader that does what you want. You can look for available shader at https://developer.valvesoftware.com/wiki/Category:Shaders and http://wiki.garrysmod.com/page/Category:Shaders although as you can see, a lot of documentation is missing. Don’t rule out WorldVertexTransition, it might be just what you need.

If it turns out that stencils are indeed what you need, I’m pretty good with that so I can help you via the usual channels… :wink: