Jump to content

  • Log In with Google      Sign In   
  • Create Account


In game Minimap Issue


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
13 replies to this topic

#1 riuthamus   Crossbones+   -  Reputation: 4322

Like
0Likes
Like

Posted 11 October 2012 - 10:41 PM

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:

Posted Image

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

Sponsor:

#2 odrega   Members   -  Reputation: 228

Like
1Likes
Like

Posted 12 October 2012 - 12:12 AM

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, 12 October 2012 - 12:15 AM.


#3 riuthamus   Crossbones+   -  Reputation: 4322

Like
0Likes
Like

Posted 12 October 2012 - 12:34 AM

Nah, there is no culling at all

#4 CryZe   Members   -  Reputation: 768

Like
1Likes
Like

Posted 12 October 2012 - 02:00 AM

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.

#5 joeblack   Members   -  Reputation: 253

Like
1Likes
Like

Posted 12 October 2012 - 02:48 AM

your w component is 0
cant this be problem ?

#6 riuthamus   Crossbones+   -  Reputation: 4322

Like
0Likes
Like

Posted 12 October 2012 - 02:55 AM

your w component is 0
cant this be problem ?


Indeed, it was! great job... thank you for the help

#7 riuthamus   Crossbones+   -  Reputation: 4322

Like
0Likes
Like

Posted 14 October 2012 - 12:42 AM

Eh, one more issue...

how to position it (wavepoints) based on world coordinates without being affected by the orthographic camera's "zoom level"

#8 riuthamus   Crossbones+   -  Reputation: 4322

Like
0Likes
Like

Posted 14 October 2012 - 06:21 PM

Also, just to add, the way we are using the minimap is a camera that projects what it sees to the minimap object.

#9 BCullis   Crossbones+   -  Reputation: 1813

Like
1Likes
Like

Posted 16 October 2012 - 08:16 AM

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.
Hazard Pay :: FPS/RTS in SharpDX
DeviantArt :: Because right-brain needs love too

#10 Telanor   Members   -  Reputation: 1282

Like
1Likes
Like

Posted 16 October 2012 - 02:45 PM

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.

#11 BCullis   Crossbones+   -  Reputation: 1813

Like
1Likes
Like

Posted 16 October 2012 - 03:06 PM

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.
Hazard Pay :: FPS/RTS in SharpDX
DeviantArt :: Because right-brain needs love too

#12 Telanor   Members   -  Reputation: 1282

Like
1Likes
Like

Posted 16 October 2012 - 07:09 PM

Can you explain how to do #2?

#13 BCullis   Crossbones+   -  Reputation: 1813

Like
1Likes
Like

Posted 17 October 2012 - 08:26 AM

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 the way to do it.

Edit:
waypoint_example.jpg
Hazard Pay :: FPS/RTS in SharpDX
DeviantArt :: Because right-brain needs love too

#14 riuthamus   Crossbones+   -  Reputation: 4322

Like
0Likes
Like

Posted 17 October 2012 - 11:18 AM

Bcullis, thank you for the very detailed post and picture.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS