2D Tilemap using shaders

Update: an updated version can be found here

Recently I had been wondering if I could create an easy way of rendering a 2D tilemap with a low amount of verts and drawcalls. My solution was to create a custom shader that will select the correct tile and draw it. This means I can draw a complete tilemap with just 1 quad/2 triangles. For the input I generate an extra texture that has the tilemap information. Currently there is space for animation in the texture but atm I haven’t programmed that yet.

Continue reading