I have a scene
that is quite static. So basically there is no animation or whatsoever when the the user is not interacting with it. But the runRenderLoop
is getting executed at 60 FPS when there is no user interaction. I do not want the same scene to be rendered again and again, which I think reduces the battery usage of the device. I want to prevent the scene
from rendering when the previously rendered scene
and the current scene
are the same.
This should help On-demand rendering solution broken since 5.29 - #6 by PolygonalSun
Well, tbh I only need the scene to render when the user moves the camera and does some interaction with the mouse (e.g clicks on the mesh). I think this solution also will not work for the UniversalCamera
situation
Hi, you can try this
camera.onViewMatrixChangedObservable.add(() => {
scene.render();
});
long version…
Create a boolean and make it true inside pointer functions and insinde above function, and in renderLoop check if this variable is true, and only then call scene.render()
Is there any way to compare the previous scene and the new scene and then prevent the scene to render if the two scenes have same attributes
You can serialize the scene and compare the json, but again this is not the solution. You may want to do this on save to avoid ‘excesive’ save request, and even there is not to good to serialize the entire scene, instead you can create a json only with the atributes you want to store.
I made a pg, check the console