Author Topic: Tile Blending  (Read 6700 times)

Offline Minigame

  • int
  • **
  • Posts: 55
    • View Profile
Tile Blending
« on: February 01, 2013, 10:48:56 pm »
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).

Thanks

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Tile Blending
« Reply #1 on: February 01, 2013, 11:01:33 pm »
Each tile is an individual textured object?

Offline Minigame

  • int
  • **
  • Posts: 55
    • View Profile
Re: Tile Blending
« Reply #2 on: February 01, 2013, 11:26:58 pm »
Edit:
Bryan will provide a proper response, as he was the original author for the map editor and knows more about it.
« Last Edit: February 01, 2013, 11:33:07 pm by corey »

Offline Bryan

  • byte
  • *
  • Posts: 26
    • View Profile
Re: Tile Blending
« Reply #3 on: February 01, 2013, 11:32:08 pm »
Each tile is an individual textured object?

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.

Offline Minigame

  • int
  • **
  • Posts: 55
    • View Profile
Re: Tile Blending
« Reply #4 on: February 02, 2013, 02:22:08 am »
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 ;D

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Tile Blending
« Reply #5 on: February 02, 2013, 09:30:47 pm »
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:

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Tile Blending
« Reply #6 on: February 02, 2013, 09:39:52 pm »
It has nothing to do with the question, but project Technopolis looks really nice!

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Tile Blending
« Reply #7 on: February 02, 2013, 09:43:38 pm »
It has nothing to do with the question, but project Technopolis looks really nice!
Yes, but it has been abandoned years ago... :( It really pushed jPCT to its limits (at that time) and i added a lot of stuff just for it (...like i did for your project too... ;) ).

Offline Minigame

  • int
  • **
  • Posts: 55
    • View Profile
Re: Tile Blending
« Reply #8 on: February 02, 2013, 10:13:32 pm »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Tile Blending
« Reply #9 on: February 02, 2013, 10:49:47 pm »
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.

Offline Bryan

  • byte
  • *
  • Posts: 26
    • View Profile
Re: Tile Blending
« Reply #10 on: February 03, 2013, 03:17:44 am »
So what if things weren't tile based. What is the best way to handle terrain, like you said texture splatting for your project but it not translating well to tile based textures.

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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Tile Blending
« Reply #11 on: February 03, 2013, 09:09:03 pm »
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).

Example image: