Jump to content
  • Advertisement
Sign in to follow this  
PyroTeamkill_175428

Per-tile or tile group rendering

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys
I have reached a bit of an impasse with my development.
I am trying to build a SimCity style tile-based game. The terrain is a 3D object that is generated from an external height map. Each tile is made up of 4 points from the height map, rendering 2 triangles. The texture is tiled across the whole 3D object.
What I would like however is the ability to change the texture of individual tiles or to stop them from rendering entirely (for tunnels, etc). The tiles are rendered using index references to a vertex grid. Each tile knows the index of its corners.

Would it be a better idea to keep a set of arrays of tiles for each different type of texture that will be used, then use this to render all those tiles in one lump. Or should I render 2 triangles at a time and render on a per-tile basis?

Thanks for any help you can give.

Share this post


Link to post
Share on other sites
Advertisement

Hi guys
I have reached a bit of an impasse with my development.
I am trying to build a SimCity style tile-based game. The terrain is a 3D object that is generated from an external height map. Each tile is made up of 4 points from the height map, rendering 2 triangles. The texture is tiled across the whole 3D object.
What I would like however is the ability to change the texture of individual tiles or to stop them from rendering entirely (for tunnels, etc). The tiles are rendered using index references to a vertex grid. Each tile knows the index of its corners.

Would it be a better idea to keep a set of arrays of tiles for each different type of texture that will be used, then use this to render all those tiles in one lump. Or should I render 2 triangles at a time and render on a per-tile basis?

Thanks for any help you can give.


Group tiles by texture, and render all tiles that have the same texture together.

Share this post


Link to post
Share on other sites
Group the tiles by texture and render the quad using its offset into the grid's vertex buffer. This way you're only loading your vertices once (as the entire grid in a single buffer), and you're switching textures as seldom as possible. I just keep a separate 2D int array with texture references that matches the dimensions of my grid. Switching textures and vertex buffers introduces enough overhead that using strategies like this can speed things up significantly.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!