Just an update, I believe that I found the root cause. Recently, we added an optimization to our inputs that would only pick when necessary. Originally, when we performed a pick, we would also fire a picking ray that would call, through a chain of functions, getViewMatrix(). It’s in here that we call the onViewMatrixChangedObservable observers. Since we’re not picking with every move, we’re not firing that ray and never getting to that point. I believe that the fix is easy but I want to verify that it’s correct and doesn’t affect performance unnecessarily. I’ll let you know when there’s a PR live.
@PolygonalSun , thanks a lot for looking into this issue.
As I said, I’m also open to better ideas to avoid idle rendering. We run a medical software on compact, fan-less hardware and I’m afraid of thermal throttling when the iGPU is busy all the time.
Independent from picking or not (it’s a good thing that you avoid unnecessary picking): Shouldn’t any change to the view matrix (e.g. rotating including momentum-based rotation) call all view matrix observers?
I’m not familiar with the internals of course, just going by the function names.
In the code originally, we generally updated the view matrix with each rendered frame or if there was some camera movement with a PointerInfo object. Technically, this should be decoupled from the picking/pointer info and added to the camera.update function (assuming there was pending movement for a camera). I am looking into how best to do without adversely affecting performance but I did think of a slight workaround that could work for you in the meantime:
function render() {
camera.update()
// In your render loop, you could check for pending camera movements and call
// the function below to update everything.
if (camera.inertialAlphaOffset !== 0 ||
camera.inertialBetaOffset !== 0 ||
camera.inertialRadiusOffset !== 0 ||
camera.inertialPanningX !== 0 ||
camera.inertialPanningY !== 0
) {
scene.updateTransformMatrix();
}
if (dirty > 0) {
console.log("RENDER");
scene.render(false);
dirty--;
}
}
You could also simplify this further by using that camera change criteria to directly call the render function (which has a function that calls the updateTransformMatrix (ultimately calling the onViewMatrixChangedObserverable)
Sorry about the time that this took but I have a tentative fix that I’m running by the team now. If there are no issues with it, I should be able to create a PR fix that should restore the initial functionality. I’ll give you an update once I hear back about my fix.