visgotti Posted October 17, 2018 Share Posted October 17, 2018 Hey obviously I know PIXI.js is meant for html5.. but I'm trying to have a server that records my game and converts it to a video. So to do this I need to render images of the current canvas at at least 20 fps In the web browser this would be obviously simple. The following code- var timeNow = Date.now(); renderer.render(mainStage); var timeAfter = Date.now(); console.log(timeAfter - timeNow) In web browsers returns 1 ms In node it returns anywhere from 180-300 I'm shimming PIXIjs with jsdom and node-canvas.. I don't understand the underlying technologies enough to understand why there's such a big difference. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted October 17, 2018 Share Posted October 17, 2018 Hello! Try doing the same stage with pure drawImage calls and then ask node-canvas guys why is their Cairo backend so slow Quote Link to comment Share on other sites More sharing options...
visgotti Posted October 17, 2018 Author Share Posted October 17, 2018 53 minutes ago, ivan.popelyshev said: Hello! Try doing the same stage with pure drawImage calls and then ask node-canvas guys why is their Cairo backend so slow Can't tell if this is sarcasm or actual advice.. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted October 17, 2018 Share Posted October 17, 2018 Both. Its always both for my posts. Make a stage that is heavy for node-canvas, or just several drawImage calls how pixi CanvasRenderer does it. Present it to node-canvas guys, ask what's wrong with it. Also people were asking about node-webgl in pixijs issues, i dont know if anyone managed to run it there. Quote Link to comment Share on other sites More sharing options...
visgotti Posted October 17, 2018 Author Share Posted October 17, 2018 I wouldn't say it's really too heavy each bunny adds ~10 ms to the render. for (var i = 0; i < 25; i++) { var bunny = new PIXI.Sprite(texture); bunny.anchor.set(0.5); bunny.x = (i % 5) * 40; bunny.y = Math.floor(i / 5) * 40; mainStage.addChild(bunny); } Quote Link to comment Share on other sites More sharing options...
visgotti Posted October 17, 2018 Author Share Posted October 17, 2018 fs.readFile('bunny.png', function(err, bunny) { img = new Image; img.src = bunny; var timeNow = Date.now(); for(var i = 0; i < 500; i++) { ctx.drawImage(img, 50, 50, 50, 50); } var timeAfter = Date.now(); console.log('time:', timeAfter-timeNow) }) time: 807 Yep you're right. 800 ms for this.. Looks like I'll have to write something that spawns enough processes so I can render scenes for my targeted framerate.. No idea what other direction I can go in. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted October 17, 2018 Share Posted October 17, 2018 post issue to node-canvas, ask why Cairo is so slow. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.