Hi everyone,
I ran into a problem recently and I can’t find an obvious solution. Let me explain.
Let’s assume I have a factory of game object that are made of 3 elements each:
- A background image (alpha blending)
- A spine scene
- A foreground image (alpha blending)
For instance, that could be a card game where each card has a animated character that can move in the frame of the card and therefore goes over the card boundaries.
In order to render a card, I would have to use either a stencil or, even better, render targets to limit the spine scene rendering to the card bounds.
That’s easy enough but then I don’t have only one card to render but many.
I can again use the same tricks but it would only work if NO card goes over another which is not always the case. Indeed, both method (stencil, render targets) are based on a single buffer test and if cards overlap then a spine character would overflow onto another card. That leads to think that each card should be rendered separately with their own stencil/render targets but that sounds crazy inefficient and difficult to achieve code wise. Is anyone here had to handle this kind of problem before? What is the best method to achieve this?
Many thanks,
Nicolas.