You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Platform(s): Reproduced on Windows; not platform-specific
Describe the bug SpriteComponent's bounding box, used for frustum culling, does not account for a non-default Sprite.Center (pivot offset). When a sprite's pivot is moved away from the texture's geometric center — for example to align the sprite's bottom edge with the entity's position so it appears to stand on the ground — the bounding box used for culling stays centered on the entity's world position instead of following the visual offset of the sprite.
As a result, the sprite is culled (disappears) as soon as the entity's position, not the sprite's actual visible edge, crosses the frustum boundary. This causes the sprite to vanish from view while a significant portion of it (up to roughly half, depending on the pivot offset) is still visually on screen.As a result, the sprite is culled (disappears) as soon as the entity's position, not the sprite's actual visible edge, crosses the frustum boundary. This causes the sprite to vanish from view while a significant portion of it (up to roughly half, depending on the pivot offset) is still visually on screen.
To Reproduce
Import a texture, e.g. 1920x1080 pixels.
Add a SpriteComponent to an entity using this texture, with CenterFromMiddle enabled.
Set Center to (0, 540) — this offsets the pivot down by half the texture height, moving the sprite's pivot to its bottom edge.
Position the entity in the scene so the sprite sits at the desired location (e.g. on the ground, Position.Y set so the bottom of the sprite touches the floor).
In running game, move the camera or the entity so the sprite moves toward the bottom edge of the screen.
Observe that the sprite disappears entirely as soon as the entity's position (i.e. the midpoint of the sprite, before the Center offset) crosses the bottom of the screen — while the upper half of the sprite is still visually within the camera's view.
Expected behavior
The sprite should remain visible and only be culled once it is actually fully outside the camera's frustum.
Release Type: GitHub
Version: master
Platform(s): Reproduced on Windows; not platform-specific
Describe the bug
SpriteComponent's bounding box, used for frustum culling, does not account for a non-defaultSprite.Center(pivot offset). When a sprite's pivot is moved away from the texture's geometric center — for example to align the sprite's bottom edge with the entity's position so it appears to stand on the ground — the bounding box used for culling stays centered on the entity's world position instead of following the visual offset of the sprite.As a result, the sprite is culled (disappears) as soon as the entity's position, not the sprite's actual visible edge, crosses the frustum boundary. This causes the sprite to vanish from view while a significant portion of it (up to roughly half, depending on the pivot offset) is still visually on screen.As a result, the sprite is culled (disappears) as soon as the entity's position, not the sprite's actual visible edge, crosses the frustum boundary. This causes the sprite to vanish from view while a significant portion of it (up to roughly half, depending on the pivot offset) is still visually on screen.
To Reproduce
SpriteComponentto an entity using this texture, withCenterFromMiddleenabled.Centerto(0, 540)— this offsets the pivot down by half the texture height, moving the sprite's pivot to its bottom edge.Position.Yset so the bottom of the sprite touches the floor).Expected behavior
The sprite should remain visible and only be culled once it is actually fully outside the camera's frustum.
Screenshots
culling.webm