Apply Texture to Custom Mesh (Terrain)

Hello All,

I have an issue I am trying to figure out how to approach best.

Situation (with Images):

I have a flat Mesh (plane) with 100 Quads (10x10). I have a script that raises a Quad and creates the quads that make the walls of this newly raised Quad. Now I have a pillar like thing on my terrain. The top side is always a grass texture, while the walls should be dirt or rock textures. This all seems to work for now (with small glitches :slight_smile: ), but I would like this Mesh to look more realistic.

I create my mesh by generating it procedurally and creating the triangles & quads and applying texture to them using the uv coordinates. My actual texture file is a 64x64 image. It has 4 tiles (32x32 each). One grass, one dirt, one rock & one snow.

Problem:

How do I make the texture from the top Quad (grass) spill over to the walls a little bit ?

Currently is like this :

32180-rightnow.png

Would like it like this :

32181-wouldlike.png

Side Note : In the above I drew a black line on the edge to demonstrate the idea, but ideally the edges of the cubes would not be so visible in order to make the terrain more life like. It would be perfect if i could make it look more rounded around the edges ( from my research I suppose I can do that with Normal Maps. )

Back to the texture spilling over : I tried searching for other approaches all together, but did not find them or could not wrap my mind around them.

Question:

  1. How can I achieve the desired effect described above, or
  2. Considering what I am trying to do, what other approaches are there for creating a more realistic textured terrain.

I am assuming that a programatic solution would be best because the tile types might increase, so creating textures for all possible combinations and applying them would be a bit too much (ex. rock with spilled over snow or grass, sand with spilled over grass, snow or dirt and so on.

I hope I explained the situation clear. Please help. Any input is highly appreciated.

This is quite hard to achieve from scratch imo and unfortunately I can’t provide a perfect solution. But I can give you some ideas about this:

  • This programmatic blending requires a custom shader. I don’t know about your skills in shading language, but this would be something like multiplying two textures depending on the Y coordinate. Also I am not sure how this would work combined with your procedural mesh generation.
  • The rounded edges you want are almost impossible to achieve with a blocky mesh like this. (at least as far as I know) This would only work with 1. no light (therefore no shadows) and 2. from only one special point of view (or MAYBE with Parallax occlusion mapping …). As soon as you changed the point of view, you would see the edges.

The fastest, easiest and best looking solution here most likely is to create different textures for all those combinations. Minecraft did the same. :wink: