Which is more common: Apply texture on TileMapLayer with separatae mask or mask is coded in the tileset

Godot Version

4.4

Question

Hello,

i’m new to Godot and game development in general. I have a TileMapLayer node and i want to fill the tiles with a pattern via shaders. I found two solutions and i’m not sure what is best.

Solution A) Shader mask is coded in the tileset directly.

I have this tileset:

As you can see, there is dark brown border and a red filling which has alpha channel information. I use the shader to fill all areas which have alpha and red channel. I can do this all in one TileMapLayer but the border become very hard on one side, where the pattern comes in contact with the border. But you can only see this, if you extremely zoom in.

Solution B) Separate mask information from the tileset

Now i have two tilesets.

The mask:

And the borders:

The mask is a little bit larger than the border, so that the mask extends just a little bit into the border. Now i have two TileMapLayer. By code the mask is drawn on the second TileMapLayer when the border is drawn on the first TileMapLayer. The Mask is filled with the pattern which lies below the border layer. This results into soft outlines because the borders are not cutted by the pattern.

Which method is more common or just better? I have no idea how this is usually done.

I see these pros and cons:

A)

  • + just one TileMapLayer
  • - hard cutted borders
  • - The alpha channel in the tileset is sacrificed for the mask

B)

  • + color information in the tileset is not affected
  • - two TileMapLayer and two tilesets required
  • - more complex
  • - maybe poorer performance?
1 Like