I guess when you write : camera2.rotationQuaternion.set(position.x, position.y, position.z, position.w);
You mean camera2.rotationQuaternion.set(rotation.x, rotation.y, rotation.z, rotation.w);
Right ?
Did you try to simply attach both camera 1 and camera 2 to the canvas ?
Sorry for the typo, the actual running environment is correct, I have modified the question description.
Render the two scenes into canvas directly without RT & blending has same behavior with current workflow. It seems to be only related to pose syncing procedures.
In the PG if I called syncCamera between the two render() or within the onViewMatrixChangedObservable() there’s no delay. Otherwise there will be delay.
Thank you @CrashMaster , in your pg and mine, similar problem can be solved by syncing camera within the viewmatrix change callback. But this still has no effect in my local environment.
Thanks! Add camera2 as children of camera1 is good.
Because I want to hide the internal camera (camera2) of my toolkit to users. Users are supposed to create their own camera (camera1) and interactions, and use my interface (something like a syncCamera()) to drive the internal one. Actually I have other cases that use Three.js or pure WebGL to create camera1, so I want the bahavior of all cases to be the same.
It looks like it is because you copy the old position of cam1 in cam2 before rendering it so you always have one frame delay between both ? https://playground.babylonjs.com/#EYOOKM#6
changing the render order of your scene should fix it
Yes changing render order works but render scene2 before scene1 is needed due to some transparency ordering reason.
My workaround was to use a third camera for user interaction (no rendering), and set pose of camera1 and camera2 from it. But this looks a little bit ugly…