2
\$\begingroup\$

I'm new to Blender and Unity and trying to figure out the best way to create a material that will use either vertex colors or a texture map to interpolate between other textures on a single mesh. This is the sort of effect you might use when you want to have a big grassy terrain mesh with a dirt path running down the middle of it and patches of rock here and there - and instead of modeling each of those as separate pieces, you create a single shader that takes a grass, dirt and rock texture map and uses a fourth blending map to decide which to sample from.

I come from a Maya background which provides an HLSL material shader that makes this straight forward. It's not as clear to me how to do this in Blender, and in particular the best way to set it up so that it imports into Unity cleanly. I suspect that setting up the shader using Blender's cycles shading network won't create anything Unity can recognize. Blender also has the Open Shading language, but again I'm unsure how well this will work with Unity.

I could also bake all my textures, but this strikes me as wasteful of memory and bandwidth.

I have experience with both HLSL and GLSL. Is trying to do this with custom shaders the best way to do about things? What's the best way to set things up so that both Blender and Unity are happy?

\$\endgroup\$
1
\$\begingroup\$

After playing around with things, I've decided to use Blender's stencil map feature (which is a reduced sort of splat map). It allows me to blend between two tileable textures on the same surface using a third as a stencil without having to use huge textures.

I also had to write a custom shader in unity to have my stencil material display, but that wasn't too hard to do.

|improve this answer|||||
\$\endgroup\$
0
\$\begingroup\$
  1. Look for Vertex Paint from Unity3D asset store. This allow you to mix texture easily.

  2. Have a look at ShaderForge too. If you have experience with HLSL, once you familiarize yourself with ShaderForge, you can do wonders.

|improve this answer|||||
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.