Reusing the buffer while the scene is totally static

I’m working on a game that is (graphically) similar to chess, though this stuff really relates any simple, turn based board game. I’d be grateful for some advice. I kind of know what I want to do, but am new to PlayCanvas and 3D graphics, so would really appreciate some pointers from people who know what they’re doing.

In a game like chess, everything is static for hundreds and thousands of frames, until a player selects a unit to move. The move is made, and the scene then sits in its new, static state for lots more frames.

I’m trying to reduce power consumption (and keep the fans off), while still using fairly expensive rendering. I’ve been playing with setting all the shadows to static, and kinda toggling dynamic shadows on a unit while it’s being moved. This helps, but I’m still rendering a lot of stuff for no reason most of the time.

Given that (to reduce distractions) all of the entities in the scene (models, shadows, cameras, lights) are totally static between moves, players are effectively looking at a still image (often through an orthographic camera). It would save a lot of cycles if I could effectively take a screenshot, then ‘pause’ the engine and just display a big PNG image overlay until someone clicks on something.

Is there some way, inside of an update function, where we could check for user input, to tell the engine to just reuse the buffer, over and over, so the scene is never recalculated at all while the program knows nothing has changed?

You can disable the autoRender which tells the application to stop rendering every frame

And then on whenever you want to render the frame, set renderNextFrame to true

1 Like