Jump to content

Need to optimise render texture


naychrist
 Share

Recommended Posts

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...