-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Per Entity sprite picking (and maybe friends) opt-out #17108
Copy link
Copy link
Closed
Labels
A-PickingPointing at and selecting objects of all sortsPointing at and selecting objects of all sortsC-PerformanceA change motivated by improving speed, memory usage or compile timesA change motivated by improving speed, memory usage or compile timesD-ModestA "normal" level of difficulty; suitable for simple features or challenging fixesA "normal" level of difficulty; suitable for simple features or challenging fixesS-Needs-DesignThis issue requires design work to think about how it would best be accomplishedThis issue requires design work to think about how it would best be accomplished
Metadata
Metadata
Assignees
Labels
A-PickingPointing at and selecting objects of all sortsPointing at and selecting objects of all sortsC-PerformanceA change motivated by improving speed, memory usage or compile timesA change motivated by improving speed, memory usage or compile timesD-ModestA "normal" level of difficulty; suitable for simple features or challenging fixesA "normal" level of difficulty; suitable for simple features or challenging fixesS-Needs-DesignThis issue requires design work to think about how it would best be accomplishedThis issue requires design work to think about how it would best be accomplished
What problem does this solve or what need does it fill?
Currently
sprite_pickingis relatively expensive, I did some light testing with tracy and 200k sprites with like only 2k of them being in camera view can result in thesprite_pickingtaking 500µs. Which is not much but frame time was 2.66ms so it took "only" almost 20% of frame time.I don't need picking for my sprites and in
debugmode - without any bevy optimizations - the performace penalty is so big that you can reach single digit fps.My specific use-case aside I can imagine that some people would want picking only for some sprites and they might want to turn off picking for the rest.
What solution would you like?
For
sprite_pickinga simple component:then in the
sprite_pickingsystem sprite query could be modified from:to
Then users if they don't want picking for their sprites they can just add
NoSpritePickingcomponent to sprite entity.What alternative(s) have you considered?
I tried adding
PickingBehavior::IGNOREto my sprites but that did not bring any speed-up.Maybe it could result in some weird behavior with
PickingBehavior? idkI think it would be nice to have similar marking ignore components for other backends.
Maybe even global
NoPickingcomponent or something ?Faster and better
sprite_pickingsystem ?- It's currently doing filtering, sorting and filtering on all sprites...Picking being opt-in ?
Additional context
Red - current default system with/out
PickingBehaviorYellow - my proposed feature with
NoSpritePickingon my sprites and modified system200k sprites (2k on camera, rest off-camera), release mode
(This is for my use-case, ofc different apps won't probably see similar speed-up)
