Jump to content


Photo

Graphical culling


  • Please log in to reply
7 replies to this topic

#1 tabc3dd

tabc3dd

    GMC Member

  • GMC Member
  • 689 posts

Posted 15 February 2012 - 06:31 PM

I'm planning on adding a HUD to the RTS i'm develloping. However, HUDs are rather big elements which take some part of the screen, and I was wondering if there was an efficient way to force the game to not attempt to render objects behind the HUD. I believe that this could allow me to gain a bit more performance from my game, however I haven't found anything as of yet.

Thank you
Tabc3dd
  • 0

#2 AhmedElyamani

AhmedElyamani

    Yamani

  • GMC Member
  • 1891 posts
  • Version:GM:Studio

Posted 15 February 2012 - 07:20 PM

the object that draws the HUD shall have a big depth
for example 106
Ahmed.
  • 0

#3 tabc3dd

tabc3dd

    GMC Member

  • GMC Member
  • 689 posts

Posted 15 February 2012 - 07:26 PM

the object that draws the HUD shall have a big depth
for example 106
Ahmed.


You mean a huge negative depth no ? But won't the game still draw the objects underneath it then overlap them with the HUD ?
Thank you
Tabc3dd
  • 0

#4 Artaex Media

Artaex Media

    Artaex Media

  • GMC Member
  • 1531 posts
  • Version:Unknown

Posted 15 February 2012 - 08:35 PM

You mean a huge negative depth no ? But won't the game still draw the objects underneath it then overlap them with the HUD ?

Negative depth is the only way I guess...
It will draw the HUD on top of everything.

Or you could try to deactive objects behind the HUD but that could screw up the game :/
  • 0

#5 Tobias(NL)

Tobias(NL)

    GMC Member

  • GMC Member
  • 877 posts
  • Version:Unknown

Posted 15 February 2012 - 08:42 PM

I think that would slow down your game, as it probably costs more fps to constantly check for instances behind the HUD, ánd deactivating them instead of drawing them behind the hud (I assume your HUD has a negative depth).

Edited by Tobias(NL), 15 February 2012 - 08:43 PM.

  • 0

#6 Caracol

Caracol

    GMC Member

  • GMC Member
  • 266 posts
  • Version:GM:Studio

Posted 15 February 2012 - 11:15 PM

Don't deactivate them... that would be dumb, because they would all stop moving as soon as they got under your HUD, which I'm assuming you don't want.

In their draw events, you could do something like this...
if (!underHUD)
{
    draw_sprite(sprite_index,image_index, x, y);
}

Although, like Tobias said, this could negate any speed gained by not drawing the object by checking to see if it's under the HUD, but I can't be certain of that. I'm not familiar with what's exactly under the hood when it comes to drawing graphics.
  • 0

#7 tabc3dd

tabc3dd

    GMC Member

  • GMC Member
  • 689 posts

Posted 16 February 2012 - 12:37 PM

Ok then, I'll just keep drawing everything ^^, thanks for the answers though :)
  • 0

#8 DZiW

DZiW

    GMC Member

  • GMC Member
  • 729 posts

Posted 16 February 2012 - 06:15 PM

I'd rather use a view inside the HUD's view... Although it depends on the shape.
Perhaps, minimizing the HUD would be even better?
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users