# Isometric Tiles Culling

This topic is 3452 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi! I've started a small isometric renderer and now I would like to reduce a bit the draw calls... does anyone know a good tutorial on how to check which iso-tiles are on screen? Thank you :)

##### Share on other sites
It is quite straight-forward to figure that out, have you thought about the following?

1. Store the tiles in a two-dimensional array
2. tileIndexX = screen.x / TILE_WIDTH
3. tileIndexY = screen.y / TILE_HEIGHT

Let's say screen.x and screen.y are in world coordinates and are the center position of the screen in the world, and you know how many tiles fit on the screen, so you can simply do a two-dimensional loop to iterate through exactly the tiles to draw.

Compute the lowest and highest visible tile index along the x-axis:
4. x1 = tileIndexX - NUM_SCREEN_TILES_X / 2
5. x2 = tileIndexX + NUM_SCREEN_TILES_X / 2

Do the same for the y-axis:
6. y1 = tileIndexY - NUM_SCREEN_TILES_Y / 2
7. y2 = tileIndexY + NUM_SCREEN_TILES_Y / 2

8. For each tile x-index , from x1 to x2
->8.1. For each tile y-index, from y1 to y2
-->8.1.1. Draw the tile

##### Share on other sites
but.... for the bottom tiles, you have to extend your drawing algorithm to catch raise block. So, you may think that the bottom row of tiles is X=0 to 20 and Y=10, but if you have a tile at X=10 and Y=8 with height=5, it would be visible in this view.

Hope I made myself clear :)

1. 1
Rutin
65
2. 2
3. 3
4. 4
5. 5

• 18
• 10
• 30
• 20
• 9
• ### Forum Statistics

• Total Topics
633416
• Total Posts
3011771
• ### Who's Online (See full list)

There are no registered users currently online

×