Topic: Transparent tile support?

Hi Alex,
I have a list of directories that I load tiles from. Think of them like layers. For example, one directory contains “blue marble” tiles and the other contains high resolution tiles. I wrote a custom tileset loader that is similar to CustomDownloadTileExample and I’m using the default tile shader.

The tiles in the high resolution directory are semi-transparent. Unfortunately the transparent parts of the image appear black on the map. This is because there is no image underneath them. I would like the low res tiles to show through the transparent areas.

I see a few options:

1. Add code to my custom tileset loader to load the low resolution texture and assign it to tile.overlayBackTexture. Unfortunately I don’t know how to size/offset them correctly. It also means I’ll be loading this low resolution texture from disk multiple times.

2. Is there something you could add to OnlineMapsTile when I load a texture that would tell OnlineMapsTileSetControl.UpdateMapSubMesh to assign a low resolution texture to tile.overlayBackTexture? Similar to what you do in the while loop at OnlineMapsTileSetControl.cs:1527.

3. Add a new function to OnlineMapsTile that would return me a Texture2D of whatever it has already loaded?  Example: Texture2D OnlineMapsTile.GetExistingTileTexture(zoom, x, y). I could then assign this to  tile.overlayBackTexture when I load a transparent texture. This will consume more memory though.

Any other ideas?

Re: Transparent tile support?

Hello.

OnlineMapsTileSetControl.OnDrawTile is called for each drawn tile, and you can do incredible tricks using this method.
Example is attached.

You can store any of your data in OnlineMapsTile.customData.
If you need to store more than one object, just create a class with your data, and store the reference in this variable.

I do not see the point in OnlineMapsTile.GetExistingTileTexture, because you have direct access to OnlineMapsTile.texture and OnlineMapsTile.overlayBackTexture, so you can just use it.

Post's attachments

Attachment icon TilesetFadeExample2.cs 12.17 kb, 280 downloads since 2017-03-28 

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.