• Advertisement
Sign in to follow this  

Rendering map of the world

This topic is 444 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

I am rendering world map in 2D fullscreen.I would like to know, what are you tjinking about my design, if there should be something improved / done differently:

1) Calculate current view bounds
2) Iterate quadtree to find tiles within bounds with desired zoom
3) Rendering 

3.0) for every visible tile
3.1) Load tile texture from file / web
3.2) if texture loaded - render tile with actual depth
3.4) goto 3.0

3.6) for every visible tile
3.7) if texture not loaded - go to tile parent while there is an existing texture and render tile. 
     Update depth to be behind already rendered tiles from loop 3.0
3.8) goto 3.6

Basically, I am rendering tile after tile and if there is no texture for tile, I go up to tile parents and render "lower" resolution one that fills the hole.

 

Is this an appropriate design? Number of draw calls does not seem to be an issue, since I can only see about 10~20 tiles at once, so one render cal for each of them is OK.

Share this post


Link to post
Share on other sites
Advertisement

I'd use a fixed grid. Quadtree is a bit overkill for this scenario I believe.

 

Or maybe he needs this. The OP is talking about

find tiles within bounds with desired zoom
. So he might be using non-leaf nodes depending on the level of the zoom.

Share this post


Link to post
Share on other sites

I am rendering world map in 2D fullscreen.I would like to know, what are you tjinking about my design, if there should be something improved / done differently:

1) Calculate current view bounds
2) Iterate quadtree to find tiles within bounds with desired zoom
3) Rendering 

3.0) for every visible tile
3.1) Load tile texture from file / web
3.2) if texture loaded - render tile with actual depth
3.4) goto 3.0

3.6) for every visible tile
3.7) if texture not loaded - go to tile parent while there is an existing texture and render tile. 
     Update depth to be behind already rendered tiles from loop 3.0
3.8) goto 3.6

Basically, I am rendering tile after tile and if there is no texture for tile, I go up to tile parents and render "lower" resolution one that fills the hole.

 

Is this an appropriate design? Number of draw calls does not seem to be an issue, since I can only see about 10~20 tiles at once, so one render cal for each of them is OK.

 

First of all it's an "algorithm" and not a design.

And what is your goal here? As I understand you want some sort of a minimap of your world. 

Or is this just your render loop?

If you are working with tiles then you'd better sort your render better.

Multiple render calls may harm your performance even if you have about 10-20. Because it's not scalable.

So if you ever want to make more, you'd have to make big changes. 

Share this post


Link to post
Share on other sites

I have changed quadtree to fixed grid. I can ocasioanlly use quadtree advantage by rendering higher-level nodes, but usually I need to traverse the full tree to the desired depth.

 

I dont want to render minimap, I want to render full-screen map. Eg. you pause the game and show the world-map with missions and other things. Tne number of render calls may be a problem in the future, but the solution can be done in the current logic. I can render one quad and solve tiling by textures only - use cubemap (reduce 6 draw calls to 1) or use texture arrays (depending on HW support - I am planing mobile version of this as well). The only thing I will have to do, is update texture coordinates and texture IDs (from cubemap or from array).

Share this post


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

  • Advertisement