fabriziospadaro / SpriteSheetRenderer

Spritesheet renderer is a powerful Unity ECS API to render massive numbers of sprites using the new dots stack, taking full advantage of Jobs, DynamicBuffers and ComputeBuffer

Home Page:https://www.linkedin.com/in/fabrizio-spadaro/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sprites do not render when camera bounds move beyond a half unit.

SemiCicada opened this issue · comments

Happens when you move the camera in any of the examples. For example, if the left edge of the camera moves beyond 0.5f, all the sprites will disappear in the camera's view.

I figured out the reason why this happens. Graphics.DrawMeshInstancedIndirect() draws the meshes based off world position. Therefore when this function is called, because the bounds are defined as a 1x1 square centered on the origin, the camera will end up culling all the meshes drawn in this call once you pass the 0.5f position. A theoretical solution would be to just increase the bounds to a large size so that the camera cannot cull the meshes, or to individually calculate the entity mesh bounds yourself.