Sign in to follow this  

In game Minimap Issue

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

So, we are attempting to make an in game minimap. Right now we have it fully working but the issue is we are unable to add sprites to it for some reason ( for waypoints and such ). We want to add the ability for a player, or the system, to add sprites on top of the map as guidance markers. In doing so we are getting the following issue:

[img]http://ft.trillian.im/0140e49785b1ade2059f928a34d262ef0d32d9cc/6blLPMfsxbnF9S0ZfzTTdKE95gVIz.png[/img]

Some more information that might help you:[list]
[*]im rendering a textured quad and its not showing up
[*]depth-read is off
[*]backface culling is off
[/list]
Any thoughts?

Share this post


Link to post
Share on other sites
Is there by chance front face culling and you've ordered the vertex's wrong? Or maybe you've left it with a projection matrix rather than an orthographic matrix? Edited by odrega

Share this post


Link to post
Share on other sites
It could either be a problem with:
- Backface / Frontface Culling
- Scissor Rectangles
- Depth / Stencil State and / or -Buffer
- The Viewport

My guess is, that your viewport might be wrong or not assigned at all.

Share this post


Link to post
Share on other sites
Sounds like you're essentially in need of a picking solution, just not with the "main" camera as the owner of the matrices used for the screen-to-world unproject call. Off-the-cuff, I would guess you need to first calculate what the "screen" (relative to the minimap as the screen) position of the clicked point is based on zoom level (i.e. the bounds of the clicked area represent smaller ranges at higher zoom levels), and then unproject that screen point into world coordinates.

Share this post


Link to post
Share on other sites
We're not placing the waypoints on the map by clicking it. The issue is the orthographic transform affects the display size of the waypoint. If you zoom out, the waypoint is really tiny, if you zoom in, its huge. We would like the size of the waypoint to remain constant.

Share this post


Link to post
Share on other sites
Ah, ok, I misunderstood the question.

There's two quick options I can think of:
1) Calculate the relationship between zoom level and scale, and apply a scaling matrix based on that function to the waypoint marker. Though I already don't like that option as much as...

2) Calculate the screen position the waypoint should be at based on zoom level, and then render it using a different, static ortho matrix (unaffected by zoom) with a translation matrix applied to the waypoint so that it's always in the right spot on the minimap.

Share this post


Link to post
Share on other sites
So if I understand correctly, you're using an orthographic "camera" set above the terrain in worldspace that looks down on the minimap/player. And you move this camera closer to, or further from, the ground to render the minimap content. Currently, your waypoint marker, which sits out in worldspace, is seen by the camera in the render pass of the terrain. If that's incorrect, disregard everything I'm about to say.

Moving the camera closer to the ground changes the range of the minimap boundaries (i.e. at "normal" zoom, you can encompass 100x100 world-space units, and at "max" zoom it encompasses 10x10 units). If a waypoint is sitting at (10,10) and the minimap is centered over the origin, then the waypoint's draw position on the minimap will be at 10% up and 10% right if you're at normal zoom, but it'll be 100% up and 100% right at max zoom. That's the calculation I'm talking about for determining the waypoint's draw location. Granted this is slightly more work if you're using a smooth-step zoom function, versus fixed increment zoom levels.

As for the rendering scale: obviously the camera moving closer to the terrain (where the waypoint marker sits) will make the marker appear larger. So if you want the waypoint to appear the same size, it can't be rendered with the same view*projection matrix that the minimap camera uses. I'd just make a one-off view*projection matrix that's fixed above the waypoint's object-space coordinates and either set it high enough over the waypoint model that it gives the waypoint the right scale, or scale the waypoint model down for the draw. The translation matrix applied to the waypoint should be calculated so that the waypoint is drawn at the correct position on the minimap render target based on the minimap's zoom level and the minimap camera's position, as mentioned above.

I'll come back and edit with a graphic in a minute, I realize it's kind of a visual thing. Also, this is just how I would accomplish it (had to do something similar for my map editor to draw brush borders and translation grips) but isn't [i]the[/i] way to do it.

Edit:
[attachment=11802:waypoint_example.jpg]

Share this post


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