I am working on creating these ‘rectangle frames’ in 3D design area of my project. The reason behind these ‘frames’ is that we need a way of showing these “frames” in 3D that represents the selected sheet size (there are. That sheet size would be like viewports but it would be fixed in the current view, and the user could pan and zoom their model to “center it” etc. without the frame moving.
I created these ‘rectangles frames’ using GIMP software with correct dimensions. And, then I am calling these frames in 3D to see if it will work.
NOW, the PROBLEM is that these frames are stretching to fit on the canvas and it SHOULD NOT do that because they should maintain it’s exact size or else these frames will not work.
I have looked up many ways using Babylon Docs, but didn’t find any good method I can use. Does anyone have any idea about this? To prevent these frames from stretching?
I would appreciate any help as I dont have much knowledge about Babylon JS.
here is my code regarding that:
const importImageComponent3D = async (imageDataURL, imageBlob, scene) => {
const {design, camera3D} = store;
if (design?.designRef?.current?.designId) {
camera3D.updateImageComponent(imageDataURL);
}
}
updateImageComponent = (imageUrl) => {
const { scene, camera3D } = store;
if (imageUrl != null && imageUrl != undefined) {
const layer = new BABYLON.Layer(‘image’, null, scene);
layer.texture = new BABYLON.Texture(imageUrl, scene);
layer.layerMask = LAYER_MASK_3D;
layer.isBackground = false;
camera3D.renderTarget = layer;
} else {
camera3D.renderTarget = null;
}
}
here ’ importImageComponent3D’ is basically allowing me to insert these ‘frames’ from my local machine.
Thanks