Skip to main content
Share Your Experience: Take the 2024 Developer Survey
17 votes

OpenGL - How come drawing sprites takes so much performance

Your GPU can probably render even 100k sprites without issues, but you need to do it smart. Sprites and other geometry must be supplied to a GPU in batches grouped by the same texture, shader and ...
HankMoody's user avatar
  • 308
3 votes
Accepted

Unity particles rendering on top of camera space UI

Increasing order in layer solved the problem.
mr-matt's user avatar
  • 2,759
2 votes

Different z index within the same tile

As stated in the comments, that texture has a transparent background in the original game. That way they can just draw the base grass, then the player, then the tree.
Bálint's user avatar
  • 14.9k
2 votes

OpenGL - How come drawing sprites takes so much performance

The way you are batching your sprites might be suboptimal. If you're using glDrawElements() to render a batch of multiple sprites, then that can only mean you're ...
Yoan Lecoq's user avatar
2 votes
Accepted

How to make a Sprite be displayed always behind everything else?

You can do this with two cameras with different culling masks. When you have multiple cameras in your scene, each camera will be rendered separately. The culling mask decides what will be rendered by ...
Philipp's user avatar
  • 120k
1 vote

What will happen if I intend to display the hidden surface after clearing the window, draw the game objects, and then display the window again?

From the documentation (emphasis mine): This clear/draw/display cycle is the only good way to draw things. Don't try other strategies, such as keeping pixels from the previous frame, "erasing&...
Đạt Phạm's user avatar
1 vote

How to either draw a group of tiles completely behind or completely in front of a player?

This problem is usually worked out by collisions. Hopefully your tile editor allows you to set groups of tiles together along with their collisions, so you don't forget to set them. And that's it. ...
Theraot's user avatar
  • 27k
1 vote
Accepted

How can I render 3D objects and particle systems in front of a Screen Space - Overlay Camera?

To render 3D objects on top of your canvas: Create a new Canvas in Screen Space - Overlay. Add a RawImage to that canvas. Create a new Render Texture. Add the Render Texture to the Raw Image. Create ...
Evorlor's user avatar
  • 5,793
1 vote
Accepted

Make non-sprite render in front of sprite

Okay, the solution was very rather simple. It was the sorting layer/order of the child of the projectile that caused it. Changing it solved the issue.
Sebastian Nielsen's user avatar
1 vote
Accepted

How do I order sprites by depth in Java, when their objects are of different classes?

I was thinking about putting them into an array list, and ordering them based upon their depth YES. but they are different object types. The guy is an object of class character, and the girl is an ...
Theraot's user avatar
  • 27k
1 vote
Accepted

How to drag 2D objects and stop it if collides with other 2D object?

I made a little sample project of how I would implement this, as a component you can simply attach to any gameobject you want to be made draggable. I will include the code for the mono behaviour here ...
Pheonix2105's user avatar
1 vote

SFML position problem when drawing a CircleShape

Do you have the same problem if you try to draw directly to the RenderWindow (window.draw(point, sf::BlendAlpha)), instead of drawing to a RenderTexture and then to ...
Misha's user avatar
  • 36
1 vote

How to draw a character behind and in front of a building? (isometric map)

I used a straight forward approach for this. My map (not the end result!) is set up us horizontal lines, where i go from top to bottom, blitting everything from left to right. That way I ...
z0rberg's's user avatar
  • 113
1 vote

Line renderer in 3D sorting order

UPDATE: doesn't work entierly! I solved this by setting the camera's transparency sort mode to orthgraphic: ...
Unresolved External's user avatar
1 vote
Accepted

LineRenderer sorting order - lines always in front of everything

First of all - SpriteRenderer and LineRenderer don't cooperate, as they say on Unity forums. ...
Jacob's user avatar
  • 2,542
1 vote

Creating Multiple Render System to Draw Different Entities in Entity-Component-System

What you should ask yourself is what is the actual difference between the two types? An animated entity typically has both some form of a skeleton of bones which are animated through various ...
Naros's user avatar
  • 2,022
1 vote
Accepted

Top down tile based game render order

When you want to have overlapping sprites in your game, you need to put them in a list which you sort by the coordinate of the lower edge of each sprite and then render them in that order. Further, ...
Philipp's user avatar
  • 120k
1 vote
Accepted

Particle systems and sprites, draw order issue

It is the case that all particles share the same Z order in unity. This is a weird design choice, but I believe it 's because the emitter is an object that is sorted with the rest of the world, and ...
CobaltHex's user avatar
  • 2,248
1 vote

How to handle Tilled Map z index order with player in libgdx?

I see two solutions to this: Make your player a part of the TiledMap by adding him to his own layer. This will automatically render him in the correct order like ...
Charanor's user avatar
  • 7,860
1 vote
Accepted

How to handle Tilled Map z index order with player in libgdx?

Sort by z position. You will probably want to add an origin to every object as well to determine their position in the game world (ie the players feed, the center of where the box touches the ground, ...
Nils Ole Timm's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible