Minimap Guidance

Hello again everyone, and thank you in advance for taking the time to read my question.

Basically, my team is working on a game which features a world map and a minimap. We’ve had a working minimap for quite some time that I programmed using a second camera and rendertotexture. It was never intended to be a long term solution, as the performance hit is pretty large (and we plan to have an artist stylize the maps).

Recently I began to implement our more long term solution. I created a tool for us to capture an image to be used as a world map texture, and import that texture into the game creating a world map (the tool captures all the required metadata for rotating and scaling the world coordinates into “map” coordinates).

So, it’s time to convert our minimap into a more long term solution. Basically what I want to do is this:

  1. Use a single Texture2D for the world map and minimap
    — World map displays the entire Texture2D (already done)
    — Minimap displays only a portion of the Texture2D

  2. Have the GUI Minimap display only a select portion of the world map (most likely using a material shader to create a circular map appearance).

  3. Allow zooming the minimap in and out by displaying a larger or smaller section of the world map in the minimap.

I already have the required functionality for getting the location in coordinates on the world map where I want to take my chunk out of the map. However, I would love a little guidance on how exactly to go about taking that chunk of the world map into a texture2D. I am attaching an image to further illustrate this in case I am not being clear.

Id imagine GetPixel/SetPixel would be a relatively easy way to solve this issue. However, would it be efficient for something that would get called every frame? Is there another solution (perhaps shader-based) which would be more efficient?

Thanks in advance for any input!

375129--12980--$minimap2_461.png

This is my second idea.

Use an orthographic camera to render-to-texture an area of the image. Draw that image to screen with the appropriate material to get the circular appearance like we already do.

There would actually be a step in the middle, as we need to display a lot of 2D minimap objects as well (things like arrows pointing towards quest location) that, since they need to rotate so much, we’ll be doing with a second orthographic camera.

My reluctance to go with this method originally was I was afraid of the performance hit we would incur from using a second orthographic camera in the loop. However, it occurred to me that I could just as easily place the elements in the first orthographic view on top of the world map - there’s really no need to use two cameras. And since I’d be using an orthographic camera with the first method as well, this is likely the way to go.

Still, any thoughts would be appreciated.

375587--12999--$minimap2_idea2_843.png