Quantcast
Channel: Pixi.js Latest Topics
Viewing all articles
Browse latest Browse all 3978

Need to optimise render texture

$
0
0

Hi all, first time posting although have a done a couple projects w pixi over the years - love it!
I am working on a game project currently where I will have tens of avatars moving around a level (up to 4k res) firing bullets and leaving trails of 'paint'. I have the paint trails working currently using a render texture but it seems to be the least performant part of my app so I am looking to optimise it:

public draw(elapsedSeconds: number) {

    for (const p of Array.from(this.players)) {

        this.paintSprite.tint = p.paintCol; //declared as white on app launch
        this.paintSprite.x = p.vecLocation.x - this.paintSize/2;
        this.paintSprite.y = p.vecLocation.y - this.paintSize/2;
        this.pixiRenderer.render(this.paintSprite, {
            renderTexture: this.paintRenderTexture,
            clear: false,
        }

    }
    
}

Ages ago if I would do similar in C++/OpenGL (using cinder/openFrameworks) I would bind the frame buffer and the paint texture once then loop through all players and tint/draw all the player's texture before unbinding. Am I correct to assume that the performance hit here is due to rebinding things multiple times each frame? Note that I have already adjusted app and render texture settings to try and help (no anti-aliasing in app or render texture, no alpha in render texture).

Any advice? I've never used the low level API to write my own open gl shaders within PIXI so if that is the only path forward would love some direction.

cheers

nay


Viewing all articles
Browse latest Browse all 3978

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>