guansss / pixi-live2d-display

A PixiJS plugin to display Live2D models of any kind.
https://guansss.github.io/pixi-live2d-display/
MIT License
870 stars 132 forks source link

How to reduce GPU consumption for loading live2d models in Pixijs? #50

Closed linhanxiao closed 2 years ago

linhanxiao commented 2 years ago

Thanks for sharing a very useful project!

I have a project here that uses face motion capture to drive a live2d model, which uses the pixi-live2d-display library and AI model calculation, but later found that most of the cpu, GPU, and memory consumption are For pixi to create application objects and add live2d models to the stage, about 25% of the GPU is used, but the AI ​​face feature calculation consumes only 14% of the GPU.

So the question is, is there some way to significantly reduce GPU resource consumption both in terms of creating application objects in pixi and adding live2d models to the stage?

Looking forward to your reply

linhanxiao commented 2 years ago

@guansss

guansss commented 2 years ago

Hi. I'm afraid there's no simple way to improve the performance, as the rendering process has already been well optimized.

One possible approach could be to use framebuffer to manage WebGL state, so that the state won't have to be reset during every render (as at the beginning of Live2DModel#render method). However I have little knowledge about this, so not sure about the feasibility.

linhanxiao commented 2 years ago

I seem to have found a way to solve this problem. Adjust the pixi rendering engine's render frames per second from the default of 60 frames per second to 30 frames per second. @guansss

guansss commented 2 years ago

Cool, making a trade-off could be the way.