Author
Topic: Tile Blending (Read 3494 times)

I have been toying with jPCT for over a year now, and have created a lightweight "game engine" that I use for something I call my 3D digital world project, and a few utilities.

Here is a preview of the map editor utility, and the million dollar question is: how can I blend the tiles?

I've looked at the terrain release, which features some sort of blending, but I wasn't able to get what I needed out of it.A nice explanation on how to approach blending tiles would be excellent, because I feel it would take my project to a new level (in terms of visual appearance).

I was the one to actually write the terrain code he is using right now (which was also based off a generation example).

What I did was generate each tile with 2 polys (trigs) and there are a specified amount of tiles in an object. Each object is also a "Region" in code and they are just placed adjacent to the previous Region/Object.

He wanted me to let you know how it worked. But if he wants tile blending, he will also have to blend through multiple objects to make the Region->Region blend for edge tiles.

Quick note: If this map editor is ever completed, I plan publishing for all jPCT users, with some instructions on how to use it in hopes that it will help people design maps for their games, with ease, and implement them into jPCT powered games

Difficult...i have no clever idea for solving this. The terrain example that you are referring to uses vertex alpha to do the blending. That requires multiple rendering passes and to use alpha values for blending, you actually have to have something to blend into. In your case, that would mean that objects would have to overlap/tiles which against the idea of using tiles.In my current Android project, i'm using shaders and a splatting texture to do it, but again, this doesn't transfer very well to tiles. IMHO, i might work best to create additional textures that do the blending, i.e. if sand touches grass, create a texture in which sand slowly fades into grass. One of the earlier jPCT projects (Technopolis) did that and the results were pretty nice:

Difficult...i have no clever idea for solving this. The terrain example that you are referring to uses vertex alpha to do the blending. That requires multiple rendering passes and to use alpha values for blending, you actually have to have something to blend into. In your case, that would mean that objects would have to overlap/tiles which against the idea of using tiles.In my current Android project, i'm using shaders and a splatting texture to do it, but again, this doesn't transfer very well to tiles. IMHO, i might work best to create additional textures that do the blending, i.e. if sand touches grass, create a texture in which sand slowly fades into grass. One of the earlier jPCT projects (Technopolis) did that and the results were pretty nice:

Alright. I already have a set of 100 tiles that match the ones in the image I posted, for manual blending, from a previous 2D project. You think it will cause any overhead having 100 tile textures + game assets loaded? If so, is there a solution? I'm using raft's texture pack.

Alright. I already have a set of 100 tiles that match the ones in the image I posted, for manual blending, from a previous 2D project. You think it will cause any overhead having 100 tile textures + game assets loaded? If so, is there a solution? I'm using raft's texture pack.

It will use more memory of course. On Android, this might be an issue...on a current desktop machine, i don't see a real problem with that approach.

Can you provide a good example of texture splatting on a terrain type mesh? I'd be curious to see and/or re-write the terrain stuff he has now to utilize your method.

I'm not sure what you mean by "good example"...the basic idea is simple: You use different texture layers where one is the splatting texture. The splatting texture contains the intensity of each of the other layers coded into rgba values (i'm using rgb only, but you might want to add alpha to the mix). The shader then mixes the remaining layers based on the color in the splatting texture at that particular point. In addition, you can use the splatting texture to place entities (like: No trees or grass on paths and things like that).