# Babylon and Pixi.js Spine

**URL:** https://forum.babylonjs.com/t/babylon-and-pixi-js-spine/43034
**Category:** Questions
**Tags:** gui, layermask, rendering
**Created:** [August 5, 2023, 6:13pm UTC](https://forum.babylonjs.com/t/babylon-and-pixi-js-spine/43034 "2023-08-05T18:13:49Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Da\_Lei](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/da_lei/32/33722_2.png) [@Da\_Lei](https://forum.babylonjs.com/u/Da_Lei)
#### Post date: [August 5, 2023, 6:13pm UTC](https://forum.babylonjs.com/t/babylon-and-pixi-js-spine/43034/1 "2023-08-05T18:13:49Z")

</div>

Hi Everyone,

so here is a question I have been figuring out for the past week.  
I am using 2D-spine-animation from pixiJS. and combining with babylon3D scene.  
I am trying to reproduce the tile-map liked effect similar to Unity – render 3D object above UI object(2D character) **Dynamically**. based on its z-depth.

Since PixiJs uses its own renderer. I had to put in the render loop before/ after the scene render. it should work with one character and few objects.(objects scene render-\>pixi container render-\>background scene render.)  
But what if there are 10 characters running in one scene. the renderloop could be uncontrollable.  
I was trying to figure this out from these approaches.

1. Pixi has masks, but I don’t know if BJS has anyway to put a rendering scene into a sprite mask everyframe.
2. Is there a possibility to combine pixi renderer into BJS engine, so that I can simply use render groups, to index its orders.
3. or I can do something with WebGL natively?
4. Or there are some other features that I didn’t know that could help.

I looked into layer masks, render group, stencil mask, I can’t really think of a solution from these. please help.

---

<div class="post-metadata">

### Author: ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)
#### Post date: [August 6, 2023, 6:05pm UTC](https://forum.babylonjs.com/t/babylon-and-pixi-js-spine/43034/2 "2023-08-06T18:05:07Z")

</div>

I can’t help you because I don’t know Pixi, but there are quite a few references to Pixi in this forum, maybe that could help you :

[https://forum.babylonjs.com/search?q=pixi](https://forum.babylonjs.com/search?q=pixi)

---

<div class="post-metadata">

### Author: ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)
#### Post date: [August 7, 2023, 11:12am UTC](https://forum.babylonjs.com/t/babylon-and-pixi-js-spine/43034/3 "2023-08-07T11:12:06Z")

</div>

If you can show us a small reproduction of how you’re setting up your scene with the renderings that can be helpful too

---

<div class="post-metadata">

### Author: ![Da\_Lei](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/da_lei/32/33722_2.png) [@Da\_Lei](https://forum.babylonjs.com/u/Da_Lei)
#### Post date: [August 10, 2023, 6:07am UTC](https://forum.babylonjs.com/t/babylon-and-pixi-js-spine/43034/4 "2023-08-10T06:07:48Z")

</div>

I have got it solve by tweeking Three.js runtime solution a bit. thanks all.

---

<div class="post-metadata">

### Author: ![Sparking2](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sparking2/32/35117_2.png) [@Sparking2](https://forum.babylonjs.com/u/Sparking2)
#### Post date: [September 22, 2023, 8:02pm UTC](https://forum.babylonjs.com/t/babylon-and-pixi-js-spine/43034/5 "2023-09-22T20:02:43Z")

</div>

Hi, it is possible for you to share your solution?
