5
$\begingroup$

TLDR: I'm trying to figure out the best method of mixing textures across UV edges in a dynamically textured mesh. For instance, if you have a plane with 4 faces and each one has a non-seamless texture applied to it, is there a way to mix the textures across the edges?

I'm making an adventure game where the terrain is dynamically generated. I've considered a few methods of texturing each face if the terrain but I run into problems with seams in the UV mesh. I've been pointed to Cycles but, and this was a while ago so I might remember wrong, I had problems getting it to work in the BGE. I was pointed to video textures, but I think there was still an issue with seams.

I tried, at one point, using the RGB color channels but I ran into an issue with only having 3 or 4 possibilities for texture. I think it was one default, and one for each color. And this also caused obvious squares, as I was applying this by vertex colors.

As an example I might shift from grass to dirt, and the edge this happens along should fade from a green grass texture go a brown dirt texture. At the moment it looks more like Minecraft, with an obvious seam between blocks.

What method should I look at? I like the idea of making a single image with each type of terrain painted in a grid, and moving UV's to change terrain type on the mesh. This is easy enough but I can't fade the textures together.

$\endgroup$
5
  • $\begingroup$ @MrZak I'm out, so I'll try your second option when I get home. But your first option is something I tried already. One default image and three other images, one for each color. Is there a way to use more colors? According to that video I'm limited to 4 textures. $\endgroup$
    – Daniel
    Jul 2, 2015 at 21:55
  • $\begingroup$ Mind providing a screenshot of your nodes? Also, I found something that says procedural textures don't work in the BGE. Does this apply? blender.stackexchange.com/questions/5701/… $\endgroup$
    – Daniel
    Jul 3, 2015 at 0:18
  • $\begingroup$ Are you sure you want to even mess with UV mapping? And how would UV maps be created if the terrain is generated automatically? Seems like you'd be better off having the textures fade/mix in relation to proximity of Empties. One Material with multiple textures, that fades between them depending on what kind of Empties are nearby. You could establish a naming convention for the Empties to control material type ("tex_ctrl.grass04", "tex_ctrl.rocks01" etc.), and Empty scale could control influence radius. If you could program that into your game I think you'd have a solution. $\endgroup$
    – Mentalist
    Jul 3, 2015 at 8:33
  • $\begingroup$ @Mentalist How would you fade between them? Is there a keyword or some set of keywords I should look for? Video textures, or one of the shader types? I'm messing with node colors right now. To answer your question, no I don't need UV mapping. I'm really just going with whatever I'm familiar with already. I have what I like to call a swiss cheese's knowledge of Blender. I like the idea of the node color thing, but it seems you're quite limited in the number of textures you'll be allowed to use based on color channels. Granted, I could be thinking narrowly about how to use nodes. $\endgroup$
    – Daniel
    Jul 3, 2015 at 14:56
  • $\begingroup$ I would just use texture paint $\endgroup$
    – PGmath
    Aug 2, 2015 at 18:23

2 Answers 2

5
$\begingroup$

Here is an example to illustrate how you can use Empties to control some aspect of your material - in your case textures. This is how it is done in Cycles, so hopefully you are able to carry this concept over into your game code.

Just a basic black and white spherical gradient appearing on a simple landscape object. The placement and size of the gradient are determined by the Empty (it's located where the 3D Cursor is in the screen shot). The Color Ramp is for controlling the falloff.

An example of how Material color can be controlled using an Empty

And here is an example of what this technique can produce when you have multiple Empties and they are actually controlling textures instead of just a color result. In the screen shot below two Empties are used against a base grass texture.

An example of how Material textures can be controlled using Empties

$\endgroup$
6
  • $\begingroup$ I'm adding this comment in advance, because I don't know how long it's gonna take me to copy what you've done. But I wanted to say that, if you're using Cycles rendering, I don't think this is possible. I've been reading that procedurally generated textures cannot be used by the BGE. I think that's why the Video Texture was added, because it occurs external to BGE rendering. It simply swaps out the source and the BGE remains ignorant. $\endgroup$
    – Daniel
    Jul 3, 2015 at 16:18
  • $\begingroup$ A link to one discussion on this. blender.stackexchange.com/questions/5701/… $\endgroup$
    – Daniel
    Jul 3, 2015 at 16:31
  • 1
    $\begingroup$ My answer was to address how you can mix the textures in a way that can be dynamically generated, and save you from relying on UV mapping. I don't know enough about the BGE to answer beyond this, so it seems there is a part 2 to your question, which is how to do something similar in the BGE. I think you can use this technique, but the setup will be different since the BGE is a different render/game engine. The technique is not "procedural", as no procedural textures are used. It's really just masking, same as you'd do in an image editor, but the masked-in area is generated by Empties. $\endgroup$
    – Mentalist
    Jul 3, 2015 at 16:33
  • 1
    $\begingroup$ @Daniel You can bake the diffuse in cycles and use that in BGE. $\endgroup$
    – PGmath
    Aug 2, 2015 at 18:13
  • 1
    $\begingroup$ @Metalist - I wanted to say, it's been a while, but this did end up working out for me. Thanks for the help. It's been a lot of fun using this method. $\endgroup$
    – Daniel
    Jun 13, 2018 at 10:51
4
$\begingroup$

I think what you are looking for is texture paint. Texture paint allows you to paint a texture directly onto your 3D model in Blender.

Here is a simple introduction to texture paint:

  1. Unwrap the model. The great think about texture paint is that it doesn't have to be a perfect job of unwrapping since you will be painting in 3D space so seams don't really matter.
  2. Go to the UV/Image Editor and create a new image with the new button.
    enter image description here
    It will prompt you to set the size and name of the new image, remember what you call it.
  3. In the 3D view go to texture paint mode.
    enter image description here
  4. Bring up the toolbar with T (if it isn't up already) and go to the slots tab. Make sure the painting mode is set to image, select the image you just created for the canvas image, and select the UV map you are using (if there is only one it will select it by default).
    enter image description here
  5. Back in the tools tab scroll down to the texture rollout and set up the texture you want to paint onto the object. I would also set the brush mapping to tiled, but play around with it to see what works best for you.
    enter image description here
    You can change the texture's settings in the texture panel of the properties view. Make sure you are editing the brush texture.
    enter image description here
  6. Now you can paint your texture onto the object however you like it.
    enter image description here
  7. When you are through go back to the UV/image editor and save the image using image > save as image. IMPORTANT NOTE: Make sure you do this before you exit Blender, if you don't it will go away!
    enter image description here
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .