Masking edges for material transitions when using vertex color mask - possible ?

Sorry, the subject line sounds pretty confusing, but I couldn’t come up with a better one :eyebrowlift2:

This is what I have - I have a terrain mesh (island), with several materials (or textures?) blended using vertex colors as masks (sand for the shore line, grass, rock’ish terrain, etc.)

The transition from one material to another is just a simple gradient, so to speak. Is it possible to add a mask to break up that smooth transition and make it look more natural ?

In game engines when 2 textures are blended in the similar fashion, an alpha mask can be used to break up the transition. For example, if sand transitions to rocks, an alpha mask where rocks are white and gaps between them are black, would make it look like a natural transition from sand to rocks with sand going between rocks. Something you can see in this article: http://www.gamasutra.com/blogs/AndreyMishkinis/20130716/196339/Advanced_Terrain_Texture_Splatting.php

How can I do that in Blender (rendering with Cycles) ?

Thanks.

It seems to be a shader code for materials specifically for Unity, but it’s GLSL and can be used in Blender too. I am not sure how to implant it into as a material shader, but there should be tutorials for that on YouTube if its possible. I saw a post somewhere stating it’s possible to use custom shaders in materials. I hope you find your answer!

-Audio Freak

Bump!

Does my question make sense ?

Hi,

It is difficult to know precisely what you mean.
But here are two shaders mixed using vertex paint
Plus adding a little noise


The colour ramp defines how the noise is mixed in
Since the vertex paint provides values 0 to 1 then the noise is is given a value when the vertex pain is 0.6 ish
The noise is heightened by the multiplier to make it more distinct

Hope this helps

Martin

Attachments


1 Like

Thanks!

That’s almost exactly what I mean, except instead of noise it should be an alpha mask (b/w image) that matches one of the textures. Here is an example:

Gravel image (full size): http://s23.postimg.org/43oqk6749/Gravel0170_1_S.jpg

Sand Image (full size): http://s22.postimg.org/505fnny8f/Soil_Beach0131_1_S.jpg

Mask:
/uploads/default/original/4X/c/2/0/c2050082c7b1128c736288e6ef53201bc00b0d96.pngstc=1
full size: http://s23.postimg.org/e4ke205fv/blend_mask.png

Simple gradient blending (mock-up done in GIMP):
/uploads/default/original/4X/e/7/f/e7fa32df7f9f417e79350f0457fa8f345e29c27e.pngstc=1
full size: http://s9.postimg.org/6rsnsi6d9/blend_gradient.png

Masked gradient blending (mock-up done in GIMP):
/uploads/default/original/4X/0/2/6/0264d55dc7e60bdb3592db27b1d0822a74b076a6.pngstc=1
full size: http://s9.postimg.org/cwtcxbd8d/blend_gradient_with_mask.png

How can that be achieved? (note that scaling of the gravel image should be synced with mask image; otherwise the transition will look out of place)

Attachments




Substitute the noise texture with the black and white blend you want to use as an image texture

Attachments


Yep, that worked! Thanks a bunch.

Here is .blend file in case someone is after the same technique: http://www.pasteall.org/blend/41477

Now I wonder if that would work for normal maps too :confused:

Btw, how can I scale up either of the textures without scaling UV map in the UV editor ?

I did - see the post above this one. No custom stuff is needed, thanks to @Martin Norris

You can use a vector mapping between the object vector and the texture vector to change the scale/rotation/offset

Attachments


i converted the shader to a material node a while back but i think i made a misstake somewhere. however this is how it looks

Attachments