Hi, We are creating a preview of a camera in a separate canvas. Our requirement is to show small preview. But doing this main view gets blurred, and its also mentioned in the documents “multiple canvases on the same page should have the same size”
Is there any way to achieve similar functionality using BJS with avoiding blur issues, Please note that as we need to show it in a separate canvas we can’t use multiple viewports in a single canvas.
Does blur disappear if you resize this canvas container element?
No, Actually it won’t allow resizing the canvas directly, doing that automatically scales another canvas.
So, We are trying to scale the container in the following way. And above image is the result of it.
<title>Multi Canvas Camera Demo</title>
<div class="mainContainer" id="mainContainer" touch-action="none"></div>
<div class="previewContainer" id="previewContainer" touch-action="none"></div>
It looks like the rendering is going on for the resolution of the “preview” component (smaller one). Can you try to switch them around? I guess if you could have higher resolution for bigger container and for the smaller one it wouldn’t be the issue?
In the doc, it is said multiple canvas should have the same size (as much as possible) for performance reasons. But it is possible to have multiple different sizes if you are willing to pay for some decreased performances => the blurring does not come from that.
Maybe your canvas.width / canvas.height dimensions are not the right one?
@neu5 Yes, I tried to switch it by creating engine with a smaller canvas
var engine = new BABYLON.Engine(previewCanvas, true);
Now it’s working fine, I wonder why its taking a smaller canvas as an input. @Evgeni_Popov yes I agree with you about documentation.