3

My problem is to how make the white background of a-frame transparent that we just can see whatever we see from the iPhone camera plus the 3D-model.

I have been trying to make AR (Augmented Reality) working in Ionic iOS version. I realised that a-frame can not trigger webcam for some reasons in iOS. So one of the workaround came to my mind is to load 3D model by a-frame and and trigger the camera at the same time. This some how works, in 2/3 of the screen we can see the camera input and 1/3 the model is loaded with white background. If I can transparent the background of the model then at I would be very happy. Is there any way to make the background of the model transparent in Ionic? is there any other workaround for this problem?

enter image description here

what I have in home.page.html is simply: ` Ionic Blank

<ion-content>
 <a-scene  *ngIf="iosReady"
       renderer="alpha: true;
               colorManagement: true;
               sortObjects: true;
               physicallyCorrectLights: true;
               maxCanvasWidth: 1920;
               maxCanvasHeight: 1920;">
  <a-gltf-model  position="1 1 -4" 
       src="/assets/models/LibertStatue.gltf" ></a-gltf-model>
 </a-scene>
</ion-content>`

And in home.page.ts I have:

const cameraPreviewOpts: CameraPreviewOptions = {
            x: 0,
            y: 0,
            width: window.screen.width,
            height: window.screen.height,
            camera: 'rear',
            tapPhoto: true,
            previewDrag: true,
            toBack: true,
            alpha: 1
        }


        CameraPreview.startCamera(cameraPreviewOpts).then(
            (res) => {
                console.log(res);
            },
            (err) => {
                console.log(err);
            });
    });
Sia
  • 63
  • 1
  • 9

0 Answers0