I'm implementing Frustrum Culling in our engine, and I'm currently struggling with SpineObjects.
I can usually get the initial bounding box of my object using skeletonData->getWidth etc, but when the objects animate they tend to extend past those bounds; and even for some objects those bounds are simply inaccurate.
Any ideas how I can get the current rendering area for my objects?
1. sayfa (Toplam 1 sayfa)
Ucenna
1 year ago
- Ucenna
- Mesajlar: 12
Nate
You can calculate the min and max of every vertex that will be rendered. Skeleton
If that's too much processing to do every frame, you could (at the start of your game or even at compile time) step through time for an animation and record the maximal bounds throughout, then you'll know how big it could be. The Spine web player does that so it can zoom the viewport to fit a whole animation:
https://github.com/EsotericSoftware/spine-runtimes/blob/4.0/spine-ts/spine-player/src/Player.ts#L720-L745
If you don't like those options, you could simply use a size large enough to contain any of your skeletons and animations.
getBounds
does that for you.If that's too much processing to do every frame, you could (at the start of your game or even at compile time) step through time for an animation and record the maximal bounds throughout, then you'll know how big it could be. The Spine web player does that so it can zoom the viewport to fit a whole animation:
https://github.com/EsotericSoftware/spine-runtimes/blob/4.0/spine-ts/spine-player/src/Player.ts#L720-L745
If you don't like those options, you could simply use a size large enough to contain any of your skeletons and animations.
1 year ago
-
Nate - Mesajlar: 12219
Ucenna
Thanks! I ended up using getBounds, which works well enough. I messed with finding the bounds as part of the rendering loop, but then I realized that that kinda just defeats the purpose of culling anyway.
I am intrigued by the preprocessor time idea. Seems like it would take a chunk to get setup, but once it's done would probably be much faster than getBounds. I regretably don't have a lot of time to spend on it now, but I might revisit it.
Thanks mate, you guys are always super helpful!

I am intrigued by the preprocessor time idea. Seems like it would take a chunk to get setup, but once it's done would probably be much faster than getBounds. I regretably don't have a lot of time to spend on it now, but I might revisit it.
Thanks mate, you guys are always super helpful!
1 year ago
- Ucenna
- Mesajlar: 12
Mark topic unread
• 1. sayfa (Toplam 1 sayfa)
Dön Runtimes
- Tüm zamanlar UTC